org.mozilla.javascript.jdk11

Class VMBridge_jdk11


public class VMBridge_jdk11
extends VMBridge

Method Summary

protected Context
getContext(Object contextHelper)
Get Context instance associated with the current thread or null if none.
protected ClassLoader
getCurrentThreadClassLoader()
Return the ClassLoader instance associated with the current thread.
protected Object
getThreadContextHelper()
Return a helper object to optimize Context access.
protected boolean
isVarArgs(Member member)
Returns whether or not a given member (method or constructor) has variable arguments.
protected void
setContext(Object contextHelper, Context cx)
Associate Context instance with the current thread or remove the current association if cx is null.
protected boolean
tryToMakeAccessible(Object accessibleObject)
In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593).

Methods inherited from class org.mozilla.javascript.VMBridge

getContext, getCurrentThreadClassLoader, getInterfaceProxyHelper, getJavaIterator, getThreadContextHelper, isVarArgs, newInterfaceProxy, setContext, tryToMakeAccessible

Method Details

getContext

protected Context getContext(Object contextHelper)
Get Context instance associated with the current thread or null if none.
Overrides:
getContext in interface VMBridge
Parameters:
contextHelper - The result of VMBridge.getThreadContextHelper() called from the current thread.

getCurrentThreadClassLoader

protected ClassLoader getCurrentThreadClassLoader()
Return the ClassLoader instance associated with the current thread.
Overrides:
getCurrentThreadClassLoader in interface VMBridge

getThreadContextHelper

protected Object getThreadContextHelper()
Return a helper object to optimize Context access.

The runtime will pass the resulting helper object to the subsequent calls to getContext(Object contextHelper) and setContext(Object contextHelper, Context cx) methods. In this way the implementation can use the helper to cache information about current thread to make Context access faster.

Overrides:
getThreadContextHelper in interface VMBridge

isVarArgs

protected boolean isVarArgs(Member member)
Returns whether or not a given member (method or constructor) has variable arguments. Variable argument methods have only been supported in Java since JDK 1.5.
Overrides:
isVarArgs in interface VMBridge

setContext

protected void setContext(Object contextHelper,
                          Context cx)
Associate Context instance with the current thread or remove the current association if cx is null.
Overrides:
setContext in interface VMBridge
Parameters:
contextHelper - The result of VMBridge.getThreadContextHelper() called from the current thread.

tryToMakeAccessible

protected boolean tryToMakeAccessible(Object accessibleObject)
In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593). VMBridge instance should try to workaround that via, for example, calling method.setAccessible(true) when it is available. The implementation is responsible to catch all possible exceptions like SecurityException if the workaround is not available.
Overrides:
tryToMakeAccessible in interface VMBridge
Returns:
true if it was possible to make method accessible or false otherwise.