From e0956267fd20f568f3e70cc3a4cffc4a87f9a247 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Wed, 16 Apr 2025 03:29:01 -0600 Subject: [PATCH] [jrubyscripting] Implement AutoCloseable on JRubyEngineWrapper (#18560) This now possible since JRuby 10 implements it. Signed-off-by: Cody Cutrer --- .../jrubyscripting/internal/JRubyEngineWrapper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 3a48c9b236..2cc24197ce 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 @@ -35,7 +35,7 @@ import org.jruby.embed.jsr223.JRubyEngine; * @author Jimmy Tanagra - Initial contribution */ @NonNullByDefault -public class JRubyEngineWrapper implements Invocable, ScriptEngine { +public class JRubyEngineWrapper implements Invocable, ScriptEngine, AutoCloseable { // Don't implement Compilable because there is a bug // in JRuby's compiled scripts: https://github.com/jruby/jruby/issues/8346 @@ -205,4 +205,9 @@ public class JRubyEngineWrapper implements Invocable, ScriptEngine { public T getInterface(@Nullable Object receiver, @Nullable Class returnType) { return engine.getInterface(receiver, returnType); } + + @Override + public void close() { + engine.close(); + } }