From d253e2cd2e6d830c28baaa9a73a3fe53f6055ad0 Mon Sep 17 00:00:00 2001 From: jimtng <2554958+jimtng@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:48:46 +1000 Subject: [PATCH] [jrubyscripting] Remove Compilable implementation (#17960) due to a bug in JRuby https://github.com/jruby/jruby/issues/8346 Signed-off-by: Jimmy Tanagra --- .../internal/JRubyEngineWrapper.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/bundles/org.openhab.automation.jrubyscripting/src/main/java/org/openhab/automation/jrubyscripting/internal/JRubyEngineWrapper.java b/bundles/org.openhab.automation.jrubyscripting/src/main/java/org/openhab/automation/jrubyscripting/internal/JRubyEngineWrapper.java index 07d13577c7f6c..628cb23b79419 100644 --- a/bundles/org.openhab.automation.jrubyscripting/src/main/java/org/openhab/automation/jrubyscripting/internal/JRubyEngineWrapper.java +++ b/bundles/org.openhab.automation.jrubyscripting/src/main/java/org/openhab/automation/jrubyscripting/internal/JRubyEngineWrapper.java @@ -16,8 +16,6 @@ import java.util.Objects; import javax.script.Bindings; -import javax.script.Compilable; -import javax.script.CompiledScript; import javax.script.Invocable; import javax.script.ScriptContext; import javax.script.ScriptEngine; @@ -37,7 +35,9 @@ * @author Jimmy Tanagra - Initial contribution */ @NonNullByDefault -public class JRubyEngineWrapper implements Compilable, Invocable, ScriptEngine { +public class JRubyEngineWrapper implements Invocable, ScriptEngine { + // Don't implement Compilable because there is a bug + // in JRuby's compiled scripts: https://github.com/jruby/jruby/issues/8346 private final JRubyEngine engine; @@ -48,16 +48,6 @@ public class JRubyEngineWrapper implements Compilable, Invocable, ScriptEngine { this.engine = Objects.requireNonNull(engine); } - @Override - public CompiledScript compile(@Nullable String script) throws ScriptException { - return new JRubyCompiledScriptWrapper(engine.compile(script)); - } - - @Override - public CompiledScript compile(@Nullable Reader reader) throws ScriptException { - return new JRubyCompiledScriptWrapper(engine.compile(reader)); - } - @Override public Object eval(@Nullable String script, @Nullable ScriptContext context) throws ScriptException { Object ctx = Objects.requireNonNull(context).getBindings(ScriptContext.ENGINE_SCOPE).get(CONTEXT_VAR_NAME);