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 (openhab#11437)

Signed-off-by: Lukas Agethen <lukas83@gmx.de>
Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
  • Loading branch information
LukasA83 authored and mischmidt83 committed Jan 9, 2022
1 parent e972ef4 commit 625fc1c
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 625fc1c

Please sign in to comment.