8026502: java/lang/invoke/MethodHandleConstants.java fails on all platforms
Reviewed-by: iveresov, jrose
--- 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);