Java Code Examples for jdk.nashorn.internal.objects.Global

The following examples show how to use jdk.nashorn.internal.objects.Global. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hottub   Source File: Context.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 2
private ScriptFunction compileImpl(final Source source, final Global newGlobal) throws ScriptException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != newGlobal);
    try {
        if (globalChanged) {
            Context.setGlobal(newGlobal);
        }

        return nashornContext.compileScript(source, newGlobal);
    } catch (final Exception e) {
        throwAsScriptException(e, newGlobal);
        throw new AssertionError("should not reach here");
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 3
Source Project: jdk8u60   Source File: NashornScriptEngine.java    License: GNU General Public License v2.0 6 votes vote down vote up
private ScriptFunction compileImpl(final Source source, final Global newGlobal) throws ScriptException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != newGlobal);
    try {
        if (globalChanged) {
            Context.setGlobal(newGlobal);
        }

        return nashornContext.compileScript(source, newGlobal);
    } catch (final Exception e) {
        throwAsScriptException(e, newGlobal);
        throw new AssertionError("should not reach here");
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 4
Source Project: hottub   Source File: Shell.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Run method logic.
 *
 * @param in input stream for Shell
 * @param out output stream for Shell
 * @param err error stream for Shell
 * @param args arguments to Shell
 *
 * @return exit code
 *
 * @throws IOException if there's a problem setting up the streams
 */
protected final int run(final InputStream in, final OutputStream out, final OutputStream err, final String[] args) throws IOException {
    final Context context = makeContext(in, out, err, args);
    if (context == null) {
        return COMMANDLINE_ERROR;
    }

    final Global global = context.createGlobal();
    final ScriptEnvironment env = context.getEnv();
    final List<String> files = env.getFiles();
    if (files.isEmpty()) {
        return readEvalPrint(context, global);
    }

    if (env._compile_only) {
        return compileScripts(context, global, files);
    }

    if (env._fx) {
        return runFXScripts(context, global, files);
    }

    return runScripts(context, global, files);
}
 
Example 5
@Test
public void evalTest() {
    final Options options = new Options("");
    final ErrorManager errors = new ErrorManager();
    final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
    final Global oldGlobal = Context.getGlobal();
    Context.setGlobal(cx.createGlobal());
    try {
        String code = "22 + 10";
        assertTrue(32.0 == ((Number)(eval(cx, "<evalTest>", code))).doubleValue());

        code = "obj = { js: 'nashorn' }; obj.js";
        assertEquals(eval(cx, "<evalTest2>", code), "nashorn");
    } finally {
        Context.setGlobal(oldGlobal);
    }
}
 
Example 6
Source Project: jdk8u60   Source File: ScriptObjectMirror.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Make a script object mirror on given object if needed. Also converts ConsString instances to Strings.
 *
 * @param obj object to be wrapped/converted
 * @param homeGlobal global to which this object belongs. Not used for ConsStrings.
 * @param jsonCompatible if true, the created wrapper will implement the Java {@code List} interface if
 * {@code obj} is a JavaScript {@code Array} object. Arrays retrieved through its properties (transitively)
 * will also implement the list interface.
 * @return wrapped/converted object
 */
private static Object wrap(final Object obj, final Object homeGlobal, final boolean jsonCompatible) {
    if(obj instanceof ScriptObject) {
        if (!(homeGlobal instanceof Global)) {
            return obj;
        }
        final ScriptObject sobj = (ScriptObject)obj;
        final Global global = (Global)homeGlobal;
        final ScriptObjectMirror mirror = new ScriptObjectMirror(sobj, global, jsonCompatible);
        if (jsonCompatible && sobj.isArray()) {
            return new JSONListAdapter(mirror, global);
        }
        return mirror;
    } else if(obj instanceof ConsString) {
        return obj.toString();
    } else if (jsonCompatible && obj instanceof ScriptObjectMirror) {
        // Since choosing JSON compatible representation is an explicit decision on user's part, if we're asked to
        // wrap a mirror that was not JSON compatible, explicitly create its compatible counterpart following the
        // principle of least surprise.
        return ((ScriptObjectMirror)obj).asJSONCompatible();
    }
    return obj;
}
 
Example 7
private static void throwAsScriptException(final Exception e, final Global global) throws ScriptException {
    if (e instanceof ScriptException) {
        throw (ScriptException)e;
    } else if (e instanceof NashornException) {
        final NashornException ne = (NashornException)e;
        final ScriptException se = new ScriptException(
            ne.getMessage(), ne.getFileName(),
            ne.getLineNumber(), ne.getColumnNumber());
        ne.initEcmaError(global);
        se.initCause(e);
        throw se;
    } else if (e instanceof RuntimeException) {
        throw (RuntimeException)e;
    } else {
        // wrap any other exception as ScriptException
        throw new ScriptException(e);
    }
}
 
Example 8
private Object evalImpl(final Context.MultiGlobalCompiledScript mgcs, final ScriptContext ctxt, final Global ctxtGlobal) throws ScriptException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != ctxtGlobal);
    try {
        if (globalChanged) {
            Context.setGlobal(ctxtGlobal);
        }

        final ScriptFunction script = mgcs.getFunction(ctxtGlobal);
        final ScriptContext oldCtxt = ctxtGlobal.getScriptContext();
        ctxtGlobal.setScriptContext(ctxt);
        try {
            return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
        } finally {
            ctxtGlobal.setScriptContext(oldCtxt);
        }
    } catch (final Exception e) {
        throwAsScriptException(e, ctxtGlobal);
        throw new AssertionError("should not reach here");
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 9
Source Project: openjdk-jdk8u   Source File: ContextTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Test
public void evalTest() {
    final Options options = new Options("");
    final ErrorManager errors = new ErrorManager();
    final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
    final Global oldGlobal = Context.getGlobal();
    Context.setGlobal(cx.createGlobal());
    try {
        String code = "22 + 10";
        assertTrue(32.0 == ((Number)(eval(cx, "<evalTest>", code))).doubleValue());

        code = "obj = { js: 'nashorn' }; obj.js";
        assertEquals(eval(cx, "<evalTest2>", code), "nashorn");
    } finally {
        Context.setGlobal(oldGlobal);
    }
}
 
Example 10
/**
 * Parses the given JSON text string and returns object representation.
 *
 * @param text JSON text to be parsed
 * @param reviver  optional value: function that takes two parameters (key, value)
 * @return Object representation of JSON text given
 */
public static Object parse(final Object text, final Object reviver) {
    final String     str    = JSType.toString(text);
    final Global     global = Context.getGlobal();
    final boolean    dualFields = ((ScriptObject) global).useDualFields();
    final JSONParser parser = new JSONParser(str, global, dualFields);
    final Object     value;

    try {
        value = parser.parse();
    } catch (final ParserException e) {
        throw ECMAErrors.syntaxError(e, "invalid.json", e.getMessage());
    }

    return applyReviver(global, value, reviver);
}
 
Example 11
Source Project: hottub   Source File: NashornScriptEngine.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void throwAsScriptException(final Exception e, final Global global) throws ScriptException {
    if (e instanceof ScriptException) {
        throw (ScriptException)e;
    } else if (e instanceof NashornException) {
        final NashornException ne = (NashornException)e;
        final ScriptException se = new ScriptException(
            ne.getMessage(), ne.getFileName(),
            ne.getLineNumber(), ne.getColumnNumber());
        ne.initEcmaError(global);
        se.initCause(e);
        throw se;
    } else if (e instanceof RuntimeException) {
        throw (RuntimeException)e;
    } else {
        // wrap any other exception as ScriptException
        throw new ScriptException(e);
    }
}
 
Example 12
Source Project: jdk8u60   Source File: NashornScriptEngine.java    License: GNU General Public License v2.0 6 votes vote down vote up
private Object evalImpl(final Context.MultiGlobalCompiledScript mgcs, final ScriptContext ctxt, final Global ctxtGlobal) throws ScriptException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != ctxtGlobal);
    try {
        if (globalChanged) {
            Context.setGlobal(ctxtGlobal);
        }

        final ScriptFunction script = mgcs.getFunction(ctxtGlobal);
        final ScriptContext oldCtxt = ctxtGlobal.getScriptContext();
        ctxtGlobal.setScriptContext(ctxt);
        try {
            return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
        } finally {
            ctxtGlobal.setScriptContext(oldCtxt);
        }
    } catch (final Exception e) {
        throwAsScriptException(e, ctxtGlobal);
        throw new AssertionError("should not reach here");
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 13
private ScriptFunction compileImpl(final Source source, final Global newGlobal) throws ScriptException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != newGlobal);
    try {
        if (globalChanged) {
            Context.setGlobal(newGlobal);
        }

        return nashornContext.compileScript(source, newGlobal);
    } catch (final Exception e) {
        throwAsScriptException(e, newGlobal);
        throw new AssertionError("should not reach here");
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 14
Source Project: openjdk-jdk8u   Source File: ListAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
ListAdapter(final JSObject obj, final Global global) {
    if (global == null) {
        throw new IllegalStateException(ECMAErrors.getMessage("list.adapter.null.global"));
    }

    this.obj = obj;
    this.global = global;
}
 
Example 15
Source Project: jdk8u_nashorn   Source File: ScriptFunction.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual prototype used by "allocate"
 * @return allocator prototype
 */
private ScriptObject getAllocatorPrototype() {
    final Object prototype = getPrototype();
    if (prototype instanceof ScriptObject) {
        return (ScriptObject) prototype;
    }
    return Global.objectPrototype();
}
 
Example 16
Source Project: jdk8u_nashorn   Source File: ListAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
ListAdapter(final JSObject obj, final Global global) {
    if (global == null) {
        throw new IllegalStateException(ECMAErrors.getMessage("list.adapter.null.global"));
    }

    this.obj = obj;
    this.global = global;
}
 
Example 17
private static void checkLinkRequest(final LinkRequest origRequest) {
    final Global global = Context.getGlobal();
    final ClassFilter cf = global.getClassFilter();
    if (cf != null) {
        throw typeError("no.reflection.with.classfilter");
    }

    final SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        final LinkRequest requestWithoutContext = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context
        final Object self = requestWithoutContext.getReceiver();
        // allow 'static' access on Class objects representing public classes of non-restricted packages
        if ((self instanceof Class) && Modifier.isPublic(((Class<?>)self).getModifiers())) {
            final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor();
            if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) {
                if (desc.getNameTokenCount() > CallSiteDescriptor.NAME_OPERAND &&
                    "static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) {
                    if (Context.isAccessibleClass((Class<?>)self) && !isReflectionClass((Class<?>)self)) {

                        // If "getProp:static" passes access checks, allow access.
                        return;
                    }
                }
            }
        }
        checkReflectionPermission(sm);
    }
}
 
