jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
changeset 22287 7bb2a658a502
parent 21618 6632680b0683
child 22297 1c62c67d9dd2
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Jan 16 11:37:49 2014 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Jan 15 20:48:44 2014 +0400
@@ -638,6 +638,12 @@
             refKind = REF_invokeVirtual;
         }
 
+        if (member.getDeclaringClass().isInterface() && refKind == REF_invokeVirtual) {
+            // Methods from Object declared in an interface can be resolved by JVM to invokevirtual kind.
+            // Need to convert it back to invokeinterface to pass verification and make the invocation works as expected.
+            refKind = REF_invokeInterface;
+        }
+
         // push arguments
         for (int i = 0; i < name.arguments.length; i++) {
             emitPushArgument(name, i);