changeset 8005:62be74f35886

8006179: JSR292 MethodHandles lookup with interface using findVirtual() Reviewed-by: jrose, twisti
author vlivanov
date Fri, 22 Feb 2013 03:00:12 -0800
parents e3cac5962e32
children 9995881dfb4e
files src/share/classes/java/lang/invoke/DirectMethodHandle.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Fri Feb 22 03:00:48 2013 -0800
+++ b/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Fri Feb 22 03:00:12 2013 -0800
@@ -51,6 +51,16 @@
     private DirectMethodHandle(MethodType mtype, LambdaForm form, MemberName member) {
         super(mtype, form);
         if (!member.isResolved())  throw new InternalError();
+
+        if (member.getDeclaringClass().isInterface() && !member.isAbstract()) {
+            // Check for corner case: invokeinterface of Object method
+            MemberName m = new MemberName(Object.class, member.getName(), member.getMethodType(), member.getReferenceKind());
+            m = MemberName.getFactory().resolveOrNull(m.getReferenceKind(), m, null);
+            if (m != null && m.isPublic()) {
+                member = m;
+            }
+        }
+
         this.member = member;
     }