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

Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • None
    • core-libs
    • None
    • source, binary, behavioral
    • minimal
    • Hide
      * Third party code using nashorn APIs will get deprecation compilation warnings from javac. Users may have to add @SuppressWarnings annotation to their code to manage these warnings.

      * jjs shell tool and nashorn engine both will print deprecation warning message at runtime - but this can be suppressed using --no-deprecation-warning option.
      Show
      * Third party code using nashorn APIs will get deprecation compilation warnings from javac. Users may have to add @SuppressWarnings annotation to their code to manage these warnings. * jjs shell tool and nashorn engine both will print deprecation warning message at runtime - but this can be suppressed using --no-deprecation-warning option.
    • Java API, add/remove/modify command line option
    • JDK

      Summary

      Nashorn script engine along with its exported APIs and nashorn shell command line tool "jjs" are deprecated for removal.

      Problem

      The Nashorn JavaScript engine was first incorporated into JDK 8 via JEP 174 as a replacement for the Rhino scripting engine. When it was released, it was a complete implementation of the ECMAScript-262 5.1 standard.

      With the rapid pace at which ECMAScript language constructs, along with APIs, are adapted and modified, we have found Nashorn challenging to maintain.

      See also: http://openjdk.java.net/jeps/335

      Solution

      Deprecate the Nashorn JavaScript script engine and APIs, and the jjs tool, with the intent to remove them in a future release.

      Specification

      Deprecated annotation:

      Nashorn module 'jdk.scripting.nashorn' exports two API packages:

      jdk.nashorn.api.scripting;

      jdk.nashorn.api.tree;

      @Deprecated(forRemoval=true) annotation will be added to the module-info.java file for jdk.scripting.nashorn module and its exported packages mentioned above as well as all the public Java types of those exported API packages.

      Both jjs shell and nashorn programmatic use via javax.script API will result in a warning about deprecation being printed at the standard error.

      "Warning: The jjs tool is planned to be removed from a future JDK release"

      "Warning: Nashorn engine is planned to be removed from a future JDK release"

      To minimize compatibility issues for the third-party tools, libraries which may be depend on nashorn engine/shell output, the warning message can be suppressed using a new command line option.

      The specification for the new command line option is as follows:

      --no-deprecation-warning (Do not show nashorn deprecation warning.) param: [true|false] default: false

        1. webrev.00.zip
          2.18 MB
        2. webrev.01.zip
          2.14 MB

            sundar Sundararajan Athijegannathan
            jlaskey Jim Laskey
            Hannes Wallnoefer, Jim Laskey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: