§4.7.(e) No overriding
Since static methods are not dynamically bound, overriding does not
apply in the normal semantics. Regarding callin bindings this has the
following consequences (assuming a role RMid
played by
BMid
plus its super-class BSuper
and its sub-class
BSub
.
- If a static base method
BMid.m
is bound by a callin binding
this has no effect on any method m
in BSub
.
- If a callin binding mentions a method
m
which is not present
in BMid
but resolves to a static method in BSuper
the binding only affects invocations as BMid.m()
but not
BSuper.m()
. If the latter call should be affected, too,
the callin binding must appear in a role class bound to BSuper
,
not BMid
.
- In order to bind two static base methods with equal signatures, one being
defined in a sub-class of the other one, two roles have to be defined
where one role refines the
playedBy
clause of the other role
(say: public class RSub extends RMid playedBy BSub
).
Now each role may bind to the static base method accessible in its direct
base-class.