Relates :
|
|
Relates :
|
|
Relates :
|
"Let C be the class of objectref. The actual method to be invoked is selected by the following lookup procedure ... If C contains a declaration for an instance method m that overrides (��5.4.5) the resolved method, then m is the method to be invoked." Selection for invokevirtual is defined in terms of overriding; but overriding is undefined for interfaces: 5.4.5: "An instance method mC declared in class C overrides another instance method mA declared in class A iff either mC is the same as mA, or all of the following are true: C is a subclass of A." We need to either: i) Special-case the logic for selection based on a resolved interface method (simplifying assumptions: interface is a superinterface of the referenced class, no superclass of the referenced class matches the descriptor, the resolved method is public) ii) Generalize overriding to include class-interface overriding (optional: include 'invokeinterface' in this as well; in that case, also need to support overriding by inherited methods, where the two method declarations don't "know" about each other) There are some subtle differences between 'invokeinterface' and 'invokevirtual' that should be taken into account here. Also, older versions of JVMS may be useful -- they may have done a better job of capturing the expected behavior.
|