RFR (M) JDK-8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults

Lois Foltan lois.foltan at oracle.com
Mon Mar 31 17:25:37 UTC 2014


Hi,

Please review the following fix:

Webrev:
     http://cr.openjdk.java.net/~lfoltan/bug_jdk8033150/

Bug: invokestatic: IncompatibleClassChangeError trying to invoke static 
method from a parent in presence of conflicting defaults
https://bugs.openjdk.java.net/browse/JDK-8033150

Summary of fix:
During default method processing, determine_target(), is responsible for 
making decisions on whether
to create and add an overpass method to the current class for issues 
that have been encountered during the walk
of the default methods.  The routine 
defaultMethods.cpp/has_matching_static() helped determine this
decision by looking within the current class for a static method that 
should be preferred during method
resolution over an overpass method being created.  However, 
has_matching_static() did not continue to
look for a static method in current class' superclasses which 
JDK-8033150 exposed.

After looking at the code more closely, the has _matching_static() 
concept is being moved out out of default
method processing and into method resolution processing.  The primary 
reason for this is to allow
default method processing to match method selection where statics are 
and should be ignored.   According
to JVMS, static methods should only be preferred over an overpass method 
at method and interface
method resolution time.  To enable method resolution to potentially find 
a static method over an overpass
method, a new parameter "ignore_overpass" was added to 
InstanceKlass::uncached_lookup_method().
It has the affect of indicating to find_method_index() to ignore 
overpass methods and continue the search
in case a static method of the same name and signature is present in the 
current class or its superclasses.

Tests:
     - jtreg hotspot/test/*, JDK java.lang & java.util, 
vm.quick.testlist, JCK lang & vm, defmeth tests
- Test will be added to the defmeth test system

Thank you,
Lois


More information about the hotspot-runtime-dev mailing list