Discussion:
17th loop of "let foo = '';" throws ReferenceError
(too old to reply)
Jesse Schulman
2018-03-23 21:48:43 UTC
Permalink
This has been tested and is happening on java 9 and 10, to reproduce:

import jdk.nashorn.api.scripting.NashornScriptEngine;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.ScriptObjectMirror;

public class LetReproducer {

public static void main(String[] args) {
NashornScriptEngineFactory factory = new
NashornScriptEngineFactory();
NashornScriptEngine engine = (NashornScriptEngine)
factory.getScriptEngine(new String[]{"--no-java", "-strict",
"--language=es6"});
ScriptObjectMirror bindings = (ScriptObjectMirror)
engine.createBindings();
for (int i = 0; i < 17; i++) {
try {
bindings.eval("let foo = '';\n");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}


Thanks,
Jesse
Sundararajan Athijegannathan
2018-03-26 05:36:13 UTC
Permalink
Thanks for reporting this issue. Filed a bug ->
https://bugs.openjdk.java.net/browse/JDK-8200215

Thanks,
-Sundar
Post by Jesse Schulman
import jdk.nashorn.api.scripting.NashornScriptEngine;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
public class LetReproducer {
public static void main(String[] args) {
NashornScriptEngineFactory factory = new
NashornScriptEngineFactory();
NashornScriptEngine engine = (NashornScriptEngine)
factory.getScriptEngine(new String[]{"--no-java", "-strict",
"--language=es6"});
ScriptObjectMirror bindings = (ScriptObjectMirror)
engine.createBindings();
for (int i = 0; i< 17; i++) {
try {
bindings.eval("let foo = '';\n");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Thanks,
Jesse
Loading...