diff --git a/bundles/org.openhab.automation.jsscripting/pom.xml b/bundles/org.openhab.automation.jsscripting/pom.xml
index e8868bb24bdbb..5a5ff68b054cc 100644
--- a/bundles/org.openhab.automation.jsscripting/pom.xml
+++ b/bundles/org.openhab.automation.jsscripting/pom.xml
@@ -22,7 +22,7 @@
!jdk.internal.reflect.*,
!jdk.vm.ci.services
- 20.1.0
+ 21.3.0
6.2.1
${project.version}
@@ -81,7 +81,7 @@
com.ibm.icu
icu4j
- 62.1
+ 69.1
diff --git a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/ClassExtender.java b/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/ClassExtender.java
deleted file mode 100644
index d3a1623df7df9..0000000000000
--- a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/ClassExtender.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) 2010-2021 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.automation.jsscripting;
-
-import com.oracle.truffle.js.runtime.java.adapter.JavaAdapterFactory;
-
-/**
- * Class utility to allow creation of 'extendable' classes with a classloader of the GraalJS bundle, rather than the
- * classloader of the file being extended.
- *
- * @author Jonathan Gilbert - Initial contribution
- */
-public class ClassExtender {
- private static ClassLoader classLoader = ClassExtender.class.getClassLoader();
-
- public static Object extend(String className) {
- try {
- return extend(Class.forName(className));
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Cannot find class " + className, e);
- }
- }
-
- public static Object extend(Class> clazz) {
- return JavaAdapterFactory.getAdapterClassFor(clazz, null, classLoader);
- }
-}
diff --git a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java b/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java
index aa62c1308592e..9f29b0d99d2c7 100644
--- a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java
+++ b/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java
@@ -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;
@@ -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()) {