VMSpec 1.2 5.4.3.3

Martin Vechev martin@fadata.bg
Fri Mar 22 10:38:00 GMT 2002


About method resoluton, as a 3rd step, it says the following:

"......Otherwise, method lookup attempts to locate the referenced method in 
any of the superinterfaces of the specified class C.
-       If any superinterface of C declares a method with the name and 
descriptor specified by the method reference, method lookup succeeds.
-       Otherwise, method lookup fails. "

I cannot think of a situation where one would need this for the 
invokevirtual instruction. The method declaration should already  be 
found  (if one exists) while searching up through the class hierarchy. 
There is no need to lookup the superinterfaces. That would mean there is a 
case where the method declaration is in one of the superinterfaces but not 
in one of the superclasses. Clearly, if declaration is not found on the way 
up (in the superclasses), there is no need for invokevirtual to start 
searching for the definition in the superclasses.









More information about the Java mailing list