Example 18
Source Project: jdk8u60   Source File: JSONFunctions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static Object applyReviver(final Global global, final Object unfiltered, final Object reviver) {
    if (reviver instanceof ScriptFunction) {
        final ScriptObject root = global.newObject();
        root.addOwnProperty("", Property.WRITABLE_ENUMERABLE_CONFIGURABLE, unfiltered);
        return walk(root, "", (ScriptFunction)reviver);
    }
    return unfiltered;
}
 
Example 19
Source Project: jdk8u_nashorn   Source File: ScriptRuntime.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an iterator over property identifiers used in the {@code for...in} statement. Note that the ECMAScript
 * 5.1 specification, chapter 12.6.4. uses the terminology "property names", which seems to imply that the property
 * identifiers are expected to be strings, but this is not actually spelled out anywhere, and Nashorn will in some
 * cases deviate from this. Namely, we guarantee to always return an iterator over {@link String} values for any
 * built-in JavaScript object. We will however return an iterator over {@link Integer} objects for native Java
 * arrays and {@link List} objects, as well as arbitrary objects representing keys of a {@link Map}. Therefore, the
 * expression {@code typeof i} within a {@code for(i in obj)} statement can return something other than
 * {@code string} when iterating over native Java arrays, {@code List}, and {@code Map} objects.
 * @param obj object to iterate on.
 * @return iterator over the object's property names.
 */
