8026502: java/lang/invoke/MethodHandleConstants.java fails on all platforms
authortwisti
Thu, 24 Oct 2013 10:52:15 -0700
changeset 21362 8b2d68e8632a
parent 21361 6e4ef4e0097f
child 21363 82e139fdd879
8026502: java/lang/invoke/MethodHandleConstants.java fails on all platforms Reviewed-by: iveresov, jrose
jdk/src/share/classes/java/lang/invoke/MethodHandles.java
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Oct 24 19:04:27 2013 +0200
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Oct 24 10:52:15 2013 -0700
@@ -1716,6 +1716,13 @@
                 checkSymbolicClass(defc);
                 return mh;
             }
+            // Treat MethodHandle.invoke and invokeExact specially.
+            if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
+                mh = findVirtualForMH(member.getName(), member.getMethodType());
+                if (mh != null) {
+                    return mh;
+                }
+            }
             MemberName resolved = resolveOrFail(refKind, member);
             mh = getDirectMethodForConstant(refKind, defc, resolved);
             if (mh instanceof DirectMethodHandle
@@ -1768,12 +1775,6 @@
             if (MethodHandleNatives.refKindIsField(refKind)) {
                 return getDirectFieldNoSecurityManager(refKind, defc, member);
             } else if (MethodHandleNatives.refKindIsMethod(refKind)) {
-                if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
-                    MethodHandle mh = findVirtualForMH(member.getName(), member.getMethodType());
-                    if (mh != null) {
-                        return mh;
-                    }
-                }
                 return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass);
             } else if (refKind == REF_newInvokeSpecial) {
                 return getDirectConstructorNoSecurityManager(defc, member);