JDK-8087136 : regression: apply on $EXEC fails with ClassCastException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u60,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-06-10
  • Updated: 2015-09-29
  • Resolved: 2015-06-11
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 8 JDK 9
8u60Fixed 9 b69Fixed
Related Reports
Relates :  
Description
File: test.js

# this test requires -scripting mode

$EXEC.apply(this, ["ls"]);
print($OUT);

-------
The above test fails with the following tip. But, if passes if this changeset is reverted.

$  hg tip
changeset:   1313:a24cb0bf79bc
tag:         tip
user:        mhaupt
date:        Tue Jun 09 09:27:02 2015 +0200
summary:     8080490: add $EXECV command to Nashorn scripting mode

$ jjs -scripting -J-Djava.ext.dirs=dist test.js 

Exception in thread "main" java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.runtime.Undefined to [Ljava.lang.Object;
	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$1$test.:program(test.js:3)
	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:640)
	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
	at jdk.nashorn.tools.Shell.apply(Shell.java:397)
	at jdk.nashorn.tools.Shell.runScripts(Shell.java:326)
	at jdk.nashorn.tools.Shell.run(Shell.java:172)
	at jdk.nashorn.tools.Shell.main(Shell.java:136)
	at jdk.nashorn.tools.Shell.main(Shell.java:112)


Comments
Sent webrev for review for jdk9-dev/nashorn http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-June/004738.html
11-06-2015