8024260: 10 closed/java/lang/invoke/* tests failing after overhaul to MethodHandleInfo
authorrfield
Fri, 06 Sep 2013 00:43:00 -0700
changeset 19817 72338a6a1a4b
parent 19816 4136f2a0645d
child 19818 ea208803594d
8024260: 10 closed/java/lang/invoke/* tests failing after overhaul to MethodHandleInfo Reviewed-by: vlivanov, briangoetz Contributed-by: john.r.rose@oracle.com
jdk/src/share/classes/java/lang/invoke/MethodHandle.java
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Thu Sep 05 14:58:49 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Fri Sep 06 00:43:00 2013 -0700
@@ -1286,7 +1286,17 @@
 
     /*non-public*/
     MethodHandle withInternalMemberName(MemberName member) {
-        return MethodHandleImpl.makeWrappedMember(this, member);
+        if (member != null) {
+            return MethodHandleImpl.makeWrappedMember(this, member);
+        } else if (internalMemberName() == null) {
+            // The required internaMemberName is null, and this MH (like most) doesn't have one.
+            return this;
+        } else {
+            // The following case is rare. Mask the internalMemberName by wrapping the MH in a BMH.
+            MethodHandle result = rebind();
+            assert (result.internalMemberName() == null);
+            return result;
+        }
     }
 
     /*non-public*/