ES6 and JavaImporter
Brad Grier
bradgrier at cox.net
Fri Jan 19 03:06:28 UTC 2018
Hello,
I wanted to experiment with the Java 9 ES6 features in my software.
Unfortunately I can't get far because of an issue involving JavaImporter. I
created a simple jjs example that illustrates the problem. The script works
under ES5 but fails under ES6 with: ./pg4.js:6 ReferenceError: "printIt"
is not defined
#!/usr/bin/jjs -J-Dnashorn.args=--language=es6
var imports = new JavaImporter(java.util);
with(imports){
function printIt(a){
print("map: " + a);
}
function printAndClear(b){
printIt(b);
b.clear();
}
var map = new HashMap();
map.put('js', 'javascript');
map.put("java", "java");
printAndClear(map);
}
Thanks. I'm using build 9.0.1+11 on OS X.
Brad
More information about the nashorn-dev
mailing list