changeset 5624:ecc14534318c jdk7u11-b20

8004933: Improve MethodHandle interaction with libraries 8006017: Improve lookup resolutions Reviewed-by: ahgross
author jrose
date Thu, 10 Jan 2013 19:22:29 -0800
parents 88c54f7a8c51
children f9567d889266
files src/share/classes/java/lang/invoke/MethodHandleNatives.java src/share/classes/java/lang/invoke/MethodHandles.java
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Dec 04 17:28:38 2012 -0800
+++ b/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Thu Jan 10 19:22:29 2013 -0800
@@ -418,6 +418,21 @@
             return defc == sun.misc.Unsafe.class;
         case "lookup":
             return defc == java.lang.invoke.MethodHandles.class;
+        case "findStatic":
+        case "findVirtual":
+        case "findConstructor":
+        case "findSpecial":
+        case "findGetter":
+        case "findSetter":
+        case "findStaticGetter":
+        case "findStaticSetter":
+        case "bind":
+        case "unreflect":
+        case "unreflectSpecial":
+        case "unreflectConstructor":
+        case "unreflectGetter":
+        case "unreflectSetter":
+            return defc == java.lang.invoke.MethodHandles.Lookup.class;
         case "invoke":
             return defc == java.lang.reflect.Method.class;
         case "get":
--- a/src/share/classes/java/lang/invoke/MethodHandles.java	Tue Dec 04 17:28:38 2012 -0800
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 10 19:22:29 2013 -0800
@@ -69,6 +69,10 @@
     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.