imposter
imposter copied to clipboard
Replace deprecated Nashorn scripting implementation
Nashorn, the provider of JavaScript scripting support is deprecated as of Java 11.
The GraalVM implementation is intended to eventually replace the Nashorn implementation.
GraalVM module added in 028875657848a71a16fd25caf05cf26f6e04a9a2.
As of v1.3.0, the GraalVM implementation is now merged, but Nashorn is still the default.
Currently Graal.js doesn't have special Map or List accessor syntax: https://github.com/oracle/graaljs/issues/107
This makes accessing things like params more cumbersome:
Nashorn:
request.headers.Authorization
request.params.foo
Graal.js
request.headers.get('Authorization')
request.params.get('foo')
Graal.js now supports map-like data structures as of v21.1.0
Added support for map-like data structures (issue #143) ... Java host interoperability was improved to handle java.util.Map implementations to make them look like guest language hash maps. This feature can be enabled and disabled with HostAccess.Builder.allowMapAccess(boolean).
Bumped Graal version in https://github.com/outofcoffee/imposter/commit/899487b4fc3ccce328e770dee2087726b315716c to support the above.
Next step is enabling native compiler support to avoid using interpreted mode, per: https://www.graalvm.org/reference-manual/js/RunOnJDK/
This will likely require packaging changes and a possible move to JDK11 to reduce the number of build targets.