Which JavaScript (ECMAScript) version does Java's Rhino implementation implement (and what's the update policy?)
Asked Answered
W

4

8

Which version of the ECMAScript standard does Java's JavaScript engine Rhino support, how much work is going into fixing bugs and keeping the implementation in sync with the latest standardized version?

Woodpecker answered 15/7, 2011 at 0:26 Comment(0)
Z
3

Note: this question is far out of date and not useful.

The question was asked in 2011, and the JDK (as of late fall 2015) no longer ships with Rhino at all; the question referred to JDK 1.6, though JDK 1.7 was released a couple weeks afterwards.

Nashorn in JDK 1.8 60 supports ES 5.1, possibly with a couple of ES2015 extensions; it's hard to find an explicit compatibility claim from Oracle sources. Supposedly, JDK 9 Nashorn is supposed to "fully support" ES2015, but again I've been unsuccessful locating official sources.

edit — note that even Nashorn is going to be unsupported soon; JDK 13? 14? Something like that.

Below is the original answer.


Rhino in the shipped JDK (from Sun) is version 1.6R2. It's ancient. Supposedly it's going to be updated in the 1.7 release.

You can always download Rhino from Mozilla and use their integration facility. I've used the Sun one, and while it's dirt simple it leaves a lot to be desired.

edit — as to which ECMAScript standard it is, well, it's a Mozilla release so they've got their own modifications. However 1.6R2 is so old that it doesn't even have things like ".forEach()".

Zoometry answered 15/7, 2011 at 0:39 Comment(3)
I don't agree that the question is not useful. Though most everyone is moving to Java 7 or Java 8 or later, some people are doing so without updating their JS code to Nashorn, for whatever reason. In other words, they're using Rhino 1.7.7.1 in a Java 8 JVM. So the question is still relevant.Wideangle
@Wideangle well I appreciate the thought :) It's still a pretty old (2011) question however.Zoometry
Google Apigee JavaScript policies still use Rhino 1.7.7.1Heterochromosome
S
9

From what is written in the release notes of the versions of Rhino:

  • Rhino 1.5 - JavaScript 1.5/ ECMA Script 3.
  • Rhino 1.6R2 - bundled with Java 6 - JavaScript 1.5, ECMAScript for XML (E4X, part of JavaScript 1.6).
  • Rhino 1.6R6 - support for the remaining JavaScript 1.5 (strict).
  • Rhino 1.7R1 - JavaScript 1.7 new features: generators, iterators, array comprehensions, let expressions, and destructuring assignment.
  • Rhino 1.7R3 - bundled with Java 7 - JavaScript 1.7, partial JavaScript 1.8 and ECMAScript 5 except for strict mode.
  • Rhino 1.7R4 - JavaScript 1.7 is default, ES5 compliance fixes, JavaScript 1.8 generator expressions.
  • Rhino 1.7R5 -
  • Rhino 1.7.6 - Array.find(), @Deprecated annotation, JavaScript 1.8 String.
  • Rhino 1.7.7 - Initial support for ECMA Script 6, ES6 Math, Number and String class.
  • Rhino 1.7.7.1 - fixes

It seems that Rhino versions, Mozilla's JavaScript versions and ECMA Script versions are very different in scope.

Serdab answered 13/4, 2017 at 22:14 Comment(0)
Z
3

Note: this question is far out of date and not useful.

The question was asked in 2011, and the JDK (as of late fall 2015) no longer ships with Rhino at all; the question referred to JDK 1.6, though JDK 1.7 was released a couple weeks afterwards.

Nashorn in JDK 1.8 60 supports ES 5.1, possibly with a couple of ES2015 extensions; it's hard to find an explicit compatibility claim from Oracle sources. Supposedly, JDK 9 Nashorn is supposed to "fully support" ES2015, but again I've been unsuccessful locating official sources.

edit — note that even Nashorn is going to be unsupported soon; JDK 13? 14? Something like that.

Below is the original answer.


Rhino in the shipped JDK (from Sun) is version 1.6R2. It's ancient. Supposedly it's going to be updated in the 1.7 release.

You can always download Rhino from Mozilla and use their integration facility. I've used the Sun one, and while it's dirt simple it leaves a lot to be desired.

edit — as to which ECMAScript standard it is, well, it's a Mozilla release so they've got their own modifications. However 1.6R2 is so old that it doesn't even have things like ".forEach()".

Zoometry answered 15/7, 2011 at 0:39 Comment(3)
I don't agree that the question is not useful. Though most everyone is moving to Java 7 or Java 8 or later, some people are doing so without updating their JS code to Nashorn, for whatever reason. In other words, they're using Rhino 1.7.7.1 in a Java 8 JVM. So the question is still relevant.Wideangle
@Wideangle well I appreciate the thought :) It's still a pretty old (2011) question however.Zoometry
Google Apigee JavaScript policies still use Rhino 1.7.7.1Heterochromosome
U
0

About the compatilibity with ES2015/ES6 only, you have this webpage from the Mozilla's official repository :

https://mozilla.github.io/rhino/compat/engines.html

Us answered 29/5, 2020 at 12:52 Comment(0)
R
-1

From Java 12 documentation:

https://docs.oracle.com/en/java/javase/12/docs/api/jdk.scripting.nashorn/module-summary.html

Nashorn is 100% compliant with the ECMA-262 Standard, Edition 5.1

Roux answered 16/11, 2019 at 4:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.