<< §3.1.(i) Shorthand definition | ↑ Table of Contents ↑ | §3.1.(k) Callout to generic method >> |
§3.1.(j) Inferred callout
If a non-abstract role class inherits an abstract method the compiler
tries to infer a callout binding for implementing the abstract method.
Similarly, if a self-call in a role class cannot be resolved, the compiler
tries to infer a callout to resolve the self-call.
Inference searches for a method in the bound base class such that
- both methods have the same name
- both methods have the same number of arguments
- each argument of the abstract role method is compatible to the corresponding argument of the base method directly, or using boxing/unboxing or lowering.
Callouts inferred from an interface have public
visibility,
callouts inferred from a self-call have private
visibility.
Per default inferred callout bindings are disabled, i.e., a compiler
must report these as an error. However, a compiler should allow to
configure reporting to produce a warning only (which can be suppressed
using a @SuppressWarnings("inferredcallout")
annotation),
or to completely ignore the diagnostic.
<< §3.1.(i) Shorthand definition | ↑ Table of Contents ↑ | §3.1.(k) Callout to generic method >> |