changeset 5626:d9969a953f69 jdk7u11-b21

8006125: Update MethodHandles library interactions Reviewed-by: mchung, jdn, ahgross
author jrose
date Fri, 11 Jan 2013 17:53:41 -0800
parents f9567d889266
children 0e35f0184115
files src/share/classes/java/lang/invoke/MethodHandles.java src/share/classes/sun/reflect/misc/MethodUtil.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MethodHandles.java	Fri Jan 11 09:00:00 2013 -0800
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java	Fri Jan 11 17:53:41 2013 -0800
@@ -69,10 +69,6 @@
     public static Lookup lookup() {
         return new Lookup();
     }
-    static {
-        // FIXME in MR1: Core Reflection cannot be used to gain a Lookup to perform MH reflection
-        Reflection.registerMethodsToFilter(MethodHandles.class, "lookup");
-    }
 
     /**
      * Returns a {@link Lookup lookup object} which is trusted minimally.
--- a/src/share/classes/sun/reflect/misc/MethodUtil.java	Fri Jan 11 09:00:00 2013 -0800
+++ b/src/share/classes/sun/reflect/misc/MethodUtil.java	Fri Jan 11 17:53:41 2013 -0800
@@ -256,6 +256,12 @@
     public static Object invoke(Method m, Object obj, Object[] params)
         throws InvocationTargetException, IllegalAccessException {
         if (m.getDeclaringClass().equals(AccessController.class) ||
+           (m.getDeclaringClass().equals(java.lang.invoke.MethodHandles.class)
+            && m.getName().equals("lookup")) ||
+           (m.getDeclaringClass().equals(java.lang.invoke.MethodHandles.Lookup.class)
+            && (m.getName().startsWith("find") ||
+                m.getName().startsWith("bind") ||
+                m.getName().startsWith("unreflect"))) ||
             m.getDeclaringClass().equals(Method.class))
             throw new InvocationTargetException(
                 new UnsupportedOperationException("invocation not supported"));