提交 f2508046 编写于 作者: J jrose

7087658: MethodHandles.Lookup.findVirtual is confused by interface methods...

7087658: MethodHandles.Lookup.findVirtual is confused by interface methods that are multiply inherited
Reviewed-by: twisti
上级 ece51a42
...@@ -622,8 +622,12 @@ import static java.lang.invoke.MethodHandleStatics.*; ...@@ -622,8 +622,12 @@ import static java.lang.invoke.MethodHandleStatics.*;
MemberName[] buf = { m }; MemberName[] buf = { m };
int n = MethodHandleNatives.getMembers(m.getDeclaringClass(), int n = MethodHandleNatives.getMembers(m.getDeclaringClass(),
m.getName(), matchSig, matchFlags, lookupClass, 0, buf); m.getName(), matchSig, matchFlags, lookupClass, 0, buf);
if (n != 1) return false; if (n == 0 || !m.isResolved())
return 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. /** Produce a resolved version of the given member.
* Super types are searched (for inherited members) if {@code searchSupers} is true. * Super types are searched (for inherited members) if {@code searchSupers} is true.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册