Request for review JDK-8010706 - system properties -> nashorn options
Hannes Wallnoefer
hannes.wallnoefer at oracle.com
Tue Mar 26 00:43:14 PDT 2013
The change looks good.
I was just confused a bit by the example because it looks like you're
setting an environment variable, while I guess you'd have to set a Java
system property using mvn -Dnashorn.args=...
Hannes
Am 2013-03-26 07:42, schrieb Marcus Lagergren:
> 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