[jrubyscripting] Implement AutoCloseable on JRubyEngineWrapper (#18560)

This now possible since JRuby 10 implements it.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
Cody Cutrer
2025-04-16 11:29:01 +02:00
committed by GitHub
parent 856c9d7386
commit e0956267fd
@@ -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> T getInterface(@Nullable Object receiver, @Nullable Class<T> returnType) {
return engine.getInterface(receiver, returnType);
}
@Override
public void close() {
engine.close();
}
}