The Artima Developer Community
Sponsored Link

Chapter 8 of Inside the Java Virtual Machine
The Linking Model
by Bill Venners

<<  Page 8 of 20  >>

Advertisement

Resolution of CONSTANT_InterfaceMethodref_info Entries

To resolve a constant pool entry of type CONSTANT_InterfaceMethodref_info, the virtual machine must first resolve the CONSTANT_Class_info entry specified in the class_index item. Therefore, any error that can be thrown because of the resolution of a CONSTANT_Class_info can be thrown during the resolution of a CONSTANT_InterfaceMethodref_info. If the resolution of the CONSTANT_Class_info entry succeeds, the virtual machine searches for the indicated method in the interface and its supertypes. (The virtual machine need not check to make sure the current class has permission to access the method, because all methods declared in interfaces are implicitly public.)

If resolution to the CONSTANT_Class_info completes successfully, the virtual machine performs interface method resolution using these steps:

  1. If the resolved type is an class, not an interface, the virtual machine throws IncompatibleClassChangeError.
  2. Otherwise, the resolved type is an interface. The virtual machine checks the referenced interface for a method of the specified name and descriptor. If the virtual machine discovers such a method, that method is the result of the successful interface method lookup.
  3. Otherwise, the virtual machine checks the class's direct superinterfaces, recursively all the superinterfaces of the interface, and class java.lang.Object for a method of the specified name and descriptor. If the virtual machine discovers such a method, that method is the result of the successful interface method lookup.

If the virtual machine discovers there is no method with the proper name, return type, and number and types of parameters in the referenced interface or any of its supertypes, the virtual machine throws NoSuchMethodError.

Otherwise, the virtual machine marks the entry as resolved and places a direct reference to the method in the data for the constant pool entry.

<<  Page 8 of 20  >>


Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use