Consider the following case: public class T1 { public int m() { return 2; } } public class T2 extends T1 { public static int m() { return 1; } } public class T3 extends T2 { public int m() { return 0; } } Call site: equivalent of invokespecial T1.m T3 Expected result: T1.m is invoked. java.lang.InternalError: p1.T1.m()int/invokeSpecial at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:1631) at java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:1602) at java.lang.invoke.MethodHandles$Lookup.getDirectMethodForConstant(MethodHandles.java:1778) at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1727) at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:442) at p1.T3.test(Unknown Source) at p1.T3Caller.test(Unknown Source) Test case is attached. ILW = HLH = P2 I = H = incorrect result: error instead of successful invocation L = L = javac rejects to compile the test case; may be a result of separate compilation though W = H = no workaround
|