diff --git a/src/share/classes/javax/script/ScriptEngineManager.java b/src/share/classes/javax/script/ScriptEngineManager.java
index 7ce42d8929867a88fb51aa6cf2f634346ed93769..769c41c968613570607b62247aa868133815745f 100644
--- a/src/share/classes/javax/script/ScriptEngineManager.java
+++ b/src/share/classes/javax/script/ScriptEngineManager.java
@@ -28,9 +28,6 @@ import java.util.*;
import java.security.*;
import java.util.ServiceLoader;
import java.util.ServiceConfigurationError;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-import sun.security.util.SecurityConstants;
/**
* The ScriptEngineManager implements a discovery and instantiation
@@ -54,23 +51,14 @@ import sun.security.util.SecurityConstants;
public class ScriptEngineManager {
private static final boolean DEBUG = false;
/**
- * If the thread context ClassLoader can be accessed by the caller,
- * then the effect of calling this constructor is the same as calling
+ * The effect of calling this constructor is the same as calling
* ScriptEngineManager(Thread.currentThread().getContextClassLoader()).
- * Otherwise, the effect is the same as calling ScriptEngineManager(null).
*
* @see java.lang.Thread#getContextClassLoader
*/
- @CallerSensitive
public ScriptEngineManager() {
ClassLoader ctxtLoader = Thread.currentThread().getContextClassLoader();
- if (canCallerAccessLoader(ctxtLoader, Reflection.getCallerClass())) {
- if (DEBUG) System.out.println("using " + ctxtLoader);
- init(ctxtLoader);
- } else {
- if (DEBUG) System.out.println("using bootstrap loader");
- init(null);
- }
+ init(ctxtLoader);
}
/**
@@ -420,41 +408,4 @@ public class ScriptEngineManager {
/** Global bindings associated with script engines created by this manager. */
private Bindings globalScope;
-
- private boolean canCallerAccessLoader(ClassLoader loader, Class> caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- ClassLoader callerLoader = getClassLoader(caller);
- if (!sun.misc.VM.isSystemDomainLoader(callerLoader)) {
- if (loader != callerLoader || !isAncestor(loader, callerLoader)) {
- try {
- sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
- } catch (SecurityException exp) {
- if (DEBUG) exp.printStackTrace();
- return false;
- }
- } // else fallthru..
- } // else fallthru..
- } // else fallthru..
-
- return true;
- }
-
- // Note that this code is same as ClassLoader.getClassLoader().
- // But, that method is package private and hence we can't call here.
- private ClassLoader getClassLoader(Class> caller) {
- if (caller == null) {
- return null;
- }
- return caller.getClassLoader();
- }
-
- // is cl1 ancestor of cl2?
- private boolean isAncestor(ClassLoader cl1, ClassLoader cl2) {
- do {
- cl2 = cl2.getParent();
- if (cl1 == cl2) return true;
- } while (cl2 != null);
- return false;
- }
}