< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaScriptEngine.java
Print this page
@@ -44,10 +44,21 @@
* Simple wrapper around jsr-223 JavaScript script engine.
* In addition to wrapping useful functionality of jsr-223 engine,
* this class exposed certain "global" functions to the script.
*/
public abstract class JSJavaScriptEngine extends MapScriptObject {
+
+ private static native Module getEveryoneModule();
+
+ // Open all packages in jdk.hotspot.agent to all modules.
+ static{
+ var everyoneModule = getEveryoneModule();
+ var saModule = JSJavaScriptEngine.class.getModule();
+ saModule.getPackages()
+ .forEach(p -> saModule.addOpens(p, everyoneModule));
+ }
+
/**
* Start a read-eval-print loop with this engine.
*/
public void startConsole() {
start(true);
< prev index next >