JDK-8027270 : JNI_GetMethodID fails to find an instance method from the superclass
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs25,7u45
  • Priority: P3
  • Status: Resolved
  • Resolution: Cannot Reproduce
  • Submitted: 2013-10-24
  • Updated: 2015-03-30
  • Resolved: 2015-03-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Relates :  
Relates :  
Description
If a superclass A has an instance class foo() and a subclass B extends A has a static method with the same name and signature (see example code below), JNI_GetMethodID stops the lookup once it finds a matching method from class B and throws NoSuchMethodException since B.foo is a static method.

class A {
  protected void foo() {
    System.out.println("A.foo");
  }
}

class B extends A {
  private static void foo() { 
    System.out.println("private static B.foo()");
  }
}

javac will fail to compile the above and this requires patching the bytecode to get to this test case.

This is related to the issue reported at
   http://weblog.ikvm.net/PermaLink.aspx?guid=cce26630-b8f3-4a05-b9d3-2426fb442385

Another issue when the subclass has a private "foo" instance method and its superclass also defines an instance "foo", the bytecode invocation of invokevirtual will ignore the private method and use the non-private foo method in the superclass.

The spec of JNI_GetMethodID  should also be clarified whether it will ignore the private method in this case.
Comments
Closing because cannot reproduce the problem. See attached test case that implements the situation described by the bug but does not reproduce the problem.
30-03-2015

ILW ML? = P4 I: Medium, It doesn't find the method when you have illegal bytecode L: Low, Edge case, highly unlikely W: Unknown (High), No know workaround at this time
29-10-2013