Request for review JDK-8010706 - system properties -> nashorn options

Marcus Lagergren marcus.lagergren at oracle.com
Mon Mar 25 23:42:02 PDT 2013


In order to make opaque frameworks easier to debug, I've added some code to Options.java that converts system properties given by the value of the property "nashorn.args" to nashorn parameters. This way we can set e.g. "--log=compiler" for something that runs three levels deep in JavaScript meta-execution frameworks without knowing exactly how they launch.

Usage example:

export  nashorn.args="--lazy-compilation --log=compiler" mvn clean verify 

Patch:

diff -r d5d80b52cf1c src/jdk/nashorn/internal/runtime/options/Options.java 
--- a/src/jdk/nashorn/internal/runtime/options/Options.java	Fri Mar 15 16:07:13 2013 +0100 
+++ b/src/jdk/nashorn/internal/runtime/options/Options.java	Tue Mar 19 18:16:36 2013 +0100 
@@ -386,6 +386,13 @@ 
        final LinkedList<String> argList = new LinkedList<>(); 
        Collections.addAll(argList, args); 

+ final String extra = getStringProperty("nashorn.args", null); 
+     if (extra != null) { 
+          for (final StringTokenizer st = new StringTokenizer(extra); st.hasMoreTokens(); ) { 
+              argList.add(st.nextToken()); 
+          } 
+ } 
+ 
        while (!argList.isEmpty()) { 
            final String arg = argList.remove(0); 

@@ -406,7 +413,7 @@ 
                files.add(arg); 
                continue; 
            } 
- 
+ 
            if (arg.startsWith(definePropPrefix)) { 
                final String value = arg.substring(definePropPrefix.length()); 
                final int eq = value.indexOf('='); 

/M



More information about the nashorn-dev mailing list