-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b61
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085640 | emb-9 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
JDK-8087057 | 8u65 | Hannes Wallnoefer | P4 | Resolved | Fixed | b01 |
JDK-8078012 | 8u60 | Hannes Wallnoefer | P4 | Resolved | Fixed | b12 |
JDK-8138509 | emb-8u65 | Unassigned | P4 | Resolved | Fixed | b01 |
JDK-8079057 | emb-8u60 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
Undeclared globals in eval code can refer to anything in the containing environment, so even if they qualify for the fast-scope flag within the eval script, the callsite should not be handled as fast scope when linking with a property of the containing environment.
This bug can be replicated by running the test case fromJDK-8026167 with objects fields:
jjs -Dnashorn.fields.objects test/script/basic/JDK-8026167.js
Exception in thread "main" java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.scripts.JO2P0 to jdk.nashorn.internal.scripts.JO1P1
at java.lang.invoke.MethodHandleImpl.newClassCastException(MethodHandleImpl.java:361)
at java.lang.invoke.MethodHandleImpl.castReference(MethodHandleImpl.java:356)
at jdk.nashorn.internal.scripts.Script$Recompilation$8$\^eval\_#1\!27\^eval\_.:program(<eval>#1:27<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.internal.runtime.Context.eval(Context.java:712)
at jdk.nashorn.internal.objects.Global.directEval(Global.java:1250)
This bug can be replicated by running the test case from
jjs -Dnashorn.fields.objects test/script/basic/
Exception in thread "main" java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.scripts.JO2P0 to jdk.nashorn.internal.scripts.JO1P1
at java.lang.invoke.MethodHandleImpl.newClassCastException(MethodHandleImpl.java:361)
at java.lang.invoke.MethodHandleImpl.castReference(MethodHandleImpl.java:356)
at jdk.nashorn.internal.scripts.Script$Recompilation$8$\^eval\_#1\!27\^eval\_.:program(<eval>#1:27<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.internal.runtime.Context.eval(Context.java:712)
at jdk.nashorn.internal.objects.Global.directEval(Global.java:1250)
- backported by
-
JDK-8078012 Undeclared globals in eval code should not be handled as fast scope
- Resolved
-
JDK-8079057 Undeclared globals in eval code should not be handled as fast scope
- Resolved
-
JDK-8085640 Undeclared globals in eval code should not be handled as fast scope
- Resolved
-
JDK-8087057 Undeclared globals in eval code should not be handled as fast scope
- Resolved
-
JDK-8138509 Undeclared globals in eval code should not be handled as fast scope
- Resolved