Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144814

Nashorn shebang must support all command-line parameters

    Details

      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 ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mhaupt Michael Haupt
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: