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

Nashorn should throw a SyntaxError when defining function that isn't standardied

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8, 11, 12, 13, 14
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      A DESCRIPTION OF THE PROBLEM :
      Nashorn dose not throw any exception as show as the below test case, while others engines throw a syntax error, such as v8, spiderMonkey, javascriptCore and chakra.
      Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unnamed_function_statement

      # Testcase:
      function () {
      print("hello nashorn!");
      return true;
      }

      #Command:
      ./nashorn/jdk-12.0.1/bin/jjs testcase.js


        Attachments

          Activity

            People

            • Assignee:
              hannesw Hannes Wallnoefer
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: