Oracle's implementation of JDK 7 is co-bundled with the Mozilla Rhino based 
( JavaScript engine which can be used in 
conjunction with javax.script (JSR-223) API.  

This directory and subdirectories contain the Rhino sources (version 1.7R3 
pre-release) with Oracle changes. Mozilla Rhino sources are licensed under 
Mozilla Public License Version 1.1. You may obtain a copy of this License at

Feature changes in JavaScript implementation:

Certain Rhino features are not included/changed in JDK mainly due to footprint 
and security reasons.

These features are:

1.JavaScript-to-bytecode compilation (also called "optimizer"). The optimizer
is disabled when security manager is present. When security manager is not
used, System property "rhino.opt.level" can be defined in the range [-1, 9].
By default, the value is set to -1 which means optimizer is disabled. 

2. Rhino's JavaAdapter has been overridden. JavaAdapter is the feature by which 
Java class can be extended by JavaScript and Java interfaces may be 
implemented by JavaScript. We have replaced Rhino's JavaAdapter with our own
implementation of JavaAdapter. In our implementation, only single Java 
interface may be implemented by a JavaScript object. For example, the following
works as expected.

       var v = new java.lang.Runnable() {
                    run: function() { print('hello'); }

In most cases, JavaAdapter is used to implement single interface with Java
anonymizer class-like syntax. The uses of JavaAdapter to extend a Java class 
or to implement multiple interfaces are very rare.

3.The Rhino command line tools (Rhino shell, debugger etc) are not bundled in 

List of changes to Rhino source code:

* Rhino classes removed

The following classes from Rhino are not included:
  * Rhino classes under org.mozilla.javascript.commonjs and sub-packages 
    are removed. These packages implement "CommonJS" module system for JS.

  * Rhino classes under and sub-packages 
    are removed. These packages include Rhino debugger, shell and few other 
    tools. We do not include Rhino command line and GUI tools. 

Rhino packages renamed

Rhino sources are in the package org.mozilla.javascript and sub-packages.
These have been renamed to and sub-packages.

  * Security - since Rhino is inside "rt.jar", untrusted applet code 
    can access Rhino classes directly -- without going through 
    javax.script API. This can be exploited to gain more access. By renaming 
    the package to sun.*, we prevent the same. [note that untrusted code can 
    not access sun.* packages by default security policy]

  * Dropping later version of Rhino with JDK 6 or above. There are existing 
   pre-JDK 6 Java apps that directly use Rhino. Such apps may want to use 
   the latest version of Rhino classes from their classpath (Rhino's js.jar 
   dropped in their classpath) rather than one in rt.jar. They may want to do 
   this because Mozilla may release another version of js.jar and users may 
   want to use that instead of the classes in JRE's rt.jar. 

Source content changes in Rhino classes:

  All source changes are marked with "JDK change:" style comments.
Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
Please Confirm