equal
deleted
inserted
replaced
114 * Returns a thread-local JS object used to define methods for the adapter class being initialized on the current |
114 * Returns a thread-local JS object used to define methods for the adapter class being initialized on the current |
115 * thread. This method is public solely for implementation reasons, so the adapter classes can invoke it from their |
115 * thread. This method is public solely for implementation reasons, so the adapter classes can invoke it from their |
116 * static initializers. |
116 * static initializers. |
117 * @return the thread-local JS object used to define methods for the class being initialized. |
117 * @return the thread-local JS object used to define methods for the class being initialized. |
118 */ |
118 */ |
119 public static ScriptObject getClassOverrides() { |
119 public static Object getClassOverrides() { |
120 final ScriptObject overrides = classOverrides.get(); |
120 final Object overrides = classOverrides.get(); |
121 assert overrides != null; |
121 assert overrides != null; |
122 return overrides; |
122 return overrides; |
123 } |
123 } |
124 |
124 |
125 /** |
125 /** |
130 * @param arg the argument to pass to the handle. |
130 * @param arg the argument to pass to the handle. |
131 * @throws Throwable if anything goes wrong. |
131 * @throws Throwable if anything goes wrong. |
132 */ |
132 */ |
133 public static void invokeNoPermissions(final MethodHandle method, final Object arg) throws Throwable { |
133 public static void invokeNoPermissions(final MethodHandle method, final Object arg) throws Throwable { |
134 NO_PERMISSIONS_INVOKER.invokeExact(method, arg); |
134 NO_PERMISSIONS_INVOKER.invokeExact(method, arg); |
|
135 } |
|
136 |
|
137 /** |
|
138 * Set the current global scope |
|
139 * @param global the global scope |
|
140 */ |
|
141 public static void setGlobal(final Object global) { |
|
142 Context.setGlobal((ScriptObject)global); |
|
143 } |
|
144 |
|
145 /** |
|
146 * Get the current global scope |
|
147 * @return the current global scope |
|
148 */ |
|
149 public static Object getGlobal() { |
|
150 return Context.getGlobal(); |
135 } |
151 } |
136 |
152 |
137 static void setClassOverrides(ScriptObject overrides) { |
153 static void setClassOverrides(ScriptObject overrides) { |
138 classOverrides.set(overrides); |
154 classOverrides.set(overrides); |
139 } |
155 } |