--- a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Tue Jul 23 21:45:27 2013 +0530
+++ b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Tue Jul 23 18:28:58 2013 +0200
@@ -292,6 +292,8 @@
return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName());
}
+ private static final Lookup publicLookup = new Lookup(MethodHandles.publicLookup());
+
/**
* Unreflects a method handle from a Method or a Constructor using safe (zero-privilege) unreflection. Should be
* only used for methods and constructors that are not caller sensitive. If a caller sensitive method were
@@ -303,14 +305,13 @@
private static MethodHandle unreflectSafely(AccessibleObject m) {
if(m instanceof Method) {
final Method reflMethod = (Method)m;
- final MethodHandle handle = SafeUnreflector.unreflect(reflMethod);
+ final MethodHandle handle = publicLookup.unreflect(reflMethod);
if(Modifier.isStatic(reflMethod.getModifiers())) {
return StaticClassIntrospector.editStaticMethodHandle(handle);
}
return handle;
}
- return StaticClassIntrospector.editConstructorMethodHandle(SafeUnreflector.unreflectConstructor(
- (Constructor<?>)m));
+ return StaticClassIntrospector.editConstructorMethodHandle(publicLookup.unreflectConstructor((Constructor<?>)m));
}
private static DynamicMethod mergeMethods(SingleDynamicMethod method, DynamicMethod existing, Class<?> clazz, String name) {