public static Iterator<?> toPropertyIterator(final Object obj) {
    if (obj instanceof ScriptObject) {
        return ((ScriptObject)obj).propertyIterator();
    }

    if (obj != null && obj.getClass().isArray()) {
        return new RangeIterator(Array.getLength(obj));
    }

    if (obj instanceof JSObject) {
        return ((JSObject)obj).keySet().iterator();
    }

    if (obj instanceof List) {
        return new RangeIterator(((List<?>)obj).size());
    }

    if (obj instanceof Map) {
        return ((Map<?,?>)obj).keySet().iterator();
    }

    final Object wrapped = Global.instance().wrapAsObject(obj);
    if (wrapped instanceof ScriptObject) {
        return ((ScriptObject)wrapped).propertyIterator();
    }

    return Collections.emptyIterator();
}
 
Example 20
Source Project: jdk8u60   Source File: Context.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the current global scope
 * @param global the global scope
 */
public static void setGlobal(final ScriptObject global) {
    if (global != null && !(global instanceof Global)) {
        throw new IllegalArgumentException("not a global!");
    }
    setGlobal((Global)global);
}
 
Example 21
Source Project: openjdk-jdk9   Source File: ListAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
ListAdapter(final JSObject obj, final Global global) {
    if (global == null) {
        throw new IllegalStateException(ECMAErrors.getMessage("list.adapter.null.global"));
    }

    this.obj = obj;
    this.global = global;
}
 
