JEP 335: Deprecate the Nashorn JavaScript Engine
Owner | Jim Laskey |
Created | 2018/05/08 14:23 |
Updated | 2018/06/06 20:28 |
Type | Feature |
Status | Candidate |
Component | core-libs / jdk.nashorn |
Scope | JDK |
Discussion | jdk dash dev at openjdk dot java dot net |
Effort | S |
Priority | 3 |
Reviewed by | Alex Buckley, Brian Goetz, Dalibor Topic |
Issue | 8202786 |
Summary
Deprecate the Nashorn JavaScript script engine and APIs, and the jjs
tool.
Motivation
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.
Non-Goals
This deprecation does not affect, in any way, the javax.script
API.
Description
Three JDK modules will be
terminally deprecated, that is, annotated with @Deprecated(forRemoval=true)
:
-
jdk.scripting.nashorn
-- contains thejdk.nashorn.api.scripting
andjdk.nashorn.api.tree
packages. -
jdk.scripting.nashorn.shell
-- contains thejjs
tool. Runningjjs
will display a warning:Warning: The jjs tool is planned to be removed from a future JDK release.
-
jdk.dynalink
-- contains the Dynalink support library.
A separate JEP will be filed for the actual removal of the types and modules in a future JDK feature release.
Alternatives
GraalJS using Oracle Labs' Truffle technology may soon be publicly available as a Java module. It is understood that GraalJS provides most of the same functionality as Nashorn along with better performance.
Risks and Assumptions
The risk of removing Nashorn is that certain applications will no longer run because of the expectation that JavaScript is present. The breadth of Nashorn usage has not been easy to track. It is hoped that feedback for this JEP might provide better insight into actual Nashorn usage.