§2.3.4.(b) Definite ambiguity

A definite ambiguity is given if

Definite binding ambiguity also occurs in cases of generic declared lifting §2.3.2.(e) if the specified role R is unbound and if two independent sub-roles R1 and R2 exist that introduce a playedBy binding to the same base class BX. In this case no potential ambiguity is flagged because roles R1 and R2 have no shared bound super-role.

Effect:
Code causing definite ambiguity is required to handle org.objectteams.LiftingFailedException.

In cases of definite binding ambiguity lifting will indeed fail except for some corner cases. Such corner cases may arise if lifting already finds an appropriate role in the cache or if an (indirect) subrole of the ambiguously bound role is an unambiguous lift target for the concrete type of the base object at run-time. See also §2.3.5.

Example code (Definite Ambiguity):
1
team class MyTeam {
2
  public class SuperRole playedBy MyBase {...}
3
  public class SubRoleA extends SuperRole playedBy SubBase {...}
4
  public class SubRoleB extends SuperRole playedBy SubBase {...}
5
6
  public void useSuperRole(SubBase as SuperRole r) {...} // must declare LiftingFailedException
7
}