Package org.mozilla.javascript.jdk18
Class VMBridge_jdk18
java.lang.Object
org.mozilla.javascript.VMBridge
org.mozilla.javascript.jdk18.VMBridge_jdk18
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ContextgetContext(Object contextHelper) GetContextinstance associated with the current thread or null if none.protected ObjectgetInterfaceProxyHelper(ContextFactory cf, Class<?>[] interfaces) Create helper object to create later proxies implementing the specified interfaces later.protected ObjectReturn a helper object to optimizeContextaccess.protected ObjectnewInterfaceProxy(Object proxyHelper, ContextFactory cf, InterfaceAdapter adapter, Object target, Scriptable topScope) Create proxy object forInterfaceAdapter.protected voidsetContext(Object contextHelper, Context cx) AssociateContextinstance with the current thread or remove the current association ifcxis null.protected booleantryToMakeAccessible(AccessibleObject accessible) In many JVMSs, public methods in private classes are not accessible by default (Sun Bug #4071593).
-
Constructor Details
-
VMBridge_jdk18
public VMBridge_jdk18()
-
-
Method Details
-
getThreadContextHelper
Description copied from class:VMBridgeReturn a helper object to optimizeContextaccess.The runtime will pass the resulting helper object to the subsequent calls to
VMBridge.getContext(Object contextHelper)andVMBridge.setContext(Object contextHelper, Context cx)methods. In this way the implementation can use the helper to cache information about current thread to makeContextaccess faster.- Specified by:
getThreadContextHelperin classVMBridge
-
getContext
Description copied from class:VMBridgeGetContextinstance associated with the current thread or null if none.- Specified by:
getContextin classVMBridge- Parameters:
contextHelper- The result ofVMBridge.getThreadContextHelper()called from the current thread.
-
setContext
Description copied from class:VMBridgeAssociateContextinstance with the current thread or remove the current association ifcxis null.- Specified by:
setContextin classVMBridge- Parameters:
contextHelper- The result ofVMBridge.getThreadContextHelper()called from the current thread.
-
tryToMakeAccessible
Description copied from class:VMBridgeIn 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.- Specified by:
tryToMakeAccessiblein classVMBridge- Returns:
- true if it was possible to make method accessible or false otherwise.
-
getInterfaceProxyHelper
Description copied from class:VMBridgeCreate helper object to create later proxies implementing the specified interfaces later. Under JDK 1.3 the implementation can look like:return java.lang.reflect.Proxy.getProxyClass(..., interfaces). getConstructor(new Class[] { java.lang.reflect.InvocationHandler.class });- Specified by:
getInterfaceProxyHelperin classVMBridge- Parameters:
interfaces- Array with one or more interface class objects.
-
newInterfaceProxy
protected Object newInterfaceProxy(Object proxyHelper, ContextFactory cf, InterfaceAdapter adapter, Object target, Scriptable topScope) Description copied from class:VMBridgeCreate proxy object forInterfaceAdapter. The proxy should callInterfaceAdapter.invoke(ContextFactory, Object, Scriptable, Object, Method, Object[])as implementation of interface methods associated withproxyHelper.Method- Specified by:
newInterfaceProxyin classVMBridge- Parameters:
proxyHelper- The result of the previous call toVMBridge.getInterfaceProxyHelper(ContextFactory, Class[]).
-