Standalone Nashorn is coming for Java 15+

Gustavo Lopes gustavo at sqreen.com
Mon Oct 12 16:41:11 UTC 2020


I've incidentally been working on this lately.

The results of my efforts are here: https://github.com/sqreen/nashorn

The tests that don't require external js libraries all pass, with some 
exceptions:

* I couldn't get the tests requiring jemmy to pass. IIRC, the original 
ant files pointed to some urls of jars that don't exist anymore and I 
couldn't find the exact jemmy and jemmyjfx versions expected.

* Half a dozen sandboxing tests don't pass because they require that 
nashorn be loaded on the platform classloader. More precisly, when 
running with a security manager and 
with -Djava.security.properties= pointing to a file restricting class 
loading with package.access, it seems to rely on the fact that the 
platform classloader doesn't have the call 
to SecurityManager::checkPackageAccess that the app classloader has

I haven't worked on the benchmarks.

Most of the work was moving to gradle. I didn't have to make a lot of 
changes to the codebase. I had to change to the Unsafe in sun.misc 
rather than the internal one, to change the parent module layer for the 
scripting JPMS module created at runtime for when nashorn isn't loaded 
on the boot layer, then some tests required small tweaks but I don't 
remember much else.

I also copied the asm library to avoid having to --add-exports the 
internal one, but maybe this can be changed to the mainline asm library.

As to the jjs executable, that was not a problem, and some tests require 
it anyway, which is why I worked on it. The only difficult was that when 
built separately from openjdk, the -J-XXX option is not available, but 
this can be worked around with the JDK_JAVA_OPTIONS environment variable.



More information about the nashorn-dev mailing list