imposter icon indicating copy to clipboard operation
imposter copied to clipboard

Replace deprecated Nashorn scripting implementation

Open outofcoffee opened this issue 4 years ago • 6 comments

Nashorn, the provider of JavaScript scripting support is deprecated as of Java 11.

The GraalVM implementation is intended to eventually replace the Nashorn implementation.

outofcoffee avatar Sep 11 '20 14:09 outofcoffee

GraalVM module added in 028875657848a71a16fd25caf05cf26f6e04a9a2.

outofcoffee avatar Sep 11 '20 14:09 outofcoffee

As of v1.3.0, the GraalVM implementation is now merged, but Nashorn is still the default.

outofcoffee avatar Apr 20 '21 08:04 outofcoffee

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')

pcornish avatar May 07 '21 17:05 pcornish

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).

outofcoffee avatar Aug 23 '21 20:08 outofcoffee

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.

outofcoffee avatar Aug 23 '21 20:08 outofcoffee