Nashorn on the module-path
Christian Stein
sormuras at gmail.com
Thu May 16 04:02:12 UTC 2019
Hi everybody,
although I'm aware of Nashorn being deprecated for removal
and that the JUnit team also tends to remove the experimental
support for script-based test execution [2] in the near future,
I'd like to learn the reason for why a global script binding behaves
differently when running on the module-path or on the class-path.
I guess(!), it boils down to swallowed illegal access exception
that happens when a simple Java object is put into a Binding.
Running on the class-path, an instance of SimpleDynamicMethod
from package "jdk.dynalink.beans" is wrap around a method
of the bound object. When running on the module-path, the
type within the Nashorn is reported as: "undefined".
I compiled a small example project [1] that describes and
demonstrates the issue. Please view the README.md file for
details. You may reproduce the issue by launching `jshell build.jsh`
on any platform having JDK 11+ installed within the root directory
of the project.
Thanks in advance for any hint and clue.
Cheers,
Christian
[1] https://github.com/sormuras/junit5-class-vs-module-path
[2]
https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution-scripts
More information about the jigsaw-dev
mailing list