<< §2.3.4 Binding ambiguities | ↑ Table of Contents ↑ |
§2.3.5 Consequences of lifting problems
The rules for lifting and role binding allow (after issuing a warning) two problematic situations:
- A potential binding ambiguity makes selection of the approprate role type impossible (§2.3.4.(a))
- A role which might be relevant for lifting is abstract (§2.5.(b))
Whenever lifting fails for one of these reasons an org.objectteams.LiftingFailedException
(§6.2.(d))
is thrown.
Given that this is a checked exception and depending on the location requiring lifting this has the following consequences:
(a) Problematic declared lifting
A method with declared lifting (§2.3.2) may have to declare org.objectteams.LiftingFailedException
.
(b) Problematic callout binding
The role method of a callout binding with result lifting (§3.3.(c)) may have to declare org.objectteams.LiftingFailedException
.
(c) Problematic callin binding
A callin binding (§4) may silently fail due to a org.objectteams.LiftingFailedException
.
This exception will actually remain hidden because the callin binding is not explicitly invoked from any source code
but implicitly
by the runtime dispatch mechanism. To signal this situation the compiler raises an error against such callin binding.
However, the compiler should allow to configure this error and understand the warning token "hidden-lifting-problem"
for suppressing this problem (§4.1.(b)).
If the problem is ignored/suppressed and if at runtime the lifting problem occurs,
triggering of the callin binding will silently fail, i.e., the program will continue in this situation as if the binding
hadn't existed in the first place.
(d) Incompatible redefinition of a role hierarchy
Consider a team T1
with a method m
with declared lifting regarding role R
,
where no lifting problems are detected.
Consider next a sub-team T2
which modifies the hierarchy of role R
such that lifting
to T2.R
is problematic due to a binding ambiguity.
In this case clients invoking T1.m()
could face the situation at runtime that an instance
of T2
is used that unexpectedly fails to lift to its role R
.
Here, the compiler signals a specific error against T2
alerting of the incompatible change.
<< §2.3.4 Binding ambiguities | ↑ Table of Contents ↑ |