mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[jrubyscripting] Remove Compilable implementation (#17960)
due to a bug in JRuby https://github.com/jruby/jruby/issues/8346 Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
parent
5eb47a042f
commit
d253e2cd2e
@ -16,8 +16,6 @@ import java.io.Reader;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.script.Bindings;
|
import javax.script.Bindings;
|
||||||
import javax.script.Compilable;
|
|
||||||
import javax.script.CompiledScript;
|
|
||||||
import javax.script.Invocable;
|
import javax.script.Invocable;
|
||||||
import javax.script.ScriptContext;
|
import javax.script.ScriptContext;
|
||||||
import javax.script.ScriptEngine;
|
import javax.script.ScriptEngine;
|
||||||
@ -37,7 +35,9 @@ import org.jruby.embed.jsr223.JRubyEngine;
|
|||||||
* @author Jimmy Tanagra - Initial contribution
|
* @author Jimmy Tanagra - Initial contribution
|
||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@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;
|
private final JRubyEngine engine;
|
||||||
|
|
||||||
@ -48,16 +48,6 @@ public class JRubyEngineWrapper implements Compilable, Invocable, ScriptEngine {
|
|||||||
this.engine = Objects.requireNonNull(engine);
|
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
|
@Override
|
||||||
public Object eval(@Nullable String script, @Nullable ScriptContext context) throws ScriptException {
|
public Object eval(@Nullable String script, @Nullable ScriptContext context) throws ScriptException {
|
||||||
Object ctx = Objects.requireNonNull(context).getBindings(ScriptContext.ENGINE_SCOPE).get(CONTEXT_VAR_NAME);
|
Object ctx = Objects.requireNonNull(context).getBindings(ScriptContext.ENGINE_SCOPE).get(CONTEXT_VAR_NAME);
|
||||||
|
Loading…
Reference in New Issue
Block a user