ES6 and JavaImporter
Hannes Wallnöfer
hannes.wallnoefer at oracle.com
Fri Jan 19 14:24:02 UTC 2018
Brad,
I as I wrote in my last reply to this list, ES6 support is quite incomplete in Nashorn.
However, that doesn’t really explain this error. I’m looking into it and will file a bug.
Hannes
> Am 19.01.2018 um 04:06 schrieb Brad Grier <bradgrier at cox.net>:
>
> 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