Skip to content

Commit

Permalink
[jsscripting] Update GraalJS to 21.3 to allow method selection via Ja…
Browse files Browse the repository at this point in the history
…vaScript (#11437)

Signed-off-by: Lukas Agethen <[email protected]>
  • Loading branch information
LukasA83 authored Nov 6, 2021
1 parent d4510f3 commit a6fd6a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 40 deletions.
4 changes: 2 additions & 2 deletions bundles/org.openhab.automation.jsscripting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
!jdk.internal.reflect.*,
!jdk.vm.ci.services
</bnd.importpackage>
<graal.version>20.1.0</graal.version>
<graal.version>21.3.0</graal.version>
<asm.version>6.2.1</asm.version>
<oh.version>${project.version}</oh.version>
</properties>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>62.1</version>
<version>69.1</version>
</dependency>

<!-- include as version required is older than OH provides -->
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.openhab.automation.jsscripting.internal.fs.DelegatingFileSystem;
import org.openhab.automation.jsscripting.internal.fs.PrefixedSeekableByteChannel;
import org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocable;
Expand Down Expand Up @@ -65,10 +66,14 @@ public class OpenhabGraalJSScriptEngine extends InvocationInterceptingScriptEngi
*/
public OpenhabGraalJSScriptEngine() {
super(null); // delegate depends on fields not yet initialised, so we cannot set it immediately
delegate = GraalJSScriptEngine.create(null,
delegate = GraalJSScriptEngine.create(
Engine.newBuilder().allowExperimentalOptions(true).option("engine.WarnInterpreterOnly", "false")
.build(),
Context.newBuilder("js").allowExperimentalOptions(true).allowAllAccess(true)
.option("js.commonjs-require-cwd", MODULE_DIR).option("js.nashorn-compat", "true") // to ease
// migration
.option("js.ecmascript-version", "2021") // nashorn compat will enforce es5 compatibility, we
// want ecma2021
.option("js.commonjs-require", "true") // enable CommonJS module support
.hostClassLoader(getClass().getClassLoader())
.fileSystem(new DelegatingFileSystem(FileSystems.getDefault().provider()) {
Expand Down

0 comments on commit a6fd6a3

Please sign in to comment.