@Test public void testEvalReader() throws ScriptException { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("java"); Reader reader = new StringReader("" + "public class Script {" + " public int getValue() {" + " return 1234;" + " }" + "}"); Object result = engine.eval(reader); assertThat(result).isEqualTo(1234); }
@Override public Object eval(Reader reader) throws ScriptException { return eval(readScript(reader)); }
JavaScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(Reader reader) throws ScriptException { return eval(readScript(reader)); } }
JavaScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(Reader reader) throws ScriptException { return eval(readScript(reader)); }  }
JavaScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(Reader reader) throws ScriptException { return eval(readScript(reader)); }  void setNameStrategy(NameStrategy nameStrategy); void setConstructorStrategy(ConstructorStrategy constructorStrategy); void setExecutionStrategyFactory(ExecutionStrategyFactory executionStrategyFactory); void setExecutionClassLoader(ClassLoader executionClassLoader); void setIsolation(Isolation isolation); @Override ScriptContext getContext(); @Override void setContext(ScriptContext context); @Override Bindings createBindings(); @Override Bindings getBindings(int scope); @Override void setBindings(Bindings bindings, int scope); @Override void put(String key, Object value); @Override Object get(String key); @Override Object eval(Reader reader); @Override Object eval(String script); @Override Object eval(Reader reader, ScriptContext context); @Override Object eval(String script, ScriptContext context); @Override Object eval(Reader reader, Bindings bindings); @Override Object eval(String script, Bindings bindings); @Override CompiledScript compile(Reader reader); @Override JavaCompiledScript compile(String script); @Override ScriptEngineFactory getFactory(); }
JavaScriptEngine implements ScriptEngine, Compilable { @Override public Object eval(Reader reader) throws ScriptException { return eval(readScript(reader)); }  void setNameStrategy(NameStrategy nameStrategy); void setConstructorStrategy(ConstructorStrategy constructorStrategy); void setExecutionStrategyFactory(ExecutionStrategyFactory executionStrategyFactory); void setExecutionClassLoader(ClassLoader executionClassLoader); void setIsolation(Isolation isolation); @Override ScriptContext getContext(); @Override void setContext(ScriptContext context); @Override Bindings createBindings(); @Override Bindings getBindings(int scope); @Override void setBindings(Bindings bindings, int scope); @Override void put(String key, Object value); @Override Object get(String key); @Override Object eval(Reader reader); @Override Object eval(String script); @Override Object eval(Reader reader, ScriptContext context); @Override Object eval(String script, ScriptContext context); @Override Object eval(Reader reader, Bindings bindings); @Override Object eval(String script, Bindings bindings); @Override CompiledScript compile(Reader reader); @Override JavaCompiledScript compile(String script); @Override ScriptEngineFactory getFactory();  }