changeset 8129:f2487bb0c0d2

8024260: 10 closed/java/lang/invoke/* tests failing after overhaul to MethodHandleInfo Reviewed-by: vlivanov, briangoetz Contributed-by: john.r.rose@oracle.com
author rfield
date Fri, 06 Sep 2013 00:43:00 -0700
parents 9cc74675a854
children da9de6f5cd6f
files src/share/classes/java/lang/invoke/MethodHandle.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MethodHandle.java	Thu Sep 05 14:58:49 2013 -0700
+++ b/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*/