BT

Oracle Proposes Deprecating Java's JavaScript Engine Nashorn

| by Kesha Williams Follow 4 Followers on Jun 14, 2018. Estimated reading time: 2 minutes |

Oracle announced via JDK Enhancement Proposal (JEP) 355 that the Nashorn JavaScript Engine may soon be deprecated and eventually removed from all future Java Development Kits (JDKs). With the rapid pace at which the ECMAScript language constructs have changed, Oracle finds the Nashorn JavaScript Engine challenging to maintain. 

Nashorn was originally introduced incorporated into JDK 8 as a replacement for the Rhino scripting engine. When Nashorn was released, it was a complete implementation of the ECMAScript-262 5.1 standard that enhanced compatibility between Java and JavaScript. There were recent additions that included new ECMAScript 6 (ES6) features. With Nashorn, developers have the ability to invoke Java code from JavaScript and also invoke JavaScript functions from within Java code. Nashorn can be embedded as an interpreter in Java applications and provides the capability to run JavaScript from the command-line using Nashorn's command-line tool, jjs. When evaluating JavaScript code from Java, Nashorn implements the javax.script API. Oracle states the deprecation of Nashorn will not affect the javax.script API.

By removing Nashorn, some applications may no longer run because of an expectation of JavaScript’s presence. 

The specific JDK modules to be deprecated include:

  • jdk.scripting.nashorn - contains the jdk.nashorn.api.scripting and jdk.nashorn.api.tree packages
  • jdk.scripting.nashorn.shell - contains the jjs tool
  • jdk.dynalink - contains the Dynalink support library

Thomas Wuerthinger, senior research director at Oracle Labs, stated that GraalVM is a good alternative with more performance and better ECMAScript compatibility than Nashorn. Although GraalVM is not available in production yet, Wuerthinger assures the development community that the JavaScript implementation based on GraalVM will be production-ready on all relevant platforms before Nashorn is deprecated. 

A separate JEP will be filed for the actual removal of the types and modules in a future JDK feature release. 

The overall feedback from the development community has been that of concern, especially from those that use Nashorn heavily for business logic. Oracle sounds willing to revert JEP 335 if there is enough developer feedback.

An alternative is for a set of credible developers to express a clear desire to maintain Nashorn going forward. If that happens before this JEP is integrated then this JEP can be withdrawn. If that happens after this JEP is integrated, but before Nashorn is removed, then a follow-on JEP can revert the deprecation.

Per Oracle, Nashorn usage is very difficult to track, so ideally any pushback will inform whether JEP 335 goes through or not. For developers using Nashorn, feedback should be provided to Oracle as this will give better insight into actual Nashorn usage. 

Readers can also keep up-to-date with all Java-related news by visiting the InfoQ Java homepage.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

In other news by Will Hartung

Oracle has decided that for Java 12, only "Object" and "String" will be supported in the JDK library. It's too much work to support anything else, and, heck, who doesn't want to download Collection classes anyway? They're also going to deprecate the Hotspot compiler as the Intel CPUs have too many instructions to keep up with, and they don't work like the JVM byte code at ALL!

Re: In other news by John Ulric

Relax! The removal will certainly happen gradually sometime between 11:59pm and 12:01am on the scheduled day, giving developers plenty of time to adapt …

Re: In other news by Kesha Williams

I should write this up as a real news article on the next April Fools' day. :-)

If GraalVM ... by Florin Jurcovici

... becomes available, stable and well integrated before Nashorn is deprecated, I don't think it's such a big issue.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT