JDK-8147419 : Missing check for interface static method referenced by method handle
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2016-01-14
  • Updated: 2016-03-25
  • Resolved: 2016-03-25
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
Blocks :  
Relates :  
Relates :  
Description
Filed for tracing remained issue after 8145148 fixed. When ASM used to generated code for invoke interface static method , say 'm' is interface static method and referenced by handle:

 #15 = InterfaceMethodref #11.#14 // I.m:()I
 #16 = MethodHandle       #9:#15  //  invokeinterface I.m()I

It should be like:

 #15 = InterfaceMethodref #11.#14 // I.m:()I
 #16 = MethodHandle       #9:#15  //  invokestatic I.m()I

When this problem is addressed in ASM, the relax check in  8145148 should be removed.
Comments
Won't check in the relaxed check for https://bugs.openjdk.java.net/browse/JDK-8145148, so this doesn't need to be tracked as an issue.
25-03-2016

Reopening to wait for the ASM changes. Will likely push with missing check.
28-01-2016

See bug 8147755, the problem is fix in current ASM workspace and has not synced down to jdk. After jdk synced with asm, the relax check is not needed in 8145148. In fact, 8145148 will remove the relax check, wait for fix synced from ASM. Closed.
25-01-2016

Note when 8147755 fixed, the test case above still pass since the condition of the test still stands. It only failed on relax check removed and 8147755 not fixed.
19-01-2016

The test like this: TestInterfaceStaticMethodHandle.jasm interface I version 52:0 { // void m() { // System.out.println("Hellow, from static I.m()!"); // } public static Method m: "()V" stack 2 locals 2 { getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; ldc String "Hello, from static I.m()!"; invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; return; } } public class TestInterfaceStaticMethodHandle version 52:0 { const #1 = Method I.m: "()V"; public static Method main:"([Ljava/lang/String;)V" stack 10 locals 4 { // REF_invokeStatic ldc MethodHandle 6:#1; invokevirtual java/lang/invoke/MethodHandle.invoke:"()V"; return; } } execute: 1) It will pass before/after 8145148 fix. java TestInterfaceStaticMethodHandle Hello, from static I.m()! 2) Remove the relax check in 8145148: - // Check tag consistency, relax for interface static default method. - if ((callee->is_interface() && !m_tag.is_interface_method() && - (ref_kind != JVM_REF_invokeStatic)) || (!callee->is_interface() && m_tag.is_interface_method())) { ResourceMark rm(THREAD); ----------------- + // Check tag consistency. + if ((callee->is_interface() && !m_tag.is_interface_method()) || (!callee->is_interface() && m_tag.is_interface_method())) { ResourceMark rm(THREAD); java TestInterfaceStaticMethodHandle Exception in thread "main" java.lang.IncompatibleClassChangeError: Inconsistent constant data for I.m()V at index 2 at TestInterfaceStaticMethodHandle.main(TestInterfaceStaticMethodHandle.jasm) filed bug 8147755 for asm.
19-01-2016

Thank you for filing this bug so we do not forget in future to make this change once ASM is fixed. Could you please attach a small ASM test case and file a bug against ASM which is owned by the tools group? And link it here so they can use the example? When you file the bug it would be good to quote the JVM Spec.
19-01-2016