eval in DebuggerSupport.java fails.

Kuperman Sergey seastranger at gmail.com
Mon Sep 29 15:11:40 UTC 2014

Hello ! I am not sure it is the right place to ask but i will try anyway )
My team is trying to develop a JS debugger poc running Nashorn , and we
encountered an issue when trying to implement evaluation in function context:
We run some JS function with:
        ScriptEngineManager sem = new ScriptEngineManager();
        ScriptEngine engine = sem.getEngineByName("nashorn");
        engine.eval("load (\"src/com/sap/rdl/runjs/file.js\");");
in another app we set a breakpoint in a function, and try to invoke eval()
function from DebuggerSupport.java , while passing to it :scope variable we
received from the relevant frame's visibleVariables (JDI).
eval succeeds when global or upper scope defined variables are involved, but
if i use an expression with local function variable, i receive ECMAException
no such variable defined.. it seems to me that eval needs local vars to be
defined within the scope but they are not ..
Is there anything i could do to make it work ?

Thanks in advance

SAP RDL development team

More information about the nashorn-dev mailing list