Example 22
Source Project: openjdk-jdk8u-backup   Source File: Shell.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Runs launches "fx:bootstrap.js" with the given JavaScript files provided
 * as arguments.
 *
 * @param context the nashorn context
 * @param global the global scope
 * @param files the list of script files to provide
 *
 * @return error code
 * @throws IOException when any script file read results in I/O error
 */
private static int runFXScripts(final Context context, final Global global, final List<String> files) throws IOException {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != global);
    try {
        if (globalChanged) {
            Context.setGlobal(global);
        }

        global.addOwnProperty("$GLOBAL", Property.NOT_ENUMERABLE, global);
        global.addOwnProperty("$SCRIPTS", Property.NOT_ENUMERABLE, files);
        context.load(global, "fx:bootstrap.js");
    } catch (final NashornException e) {
        context.getErrorManager().error(e.toString());
        if (context.getEnv()._dump_on_error) {
            e.printStackTrace(context.getErr());
        }

        return RUNTIME_ERROR;
    } finally {
        context.getOut().flush();
        context.getErr().flush();
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }

    return SUCCESS;
}
 
Example 23
Source Project: TencentKona-8   Source File: DebugLogger.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void logEvent(final RuntimeEvent<?> event) {
    if (event != null) {
        final Global global = Context.getGlobal();
        if (global.has("Debug")) {
            final ScriptObject debug = (ScriptObject)global.get("Debug");
            final ScriptFunction addRuntimeEvent = (ScriptFunction)debug.get("addRuntimeEvent");
            ScriptRuntime.apply(addRuntimeEvent, debug, event);
        }
    }
}
 
Example 24
Source Project: openjdk-jdk8u   Source File: DebugLogger.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void logEvent(final RuntimeEvent<?> event) {
    if (event != null) {
        final Global global = Context.getGlobal();
        if (global.has("Debug")) {
            final ScriptObject debug = (ScriptObject)global.get("Debug");
            final ScriptFunction addRuntimeEvent = (ScriptFunction)debug.get("addRuntimeEvent");
            ScriptRuntime.apply(addRuntimeEvent, debug, event);
        }
    }
}
 
Example 25
Source Project: jdk8u_nashorn   Source File: ECMAErrors.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Error dispatch mechanism.
 * Create a {@link ParserException} as the correct JavaScript error
 *
 * @param global global scope object
 * @param e {@code ParserException} for error dispatcher
 *
 * @return the resulting {@link ECMAException}
 */
public static ECMAException asEcmaException(final Global global, final ParserException e) {
    final JSErrorType errorType = e.getErrorType();
    assert errorType != null : "error type for " + e + " was null";

    final Global globalObj    = global;
    final String       msg    = e.getMessage();

    // translate to ECMAScript Error object using error type
    switch (errorType) {
    case ERROR:
        return error(globalObj.newError(msg), e);
    case EVAL_ERROR:
        return error(globalObj.newEvalError(msg), e);
    case RANGE_ERROR:
        return error(globalObj.newRangeError(msg), e);
    case REFERENCE_ERROR:
        return error(globalObj.newReferenceError(msg), e);
    case SYNTAX_ERROR:
        return error(globalObj.newSyntaxError(msg), e);
    case TYPE_ERROR:
        return error(globalObj.newTypeError(msg), e);
    case URI_ERROR:
        return error(globalObj.newURIError(msg), e);
    default:
        // should not happen - perhaps unknown error type?
        throw new AssertionError(e.getMessage());
    }
}
 
