changeset 5480:5790290441b2

7087658: MethodHandles.Lookup.findVirtual is confused by interface methods that are multiply inherited Reviewed-by: twisti
author jrose
date Thu, 12 Jul 2012 00:12:28 -0700
parents 5745feb0a1d6
children 0204531e8d85
files src/share/classes/java/lang/invoke/MemberName.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MemberName.java	Thu Jul 12 00:11:35 2012 -0700
+++ b/src/share/classes/java/lang/invoke/MemberName.java	Thu Jul 12 00:12:28 2012 -0700
@@ -622,8 +622,12 @@
             MemberName[] buf = { m };
             int n = MethodHandleNatives.getMembers(m.getDeclaringClass(),
                     m.getName(), matchSig, matchFlags, lookupClass, 0, buf);
-            if (n != 1)  return false;
-            return m.isResolved();
+            if (n == 0 || !m.isResolved())
+                return false;  // no result
+            else if (n == 1 || m.clazz.isInterface())
+                return true;   // unique result, or multiple inheritance is OK
+            else
+                return false;  // ambiguous result (can this happen?)
         }
         /** Produce a resolved version of the given member.
          *  Super types are searched (for inherited members) if {@code searchSupers} is true.