JDK-8066219 : Fuzzing bug: Cast bug Undefined->Number, requires warmup
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u60
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2014-12-01
  • Updated: 2015-06-05
  • Resolved: 2015-06-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
Needs warmup to manifest itself

function tryItOut(c) {
 var f = tryCompiling(c);
 if (f !== null && c.indexOf('infloop') === -1) {
   tryRunning(f);
 }
}

function tryCompiling(c) {
 try { return Function(c); } catch(e) { return null; }
}

function tryRunning(f) {
 try {
   return f();
 } catch (e) {
   if (e instanceof java.lang.Throwable) e.printStackTrace();
 }
}

tryItOut("return;");
tryItOut("var x = [];");
tryItOut("var y = [];");
tryItOut("var z = [];");
tryItOut("return;");
tryItOut("Math.min");
tryItOut("Math.log");
tryItOut("Math.cos");
tryItOut("Math.max");
tryItOut("Math.sin");
tryItOut("Math.random");
tryItOut("");
tryItOut("return 1e81;");
tryItOut("{}");
tryItOut("((new Function(\"([,,]);\")).apply)(3.14);");
tryItOut("Math.tan");
tryItOut("Math.pow");
tryItOut("([,,]);");

java.lang.ClassCastException: jdk.nashorn.internal.runtime.Undefined cannot be cast to java.lang.Number
   at sun.invoke.util.ValueConversions.primitiveConversion(ValueConversions.java:199)
   at sun.invoke.util.ValueConversions.unboxDouble(ValueConversions.java:119)
   at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:656)
   at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
   at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
   at jdk.nashorn.internal.scripts.Script$Recompilation$10$213A$a.tryRunning(/tmp/a.js:14)
   at jdk.nashorn.internal.scripts.Script$Recompilation$7$a.tryItOut(/tmp/a.js:4)
   at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
   at jdk.nashorn.internal.scripts.Script$Recompilation$1$a.:program(/tmp/a.js:37)
   at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
   ...

Comments
Fixing JDK-8066220 made this not fail anymore, so I'm closing as a duplicate.
05-06-2015

Reproduced w/without -ot=false in either version.
29-05-2015

reproduced with jdk9-dev as well as jdk8u-dev as well.
29-05-2015