JDK-8144814 : Nashorn shebang must support all command-line parameters
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u66
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_8
  • CPU: x86
  • Submitted: 2015-11-13
  • Updated: 2015-12-07
  • Resolved: 2015-12-07
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
When writing a shebang (#!) at the beginning of a jjs script, one can pass parameters & arguments. However, currently only a few parameters are supported.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- create a script test.js with the content as given in the "Source code" field
- run the script on a Windows host with the command:
jjs test.js
- run the script again, with the command:
jjs --language=es6 test.js

(note: it has to be on a Windows host, because I used "notepad" in the script to test the "-scripting" parameter)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the script must fail on line 4 both times

ACTUAL -
with "jjs test.js", the script incorrectly fails on line 16
with "jjs --language=es6 test.js", the script incorrectly passes

these results prove that, currently, the only command-line parameter which is supported, is "-scripting". All other command-line parameters must be supported as well.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
#!jjs --no-syntax-extensions -strict --no-java -scripting --language=es6

// --no-syntax-extensions
var x = function(x) x*x;

// -strict
someVar = 2;

// --no-java
Java.type("java.lang.System");

// -scripting
$EXEC("notepad");

// --language=es6
var p = `a
b`;

---------- END SOURCE ----------