-
Bug
-
Resolution: Duplicate
-
P2
-
8, 8u60
-
x86_64
-
generic
The attached program can be used to reproduce the bug.
When expressions are evaluated via jdk.nashorn.internal.runtime.DebuggerSupport.eval(), or jdk.nashorn.internal.runtime.Context.eval(), then the local variables are not found, they are reported as not defined. Unless there's a reference to that variable in a different scope.
There is a difference between the 'a' and 'b' variables. While 'a' is used in the current scope only, 'b' is used inside (unused) 'bRef' function. This is sufficient to be able to use 'b' in evaluation. When 'bRef' is removed, 'b' will not be found as well as 'a' is not.
To reproduce, stop debugger in the attached file EvalTest.js on line 11.
(You can use NetBeans IDE and run Debug File on EvalTest.js and when it breaks on line 11, select "a+10" and hover on it to get a tooltip).
Then find the scope variable from the list of local variables, and either run:
jdk.nashorn.internal.runtime.DebuggerSupport.eval(scopeVar, thisVar, "a+10", false),
or (currently being executed in NetBeans):
Context context = jdk.nashorn.internal.runtime.Context.fromClass(<current file's class>);
context.eval(scopeVar, "a+10", thisVar, null, false).
In both evaluations it ends with ECMAException: ReferenceError: "a" is not defined - the full exception attached.
When 'a' is replaced with 'b', the evaluation finish successfully and gives '12' as the result.
When expressions are evaluated via jdk.nashorn.internal.runtime.DebuggerSupport.eval(), or jdk.nashorn.internal.runtime.Context.eval(), then the local variables are not found, they are reported as not defined. Unless there's a reference to that variable in a different scope.
There is a difference between the 'a' and 'b' variables. While 'a' is used in the current scope only, 'b' is used inside (unused) 'bRef' function. This is sufficient to be able to use 'b' in evaluation. When 'bRef' is removed, 'b' will not be found as well as 'a' is not.
To reproduce, stop debugger in the attached file EvalTest.js on line 11.
(You can use NetBeans IDE and run Debug File on EvalTest.js and when it breaks on line 11, select "a+10" and hover on it to get a tooltip).
Then find the scope variable from the list of local variables, and either run:
jdk.nashorn.internal.runtime.DebuggerSupport.eval(scopeVar, thisVar, "a+10", false),
or (currently being executed in NetBeans):
Context context = jdk.nashorn.internal.runtime.Context.fromClass(<current file's class>);
context.eval(scopeVar, "a+10", thisVar, null, false).
In both evaluations it ends with ECMAException: ReferenceError: "a" is not defined - the full exception attached.
When 'a' is replaced with 'b', the evaluation finish successfully and gives '12' as the result.
- duplicates
-
JDK-8131929 Add option for debuggable scopes
-
- Resolved
-
- is blocked by
-
JDK-8131929 Add option for debuggable scopes
-
- Resolved
-