§2.3.4.(c) Actual ambiguity
At runtime actual ambiguity may occur if for the
dynamic type of a base to be lifted the conditions of (b)
above hold accordingly. Actual ambiguity is only possible in cases
reported by the compiler as potential or definite ambiguity.
Effect:
An actual ambiguity is reported at runtime by throwing a
org.objectteams.LiftingFailedException
.
Example code (Actual Ambiguity):
1 |
import org.objectteams.LiftingFailedException; |
2 |
team class MyTeam { |
3 |
public class SuperRole playedBy MyBase {...} |
4 |
public class SubRoleA extends SuperRole playedBy SubBase {...} |
5 |
public class SubRoleB extends SuperRole playedBy SubBase {...} |
6 |
|
7 |
public void useSuperRole(MyBase as SuperRole r) throws LiftingFailedException {...} |
8 |
} |
9 |
|
10 |
MyTeam mt = new MyTeam(); |
11 |
mt.useSuperRole(new SubBase()); |