@Test public void testEvalFromFile3() throws FileNotFoundException, ScriptException { InputStreamReader code = getStream("hello2.kt"); Object result = engine.eval(code); assertNotNull(result); assertEquals("main", result.getClass().getDeclaredMethods()[0].getName()); assertEquals("hello", result.getClass().getPackage().getName()); }
@Override public Object eval(String script, ScriptContext context) throws ScriptException { try { File file = File.createTempFile("kc_evl", ".kts"); KotlinCompiledScript scr = new KotlinCompiledScript(this, script, file); Bindings ctx = context.getBindings(ScriptContext.ENGINE_SCOPE); return scr.eval(ctx); } catch (IOException e) { throw new ScriptException(e); } }
KotlinScriptEngine extends AbstractScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(String script, ScriptContext context) throws ScriptException { try { File file = File.createTempFile("kc_evl", ".kts"); KotlinCompiledScript scr = new KotlinCompiledScript(this, script, file); Bindings ctx = context.getBindings(ScriptContext.ENGINE_SCOPE); return scr.eval(ctx); } catch (IOException e) { throw new ScriptException(e); } } }
KotlinScriptEngine extends AbstractScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(String script, ScriptContext context) throws ScriptException { try { File file = File.createTempFile("kc_evl", ".kts"); KotlinCompiledScript scr = new KotlinCompiledScript(this, script, file); Bindings ctx = context.getBindings(ScriptContext.ENGINE_SCOPE); return scr.eval(ctx); } catch (IOException e) { throw new ScriptException(e); } } KotlinScriptEngine(KotlinScriptEngineFactory factory); }
KotlinScriptEngine extends AbstractScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(String script, ScriptContext context) throws ScriptException { try { File file = File.createTempFile("kc_evl", ".kts"); KotlinCompiledScript scr = new KotlinCompiledScript(this, script, file); Bindings ctx = context.getBindings(ScriptContext.ENGINE_SCOPE); return scr.eval(ctx); } catch (IOException e) { throw new ScriptException(e); } } KotlinScriptEngine(KotlinScriptEngineFactory factory); @Override CompiledScript compile(String script); @Override Object eval(String script, ScriptContext context); Object evalClass(Class<?> clazz, Bindings ctx); Class<?> compileScript(File file); @Override Bindings createBindings(); @Override ScriptEngineFactory getFactory(); @Override CompiledScript compile(Reader script); @Override Object eval(Reader script, ScriptContext context); }
KotlinScriptEngine extends AbstractScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(String script, ScriptContext context) throws ScriptException { try { File file = File.createTempFile("kc_evl", ".kts"); KotlinCompiledScript scr = new KotlinCompiledScript(this, script, file); Bindings ctx = context.getBindings(ScriptContext.ENGINE_SCOPE); return scr.eval(ctx); } catch (IOException e) { throw new ScriptException(e); } } KotlinScriptEngine(KotlinScriptEngineFactory factory); @Override CompiledScript compile(String script); @Override Object eval(String script, ScriptContext context); Object evalClass(Class<?> clazz, Bindings ctx); Class<?> compileScript(File file); @Override Bindings createBindings(); @Override ScriptEngineFactory getFactory(); @Override CompiledScript compile(Reader script); @Override Object eval(Reader script, ScriptContext context);  }