nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
changeset 19455 b972b61a6921
parent 19093 49bb7e75b326
child 24778 2ff5d7041566
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Thu Aug 01 12:23:38 2013 +0200
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Wed Aug 07 16:38:44 2013 +0200
@@ -189,15 +189,17 @@
         return type == StaticClass.class;
     }
 
-    /*private*/ static final MethodHandle GET_CLASS = new Lookup(MethodHandles.lookup()).findVirtual(StaticClass.class,
-            "getRepresentedClass", MethodType.methodType(Class.class));
-
-    /*private*/ static final MethodHandle IS_CLASS = new Lookup(MethodHandles.lookup()).findStatic(StaticClassLinker.class,
-            "isClass", MethodType.methodType(Boolean.TYPE, Class.class, Object.class));
-
+    /*private*/ static final MethodHandle GET_CLASS;
+    /*private*/ static final MethodHandle IS_CLASS;
     /*private*/ static final MethodHandle ARRAY_CTOR = Lookup.PUBLIC.findStatic(Array.class, "newInstance",
             MethodType.methodType(Object.class, Class.class, int.class));
 
+    static {
+        final Lookup lookup = new Lookup(MethodHandles.lookup());
+        GET_CLASS = lookup.findVirtual(StaticClass.class, "getRepresentedClass", MethodType.methodType(Class.class));
+        IS_CLASS = lookup.findOwnStatic("isClass", Boolean.TYPE, Class.class, Object.class);
+    }
+
     @SuppressWarnings("unused")
     private static boolean isClass(Class<?> clazz, Object obj) {
         return obj instanceof StaticClass && ((StaticClass)obj).getRepresentedClass() == clazz;