Example 26
Source Project: jdk8u60   Source File: ScriptObjectMirror.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object call(final Object thiz, final Object... args) {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != global);

    try {
        if (globalChanged) {
            Context.setGlobal(global);
        }

        if (sobj instanceof ScriptFunction) {
            final Object[] modArgs = globalChanged? wrapArrayLikeMe(args, oldGlobal) : args;
            final Object self = globalChanged? wrapLikeMe(thiz, oldGlobal) : thiz;
            return wrapLikeMe(ScriptRuntime.apply((ScriptFunction)sobj, unwrap(self, global), unwrapArray(modArgs, global)));
        }

        throw new RuntimeException("not a function: " + toString());
    } catch (final NashornException ne) {
        throw ne.initEcmaError(global);
    } catch (final RuntimeException | Error e) {
        throw e;
    } catch (final Throwable t) {
        throw new RuntimeException(t);
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 27
/**
 * Call member function
 * @param functionName function name
 * @param args         arguments
 * @return return value of function
 */
public Object callMember(final String functionName, final Object... args) {
    Objects.requireNonNull(functionName);
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != global);

    try {
        if (globalChanged) {
            Context.setGlobal(global);
        }

        final Object val = sobj.get(functionName);
        if (val instanceof ScriptFunction) {
            final Object[] modArgs = globalChanged? wrapArrayLikeMe(args, oldGlobal) : args;
            return wrapLikeMe(ScriptRuntime.apply((ScriptFunction)val, sobj, unwrapArray(modArgs, global)));
        } else if (val instanceof JSObject && ((JSObject)val).isFunction()) {
            return ((JSObject)val).call(sobj, args);
        }

        throw new NoSuchMethodException("No such function " + functionName);
    } catch (final NashornException ne) {
        throw ne.initEcmaError(global);
    } catch (final RuntimeException | Error e) {
        throw e;
    } catch (final Throwable t) {
        throw new RuntimeException(t);
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 28
@Override
public Object call(final Object thiz, final Object... args) {
    final Global oldGlobal = Context.getGlobal();
    final boolean globalChanged = (oldGlobal != global);

    try {
        if (globalChanged) {
            Context.setGlobal(global);
        }

        if (sobj instanceof ScriptFunction) {
            final Object[] modArgs = globalChanged? wrapArrayLikeMe(args, oldGlobal) : args;
            final Object self = globalChanged? wrapLikeMe(thiz, oldGlobal) : thiz;
            return wrapLikeMe(ScriptRuntime.apply((ScriptFunction)sobj, unwrap(self, global), unwrapArray(modArgs, global)));
        }

        throw new RuntimeException("not a function: " + toString());
    } catch (final NashornException ne) {
        throw ne.initEcmaError(global);
    } catch (final RuntimeException | Error e) {
        throw e;
    } catch (final Throwable t) {
        throw new RuntimeException(t);
    } finally {
        if (globalChanged) {
            Context.setGlobal(oldGlobal);
        }
    }
}
 
Example 29
Source Project: hottub   Source File: FindProperty.java    License: GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle insertAccessorsGetter(final UserAccessorProperty uap, final LinkRequest request, final MethodHandle mh) {
    MethodHandle superGetter = uap.getAccessorsGetter();
    if (isInherited()) {
        superGetter = ScriptObject.addProtoFilter(superGetter, getProtoChainLength());
    }
    if (request != null && !(request.getReceiver() instanceof ScriptObject)) {
        final MethodHandle wrapFilter = Global.getPrimitiveWrapFilter(request.getReceiver());
        superGetter = MH.filterArguments(superGetter, 0, wrapFilter.asType(wrapFilter.type().changeReturnType(superGetter.type().parameterType(0))));
    }
    superGetter = MH.asType(superGetter, superGetter.type().changeParameterType(0, Object.class));

    return MH.foldArguments(mh, superGetter);
}
 
Example 30
static void checkReflectionAccess(final Class<?> clazz, final boolean isStatic) {
    final Global global = Context.getGlobal();
    final ClassFilter cf = global.getClassFilter();
    if (cf != null && isReflectiveCheckNeeded(clazz, isStatic)) {
        throw typeError("no.reflection.with.classfilter");
    }

    final SecurityManager sm = System.getSecurityManager();
    if (sm != null && isReflectiveCheckNeeded(clazz, isStatic)) {
        checkReflectionPermission(sm);
    }
}