-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b35
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085743 | emb-9 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
JDK-8064243 | 8u45 | Hannes Wallnoefer | P4 | Resolved | Fixed | b01 |
JDK-8060018 | 8u40 | Hannes Wallnoefer | P4 | Resolved | Fixed | b10 |
JDK-8070480 | emb-8u47 | Hannes Wallnoefer | P4 | Resolved | Fixed | team |
A NullPointerException occurs when installing scripts from persistent cache with optimistic types disabled. When running the script below twice:
$ java -jar dist/nashorn.jar --optimistic-types=false -pcc ./test/script/basic/JDK-8048079_2a.js
parsed and compiled ok prototype.js
$ java -jar dist/nashorn.jar --optimistic-types=false -pcc ./test/script/basic/JDK-8048079_2a.js
Exception in thread "main" java.lang.NullPointerException
at jdk.nashorn.internal.runtime.Context.install(Context.java:1249)
at jdk.nashorn.internal.runtime.Context.compile(Context.java:1192)
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1123)
at jdk.nashorn.internal.runtime.Context.evaluateSource(Context.java:1089)
at jdk.nashorn.internal.runtime.Context.load(Context.java:773)
at jdk.nashorn.internal.objects.Global.load(Global.java:1000)
at jdk.nashorn.internal.scripts.Script$JDK_8048079_2a.:program(./test/script/basic/JDK-8048079_2a.js:34)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
at jdk.nashorn.tools.Shell.apply(Shell.java:394)
at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
at jdk.nashorn.tools.Shell.run(Shell.java:169)
at jdk.nashorn.tools.Shell.main(Shell.java:133)
at jdk.nashorn.tools.Shell.main(Shell.java:112)
Obviously a function in the constants array may not have an initializer when lazy compilation is enabled, so we need to add a null check right there.
$ java -jar dist/nashorn.jar --optimistic-types=false -pcc ./test/script/basic/
parsed and compiled ok prototype.js
$ java -jar dist/nashorn.jar --optimistic-types=false -pcc ./test/script/basic/
Exception in thread "main" java.lang.NullPointerException
at jdk.nashorn.internal.runtime.Context.install(Context.java:1249)
at jdk.nashorn.internal.runtime.Context.compile(Context.java:1192)
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1123)
at jdk.nashorn.internal.runtime.Context.evaluateSource(Context.java:1089)
at jdk.nashorn.internal.runtime.Context.load(Context.java:773)
at jdk.nashorn.internal.objects.Global.load(Global.java:1000)
at jdk.nashorn.internal.scripts.Script$JDK_8048079_2a.:program(./test/script/basic/
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
at jdk.nashorn.tools.Shell.apply(Shell.java:394)
at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
at jdk.nashorn.tools.Shell.run(Shell.java:169)
at jdk.nashorn.tools.Shell.main(Shell.java:133)
at jdk.nashorn.tools.Shell.main(Shell.java:112)
Obviously a function in the constants array may not have an initializer when lazy compilation is enabled, so we need to add a null check right there.
- backported by
-
JDK-8060018 NPE restoring cached script with optimistic types disabled
-
- Resolved
-
-
JDK-8064243 NPE restoring cached script with optimistic types disabled
-
- Resolved
-
-
JDK-8070480 NPE restoring cached script with optimistic types disabled
-
- Resolved
-
-
JDK-8085743 NPE restoring cached script with optimistic types disabled
-
- Resolved
-