[otj-users] callin binding to final method

Andreas Werner andreas at wernerx.de
Mon Oct 8 22:45:40 CEST 2007


Hi folks,

Stephan and I have been discussing the topic of callin bindings and
final base methods. I was asking him, whether the constraint defined in
OTJLD 4.1(f) is really needed.
This constraint says, that if a role method is bound to a final base
method, the enclosing role must be played by the exact base class of the
base method in order to ensure, that in sub classes the semantics of the
final method remains the same.

In my opinion this constraint is superseded by the fact, that it is
actually possible to change the implementation of a final base method
for any specific sub class. This can be achieved by a callin bindin
together with a base guard, i.e. *base when (base instanceof SubClass)*.
 The consequence is, that no user of a final method can be sure, that
the method's semantics hasn't been changed.
My question is now: Are there still reasons to keep the constraint 4.1(f)?

Stephan's answer was, that actually the reasons of the constraint were
primarily of technical nature: The runtime environment is not able to
create a method in the sub class, which contains the dispatch code for
the callin binding and which is overriding the original final method at
the same time.

@Stephan: Does this problem originate from the fact, that the original
method was declared final? And, is the strategy the same as for non
final methods?

@All: What do you think? Are there reasons to keep the constraint, or
could it be omitted (at least in theory)?

Best regards, Andreas



More information about the otj-users mailing list