8007915: Nashorn IR, codegen, parser packages and Context instance should be inaccessible to user code
authorsundar
Mon, 11 Feb 2013 21:26:06 +0530
changeset 16226 0e4f37e6cc40
parent 16225 81d58c2b9fcf
child 16227 1bafb74d17b2
8007915: Nashorn IR, codegen, parser packages and Context instance should be inaccessible to user code Reviewed-by: lagergren, jlaskey, attila
nashorn/bin/jjssecure
nashorn/bin/jjssecure.bat
nashorn/bin/nashornsecure
nashorn/bin/nashornsecure.bat
nashorn/make/Makefile
nashorn/make/build.xml
nashorn/make/java.security.override
nashorn/make/project.properties
nashorn/src/jdk/nashorn/internal/codegen/Attr.java
nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
nashorn/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java
nashorn/src/jdk/nashorn/internal/ir/Symbol.java
nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java
nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java
nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java
nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java
nashorn/src/jdk/nashorn/internal/objects/Global.java
nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java
nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java
nashorn/src/jdk/nashorn/internal/objects/NativeError.java
nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java
nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java
nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java
nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java
nashorn/src/jdk/nashorn/internal/objects/NativeJava.java
nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java
nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java
nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java
nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java
nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java
nashorn/src/jdk/nashorn/internal/objects/NativeString.java
nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java
nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java
nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java
nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java
nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java
nashorn/src/jdk/nashorn/internal/parser/Lexer.java
nashorn/src/jdk/nashorn/internal/parser/RegExp.java
nashorn/src/jdk/nashorn/internal/parser/RegExpScanner.java
nashorn/src/jdk/nashorn/internal/runtime/ArgumentSetter.java
nashorn/src/jdk/nashorn/internal/runtime/BitVector.java
nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
nashorn/src/jdk/nashorn/internal/runtime/Context.java
nashorn/src/jdk/nashorn/internal/runtime/Debug.java
nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java
nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java
nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java
nashorn/src/jdk/nashorn/internal/runtime/Logging.java
nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java
nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
nashorn/src/jdk/nashorn/internal/runtime/RegExp.java
nashorn/src/jdk/nashorn/internal/runtime/RegExpScanner.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java
nashorn/src/jdk/nashorn/internal/runtime/StructureLoader.java
nashorn/src/jdk/nashorn/internal/runtime/WithObject.java
nashorn/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java
nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java
nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java
nashorn/src/jdk/nashorn/internal/runtime/resources/parser.js
nashorn/test/script/sandbox/nashorninternals.js
nashorn/test/script/trusted/JDK-8006529.js
nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java
nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java
nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
nashorn/test/src/jdk/nashorn/internal/access/BooleanAccessTest.java
nashorn/test/src/jdk/nashorn/internal/access/MethodAccessTest.java
nashorn/test/src/jdk/nashorn/internal/access/NumberAccessTest.java
nashorn/test/src/jdk/nashorn/internal/access/NumberBoxingTest.java
nashorn/test/src/jdk/nashorn/internal/access/ObjectAccessTest.java
nashorn/test/src/jdk/nashorn/internal/access/Person.java
nashorn/test/src/jdk/nashorn/internal/access/SharedObject.java
nashorn/test/src/jdk/nashorn/internal/access/StringAccessTest.java
nashorn/test/src/jdk/nashorn/internal/codegen/CompilerAccess.java
--- a/nashorn/bin/jjssecure	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/bin/jjssecure	Mon Feb 11 21:26:06 2013 +0530
@@ -26,4 +26,4 @@
 
 [ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1;
 
-$JAVA_HOME/bin/java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=true -Dnashorn.home=`dirname $0`/.. -Djava.security.manager jdk.nashorn.tools.Shell $*
+$JAVA_HOME/bin/java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=`dirname $0`/../make/java.security.override -Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=true -Dnashorn.home=`dirname $0`/.. -Djava.security.manager jdk.nashorn.tools.Shell $*
--- a/nashorn/bin/jjssecure.bat	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/bin/jjssecure.bat	Mon Feb 11 21:26:06 2013 +0530
@@ -24,4 +24,4 @@
 rem
 @echo off
 
-java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.home=%~dp0\.. -Djava.security.manager jdk.nashorn.tools.Shell
+java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=%~dp0\..\make\java.security.override -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.home=%~dp0\.. -Djava.security.manager jdk.nashorn.tools.Shell
--- a/nashorn/bin/nashornsecure	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/bin/nashornsecure	Mon Feb 11 21:26:06 2013 +0530
@@ -26,4 +26,4 @@
 
 [ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1;
 
-$JAVA_HOME/bin/jrunscript -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $*
+$JAVA_HOME/bin/jrunscript -J-Djava.security.properties=`dirname $0`/../make/java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $*
--- a/nashorn/bin/nashornsecure.bat	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/bin/nashornsecure.bat	Mon Feb 11 21:26:06 2013 +0530
@@ -24,4 +24,4 @@
 rem
 @echo off
 
-jrunscript -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn
+jrunscript -J-Djava.security.properties=%~dp0\..\make\java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn
--- a/nashorn/make/Makefile	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/make/Makefile	Mon Feb 11 21:26:06 2013 +0530
@@ -181,7 +181,7 @@
 endif
 
 # Default target and expected 'do everything' target
-all: test docs
+all: test
 
 # Standard make clobber target
 clobber: clean
--- a/nashorn/make/build.xml	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/make/build.xml	Mon Feb 11 21:26:06 2013 +0530
@@ -201,12 +201,12 @@
 
     <!-- tests that check nashorn internals and internal API -->
     <jar jarfile="${nashorn.internal.tests.jar}">
-      <fileset dir="${build.test.classes.dir}" excludes="**/api/scripting/*"/>
+      <fileset dir="${build.test.classes.dir}" excludes="**/api/*"/>
     </jar>
 
     <!-- tests that check nashorn script engine (jsr-223) API -->
     <jar jarfile="${nashorn.api.tests.jar}">
-      <fileset dir="${build.test.classes.dir}" includes="**/api/scripting/*"/>
+      <fileset dir="${build.test.classes.dir}" includes="**/api/*"/>
     </jar>
 
   </target>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/make/java.security.override	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,14 @@
+# We would like to avoid references from anywhere outside nashorn
+# to codegen, IR and parser packages, in particular script generated classes.
+# We ensure that by overriding "package.access" security property.
+
+# The following "package.access" value was copied from  default java.security 
+# of jre/lib/security and appended with nashorn IR, Codegen and Parser packages.
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,jdk.internal.,jdk.nashorn.internal.ir., jdk.nashorn.internal.codegen., jdk.nashorn.internal.parser.
--- a/nashorn/make/project.properties	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/make/project.properties	Mon Feb 11 21:26:06 2013 +0530
@@ -225,7 +225,7 @@
 #-XX:+HeapDumpOnOutOfMemoryError -XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M  
 run.test.jvmargs.octane=-Xms${run.test.xms} ${run.test.jvmargs}
 
-run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
+run.test.jvmsecurityargs=-Xverify:all -Djava.security.properties=${basedir}/make/java.security.override -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
 
 # path of rhino.jar for benchmarks
 rhino.jar=
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Mon Feb 11 21:26:06 2013 +0530
@@ -415,6 +415,7 @@
             symbol.setIsScope();
         }
 
+        assert symbol != null;
         if(symbol.isGlobal()) {
             getCurrentFunctionNode().setUsesGlobalSymbol();
         } else if(symbol.isScope()) {
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon Feb 11 21:26:06 2013 +0530
@@ -3183,6 +3183,7 @@
                 @Override
                 public Node enter(final IdentNode node) {
                     final Symbol symbol = node.getSymbol();
+                    assert symbol != null;
                     if (symbol.isScope()) {
                         if (symbol.isFastScope(currentFunction)) {
                             storeFastScopeVar(node.getType(), symbol, CALLSITE_SCOPE | getCallSiteFlags());
@@ -3190,7 +3191,6 @@
                             method.dynamicSet(node.getType(), node.getName(), CALLSITE_SCOPE | getCallSiteFlags());
                         }
                     } else {
-                        assert symbol != null;
                         method.store(symbol);
                     }
                     return null;
--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Mon Feb 11 21:26:06 2013 +0530
@@ -108,6 +108,9 @@
     /** Name of the objects package */
     public static final String OBJECTS_PACKAGE = "jdk/nashorn/internal/objects";
 
+    /** Name of the runtime package */
+    public static final String RUNTIME_PACKAGE = "jdk/nashorn/internal/runtime";
+
     /** Name of the Global object, cannot be referred to as .class, @see CodeGenerator */
     public static final String GLOBAL_OBJECT = OBJECTS_PACKAGE + '/' + "Global";
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/RuntimeCallSite.java	Mon Feb 11 21:26:06 2013 +0530
@@ -42,6 +42,7 @@
 import jdk.nashorn.internal.ir.RuntimeNode;
 import jdk.nashorn.internal.ir.RuntimeNode.Request;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.Lookup;
 import jdk.nashorn.internal.runtime.linker.MethodHandleFactory;
 
@@ -55,8 +56,8 @@
  * {@code Object a === int b} is a good idea to specialize to {@code ((Integer)a).intValue() == b}
  * surrounded by catch blocks that will try less narrow specializations
  */
-public class RuntimeCallSite extends MutableCallSite {
-    static final Call BOOTSTRAP = staticCallNoLookup(RuntimeCallSite.class, "bootstrap", CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class);
+public final class RuntimeCallSite extends MutableCallSite {
+    static final Call BOOTSTRAP = staticCallNoLookup(Bootstrap.class, "runtimeBootstrap", CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class);
 
     private static final MethodHandle NEXT = findOwnMH("next",  MethodHandle.class);
 
@@ -200,26 +201,13 @@
      * @param type method type for call site
      * @param name name of runtime call
      */
-    RuntimeCallSite(final MethodType type, final String name) {
+    public RuntimeCallSite(final MethodType type, final String name) {
         super(type);
         this.name    = name;
         this.request = Request.valueOf(name.substring(0, name.indexOf(SpecializedRuntimeNode.REQUEST_SEPARATOR)));
         setTarget(makeMethod(name));
     }
 
-    /**
-     * Bootstrapper for a specialized Runtime call
-     *
-     * @param lookup       lookup
-     * @param initialName  initial name for callsite
-     * @param type         method type for call site
-     *
-     * @return callsite for a runtime node
-     */
-    public static CallSite bootstrap(final MethodHandles.Lookup lookup, final String initialName, final MethodType type) {
-        return new RuntimeCallSite(type, initialName);
-    }
-
     private String nextName(final String requestName) {
         if (requestName.equals(request.toString())) {
             return null;
--- a/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Mon Feb 11 21:26:06 2013 +0530
@@ -660,7 +660,7 @@
         if (TRACE_SYMBOLS != null && (TRACE_SYMBOLS.isEmpty() || TRACE_SYMBOLS.contains(name))) {
             Context.err("SYMBOL: '" + name + "' " + desc);
             if (TRACE_SYMBOLS_STACKTRACE != null && (TRACE_SYMBOLS_STACKTRACE.isEmpty() || TRACE_SYMBOLS_STACKTRACE.contains(name))) {
-                new Throwable().printStackTrace(Context.getContext().getErr());
+                new Throwable().printStackTrace(Context.getCurrentErr());
             }
         }
     }
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Mon Feb 11 21:26:06 2013 +0530
@@ -80,19 +80,13 @@
     /**
      * Returns AST as JSON compatible string.
      *
+     * @param context nashorn context to use
      * @param code code to be parsed
      * @param name name of the code source (used for location)
      * @param includeLoc tells whether to include location information for nodes or not
      * @return JSON string representation of AST of the supplied code
      */
-    public static String parse(final String code, final String name, final boolean includeLoc) {
-        final Context      context    = AccessController.doPrivileged(
-                new PrivilegedAction<Context>() {
-                    @Override
-                    public Context run() {
-                        return Context.getContext();
-                    }
-                });
+    public static String parse(final Context context, final String code, final String name, final boolean includeLoc) {
         final Compiler     compiler   = Compiler.compiler(new Source(name, code), context, new Context.ThrowErrorManager(), context._strict);
         final Parser       parser     = new Parser(compiler, context._strict);
         final JSONWriter   jsonWriter = new JSONWriter(includeLoc);
--- a/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Mon Feb 11 21:26:06 2013 +0530
@@ -138,7 +138,7 @@
 
     @Override
     public PropertyDescriptor fillFrom(final ScriptObject sobj) {
-        final boolean strict = getContext()._strict;
+        final boolean strict = isStrictContext();
 
         if (sobj.has(CONFIGURABLE)) {
             this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
--- a/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Mon Feb 11 21:26:06 2013 +0530
@@ -136,7 +136,7 @@
 
     @Override
     public PropertyDescriptor fillFrom(final ScriptObject sobj) {
-        final boolean strict = getContext()._strict;
+        final boolean strict = isStrictContext();
         if (sobj.has(CONFIGURABLE)) {
             this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
         } else {
--- a/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Mon Feb 11 21:26:06 2013 +0530
@@ -124,7 +124,7 @@
 
     @Override
     public PropertyDescriptor fillFrom(final ScriptObject sobj) {
-        final boolean strict = getContext()._strict;
+        final boolean strict = isStrictContext();
         if (sobj.has(CONFIGURABLE)) {
             this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
         } else {
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Mon Feb 11 21:26:06 2013 +0530
@@ -347,10 +347,13 @@
     private static final MethodHandle LOAD    = findOwnMH("load",    Object.class, Object.class, Object.class);
     private static final MethodHandle EXIT    = findOwnMH("exit",    Object.class, Object.class, Object.class);
 
+    private final Context context;
+
     /**
      * Constructor
      */
-    public Global() {
+    public Global(final Context context) {
+        this.context = context;
         this.setIsScope();
         /*
          * Duplicate global's map and use it. This way the initial Map filled
@@ -359,19 +362,23 @@
          */
         this.setMap(getMap().duplicate());
 
-        final int cacheSize = getContext()._class_cache_size;
+        final int cacheSize = context._class_cache_size;
         if (cacheSize > 0) {
             classCache = new ClassCache(cacheSize);
         }
     }
 
     /**
-     * Script access to unique context specific Global instance
+     * Script access to "current" Global instance
      *
      * @return the global singleton
      */
     public static Global instance() {
-        return (Global)Context.getGlobal();
+        ScriptObject global = Context.getGlobal();
+        if (! (global instanceof Global)) {
+            throw new IllegalStateException("no current global instance");
+        }
+        return (Global)global;
     }
 
     /**
@@ -380,7 +387,7 @@
      * @return the context
      */
     static Context getThisContext() {
-        return instance().getContext();
+        return instance().context;
     }
 
     /**
@@ -569,7 +576,7 @@
     public PropertyDescriptor newAccessorDescriptor(final Object get, final Object set, final boolean configurable, final boolean enumerable) {
         final AccessorPropertyDescriptor desc = new AccessorPropertyDescriptor(configurable, enumerable, get == null ? UNDEFINED : get, set == null ? UNDEFINED : set);
 
-        final boolean strict = getContext()._strict;
+        final boolean strict = context._strict;
 
         if (get == null) {
             desc.delete(PropertyDescriptor.GET, strict);
@@ -658,7 +665,7 @@
         final Global global = Global.instance();
         final ScriptObject scope = (self instanceof ScriptObject) ? (ScriptObject)self : global;
 
-        return global.getContext().eval(scope, str.toString(), callThis, location, Boolean.TRUE.equals(strict));
+        return global.context.eval(scope, str.toString(), callThis, location, Boolean.TRUE.equals(strict));
     }
 
     /**
@@ -698,7 +705,7 @@
     public static Object load(final Object self, final Object source) throws IOException {
         final Global global = Global.instance();
         final ScriptObject scope = (self instanceof ScriptObject) ? (ScriptObject)self : global;
-        return global.getContext().load(scope, source);
+        return global.context.load(scope, source);
     }
 
     /**
@@ -1344,7 +1351,7 @@
         this.decodeURIComponent = ScriptFunctionImpl.makeFunction("decodeURIComponent", GlobalFunctions.DECODE_URICOMPONENT);
         this.escape             = ScriptFunctionImpl.makeFunction("escape",     GlobalFunctions.ESCAPE);
         this.unescape           = ScriptFunctionImpl.makeFunction("unescape",   GlobalFunctions.UNESCAPE);
-        this.print              = ScriptFunctionImpl.makeFunction("print",      getContext()._print_no_newline ? PRINT : PRINTLN);
+        this.print              = ScriptFunctionImpl.makeFunction("print",      context._print_no_newline ? PRINT : PRINTLN);
         this.load               = ScriptFunctionImpl.makeFunction("load",       LOAD);
         this.exit               = ScriptFunctionImpl.makeFunction("exit",       EXIT);
         this.quit               = ScriptFunctionImpl.makeFunction("quit",       EXIT);
@@ -1387,7 +1394,7 @@
 
         initTypedArray();
 
-        if (getContext()._scripting) {
+        if (context._scripting) {
             initScripting();
         }
 
@@ -1403,11 +1410,11 @@
         this.__LINE__ = 0.0;
 
         // expose script (command line) arguments as "arguments" property of global
-        final List<String> arguments = getContext().getOptions().getArguments();
+        final List<String> arguments = context.getOptions().getArguments();
         final Object argsObj = wrapAsObject(arguments.toArray());
 
         addOwnProperty("arguments", Attribute.NOT_ENUMERABLE, argsObj);
-        if (getContext()._scripting) {
+        if (context._scripting) {
             // synonym for "arguments" in scripting mode
             addOwnProperty("$ARG", Attribute.NOT_ENUMERABLE, argsObj);
         }
@@ -1485,7 +1492,7 @@
         addOwnProperty("echo", Attribute.NOT_ENUMERABLE, value);
 
         // Nashorn extension: global.$OPTIONS (scripting-mode-only)
-        value = new OptionsObject(this.getContext());
+        value = new OptionsObject(context);
         addOwnProperty("$OPTIONS", Attribute.NOT_ENUMERABLE, value);
 
         // Nashorn extension: global.$ENV (scripting-mode-only)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Mon Feb 11 21:26:06 2013 +0530
@@ -118,7 +118,7 @@
             if (value == ScriptRuntime.EMPTY) {
                 arrayData = arrayData.delete(index);
             } else {
-                arrayData = arrayData.set(index, value, getContext()._strict);
+                arrayData = arrayData.set(index, value, isStrictContext());
             }
         }
 
@@ -644,7 +644,7 @@
             if (bulkable(sobj)) {
                 final NativeArray nativeArray = (NativeArray)sobj;
                 if (nativeArray.getArray().length() + args.length <= JSType.MAX_UINT) {
-                    final ArrayData newData = nativeArray.getArray().push(nativeArray.getContext()._strict, args);
+                    final ArrayData newData = nativeArray.getArray().push(nativeArray.isStrictContext(), args);
                     nativeArray.setArray(newData);
                     return newData.length();
                 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
 @ScriptClass("ArrayBuffer")
-class NativeArrayBuffer extends ScriptObject {
+final class NativeArrayBuffer extends ScriptObject {
     private final byte[] buffer;
 
     @Constructor(arity = 1)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Mon Feb 11 21:26:06 2013 +0530
@@ -46,7 +46,7 @@
  *
  */
 @ScriptClass("Debug")
-public class NativeDebug extends ScriptObject {
+public final class NativeDebug extends ScriptObject {
     NativeDebug() {
         this.setProto(Global.objectPrototype());
     }
@@ -64,6 +64,10 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
     public static Object getContext(final Object self) {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission("getNashornContext"));
+        }
         return Global.getThisContext();
     }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -47,7 +47,7 @@
  * ECMA 15.11 Error Objects
  */
 @ScriptClass("Error")
-public class NativeError extends ScriptObject {
+public final class NativeError extends ScriptObject {
 
     static final MethodHandle GET_COLUMNNUMBER = findOwnMH("getColumnNumber", Object.class, Object.class);
     static final MethodHandle SET_COLUMNNUMBER = findOwnMH("setColumnNumber", Object.class, Object.class, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  *
  */
 @ScriptClass("Error")
-public class NativeEvalError extends ScriptObject {
+public final class NativeEvalError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,7 +37,7 @@
  * Float32 array for the TypedArray extension
  */
 @ScriptClass("Float32Array")
-public class NativeFloat32Array extends ArrayBufferView {
+public final class NativeFloat32Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 4;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,7 +37,7 @@
  * Float64 array for the TypedArray extension
  */
 @ScriptClass("Float64Array")
-public class NativeFloat64Array extends ArrayBufferView {
+public final class NativeFloat64Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 8;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Mon Feb 11 21:26:06 2013 +0530
@@ -168,7 +168,7 @@
             arguments = ScriptRuntime.EMPTY_ARRAY;
         }
 
-        return ((ScriptFunction)self).makeBoundFunction(thiz, arguments);
+        return ((ScriptFunctionImpl)self).makeBoundFunction(thiz, arguments);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Int16 array for the TypedArray extension
  */
 @ScriptClass("Int16Array")
-public class NativeInt16Array extends ArrayBufferView {
+public final class NativeInt16Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 2;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Int32 array for the TypedArray extension
  */
 @ScriptClass("Int32Array")
-public class NativeInt32Array extends ArrayBufferView {
+public final class NativeInt32Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 4;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Int8Array for the TypedArray extension
  */
 @ScriptClass("Int8Array")
-public class NativeInt8Array extends ArrayBufferView {
+public final class NativeInt8Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 1;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Mon Feb 11 21:26:06 2013 +0530
@@ -617,7 +617,7 @@
         case "getMethod":
             final FindProperty find = adaptee.findProperty(__call__, true);
             if (find != null) {
-                final ScriptFunction func = (ScriptFunction)getObjectValue(find);
+                final ScriptFunctionImpl func = (ScriptFunctionImpl)getObjectValue(find);
                 // TODO: It's a shame we need to produce a function bound to this and name, when we'd only need it bound
                 // to name. Probably not a big deal, but if we can ever make it leaner, it'd be nice.
                 return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class,
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Mon Feb 11 21:26:06 2013 +0530
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.objects;
 
-import static jdk.nashorn.internal.runtime.ECMAErrors.syntaxError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
@@ -36,25 +35,15 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import jdk.nashorn.internal.ir.LiteralNode;
-import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
-import jdk.nashorn.internal.ir.Node;
-import jdk.nashorn.internal.ir.ObjectNode;
-import jdk.nashorn.internal.ir.PropertyNode;
-import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.parser.JSONParser;
-import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.ConsString;
-import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.JSONFunctions;
 import jdk.nashorn.internal.runtime.JSType;
-import jdk.nashorn.internal.runtime.ParserException;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
-import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
@@ -68,8 +57,6 @@
     private static final InvokeByName TO_JSON = new InvokeByName("toJSON", ScriptObject.class, Object.class, Object.class);
     private static final MethodHandle REPLACER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
             ScriptFunction.class, ScriptObject.class, Object.class, Object.class);
-    private static final MethodHandle REVIVER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
-            ScriptFunction.class, ScriptObject.class, String.class, Object.class);
 
 
     NativeJSON() {
@@ -87,27 +74,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
     public static Object parse(final Object self, final Object text, final Object reviver) {
-        final String     str     = JSType.toString(text);
-        final Context    context = Global.getThisContext();
-        final JSONParser parser  = new JSONParser(
-                new Source("<json>", str),
-                new Context.ThrowErrorManager(),
-                (context != null) ?
-                    context._strict :
-                    false);
-
-        Node node;
-
-        try {
-            node = parser.parse();
-        } catch (final ParserException e) {
-            syntaxError(e, "invalid.json", e.getMessage());
-            return UNDEFINED;
-        }
-
-        final Object unfiltered = convertNode(node);
-
-        return applyReviver(unfiltered, reviver);
+        return JSONFunctions.parse(text, reviver);
     }
 
     /**
@@ -198,136 +165,6 @@
 
     // -- Internals only below this point
 
-    // parse helpers
-
-    // apply 'reviver' function if available
-    private static Object applyReviver(final Object unfiltered, final Object reviver) {
-        if (reviver instanceof ScriptFunction) {
-            final ScriptObject root = Global.newEmptyInstance();
-            root.set("", unfiltered, Global.isStrict());
-            return walk(root, "", (ScriptFunction)reviver);
-        }
-        return unfiltered;
-    }
-
-    // This is the abstract "Walk" operation from the spec.
-    private static Object walk(final ScriptObject holder, final Object name, final ScriptFunction reviver) {
-        final Object val = holder.get(name);
-        if (val == UNDEFINED) {
-            return val;
-        } else if (val instanceof ScriptObject) {
-            final ScriptObject     valueObj = (ScriptObject)val;
-            final boolean          strict   = Global.isStrict();
-            final Iterator<String> iter     = valueObj.propertyIterator();
-
-            while (iter.hasNext()) {
-                final String key        = iter.next();
-                final Object newElement = walk(valueObj, key, reviver);
-
-                if (newElement == UNDEFINED) {
-                    valueObj.delete(key, strict);
-                } else {
-                    valueObj.set(key, newElement, strict);
-                }
-            }
-
-            return valueObj;
-        } else if (isArray(val)) {
-            final NativeArray      valueArray = (NativeArray)val;
-            final boolean          strict     = Global.isStrict();
-            final Iterator<String> iter       = valueArray.propertyIterator();
-
-            while (iter.hasNext()) {
-                final String key        = iter.next();
-                final Object newElement = walk(valueArray, valueArray.get(key), reviver);
-
-                if (newElement == UNDEFINED) {
-                    valueArray.delete(key, strict);
-                } else {
-                    valueArray.set(key, newElement, strict);
-                }
-            }
-            return valueArray;
-        } else {
-            try {
-                // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
-                return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
-            } catch(Error|RuntimeException t) {
-                throw t;
-            } catch(final Throwable t) {
-                throw new RuntimeException(t);
-            }
-        }
-    }
-
-    // Converts IR node to runtime value
-    private static Object convertNode(final Node node) {
-
-       if (node instanceof LiteralNode) {
-            // check for array literal
-            if (node.tokenType() == TokenType.ARRAY) {
-                assert node instanceof ArrayLiteralNode;
-                final Node[] elements = ((ArrayLiteralNode)node).getValue();
-
-                // NOTE: We cannot use LiteralNode.isNumericArray() here as that
-                // method uses symbols of element nodes. Since we don't do lower
-                // pass, there won't be any symbols!
-                if (isNumericArray(elements)) {
-                    final double[] values = new double[elements.length];
-                    int   index = 0;
-
-                    for (final Node elem : elements) {
-                        values[index++] = JSType.toNumber(convertNode(elem));
-                    }
-                    return Global.allocate(values);
-                }
-
-                final Object[] values = new Object[elements.length];
-                int   index = 0;
-
-                for (final Node elem : elements) {
-                    values[index++] = convertNode(elem);
-                }
-
-                return Global.allocate(values);
-            }
-
-            return ((LiteralNode<?>)node).getValue();
-
-        } else if (node instanceof ObjectNode) {
-            final ObjectNode   objNode  = (ObjectNode) node;
-            final ScriptObject object   = Global.newEmptyInstance();
-            final boolean      strict   = Global.isStrict();
-            final List<Node>   elements = objNode.getElements();
-
-            for (final Node elem : elements) {
-                final PropertyNode pNode     = (PropertyNode) elem;
-                final Node         valueNode = pNode.getValue();
-
-                object.set(pNode.getKeyName(), convertNode(valueNode), strict);
-            }
-
-            return object;
-        } else if (node instanceof UnaryNode) {
-            // UnaryNode used only to represent negative number JSON value
-            final UnaryNode unaryNode = (UnaryNode)node;
-            return -((LiteralNode<?>)unaryNode.rhs()).getNumber();
-        } else {
-            return null;
-        }
-    }
-
-    // does the given IR node represent a numeric array?
-    private static boolean isNumericArray(final Node[] values) {
-        for (final Node node : values) {
-            if (node instanceof LiteralNode && ((LiteralNode<?>)node).getValue() instanceof Number) {
-                continue;
-            }
-            return false;
-        }
-        return true;
-    }
-
     // stringify helpers.
 
     private static class StringifyState {
@@ -380,9 +217,9 @@
         }
 
         if (value instanceof String) {
-            return JSONParser.quote((String)value);
+            return JSONFunctions.quote((String)value);
         } else if (value instanceof ConsString) {
-            return JSONParser.quote(value.toString());
+            return JSONFunctions.quote(value.toString());
         }
 
         if (value instanceof Number) {
@@ -421,7 +258,7 @@
             if (strP != UNDEFINED) {
                 final StringBuilder member = new StringBuilder();
 
-                member.append(JSONParser.quote(p.toString())).append(':');
+                member.append(JSONFunctions.quote(p.toString())).append(':');
                 if (!state.gap.isEmpty()) {
                     member.append(' ');
                 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Mon Feb 11 21:26:06 2013 +0530
@@ -47,7 +47,7 @@
  * arrays, and so forth.
  */
 @ScriptClass("Java")
-public class NativeJava {
+public final class NativeJava {
 
     private NativeJava() {
     }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Mon Feb 11 21:26:06 2013 +0530
@@ -52,7 +52,7 @@
  * {@link NativeJava#type(Object, Object) Java.type()} method.
  */
 @ScriptClass("JavaImporter")
-public class NativeJavaImporter extends ScriptObject {
+public final class NativeJavaImporter extends ScriptObject {
     private final Object[] args;
 
     NativeJavaImporter(final Object[] args) {
@@ -121,7 +121,7 @@
         final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         final Object value = createProperty(name);
         if(value != null) {
-            set(name, value, getContext()._strict);
+            set(name, value, isStrictContext());
             return true;
         }
         return false;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  *
  */
 @ScriptClass("Error")
-public class NativeRangeError extends ScriptObject {
+public final class NativeRangeError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  *
  */
 @ScriptClass("Error")
-public class NativeReferenceError extends ScriptObject {
+public final class NativeReferenceError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Mon Feb 11 21:26:06 2013 +0530
@@ -41,10 +41,10 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.SpecializedConstructor;
 import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.parser.RegExp;
 import jdk.nashorn.internal.runtime.BitVector;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.RegExp;
 import jdk.nashorn.internal.runtime.RegExpMatch;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  * RegExp.prototype.exec method.
  */
 @ScriptClass("RegExpExecResult")
-public class NativeRegExpExecResult extends ScriptObject {
+public final class NativeRegExpExecResult extends ScriptObject {
     /** index property */
     @Property
     public Object index;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Mon Feb 11 21:26:06 2013 +0530
@@ -47,7 +47,6 @@
 import jdk.nashorn.internal.objects.annotations.SpecializedConstructor;
 import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
 import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.parser.Lexer;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -1034,10 +1033,10 @@
         int start = 0;
         int end   = len - 1;
 
-        while (start <= end && Lexer.isJSWhitespace(str.charAt(start))) {
+        while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
             start++;
         }
-        while (end > start && Lexer.isJSWhitespace(str.charAt(end))) {
+        while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
             end--;
         }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  *
  */
 @ScriptClass("Error")
-public class NativeSyntaxError extends ScriptObject {
+public final class NativeSyntaxError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  *
  */
 @ScriptClass("Error")
-public class NativeTypeError extends ScriptObject {
+public final class NativeTypeError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Mon Feb 11 21:26:06 2013 +0530
@@ -39,7 +39,7 @@
  * ECMA 15.11.6.6 URIError
  */
 @ScriptClass("Error")
-public class NativeURIError extends ScriptObject {
+public final class NativeURIError extends ScriptObject {
 
     /** message property in instance */
     @Property(name = NativeError.MESSAGE)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Uint16 array for TypedArray extension
  */
 @ScriptClass("Uint16Array")
-public class NativeUint16Array extends ArrayBufferView {
+public final class NativeUint16Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 2;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Uint32 array for TypedArray extension
  */
 @ScriptClass("Uint32Array")
-public class NativeUint32Array extends ArrayBufferView {
+public final class NativeUint32Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 4;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Uint8 array for TypedArray extension
  */
 @ScriptClass("Uint8Array")
-public class NativeUint8Array extends ArrayBufferView {
+public final class NativeUint8Array extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 1;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,7 +37,7 @@
  * Uint8 clamped array for TypedArray extension
  */
 @ScriptClass("Uint8ClampedArray")
-public class NativeUint8ClampedArray extends ArrayBufferView {
+public final class NativeUint8ClampedArray extends ArrayBufferView {
     private static final int BYTES_PER_ELEMENT = 1;
     private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Mon Feb 11 21:26:06 2013 +0530
@@ -30,12 +30,12 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
-import jdk.nashorn.internal.codegen.objects.FunctionObjectCreator;
+
+import jdk.nashorn.internal.runtime.ScriptFunctionData;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptFunctionData;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.linker.Lookup;
@@ -184,7 +184,7 @@
      * @param strict are we in strict mode
      * @return new ScriptFunction
      */
-    public static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs, final boolean strict) {
+    static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs, final boolean strict) {
         final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, strict, true);
         func.setConstructHandle(null);
         func.setPrototype(UNDEFINED);
@@ -200,7 +200,7 @@
      * @param specs  specialized versions of function if available, null otherwise
      * @return new ScriptFunction
      */
-    public static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) {
+    static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) {
         return makeFunction(name, methodHandle, specs, false);
     }
 
@@ -211,7 +211,7 @@
      * @param methodHandle handle for invocation
      * @return new ScriptFunction
      */
-    public static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle) {
+    static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle) {
         return makeFunction(name, methodHandle, null);
     }
 
@@ -223,7 +223,7 @@
      * @param args arguments to bind
      */
     @Override
-    public ScriptFunction makeBoundFunction(final Object thiz, final Object[] args) {
+    protected ScriptFunction makeBoundFunction(final Object thiz, final Object[] args) {
         Object[] allArgs = args;
 
         if (allArgs == null) {
--- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,6 +37,7 @@
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.JSErrorType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.RegExp;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
--- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Mon Feb 11 21:26:06 2013 +0530
@@ -289,7 +289,7 @@
         add(type, start, position);
     }
 
-    static String getWhitespaceRegExp() {
+    public static String getWhitespaceRegExp() {
         return JAVASCRIPT_WHITESPACE_IN_REGEXP;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/parser/RegExp.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.parser;
-
-import static java.util.regex.Pattern.CASE_INSENSITIVE;
-import static java.util.regex.Pattern.MULTILINE;
-import static java.util.regex.Pattern.UNICODE_CASE;
-
-import java.util.HashSet;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import jdk.nashorn.internal.runtime.BitVector;
-import jdk.nashorn.internal.runtime.ECMAErrors;
-import jdk.nashorn.internal.runtime.ParserException;
-
-/**
- * This class is used to represent a parsed regular expression. Accepts input
- * pattern string and flagString. This is used by AbstractParser to validate
- * RegExp literals as well as by NativeRegExp to parse RegExp constructor arguments.
- */
-public final class RegExp {
-    /** Pattern string. */
-    private final String input;
-
-    /** Global search flag for this regexp.*/
-    private boolean global;
-
-    /** Case insensitive flag for this regexp */
-    private boolean ignoreCase;
-
-    /** Multi-line flag for this regexp */
-    private boolean multiline;
-
-    /** Java regexp pattern to use for match. We compile to one of these */
-    private Pattern pattern;
-
-    /** BitVector that keeps track of groups in negative lookahead */
-    private BitVector groupsInNegativeLookahead;
-
-    /**
-     * Creates RegExpLiteral object from given input and flagString.
-     *
-     * @param input RegExp pattern string
-     * @param flagString RegExp flags
-     * @throws ParserException if flagString is invalid or input string has syntax error.
-     */
-    public RegExp(final String input, final String flagString) throws ParserException {
-        this.input = input;
-        final HashSet<Character> usedFlags = new HashSet<>();
-        int flags = 0;
-
-        for (final char ch : flagString.toCharArray()) {
-            if (usedFlags.contains(ch)) {
-                throwParserException("repeated.flag", Character.toString(ch));
-            }
-
-            switch (ch) {
-            case 'g':
-                this.global = true;
-                usedFlags.add(ch);
-                break;
-            case 'i':
-                this.ignoreCase = true;
-                flags |= CASE_INSENSITIVE | UNICODE_CASE;
-                usedFlags.add(ch);
-                break;
-            case 'm':
-                this.multiline = true;
-                flags |= MULTILINE;
-                usedFlags.add(ch);
-                break;
-            default:
-                throwParserException("unsupported.flag", Character.toString(ch));
-            }
-        }
-
-        try {
-            RegExpScanner parsed;
-
-            try {
-                parsed = RegExpScanner.scan(input);
-            } catch (final PatternSyntaxException e) {
-                // refine the exception with a better syntax error, if this
-                // passes, just rethrow what we have
-                Pattern.compile(input, flags);
-                throw e;
-            }
-
-            if (parsed != null) {
-                this.pattern = Pattern.compile(parsed.getJavaPattern(), flags);
-                this.groupsInNegativeLookahead = parsed.getGroupsInNegativeLookahead();
-            }
-        } catch (final PatternSyntaxException e2) {
-            throwParserException("syntax", e2.getMessage());
-        }
-
-    }
-
-    /**
-     * @return the input
-     */
-    public String getInput() {
-        return input;
-    }
-
-    /**
-     * @return the global
-     */
-    public boolean isGlobal() {
-        return global;
-    }
-
-    /**
-     * @return the ignoreCase
-     */
-    public boolean isIgnoreCase() {
-        return ignoreCase;
-    }
-
-    /**
-     * @return the multiline
-     */
-    public boolean isMultiline() {
-        return multiline;
-    }
-
-    /**
-     * @return the pattern
-     */
-    public Pattern getPattern() {
-        return pattern;
-    }
-
-    /**
-     * @return the groupsInNegativeLookahead
-     */
-    public BitVector getGroupsInNegativeLookahead() {
-        return groupsInNegativeLookahead;
-    }
-
-    /**
-     * Validation method for RegExp input and flagString - we don't care about the RegExp object
-     *
-     * @param input        regexp input
-     * @param flagString   flag string
-     *
-     * @throws ParserException if invalid regexp and flags
-     */
-    @SuppressWarnings({"unused", "ResultOfObjectAllocationIgnored"})
-    public static void validate(final String input, final String flagString) throws ParserException {
-        new RegExp(input, flagString);
-    }
-
-    private static void throwParserException(final String key, final String str) throws ParserException {
-        throw new ParserException(ECMAErrors.getMessage("parser.error.regex." + key, str));
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/parser/RegExpScanner.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1414 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.parser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.PatternSyntaxException;
-import jdk.nashorn.internal.runtime.BitVector;
-
-/**
- * Scan a JavaScript regexp, converting to Java regex if necessary.
- *
- */
-public class RegExpScanner extends Scanner {
-
-    /**
-     * String builder to accumulate the result - this contains verbatim parsed JavaScript.
-     * to get the java equivalent we need to create a Pattern token and return its toString()
-     */
-    private final StringBuilder sb;
-
-    /** An optional error message if one occurred during parse. */
-    private String errorMessage;
-
-    /** Is this the special case of a regexp that never matches anything */
-    private boolean neverMatches;
-
-    /** The resulting java.util.regex pattern string. */
-    private String javaPattern;
-
-    /** Expected token table */
-    private final Map<Character, Integer> expected = new HashMap<>();
-
-    /** Capturing parenthesis that have been found so far. */
-    private final List<Capture> caps = new LinkedList<>();
-
-    /** Forward references to capturing parenthesis to be resolved later.*/
-    private final Map<Integer, Token> forwardReferences = new LinkedHashMap<>();
-
-    /** Current level of zero-width negative lookahead assertions. */
-    private int negativeLookaheadLevel;
-
-    private static final String NON_IDENT_ESCAPES = "$^*+(){}[]|\\.?";
-
-    private static class Capture {
-        /**
-         * Zero-width negative lookaheads enclosing the capture.
-         */
-        private final int negativeLookaheadLevel;
-        /**
-         * Captures that live inside a negative lookahead are dead after the
-         * lookahead and will be undefined if referenced from outside.
-         */
-        private boolean isDead;
-
-        Capture(final int negativeLookaheadLevel) {
-            this.negativeLookaheadLevel = negativeLookaheadLevel;
-        }
-
-        public int getNegativeLookaheadLevel() {
-            return negativeLookaheadLevel;
-        }
-
-        public boolean isDead() {
-            return isDead;
-        }
-
-        public void setDead() {
-            this.isDead = true;
-        }
-    }
-
-    /**
-     * This is a token - the JavaScript regexp is scanned into a token tree
-     * A token has other tokens as children as well as "atoms", i.e. Strings.
-     *
-     */
-    private static class Token {
-
-        private enum Type {
-            PATTERN,
-            DISJUNCTION,
-            ALTERNATIVE,
-            TERM,
-            ASSERTION,
-            QUANTIFIER,
-            QUANTIFIER_PREFIX,
-            ATOM,
-            PATTERN_CHARACTER,
-            ATOM_ESCAPE,
-            CHARACTER_ESCAPE,
-            CONTROL_ESCAPE,
-            CONTROL_LETTER,
-            IDENTITY_ESCAPE,
-            DECIMAL_ESCAPE,
-            CHARACTERCLASS_ESCAPE,
-            CHARACTERCLASS,
-            CLASSRANGES,
-            NON_EMPTY_CLASSRANGES,
-            NON_EMPTY_CLASSRANGES_NODASH,
-            CLASSATOM,
-            CLASSATOM_NODASH,
-            CLASS_ESCAPE,
-            DECIMALDIGITS,
-            HEX_ESCAPESEQUENCE,
-            UNICODE_ESCAPESEQUENCE,
-        }
-
-        /**
-         * Token tyoe
-         */
-        private final Token.Type type;
-
-        /**
-         * Child nodes
-         */
-        private final List<Object> children;
-
-        /**
-         * Parent node
-         */
-        private Token parent;
-
-        /**
-         * Dead code flag
-         */
-        private boolean isDead;
-
-        private static final Map<Type, ToString> toStringMap = new HashMap<>();
-        private static final ToString DEFAULT_TOSTRING = new ToString();
-
-        private static String unicode(final int value) {
-            final StringBuilder sb = new StringBuilder();
-            final String hex = Integer.toHexString(value);
-            sb.append('u');
-            for (int i = 0; i < 4 - hex.length(); i++) {
-                sb.append('0');
-            }
-            sb.append(hex);
-
-            return sb.toString();
-        }
-
-        static {
-            toStringMap.put(Type.CHARACTERCLASS, new ToString() {
-                @Override
-                public String toString(final Token token) {
-                    return super.toString(token).replace("\\b", "\b");
-                }
-            });
-
-            // for some reason java regexps don't like control characters on the
-            // form "\\ca".match([string with ascii 1 at char0]). Translating
-            // them to unicode does it though.
-            toStringMap.put(Type.CHARACTER_ESCAPE, new ToString() {
-                @Override
-                public String toString(final Token token) {
-                    final String str = super.toString(token);
-                    if (str.length() == 2) {
-                        return Token.unicode(Character.toLowerCase(str.charAt(1)) - 'a' + 1);
-                    }
-                    return str;
-                }
-            });
-
-            toStringMap.put(Type.DECIMAL_ESCAPE, new ToString() {
-                @Override
-                public String toString(final Token token) {
-                    final String str = super.toString(token);
-
-                    if ("\0".equals(str)) {
-                        return str;
-                    }
-
-                    int value;
-
-                    if (!token.hasParentOfType(Type.CLASSRANGES)) {
-                        return str;
-                    }
-
-                    value = Integer.parseInt(str, 8); //throws exception that leads to SyntaxError if not octal
-                    if (value > 0xff) {
-                        throw new NumberFormatException(str);
-                    }
-
-                    return Token.unicode(value);
-                }
-            });
-
-        }
-
-        /**
-         * JavaScript Token to Java regex substring framework.
-         *
-         */
-        private static class ToString {
-            String toString(final Token token) {
-                final StringBuilder sb = new StringBuilder();
-                for (final Object child : token.getChildren()) {
-                    sb.append(child);
-                }
-
-                //perform global substitutions that hold true for any evaluated form
-                String str = sb.toString();
-                switch (str) {
-                case "\\s":
-                    str = "[" + Lexer.getWhitespaceRegExp() + "]";
-                    break;
-                case "\\S":
-                    str = "[^" + Lexer.getWhitespaceRegExp() + "]";
-                    break;
-                case "[^]":
-                    str = "[\\s\\S]";
-                    break;
-                default:
-                    break;
-                }
-                return str;
-            }
-        }
-
-        /**
-         * Token iterator. Doesn't return "atom" children. i.e. string representations,
-         * just tokens
-         *
-         */
-        private static class TokenIterator implements Iterator<Token> {
-            private final List<Token> preorder;
-
-            private void init(final Token root) {
-                preorder.add(root);
-                for (final Object child : root.getChildren()) {
-                    if (child instanceof Token) {
-                        init((Token)child);
-                    }
-                }
-            }
-
-            TokenIterator(final Token root) {
-                preorder = new ArrayList<>();
-                init(root);
-            }
-
-            @Override
-            public boolean hasNext() {
-                return !preorder.isEmpty();
-            }
-
-            @Override
-            public Token next() {
-                return preorder.remove(0);
-            }
-
-            @Override
-            public void remove() {
-                next();
-            }
-        }
-
-        /**
-         * Constructor
-         * @param type the token type
-         */
-        Token(final Token.Type type) {
-            this.type = type;
-            children = new ArrayList<>();
-        }
-
-        /**
-         * Add a an "atom" child to a token
-         * @param child the child to add
-         * @return the token (for chaining)
-         */
-        public Token add(final String child) {
-            children.add(child);
-            return this;
-        }
-
-        /**
-         * Add a child to a token
-         * @param child the child
-         * @return the token (for chaining)
-         */
-        public Token add(final Token child) {
-            if (child != null) {
-                children.add(child);
-                child.setParent(this);
-            }
-            return this;
-        }
-
-        /**
-         * Remove a child from a token
-         * @param child the child to remove
-         * @return true if successful
-         */
-        public boolean remove(final Token child) {
-            return children.remove(child);
-        }
-
-        /**
-         * Remove the last child from a token
-         * @return the removed child
-         */
-        public Object removeLast() {
-            return children.remove(children.size() - 1);
-        }
-
-        /**
-         * Flag this token as dead code
-         * @param isDead is it dead or not
-         */
-        private void setIsDead(final boolean isDead) {
-            this.isDead = isDead;
-        }
-
-        /**
-         * Is this token dead code
-         * @return boolean
-         */
-        private boolean getIsDead() {
-            return isDead;
-        }
-
-        /**
-         * Get the parent of this token
-         * @return parent token
-         */
-        public Token getParent() {
-            return parent;
-        }
-
-        public boolean hasParentOfType(final Token.Type parentType) {
-            for (Token p = getParent(); p != null; p = p.getParent()) {
-                if (p.getType() == parentType) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public boolean hasChildOfType(final Token.Type childType) {
-            for (final Iterator<Token> iter = iterator() ; iter.hasNext() ; ) {
-                if (iter.next().getType() == childType) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /**
-         * Set the parent of this token
-         * @param parent
-         */
-        private void setParent(final Token parent) {
-            this.parent = parent;
-        }
-
-        /**
-         * Get the children of this token
-         * @return an array of children, never null
-         */
-        public Object[] getChildren() {
-            return children.toArray();
-        }
-
-        /**
-         * Reset this token, remove all children
-         */
-        public void reset() {
-            children.clear();
-        }
-
-        /**
-         * Get a preorder token iterator with this token as root
-         * @return an iterator
-         */
-        public Iterator<Token> iterator() {
-            return new TokenIterator(this);
-        }
-
-        /**
-         * Get the type of this token
-         * @return type
-         */
-        public Type getType() {
-            return type;
-        }
-
-        /**
-         * Turn this token into Java regexp compatible text
-         * @return part of a java regexp
-         */
-        @Override
-        public String toString() {
-            ToString t = toStringMap.get(getType());
-            if (t == null) {
-                t = DEFAULT_TOSTRING;
-            }
-            return t.toString(this);
-        }
-    }
-
-    /**
-     * Constructor
-     * @param string the JavaScript regexp to parse
-     */
-    private RegExpScanner(final String string) {
-        super(string);
-        sb = new StringBuilder(limit);
-        reset(0);
-        expected.put(']', 0);
-        expected.put('}', 0);
-    }
-
-    private void processForwardReferences() {
-        if (neverMatches()) {
-            return;
-        }
-
-        for (final Map.Entry<Integer, Token> fwdRef : forwardReferences.entrySet()) {
-            if (fwdRef.getKey().intValue() > caps.size()) {
-                neverMatches = true;
-                break;
-            }
-
-            fwdRef.getValue().setIsDead(true);
-        }
-
-        forwardReferences.clear();
-    }
-
-    /**
-     * Scan a JavaScript regexp string returning a Java safe regex string.
-     *
-     * @param string
-     *            JavaScript regexp string.
-     * @return Java safe regex string.
-     */
-    public static RegExpScanner scan(final String string) {
-        final RegExpScanner scanner = new RegExpScanner(string);
-
-        Token pattern;
-
-        try {
-            pattern = scanner.pattern();
-        } catch (final Exception e) {
-            throw new PatternSyntaxException(e.getMessage(), string, scanner.sb.length());
-        }
-
-        scanner.processForwardReferences();
-        if (scanner.neverMatches()) {
-            return null; // never matches
-        }
-
-        // go over the code and remove dead code
-        final Iterator<Token> iter = pattern.iterator();
-        while (iter.hasNext()) {
-            final Token next = iter.next();
-            if (next.getIsDead()) {
-                next.getParent().remove(next);
-            }
-        }
-
-        // turn the pattern into a string, p, the java equivalent string for our js regexp
-        final String p = pattern.toString();
-        // if builder contains all tokens that were sent in, we know
-        // we correctly parsed the entire JavaScript regexp without syntax errors
-        if (!string.equals(scanner.getStringBuilder().toString())) {
-            throw new PatternSyntaxException(string, p, p.length() + 1);
-        }
-
-        scanner.javaPattern = p;
-        return scanner;
-     }
-
-    /**
-     * Does this regexp ever match anything? Use of e.g. [], which is legal in JavaScript,
-     * is an example where we never match
-     *
-     * @return boolean
-     */
-    private boolean neverMatches() {
-        return neverMatches;
-    }
-
-    /**
-     * This is used to set better error messages that can be reused
-     * in NativeRegExp for augmenting e.g. SyntaxErrors.
-     *
-     * @return an error message or null if no extra info
-     */
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    final StringBuilder getStringBuilder() {
-        return sb;
-    }
-
-    String getJavaPattern() {
-        return javaPattern;
-    }
-
-    BitVector getGroupsInNegativeLookahead() {
-        BitVector vec = null;
-        for (int i = 0; i < caps.size(); i++) {
-            final Capture cap = caps.get(i);
-            if (cap.getNegativeLookaheadLevel() > 0) {
-                if (vec == null) {
-                    vec = new BitVector(caps.size() + 1);
-                }
-                vec.set(i + 1);
-            }
-        }
-        return vec;
-    }
-
-    /**
-     * Commit n characters to the builder and to a given token
-     * @param token Uncommitted token.
-     * @param n     Number of characters.
-     * @return Committed token
-     */
-    private Token commit(final Token token, final int n) {
-        final int startIn = position;
-
-        switch (n) {
-        case 1:
-            sb.append(ch0);
-            skip(1);
-            break;
-        case 2:
-            sb.append(ch0);
-            sb.append(ch1);
-            skip(2);
-            break;
-        case 3:
-            sb.append(ch0);
-            sb.append(ch1);
-            sb.append(ch2);
-            skip(3);
-            break;
-        default:
-            assert false : "Should not reach here";
-        }
-
-        if (token == null) {
-            return null;
-        }
-
-        return token.add(sb.substring(startIn, sb.length()));
-    }
-
-    /**
-     * Restart the buffers back at an earlier position.
-     *
-     * @param startIn
-     *            Position in the input stream.
-     * @param startOut
-     *            Position in the output stream.
-     */
-    private void restart(final int startIn, final int startOut) {
-        reset(startIn);
-        sb.setLength(startOut);
-    }
-
-    private void push(final char ch) {
-        expected.put(ch, expected.get(ch) + 1);
-    }
-
-    private void pop(final char ch) {
-        expected.put(ch, Math.min(0, expected.get(ch) - 1));
-    }
-
-    /*
-     * Recursive descent tokenizer starts below.
-     */
-
-    /*
-     * Pattern ::
-     *      Disjunction
-     */
-    private Token pattern() {
-        final Token token = new Token(Token.Type.PATTERN);
-
-        final Token child = disjunction();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        return null;
-    }
-
-    /*
-     * Disjunction ::
-     *      Alternative
-     *      Alternative | Disjunction
-     */
-    private Token disjunction() {
-        final Token token = new Token(Token.Type.DISJUNCTION);
-
-        while (true) {
-            token.add(alternative());
-
-            if (ch0 == '|') {
-                commit(token, 1);
-            } else {
-                break;
-            }
-        }
-
-        return token;
-    }
-
-    /*
-     * Alternative ::
-     *      [empty]
-     *      Alternative Term
-     */
-    private Token alternative() {
-        final Token token = new Token(Token.Type.ALTERNATIVE);
-
-        Token child;
-        while ((child = term()) != null) {
-            token.add(child);
-        }
-
-        return token;
-    }
-
-    /*
-     * Term ::
-     *      Assertion
-     *      Atom
-     *      Atom Quantifier
-     */
-    private Token term() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.TERM);
-        Token child;
-
-        child = assertion();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = atom();
-        if (child != null) {
-            boolean emptyCharacterClass = false;
-            if ("[]".equals(child.toString())) {
-                emptyCharacterClass = true;
-            }
-
-            token.add(child);
-
-            final Token quantifier = quantifier();
-            if (quantifier != null) {
-                token.add(quantifier);
-            }
-
-            if (emptyCharacterClass) {
-                if (quantifier == null) {
-                    neverMatches = true; //never matches ever.
-                } else {
-                    //if we can get away with max zero, remove this entire token
-                    final String qs = quantifier.toString();
-                    if ("+".equals(qs) || "*".equals(qs) || qs.startsWith("{0,")) {
-                        token.setIsDead(true);
-                    }
-                }
-            }
-
-            return token;
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * Assertion ::
-     *      ^
-     *      $
-     *      \b
-     *      \B
-     *      ( ? = Disjunction )
-     *      ( ? ! Disjunction )
-     */
-    private Token assertion() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.ASSERTION);
-
-        switch (ch0) {
-        case '^':
-        case '$':
-            return commit(token, 1);
-
-        case '\\':
-            if (ch1 == 'b' || ch1 == 'B') {
-                return commit(token, 2);
-            }
-            break;
-
-        case '(':
-            if (ch1 != '?') {
-                break;
-            }
-            if (ch2 != '=' && ch2 != '!') {
-                break;
-            }
-            final boolean isNegativeLookahead = (ch2 == '!');
-            commit(token, 3);
-
-            if (isNegativeLookahead) {
-                negativeLookaheadLevel++;
-            }
-            final Token disjunction = disjunction();
-            if (isNegativeLookahead) {
-                for (final Capture cap : caps) {
-                    if (cap.getNegativeLookaheadLevel() >= negativeLookaheadLevel) {
-                        cap.setDead();
-                    }
-                }
-                negativeLookaheadLevel--;
-            }
-
-            if (disjunction != null && ch0 == ')') {
-                token.add(disjunction);
-                return commit(token, 1);
-            }
-            break;
-
-        default:
-            break;
-        }
-
-        restart(startIn, startOut);
-
-        return null;
-    }
-
-    /*
-     * Quantifier ::
-     *      QuantifierPrefix
-     *      QuantifierPrefix ?
-     */
-    private Token quantifier() {
-        final Token token = new Token(Token.Type.QUANTIFIER);
-        final Token child = quantifierPrefix();
-        if (child != null) {
-            token.add(child);
-            if (ch0 == '?') {
-                commit(token, 1);
-            }
-            return token;
-        }
-        return null;
-    }
-
-    /*
-     * QuantifierPrefix ::
-     *      *
-     *      +
-     *      ?
-     *      { DecimalDigits }
-     *      { DecimalDigits , }
-     *      { DecimalDigits , DecimalDigits }
-     */
-    private Token quantifierPrefix() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.QUANTIFIER_PREFIX);
-
-        switch (ch0) {
-        case '*':
-        case '+':
-        case '?':
-            return commit(token, 1);
-
-        case '{':
-            commit(token, 1);
-
-            final Token child = decimalDigits();
-            if (child == null) {
-                break; // not a quantifier - back out
-            }
-            push('}');
-            token.add(child);
-
-            if (ch0 == ',') {
-                commit(token, 1);
-                token.add(decimalDigits());
-            }
-
-            if (ch0 == '}') {
-                pop('}');
-                commit(token, 1);
-            }
-
-            return token;
-
-        default:
-            break;
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * Atom ::
-     *      PatternCharacter
-     *      .
-     *      \ AtomEscape
-     *      CharacterClass
-     *      ( Disjunction )
-     *      ( ? : Disjunction )
-     *
-     */
-    private Token atom() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.ATOM);
-        Token child;
-
-        child = patternCharacter();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        if (ch0 == '.') {
-            return commit(token, 1);
-        }
-
-        if (ch0 == '\\') {
-            commit(token, 1);
-            child = atomEscape();
-
-            if (child != null) {
-                if (child.hasChildOfType(Token.Type.IDENTITY_ESCAPE)) {
-                    final char idEscape = child.toString().charAt(0);
-                    if (NON_IDENT_ESCAPES.indexOf(idEscape) == -1) {
-                        token.reset();
-                    }
-                }
-
-                token.add(child);
-
-                // forward backreferences always match empty. JavaScript != Java
-                if (child.hasChildOfType(Token.Type.DECIMAL_ESCAPE) && !"\u0000".equals(child.toString())) {
-                    final int refNum = Integer.parseInt(child.toString());
-
-                    if (refNum - 1 < caps.size() && caps.get(refNum - 1).isDead()) {
-                        // reference to dead in-negative-lookahead capture
-                        token.setIsDead(true);
-                    } else if (caps.size() < refNum) {
-                        // forward reference: always matches against empty string (dead token).
-                        // invalid reference (non-existant capture): pattern never matches.
-                        forwardReferences.put(refNum, token);
-                    }
-                }
-
-                return token;
-            }
-        }
-
-        child = characterClass();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        if (ch0 == '(') {
-            boolean capturingParens = true;
-            commit(token, 1);
-            if (ch0 == '?' && ch1 == ':') {
-                capturingParens = false;
-                commit(token, 2);
-            }
-
-            child = disjunction();
-            if (child != null) {
-                token.add(child);
-                if (ch0 == ')') {
-                    final Token atom = commit(token, 1);
-                    if (capturingParens) {
-                        caps.add(new Capture(negativeLookaheadLevel));
-                    }
-                    return atom;
-                }
-            }
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * PatternCharacter ::
-     *      SourceCharacter but not any of: ^$\.*+?()[]{}|
-     */
-    @SuppressWarnings("fallthrough")
-    private Token patternCharacter() {
-        if (atEOF()) {
-            return null;
-        }
-
-        switch (ch0) {
-        case '^':
-        case '$':
-        case '\\':
-        case '.':
-        case '*':
-        case '+':
-        case '?':
-        case '(':
-        case ')':
-        case '[':
-        case '|':
-            return null;
-
-        case '}':
-        case ']':
-            final int n = expected.get(ch0);
-            if (n != 0) {
-                return null;
-            }
-
-       case '{':
-           // if not a valid quantifier escape curly brace to match itself
-           // this ensures compatibility with other JS implementations
-           final Token quant = quantifierPrefix();
-           return (quant == null) ? commit(new Token(Token.Type.PATTERN_CHARACTER).add("\\"), 1) : null;
-
-        default:
-            return commit(new Token(Token.Type.PATTERN_CHARACTER), 1); // SOURCECHARACTER
-        }
-    }
-
-    /*
-     * AtomEscape ::
-     *      DecimalEscape
-     *      CharacterEscape
-     *      CharacterClassEscape
-     */
-    private Token atomEscape() {
-        final Token token = new Token(Token.Type.ATOM_ESCAPE);
-        Token child;
-
-        child = decimalEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = characterClassEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = characterEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-
-        return null;
-    }
-
-    /*
-     * CharacterEscape ::
-     *      ControlEscape
-     *      c ControlLetter
-     *      HexEscapeSequence
-     *      UnicodeEscapeSequence
-     *      IdentityEscape
-     */
-    private Token characterEscape() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-
-        final Token token = new Token(Token.Type.CHARACTER_ESCAPE);
-        Token child;
-
-        child = controlEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        if (ch0 == 'c') {
-            commit(token, 1);
-            child = controlLetter();
-            if (child != null) {
-                return token.add(child);
-            }
-            restart(startIn, startOut);
-        }
-
-        child = hexEscapeSequence();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = unicodeEscapeSequence();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = identityEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        restart(startIn, startOut);
-
-        return null;
-    }
-
-    private boolean scanEscapeSequence(final char leader, final int length, final Token token) {
-        final int startIn  = position;
-        final int startOut = sb.length();
-
-        if (ch0 != leader) {
-            return false;
-        }
-
-        commit(token, 1);
-        for (int i = 0; i < length; i++) {
-            final char ch0l = Character.toLowerCase(ch0);
-            if ((ch0l >= 'a' && ch0l <= 'f') || isDecimalDigit(ch0)) {
-                commit(token, 1);
-            } else {
-                restart(startIn, startOut);
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    private Token hexEscapeSequence() {
-        final Token token = new Token(Token.Type.HEX_ESCAPESEQUENCE);
-        if (scanEscapeSequence('x', 2, token)) {
-            return token;
-        }
-        return null;
-    }
-
-    private Token unicodeEscapeSequence() {
-        final Token token = new Token(Token.Type.UNICODE_ESCAPESEQUENCE);
-        if (scanEscapeSequence('u', 4, token)) {
-            return token;
-        }
-        return null;
-    }
-
-    /*
-     * ControlEscape ::
-     *      one of fnrtv
-     */
-    private Token controlEscape() {
-        switch (ch0) {
-        case 'f':
-        case 'n':
-        case 'r':
-        case 't':
-        case 'v':
-            return commit(new Token(Token.Type.CONTROL_ESCAPE), 1);
-
-        default:
-            return null;
-        }
-    }
-
-    /*
-     * ControlLetter ::
-     *      one of abcdefghijklmnopqrstuvwxyz
-     *      ABCDEFGHIJKLMNOPQRSTUVWXYZ
-     */
-    private Token controlLetter() {
-        final char c = Character.toUpperCase(ch0);
-        if (c >= 'A' && c <= 'Z') {
-            final Token token = new Token(Token.Type.CONTROL_LETTER);
-            commit(token, 1);
-            return token;
-        }
-        return null;
-        /*
-        Token token = new Token(Token.Type.CONTROL_LETTER);
-        commit(null, 1);//add original char to builder not to token
-        this.neverMatches = c < 'A' || c > 'Z';
-        return token.add(""+c);*/
-    }
-
-    /*
-     * IdentityEscape ::
-     *      SourceCharacter but not IdentifierPart
-     *      <ZWJ>  (200c)
-     *      <ZWNJ> (200d)
-     */
-    private Token identityEscape() {
-        final Token token = new Token(Token.Type.IDENTITY_ESCAPE);
-        commit(token, 1);
-        return token;
-    }
-
-    /*
-     * DecimalEscape ::
-     *      DecimalIntegerLiteral [lookahead DecimalDigit]
-     */
-    private Token decimalEscape() {
-        final Token token = new Token(Token.Type.DECIMAL_ESCAPE);
-        final int startIn  = position;
-        final int startOut = sb.length();
-
-        if (ch0 == '0' && !isDecimalDigit(ch1)) {
-            commit(token, 1);
-            token.removeLast();
-            //  DecimalEscape :: 0. If i is zero, return the EscapeValue consisting of a <NUL> character (Unicodevalue0000);
-            return token.add("\u0000");
-        }
-
-        if (isDecimalDigit(ch0)) {
-            while (isDecimalDigit(ch0)) {
-                commit(token, 1);
-            }
-            return token;
-        }
-
-        restart(startIn, startOut);
-
-        return null;
-    }
-
-    /*
-     * CharacterClassEscape ::
-     *  one of dDsSwW
-     */
-    private Token characterClassEscape() {
-        switch (ch0) {
-        case 's':
-        case 'S':
-        case 'd':
-        case 'D':
-        case 'w':
-        case 'W':
-            return commit(new Token(Token.Type.CHARACTERCLASS_ESCAPE), 1);
-
-        default:
-            return null;
-        }
-    }
-
-    /*
-     * CharacterClass ::
-     *      [ [lookahead {^}] ClassRanges ]
-     *      [ ^ ClassRanges ]
-     */
-    private Token characterClass() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.CHARACTERCLASS);
-
-        if (ch0 == '[') {
-            push(']');
-            commit(token, 1);
-
-            if (ch0 == '^') {
-                commit(token, 1);
-            }
-
-            final Token child = classRanges();
-            if (child != null && ch0 == ']') {
-                pop(']');
-                token.add(child);
-                return commit(token, 1);
-            }
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * ClassRanges ::
-     *      [empty]
-     *      NonemptyClassRanges
-     */
-    private Token classRanges() {
-        return new Token(Token.Type.CLASSRANGES).add(nonemptyClassRanges());
-    }
-
-    /*
-     * NonemptyClassRanges ::
-     *      ClassAtom
-     *      ClassAtom NonemptyClassRangesNoDash
-     *      ClassAtom - ClassAtom ClassRanges
-     */
-    private Token nonemptyClassRanges() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.NON_EMPTY_CLASSRANGES);
-        Token child;
-
-        child = classAtom();
-        if (child != null) {
-            token.add(child);
-
-            if (ch0 == '-') {
-                commit(token, 1);
-
-                final Token child1 = classAtom();
-                final Token child2 = classRanges();
-                if (child1 != null && child2 != null) {
-                    token.add(child1);
-                    token.add(child2);
-
-                    return token;
-                }
-            }
-
-            child = nonemptyClassRangesNoDash();
-            if (child != null) {
-                token.add(child);
-                return token;
-            }
-
-            return token;
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * NonemptyClassRangesNoDash ::
-     *      ClassAtom
-     *      ClassAtomNoDash NonemptyClassRangesNoDash
-     *      ClassAtomNoDash - ClassAtom ClassRanges
-     */
-    private Token nonemptyClassRangesNoDash() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.NON_EMPTY_CLASSRANGES_NODASH);
-        Token child;
-
-        child = classAtomNoDash();
-        if (child != null) {
-            token.add(child);
-
-            // need to check dash first, as for e.g. [a-b|c-d] will otherwise parse - as an atom
-            if (ch0 == '-') {
-               commit(token, 1);
-
-               final Token child1 = classAtom();
-               final Token child2 = classRanges();
-               if (child1 != null && child2 != null) {
-                   token.add(child1);
-                   return token.add(child2);
-               }
-               //fallthru
-           }
-
-            child = nonemptyClassRangesNoDash();
-            if (child != null) {
-                token.add(child);
-            }
-            return token; // still a class atom
-        }
-
-        child = classAtom();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        restart(startIn, startOut);
-        return null;
-    }
-
-    /*
-     * ClassAtom : - ClassAtomNoDash
-     */
-    private Token classAtom() {
-        final Token token = new Token(Token.Type.CLASSATOM);
-
-        if (ch0 == '-') {
-            return commit(token, 1);
-        }
-
-        final Token child = classAtomNoDash();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        return null;
-    }
-
-    /*
-     * ClassAtomNoDash ::
-     *      SourceCharacter but not one of \ or ] or -
-     *      \ ClassEscape
-     */
-    private Token classAtomNoDash() {
-        final int startIn  = position;
-        final int startOut = sb.length();
-        final Token token  = new Token(Token.Type.CLASSATOM_NODASH);
-
-        switch (ch0) {
-        case ']':
-        case '-':
-        case '\0':
-            return null;
-
-        case '[':
-            // unescaped left square bracket - add escape
-            return commit(token.add("\\"), 1);
-
-        case '\\':
-            commit(token, 1);
-            final Token child = classEscape();
-            if (child != null) {
-                return token.add(child);
-            }
-
-            restart(startIn, startOut);
-            return null;
-
-        default:
-            return commit(token, 1);
-        }
-    }
-
-    /*
-     * ClassEscape ::
-     *      DecimalEscape
-     *      b
-     *      CharacterEscape
-     *      CharacterClassEscape
-     */
-    private Token classEscape() {
-        final Token token = new Token(Token.Type.CLASS_ESCAPE);
-        Token child;
-
-        child = decimalEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        if (ch0 == 'b') {
-            return commit(token, 1);
-        }
-
-        child = characterEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        child = characterClassEscape();
-        if (child != null) {
-            return token.add(child);
-        }
-
-        return null;
-    }
-
-    /*
-     * DecimalDigits
-     */
-    private Token decimalDigits() {
-        if (!isDecimalDigit(ch0)) {
-            return null;
-        }
-
-        final Token token = new Token(Token.Type.DECIMALDIGITS);
-        while (isDecimalDigit(ch0)) {
-            commit(token, 1);
-        }
-
-        return token;
-    }
-
-    private static boolean isDecimalDigit(final char ch) {
-        return ch >= '0' && ch <= '9';
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/runtime/ArgumentSetter.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ArgumentSetter.java	Mon Feb 11 21:26:06 2013 +0530
@@ -32,7 +32,8 @@
  * A class with static helper methods invoked from generated bytecode for setting values of parameters of variable-arity
  * functions.
  */
-public class ArgumentSetter {
+public final class ArgumentSetter {
+    private ArgumentSetter() {}
 
     /** Method handle for setting a function argument at a given index in an arguments object. Used from generated bytecode */
     public static final Call SET_ARGUMENT      = staticCall(ArgumentSetter.class, "setArgument", void.class, Object.class, ScriptObject.class, int.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/BitVector.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/BitVector.java	Mon Feb 11 21:26:06 2013 +0530
@@ -30,7 +30,7 @@
 /**
  * Faster implementation of BitSet
  */
-public class BitVector implements Cloneable {
+public final class BitVector implements Cloneable {
     /** Number of bits per slot. */
     private static final int BITSPERSLOT = 64;
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java	Mon Feb 11 21:26:06 2013 +0530
@@ -33,7 +33,7 @@
  * instances of <tt>ConsString</tt> or {@link String}. Copying of characters to
  * a proper string is delayed until it becomes necessary.
  */
-public class ConsString implements CharSequence {
+public final class ConsString implements CharSequence {
 
     private CharSequence left, right;
     final private int length;
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,6 +36,7 @@
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.AccessController;
@@ -84,11 +85,11 @@
             Class<?> caller = Reflection.getCallerClass(2);
             ClassLoader callerLoader = caller.getClassLoader();
 
-            // Allow this method only for nashorn's own classes, script
-            // generated classes and Java adapter classes. Rest should
+            // Allow this method only for nashorn's own classes, objects
+            // package classes and Java adapter classes. Rest should
             // have the necessary security permission.
             if (callerLoader != myLoader &&
-                !(callerLoader instanceof NashornLoader) &&
+                !(callerLoader instanceof StructureLoader) &&
                 !(JavaAdapterFactory.isAdapterClass(caller))) {
                 sm.checkPermission(new RuntimePermission("getNashornGlobal"));
             }
@@ -332,7 +333,7 @@
              new PrivilegedAction<ClassLoader>() {
                 @Override
                 public ClassLoader run() {
-                    final ClassLoader structureLoader = new StructureLoader(sharedLoader, Context.this);
+                    final StructureLoader structureLoader = new StructureLoader(sharedLoader, Context.this);
                     return new ScriptLoader(structureLoader, Context.this);
                 }
              });
@@ -959,7 +960,7 @@
                     // Generated code won't refer to any class generated by context
                     // script loader and so parent loader can be the structure
                     // loader -- which is parent of the context script loader.
-                    return new ScriptLoader(scriptLoader.getParent(), Context.this);
+                    return new ScriptLoader((StructureLoader)scriptLoader.getParent(), Context.this);
                 }
              });
     }
@@ -967,10 +968,15 @@
     private ScriptObject newGlobalTrusted() {
         try {
             final Class<?> clazz = Class.forName("jdk.nashorn.internal.objects.Global", true, scriptLoader);
-            return (ScriptObject) clazz.newInstance();
-        } catch (final ClassNotFoundException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) {
+            final Constructor cstr = clazz.getConstructor(Context.class);
+            return (ScriptObject) cstr.newInstance(this);
+        } catch (final Exception e) {
             printStackTrace(e);
-            throw new RuntimeException(e);
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw new RuntimeException(e);
+            }
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/Debug.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Debug.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,7 +36,7 @@
  * Utilities for debugging Nashorn.
  *
  */
-public class Debug {
+public final class Debug {
     private Debug() {
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Mon Feb 11 21:26:06 2013 +0530
@@ -34,7 +34,7 @@
  * Wrapper class for Logging system. This is how you are supposed to register a logger and use it
  */
 
-public class DebugLogger {
+public final class DebugLogger {
     @SuppressWarnings("NonConstantLogger")
     private final Logger  logger;
     private final boolean isEnabled;
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,7 +37,7 @@
  * These are actual implementation methods for functions exposed by global
  * scope. The code lives here to share the code across the contexts.
  */
-public class GlobalFunctions {
+public final class GlobalFunctions {
 
     /** Methodhandle to implementation of ECMA 15.1.2.2, parseInt */
     public static final MethodHandle PARSEINT = findOwnMH("parseInt",   double.class, Object.class, Object.class, Object.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import static jdk.nashorn.internal.runtime.ScriptObject.isArray;
+
+import java.lang.invoke.MethodHandle;
+import java.util.Iterator;
+import java.util.List;
+import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.ir.Node;
+import jdk.nashorn.internal.ir.ObjectNode;
+import jdk.nashorn.internal.ir.PropertyNode;
+import jdk.nashorn.internal.ir.UnaryNode;
+import jdk.nashorn.internal.parser.JSONParser;
+import jdk.nashorn.internal.parser.TokenType;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
+
+/**
+ * Utilities used by "JSON" object implementation.
+ */
+public final class JSONFunctions {
+    private JSONFunctions() {}
+    private static final MethodHandle REVIVER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
+            ScriptFunction.class, ScriptObject.class, String.class, Object.class);
+
+    /**
+     * Returns JSON-compatible quoted version of the given string.
+     *
+     * @param str String to be quoted
+     * @return JSON-compatible quoted string
+     */
+    public static String quote(final String str) {
+        return JSONParser.quote(str);
+    }
+
+    /**
+     * Parses the given JSON text string and returns object representation.
+     *
+     * @param text JSON text to be parsed
+     * @param reviver  optional value: function that takes two parameters (key, value)
+     * @return Object representation of JSON text given
+     */
+    public static Object parse(final Object text, final Object reviver) {
+        final String     str     = JSType.toString(text);
+        final Context    context = Context.getContextTrusted();
+        final JSONParser parser  = new JSONParser(
+                new Source("<json>", str),
+                new Context.ThrowErrorManager(),
+                (context != null) ?
+                    context._strict :
+                    false);
+
+        Node node;
+
+        try {
+            node = parser.parse();
+        } catch (final ParserException e) {
+            ECMAErrors.syntaxError(e, "invalid.json", e.getMessage());
+            return ScriptRuntime.UNDEFINED;
+        }
+
+        final ScriptObject global = Context.getGlobalTrusted();
+        Object unfiltered = convertNode(global, node);
+        return applyReviver(global, unfiltered, reviver);
+    }
+
+    // -- Internals only below this point
+
+    // parse helpers
+
+    // apply 'reviver' function if available
+    private static Object applyReviver(final ScriptObject global, final Object unfiltered, final Object reviver) {
+        if (reviver instanceof ScriptFunction) {
+            assert global instanceof GlobalObject;
+            final ScriptObject root = ((GlobalObject)global).newObject();
+            root.set("", unfiltered, root.isStrictContext());
+            return walk(root, "", (ScriptFunction)reviver);
+        }
+        return unfiltered;
+    }
+
+    // This is the abstract "Walk" operation from the spec.
+    private static Object walk(final ScriptObject holder, final Object name, final ScriptFunction reviver) {
+        final Object val = holder.get(name);
+        if (val == ScriptRuntime.UNDEFINED) {
+            return val;
+        } else if (val instanceof ScriptObject) {
+            final ScriptObject     valueObj = (ScriptObject)val;
+            final boolean          strict   = valueObj.isStrictContext();
+            final Iterator<String> iter     = valueObj.propertyIterator();
+
+            while (iter.hasNext()) {
+                final String key        = iter.next();
+                final Object newElement = walk(valueObj, key, reviver);
+
+                if (newElement == ScriptRuntime.UNDEFINED) {
+                    valueObj.delete(key, strict);
+                } else {
+                    valueObj.set(key, newElement, strict);
+                }
+            }
+
+            return valueObj;
+        } else if (isArray(val)) {
+            final ScriptObject      valueArray = (ScriptObject)val;
+            final boolean          strict     = valueArray.isStrictContext();
+            final Iterator<String> iter       = valueArray.propertyIterator();
+
+            while (iter.hasNext()) {
+                final String key        = iter.next();
+                final Object newElement = walk(valueArray, valueArray.get(key), reviver);
+
+                if (newElement == ScriptRuntime.UNDEFINED) {
+                    valueArray.delete(key, strict);
+                } else {
+                    valueArray.set(key, newElement, strict);
+                }
+            }
+            return valueArray;
+        } else {
+            try {
+                // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
+                return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
+            } catch(Error|RuntimeException t) {
+                throw t;
+            } catch(final Throwable t) {
+                throw new RuntimeException(t);
+            }
+        }
+    }
+
+    // Converts IR node to runtime value
+    private static Object convertNode(final ScriptObject global, final Node node) {
+        assert global instanceof GlobalObject;
+
+        if (node instanceof LiteralNode) {
+            // check for array literal
+            if (node.tokenType() == TokenType.ARRAY) {
+                assert node instanceof LiteralNode.ArrayLiteralNode;
+                final Node[] elements = ((LiteralNode.ArrayLiteralNode)node).getValue();
+
+                // NOTE: We cannot use LiteralNode.isNumericArray() here as that
+                // method uses symbols of element nodes. Since we don't do lower
+                // pass, there won't be any symbols!
+                if (isNumericArray(elements)) {
+                    final double[] values = new double[elements.length];
+                    int   index = 0;
+
+                    for (final Node elem : elements) {
+                        values[index++] = JSType.toNumber(convertNode(global, elem));
+                    }
+                    return ((GlobalObject)global).wrapAsObject(values);
+                }
+
+                final Object[] values = new Object[elements.length];
+                int   index = 0;
+
+                for (final Node elem : elements) {
+                    values[index++] = convertNode(global, elem);
+                }
+
+                return ((GlobalObject)global).wrapAsObject(values);
+            }
+
+            return ((LiteralNode<?>)node).getValue();
+
+        } else if (node instanceof ObjectNode) {
+            final ObjectNode   objNode  = (ObjectNode) node;
+            final ScriptObject object   = ((GlobalObject)global).newObject();
+            final boolean      strict   = global.isStrictContext();
+            final List<Node>   elements = objNode.getElements();
+
+            for (final Node elem : elements) {
+                final PropertyNode pNode     = (PropertyNode) elem;
+                final Node         valueNode = pNode.getValue();
+
+                object.set(pNode.getKeyName(), convertNode(global, valueNode), strict);
+            }
+
+            return object;
+        } else if (node instanceof UnaryNode) {
+            // UnaryNode used only to represent negative number JSON value
+            final UnaryNode unaryNode = (UnaryNode)node;
+            return -((LiteralNode<?>)unaryNode.rhs()).getNumber();
+        } else {
+            return null;
+        }
+    }
+
+    // does the given IR node represent a numeric array?
+    private static boolean isNumericArray(final Node[] values) {
+        for (final Node node : values) {
+            if (node instanceof LiteralNode && ((LiteralNode<?>)node).getValue() instanceof Number) {
+                continue;
+            }
+            return false;
+        }
+        return true;
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/runtime/Logging.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Logging.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  * specified on the command line. Supports all standard log levels
  *
  */
-public class Logging {
+public final class Logging {
 
     private Logging() {
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java	Mon Feb 11 21:26:06 2013 +0530
@@ -51,13 +51,16 @@
         this.context = context;
     }
 
+
     /**
-     * Override loadClass so that we can checkPackageAccess.
+     * Called by subclass after package access check is done
+     * @param name name of the class to be loaded
+     * @param resolve whether the class should be resolved or not
+     * @return Class object
+     * @throws ClassNotFoundException
      */
-    @Override
-    public Class<?> loadClass(final String name) throws ClassNotFoundException {
-        checkPackageAccess(name);
-        return super.loadClass(name);
+    protected final Class<?> loadClassTrusted(final String name, final boolean resolve) throws ClassNotFoundException {
+        return super.loadClass(name, resolve);
     }
 
     protected static void checkPackageAccess(final String name) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Mon Feb 11 21:26:06 2013 +0530
@@ -64,7 +64,7 @@
  * var ftype4 = Java.asType("java.awt.geom.Arc2D").Float
  * </pre>
  */
-public class NativeJavaPackage extends ScriptObject {
+public final class NativeJavaPackage extends ScriptObject {
     /** Full name of package (includes path.) */
     private final String name;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RegExp.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import static java.util.regex.Pattern.CASE_INSENSITIVE;
+import static java.util.regex.Pattern.MULTILINE;
+import static java.util.regex.Pattern.UNICODE_CASE;
+
+import java.util.HashSet;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * This class is used to represent a parsed regular expression. Accepts input
+ * pattern string and flagString. This is used by AbstractParser to validate
+ * RegExp literals as well as by NativeRegExp to parse RegExp constructor arguments.
+ */
+public final class RegExp {
+    /** Pattern string. */
+    private final String input;
+
+    /** Global search flag for this regexp.*/
+    private boolean global;
+
+    /** Case insensitive flag for this regexp */
+    private boolean ignoreCase;
+
+    /** Multi-line flag for this regexp */
+    private boolean multiline;
+
+    /** Java regexp pattern to use for match. We compile to one of these */
+    private Pattern pattern;
+
+    /** BitVector that keeps track of groups in negative lookahead */
+    private BitVector groupsInNegativeLookahead;
+
+    /**
+     * Creates RegExpLiteral object from given input and flagString.
+     *
+     * @param input RegExp pattern string
+     * @param flagString RegExp flags
+     * @throws ParserException if flagString is invalid or input string has syntax error.
+     */
+    public RegExp(final String input, final String flagString) throws ParserException {
+        this.input = input;
+        final HashSet<Character> usedFlags = new HashSet<>();
+        int flags = 0;
+
+        for (final char ch : flagString.toCharArray()) {
+            if (usedFlags.contains(ch)) {
+                throwParserException("repeated.flag", Character.toString(ch));
+            }
+
+            switch (ch) {
+            case 'g':
+                this.global = true;
+                usedFlags.add(ch);
+                break;
+            case 'i':
+                this.ignoreCase = true;
+                flags |= CASE_INSENSITIVE | UNICODE_CASE;
+                usedFlags.add(ch);
+                break;
+            case 'm':
+                this.multiline = true;
+                flags |= MULTILINE;
+                usedFlags.add(ch);
+                break;
+            default:
+                throwParserException("unsupported.flag", Character.toString(ch));
+            }
+        }
+
+        try {
+            RegExpScanner parsed;
+
+            try {
+                parsed = RegExpScanner.scan(input);
+            } catch (final PatternSyntaxException e) {
+                // refine the exception with a better syntax error, if this
+                // passes, just rethrow what we have
+                Pattern.compile(input, flags);
+                throw e;
+            }
+
+            if (parsed != null) {
+                this.pattern = Pattern.compile(parsed.getJavaPattern(), flags);
+                this.groupsInNegativeLookahead = parsed.getGroupsInNegativeLookahead();
+            }
+        } catch (final PatternSyntaxException e2) {
+            throwParserException("syntax", e2.getMessage());
+        }
+
+    }
+
+    /**
+     * @return the input
+     */
+    public String getInput() {
+        return input;
+    }
+
+    /**
+     * @return the global
+     */
+    public boolean isGlobal() {
+        return global;
+    }
+
+    /**
+     * @return the ignoreCase
+     */
+    public boolean isIgnoreCase() {
+        return ignoreCase;
+    }
+
+    /**
+     * @return the multiline
+     */
+    public boolean isMultiline() {
+        return multiline;
+    }
+
+    /**
+     * @return the pattern
+     */
+    public Pattern getPattern() {
+        return pattern;
+    }
+
+    /**
+     * @return the groupsInNegativeLookahead
+     */
+    public BitVector getGroupsInNegativeLookahead() {
+        return groupsInNegativeLookahead;
+    }
+
+    /**
+     * Validation method for RegExp input and flagString - we don't care about the RegExp object
+     *
+     * @param input        regexp input
+     * @param flagString   flag string
+     *
+     * @throws ParserException if invalid regexp and flags
+     */
+    @SuppressWarnings({"unused", "ResultOfObjectAllocationIgnored"})
+    public static void validate(final String input, final String flagString) throws ParserException {
+        new RegExp(input, flagString);
+    }
+
+    private static void throwParserException(final String key, final String str) throws ParserException {
+        throw new ParserException(ECMAErrors.getMessage("parser.error.regex." + key, str));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RegExpScanner.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,1415 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.PatternSyntaxException;
+import jdk.nashorn.internal.parser.Lexer;
+import jdk.nashorn.internal.parser.Scanner;
+
+/**
+ * Scan a JavaScript regexp, converting to Java regex if necessary.
+ *
+ */
+final class RegExpScanner extends Scanner {
+
+    /**
+     * String builder to accumulate the result - this contains verbatim parsed JavaScript.
+     * to get the java equivalent we need to create a Pattern token and return its toString()
+     */
+    private final StringBuilder sb;
+
+    /** An optional error message if one occurred during parse. */
+    private String errorMessage;
+
+    /** Is this the special case of a regexp that never matches anything */
+    private boolean neverMatches;
+
+    /** The resulting java.util.regex pattern string. */
+    private String javaPattern;
+
+    /** Expected token table */
+    private final Map<Character, Integer> expected = new HashMap<>();
+
+    /** Capturing parenthesis that have been found so far. */
+    private final List<Capture> caps = new LinkedList<>();
+
+    /** Forward references to capturing parenthesis to be resolved later.*/
+    private final Map<Integer, Token> forwardReferences = new LinkedHashMap<>();
+
+    /** Current level of zero-width negative lookahead assertions. */
+    private int negativeLookaheadLevel;
+
+    private static final String NON_IDENT_ESCAPES = "$^*+(){}[]|\\.?";
+
+    private static class Capture {
+        /**
+         * Zero-width negative lookaheads enclosing the capture.
+         */
+        private final int negativeLookaheadLevel;
+        /**
+         * Captures that live inside a negative lookahead are dead after the
+         * lookahead and will be undefined if referenced from outside.
+         */
+        private boolean isDead;
+
+        Capture(final int negativeLookaheadLevel) {
+            this.negativeLookaheadLevel = negativeLookaheadLevel;
+        }
+
+        public int getNegativeLookaheadLevel() {
+            return negativeLookaheadLevel;
+        }
+
+        public boolean isDead() {
+            return isDead;
+        }
+
+        public void setDead() {
+            this.isDead = true;
+        }
+    }
+
+    /**
+     * This is a token - the JavaScript regexp is scanned into a token tree
+     * A token has other tokens as children as well as "atoms", i.e. Strings.
+     *
+     */
+    private static class Token {
+
+        private enum Type {
+            PATTERN,
+            DISJUNCTION,
+            ALTERNATIVE,
+            TERM,
+            ASSERTION,
+            QUANTIFIER,
+            QUANTIFIER_PREFIX,
+            ATOM,
+            PATTERN_CHARACTER,
+            ATOM_ESCAPE,
+            CHARACTER_ESCAPE,
+            CONTROL_ESCAPE,
+            CONTROL_LETTER,
+            IDENTITY_ESCAPE,
+            DECIMAL_ESCAPE,
+            CHARACTERCLASS_ESCAPE,
+            CHARACTERCLASS,
+            CLASSRANGES,
+            NON_EMPTY_CLASSRANGES,
+            NON_EMPTY_CLASSRANGES_NODASH,
+            CLASSATOM,
+            CLASSATOM_NODASH,
+            CLASS_ESCAPE,
+            DECIMALDIGITS,
+            HEX_ESCAPESEQUENCE,
+            UNICODE_ESCAPESEQUENCE,
+        }
+
+        /**
+         * Token tyoe
+         */
+        private final Token.Type type;
+
+        /**
+         * Child nodes
+         */
+        private final List<Object> children;
+
+        /**
+         * Parent node
+         */
+        private Token parent;
+
+        /**
+         * Dead code flag
+         */
+        private boolean isDead;
+
+        private static final Map<Type, ToString> toStringMap = new HashMap<>();
+        private static final ToString DEFAULT_TOSTRING = new ToString();
+
+        private static String unicode(final int value) {
+            final StringBuilder sb = new StringBuilder();
+            final String hex = Integer.toHexString(value);
+            sb.append('u');
+            for (int i = 0; i < 4 - hex.length(); i++) {
+                sb.append('0');
+            }
+            sb.append(hex);
+
+            return sb.toString();
+        }
+
+        static {
+            toStringMap.put(Type.CHARACTERCLASS, new ToString() {
+                @Override
+                public String toString(final Token token) {
+                    return super.toString(token).replace("\\b", "\b");
+                }
+            });
+
+            // for some reason java regexps don't like control characters on the
+            // form "\\ca".match([string with ascii 1 at char0]). Translating
+            // them to unicode does it though.
+            toStringMap.put(Type.CHARACTER_ESCAPE, new ToString() {
+                @Override
+                public String toString(final Token token) {
+                    final String str = super.toString(token);
+                    if (str.length() == 2) {
+                        return Token.unicode(Character.toLowerCase(str.charAt(1)) - 'a' + 1);
+                    }
+                    return str;
+                }
+            });
+
+            toStringMap.put(Type.DECIMAL_ESCAPE, new ToString() {
+                @Override
+                public String toString(final Token token) {
+                    final String str = super.toString(token);
+
+                    if ("\0".equals(str)) {
+                        return str;
+                    }
+
+                    int value;
+
+                    if (!token.hasParentOfType(Type.CLASSRANGES)) {
+                        return str;
+                    }
+
+                    value = Integer.parseInt(str, 8); //throws exception that leads to SyntaxError if not octal
+                    if (value > 0xff) {
+                        throw new NumberFormatException(str);
+                    }
+
+                    return Token.unicode(value);
+                }
+            });
+
+        }
+
+        /**
+         * JavaScript Token to Java regex substring framework.
+         *
+         */
+        private static class ToString {
+            String toString(final Token token) {
+                final StringBuilder sb = new StringBuilder();
+                for (final Object child : token.getChildren()) {
+                    sb.append(child);
+                }
+
+                //perform global substitutions that hold true for any evaluated form
+                String str = sb.toString();
+                switch (str) {
+                case "\\s":
+                    str = "[" + Lexer.getWhitespaceRegExp() + "]";
+                    break;
+                case "\\S":
+                    str = "[^" + Lexer.getWhitespaceRegExp() + "]";
+                    break;
+                case "[^]":
+                    str = "[\\s\\S]";
+                    break;
+                default:
+                    break;
+                }
+                return str;
+            }
+        }
+
+        /**
+         * Token iterator. Doesn't return "atom" children. i.e. string representations,
+         * just tokens
+         *
+         */
+        private static class TokenIterator implements Iterator<Token> {
+            private final List<Token> preorder;
+
+            private void init(final Token root) {
+                preorder.add(root);
+                for (final Object child : root.getChildren()) {
+                    if (child instanceof Token) {
+                        init((Token)child);
+                    }
+                }
+            }
+
+            TokenIterator(final Token root) {
+                preorder = new ArrayList<>();
+                init(root);
+            }
+
+            @Override
+            public boolean hasNext() {
+                return !preorder.isEmpty();
+            }
+
+            @Override
+            public Token next() {
+                return preorder.remove(0);
+            }
+
+            @Override
+            public void remove() {
+                next();
+            }
+        }
+
+        /**
+         * Constructor
+         * @param type the token type
+         */
+        Token(final Token.Type type) {
+            this.type = type;
+            children = new ArrayList<>();
+        }
+
+        /**
+         * Add a an "atom" child to a token
+         * @param child the child to add
+         * @return the token (for chaining)
+         */
+        public Token add(final String child) {
+            children.add(child);
+            return this;
+        }
+
+        /**
+         * Add a child to a token
+         * @param child the child
+         * @return the token (for chaining)
+         */
+        public Token add(final Token child) {
+            if (child != null) {
+                children.add(child);
+                child.setParent(this);
+            }
+            return this;
+        }
+
+        /**
+         * Remove a child from a token
+         * @param child the child to remove
+         * @return true if successful
+         */
+        public boolean remove(final Token child) {
+            return children.remove(child);
+        }
+
+        /**
+         * Remove the last child from a token
+         * @return the removed child
+         */
+        public Object removeLast() {
+            return children.remove(children.size() - 1);
+        }
+
+        /**
+         * Flag this token as dead code
+         * @param isDead is it dead or not
+         */
+        private void setIsDead(final boolean isDead) {
+            this.isDead = isDead;
+        }
+
+        /**
+         * Is this token dead code
+         * @return boolean
+         */
+        private boolean getIsDead() {
+            return isDead;
+        }
+
+        /**
+         * Get the parent of this token
+         * @return parent token
+         */
+        public Token getParent() {
+            return parent;
+        }
+
+        public boolean hasParentOfType(final Token.Type parentType) {
+            for (Token p = getParent(); p != null; p = p.getParent()) {
+                if (p.getType() == parentType) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public boolean hasChildOfType(final Token.Type childType) {
+            for (final Iterator<Token> iter = iterator() ; iter.hasNext() ; ) {
+                if (iter.next().getType() == childType) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /**
+         * Set the parent of this token
+         * @param parent
+         */
+        private void setParent(final Token parent) {
+            this.parent = parent;
+        }
+
+        /**
+         * Get the children of this token
+         * @return an array of children, never null
+         */
+        public Object[] getChildren() {
+            return children.toArray();
+        }
+
+        /**
+         * Reset this token, remove all children
+         */
+        public void reset() {
+            children.clear();
+        }
+
+        /**
+         * Get a preorder token iterator with this token as root
+         * @return an iterator
+         */
+        public Iterator<Token> iterator() {
+            return new TokenIterator(this);
+        }
+
+        /**
+         * Get the type of this token
+         * @return type
+         */
+        public Type getType() {
+            return type;
+        }
+
+        /**
+         * Turn this token into Java regexp compatible text
+         * @return part of a java regexp
+         */
+        @Override
+        public String toString() {
+            ToString t = toStringMap.get(getType());
+            if (t == null) {
+                t = DEFAULT_TOSTRING;
+            }
+            return t.toString(this);
+        }
+    }
+
+    /**
+     * Constructor
+     * @param string the JavaScript regexp to parse
+     */
+    private RegExpScanner(final String string) {
+        super(string);
+        sb = new StringBuilder(limit);
+        reset(0);
+        expected.put(']', 0);
+        expected.put('}', 0);
+    }
+
+    private void processForwardReferences() {
+        if (neverMatches()) {
+            return;
+        }
+
+        for (final Map.Entry<Integer, Token> fwdRef : forwardReferences.entrySet()) {
+            if (fwdRef.getKey().intValue() > caps.size()) {
+                neverMatches = true;
+                break;
+            }
+
+            fwdRef.getValue().setIsDead(true);
+        }
+
+        forwardReferences.clear();
+    }
+
+    /**
+     * Scan a JavaScript regexp string returning a Java safe regex string.
+     *
+     * @param string
+     *            JavaScript regexp string.
+     * @return Java safe regex string.
+     */
+    public static RegExpScanner scan(final String string) {
+        final RegExpScanner scanner = new RegExpScanner(string);
+
+        Token pattern;
+
+        try {
+            pattern = scanner.pattern();
+        } catch (final Exception e) {
+            throw new PatternSyntaxException(e.getMessage(), string, scanner.sb.length());
+        }
+
+        scanner.processForwardReferences();
+        if (scanner.neverMatches()) {
+            return null; // never matches
+        }
+
+        // go over the code and remove dead code
+        final Iterator<Token> iter = pattern.iterator();
+        while (iter.hasNext()) {
+            final Token next = iter.next();
+            if (next.getIsDead()) {
+                next.getParent().remove(next);
+            }
+        }
+
+        // turn the pattern into a string, p, the java equivalent string for our js regexp
+        final String p = pattern.toString();
+        // if builder contains all tokens that were sent in, we know
+        // we correctly parsed the entire JavaScript regexp without syntax errors
+        if (!string.equals(scanner.getStringBuilder().toString())) {
+            throw new PatternSyntaxException(string, p, p.length() + 1);
+        }
+
+        scanner.javaPattern = p;
+        return scanner;
+     }
+
+    /**
+     * Does this regexp ever match anything? Use of e.g. [], which is legal in JavaScript,
+     * is an example where we never match
+     *
+     * @return boolean
+     */
+    private boolean neverMatches() {
+        return neverMatches;
+    }
+
+    /**
+     * This is used to set better error messages that can be reused
+     * in NativeRegExp for augmenting e.g. SyntaxErrors.
+     *
+     * @return an error message or null if no extra info
+     */
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    final StringBuilder getStringBuilder() {
+        return sb;
+    }
+
+    String getJavaPattern() {
+        return javaPattern;
+    }
+
+    BitVector getGroupsInNegativeLookahead() {
+        BitVector vec = null;
+        for (int i = 0; i < caps.size(); i++) {
+            final Capture cap = caps.get(i);
+            if (cap.getNegativeLookaheadLevel() > 0) {
+                if (vec == null) {
+                    vec = new BitVector(caps.size() + 1);
+                }
+                vec.set(i + 1);
+            }
+        }
+        return vec;
+    }
+
+    /**
+     * Commit n characters to the builder and to a given token
+     * @param token Uncommitted token.
+     * @param n     Number of characters.
+     * @return Committed token
+     */
+    private Token commit(final Token token, final int n) {
+        final int startIn = position;
+
+        switch (n) {
+        case 1:
+            sb.append(ch0);
+            skip(1);
+            break;
+        case 2:
+            sb.append(ch0);
+            sb.append(ch1);
+            skip(2);
+            break;
+        case 3:
+            sb.append(ch0);
+            sb.append(ch1);
+            sb.append(ch2);
+            skip(3);
+            break;
+        default:
+            assert false : "Should not reach here";
+        }
+
+        if (token == null) {
+            return null;
+        }
+
+        return token.add(sb.substring(startIn, sb.length()));
+    }
+
+    /**
+     * Restart the buffers back at an earlier position.
+     *
+     * @param startIn
+     *            Position in the input stream.
+     * @param startOut
+     *            Position in the output stream.
+     */
+    private void restart(final int startIn, final int startOut) {
+        reset(startIn);
+        sb.setLength(startOut);
+    }
+
+    private void push(final char ch) {
+        expected.put(ch, expected.get(ch) + 1);
+    }
+
+    private void pop(final char ch) {
+        expected.put(ch, Math.min(0, expected.get(ch) - 1));
+    }
+
+    /*
+     * Recursive descent tokenizer starts below.
+     */
+
+    /*
+     * Pattern ::
+     *      Disjunction
+     */
+    private Token pattern() {
+        final Token token = new Token(Token.Type.PATTERN);
+
+        final Token child = disjunction();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        return null;
+    }
+
+    /*
+     * Disjunction ::
+     *      Alternative
+     *      Alternative | Disjunction
+     */
+    private Token disjunction() {
+        final Token token = new Token(Token.Type.DISJUNCTION);
+
+        while (true) {
+            token.add(alternative());
+
+            if (ch0 == '|') {
+                commit(token, 1);
+            } else {
+                break;
+            }
+        }
+
+        return token;
+    }
+
+    /*
+     * Alternative ::
+     *      [empty]
+     *      Alternative Term
+     */
+    private Token alternative() {
+        final Token token = new Token(Token.Type.ALTERNATIVE);
+
+        Token child;
+        while ((child = term()) != null) {
+            token.add(child);
+        }
+
+        return token;
+    }
+
+    /*
+     * Term ::
+     *      Assertion
+     *      Atom
+     *      Atom Quantifier
+     */
+    private Token term() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.TERM);
+        Token child;
+
+        child = assertion();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = atom();
+        if (child != null) {
+            boolean emptyCharacterClass = false;
+            if ("[]".equals(child.toString())) {
+                emptyCharacterClass = true;
+            }
+
+            token.add(child);
+
+            final Token quantifier = quantifier();
+            if (quantifier != null) {
+                token.add(quantifier);
+            }
+
+            if (emptyCharacterClass) {
+                if (quantifier == null) {
+                    neverMatches = true; //never matches ever.
+                } else {
+                    //if we can get away with max zero, remove this entire token
+                    final String qs = quantifier.toString();
+                    if ("+".equals(qs) || "*".equals(qs) || qs.startsWith("{0,")) {
+                        token.setIsDead(true);
+                    }
+                }
+            }
+
+            return token;
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * Assertion ::
+     *      ^
+     *      $
+     *      \b
+     *      \B
+     *      ( ? = Disjunction )
+     *      ( ? ! Disjunction )
+     */
+    private Token assertion() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.ASSERTION);
+
+        switch (ch0) {
+        case '^':
+        case '$':
+            return commit(token, 1);
+
+        case '\\':
+            if (ch1 == 'b' || ch1 == 'B') {
+                return commit(token, 2);
+            }
+            break;
+
+        case '(':
+            if (ch1 != '?') {
+                break;
+            }
+            if (ch2 != '=' && ch2 != '!') {
+                break;
+            }
+            final boolean isNegativeLookahead = (ch2 == '!');
+            commit(token, 3);
+
+            if (isNegativeLookahead) {
+                negativeLookaheadLevel++;
+            }
+            final Token disjunction = disjunction();
+            if (isNegativeLookahead) {
+                for (final Capture cap : caps) {
+                    if (cap.getNegativeLookaheadLevel() >= negativeLookaheadLevel) {
+                        cap.setDead();
+                    }
+                }
+                negativeLookaheadLevel--;
+            }
+
+            if (disjunction != null && ch0 == ')') {
+                token.add(disjunction);
+                return commit(token, 1);
+            }
+            break;
+
+        default:
+            break;
+        }
+
+        restart(startIn, startOut);
+
+        return null;
+    }
+
+    /*
+     * Quantifier ::
+     *      QuantifierPrefix
+     *      QuantifierPrefix ?
+     */
+    private Token quantifier() {
+        final Token token = new Token(Token.Type.QUANTIFIER);
+        final Token child = quantifierPrefix();
+        if (child != null) {
+            token.add(child);
+            if (ch0 == '?') {
+                commit(token, 1);
+            }
+            return token;
+        }
+        return null;
+    }
+
+    /*
+     * QuantifierPrefix ::
+     *      *
+     *      +
+     *      ?
+     *      { DecimalDigits }
+     *      { DecimalDigits , }
+     *      { DecimalDigits , DecimalDigits }
+     */
+    private Token quantifierPrefix() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.QUANTIFIER_PREFIX);
+
+        switch (ch0) {
+        case '*':
+        case '+':
+        case '?':
+            return commit(token, 1);
+
+        case '{':
+            commit(token, 1);
+
+            final Token child = decimalDigits();
+            if (child == null) {
+                break; // not a quantifier - back out
+            }
+            push('}');
+            token.add(child);
+
+            if (ch0 == ',') {
+                commit(token, 1);
+                token.add(decimalDigits());
+            }
+
+            if (ch0 == '}') {
+                pop('}');
+                commit(token, 1);
+            }
+
+            return token;
+
+        default:
+            break;
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * Atom ::
+     *      PatternCharacter
+     *      .
+     *      \ AtomEscape
+     *      CharacterClass
+     *      ( Disjunction )
+     *      ( ? : Disjunction )
+     *
+     */
+    private Token atom() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.ATOM);
+        Token child;
+
+        child = patternCharacter();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        if (ch0 == '.') {
+            return commit(token, 1);
+        }
+
+        if (ch0 == '\\') {
+            commit(token, 1);
+            child = atomEscape();
+
+            if (child != null) {
+                if (child.hasChildOfType(Token.Type.IDENTITY_ESCAPE)) {
+                    final char idEscape = child.toString().charAt(0);
+                    if (NON_IDENT_ESCAPES.indexOf(idEscape) == -1) {
+                        token.reset();
+                    }
+                }
+
+                token.add(child);
+
+                // forward backreferences always match empty. JavaScript != Java
+                if (child.hasChildOfType(Token.Type.DECIMAL_ESCAPE) && !"\u0000".equals(child.toString())) {
+                    final int refNum = Integer.parseInt(child.toString());
+
+                    if (refNum - 1 < caps.size() && caps.get(refNum - 1).isDead()) {
+                        // reference to dead in-negative-lookahead capture
+                        token.setIsDead(true);
+                    } else if (caps.size() < refNum) {
+                        // forward reference: always matches against empty string (dead token).
+                        // invalid reference (non-existant capture): pattern never matches.
+                        forwardReferences.put(refNum, token);
+                    }
+                }
+
+                return token;
+            }
+        }
+
+        child = characterClass();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        if (ch0 == '(') {
+            boolean capturingParens = true;
+            commit(token, 1);
+            if (ch0 == '?' && ch1 == ':') {
+                capturingParens = false;
+                commit(token, 2);
+            }
+
+            child = disjunction();
+            if (child != null) {
+                token.add(child);
+                if (ch0 == ')') {
+                    final Token atom = commit(token, 1);
+                    if (capturingParens) {
+                        caps.add(new Capture(negativeLookaheadLevel));
+                    }
+                    return atom;
+                }
+            }
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * PatternCharacter ::
+     *      SourceCharacter but not any of: ^$\.*+?()[]{}|
+     */
+    @SuppressWarnings("fallthrough")
+    private Token patternCharacter() {
+        if (atEOF()) {
+            return null;
+        }
+
+        switch (ch0) {
+        case '^':
+        case '$':
+        case '\\':
+        case '.':
+        case '*':
+        case '+':
+        case '?':
+        case '(':
+        case ')':
+        case '[':
+        case '|':
+            return null;
+
+        case '}':
+        case ']':
+            final int n = expected.get(ch0);
+            if (n != 0) {
+                return null;
+            }
+
+       case '{':
+           // if not a valid quantifier escape curly brace to match itself
+           // this ensures compatibility with other JS implementations
+           final Token quant = quantifierPrefix();
+           return (quant == null) ? commit(new Token(Token.Type.PATTERN_CHARACTER).add("\\"), 1) : null;
+
+        default:
+            return commit(new Token(Token.Type.PATTERN_CHARACTER), 1); // SOURCECHARACTER
+        }
+    }
+
+    /*
+     * AtomEscape ::
+     *      DecimalEscape
+     *      CharacterEscape
+     *      CharacterClassEscape
+     */
+    private Token atomEscape() {
+        final Token token = new Token(Token.Type.ATOM_ESCAPE);
+        Token child;
+
+        child = decimalEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = characterClassEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = characterEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+
+        return null;
+    }
+
+    /*
+     * CharacterEscape ::
+     *      ControlEscape
+     *      c ControlLetter
+     *      HexEscapeSequence
+     *      UnicodeEscapeSequence
+     *      IdentityEscape
+     */
+    private Token characterEscape() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+
+        final Token token = new Token(Token.Type.CHARACTER_ESCAPE);
+        Token child;
+
+        child = controlEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        if (ch0 == 'c') {
+            commit(token, 1);
+            child = controlLetter();
+            if (child != null) {
+                return token.add(child);
+            }
+            restart(startIn, startOut);
+        }
+
+        child = hexEscapeSequence();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = unicodeEscapeSequence();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = identityEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        restart(startIn, startOut);
+
+        return null;
+    }
+
+    private boolean scanEscapeSequence(final char leader, final int length, final Token token) {
+        final int startIn  = position;
+        final int startOut = sb.length();
+
+        if (ch0 != leader) {
+            return false;
+        }
+
+        commit(token, 1);
+        for (int i = 0; i < length; i++) {
+            final char ch0l = Character.toLowerCase(ch0);
+            if ((ch0l >= 'a' && ch0l <= 'f') || isDecimalDigit(ch0)) {
+                commit(token, 1);
+            } else {
+                restart(startIn, startOut);
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    private Token hexEscapeSequence() {
+        final Token token = new Token(Token.Type.HEX_ESCAPESEQUENCE);
+        if (scanEscapeSequence('x', 2, token)) {
+            return token;
+        }
+        return null;
+    }
+
+    private Token unicodeEscapeSequence() {
+        final Token token = new Token(Token.Type.UNICODE_ESCAPESEQUENCE);
+        if (scanEscapeSequence('u', 4, token)) {
+            return token;
+        }
+        return null;
+    }
+
+    /*
+     * ControlEscape ::
+     *      one of fnrtv
+     */
+    private Token controlEscape() {
+        switch (ch0) {
+        case 'f':
+        case 'n':
+        case 'r':
+        case 't':
+        case 'v':
+            return commit(new Token(Token.Type.CONTROL_ESCAPE), 1);
+
+        default:
+            return null;
+        }
+    }
+
+    /*
+     * ControlLetter ::
+     *      one of abcdefghijklmnopqrstuvwxyz
+     *      ABCDEFGHIJKLMNOPQRSTUVWXYZ
+     */
+    private Token controlLetter() {
+        final char c = Character.toUpperCase(ch0);
+        if (c >= 'A' && c <= 'Z') {
+            final Token token = new Token(Token.Type.CONTROL_LETTER);
+            commit(token, 1);
+            return token;
+        }
+        return null;
+        /*
+        Token token = new Token(Token.Type.CONTROL_LETTER);
+        commit(null, 1);//add original char to builder not to token
+        this.neverMatches = c < 'A' || c > 'Z';
+        return token.add(""+c);*/
+    }
+
+    /*
+     * IdentityEscape ::
+     *      SourceCharacter but not IdentifierPart
+     *      <ZWJ>  (200c)
+     *      <ZWNJ> (200d)
+     */
+    private Token identityEscape() {
+        final Token token = new Token(Token.Type.IDENTITY_ESCAPE);
+        commit(token, 1);
+        return token;
+    }
+
+    /*
+     * DecimalEscape ::
+     *      DecimalIntegerLiteral [lookahead DecimalDigit]
+     */
+    private Token decimalEscape() {
+        final Token token = new Token(Token.Type.DECIMAL_ESCAPE);
+        final int startIn  = position;
+        final int startOut = sb.length();
+
+        if (ch0 == '0' && !isDecimalDigit(ch1)) {
+            commit(token, 1);
+            token.removeLast();
+            //  DecimalEscape :: 0. If i is zero, return the EscapeValue consisting of a <NUL> character (Unicodevalue0000);
+            return token.add("\u0000");
+        }
+
+        if (isDecimalDigit(ch0)) {
+            while (isDecimalDigit(ch0)) {
+                commit(token, 1);
+            }
+            return token;
+        }
+
+        restart(startIn, startOut);
+
+        return null;
+    }
+
+    /*
+     * CharacterClassEscape ::
+     *  one of dDsSwW
+     */
+    private Token characterClassEscape() {
+        switch (ch0) {
+        case 's':
+        case 'S':
+        case 'd':
+        case 'D':
+        case 'w':
+        case 'W':
+            return commit(new Token(Token.Type.CHARACTERCLASS_ESCAPE), 1);
+
+        default:
+            return null;
+        }
+    }
+
+    /*
+     * CharacterClass ::
+     *      [ [lookahead {^}] ClassRanges ]
+     *      [ ^ ClassRanges ]
+     */
+    private Token characterClass() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.CHARACTERCLASS);
+
+        if (ch0 == '[') {
+            push(']');
+            commit(token, 1);
+
+            if (ch0 == '^') {
+                commit(token, 1);
+            }
+
+            final Token child = classRanges();
+            if (child != null && ch0 == ']') {
+                pop(']');
+                token.add(child);
+                return commit(token, 1);
+            }
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * ClassRanges ::
+     *      [empty]
+     *      NonemptyClassRanges
+     */
+    private Token classRanges() {
+        return new Token(Token.Type.CLASSRANGES).add(nonemptyClassRanges());
+    }
+
+    /*
+     * NonemptyClassRanges ::
+     *      ClassAtom
+     *      ClassAtom NonemptyClassRangesNoDash
+     *      ClassAtom - ClassAtom ClassRanges
+     */
+    private Token nonemptyClassRanges() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.NON_EMPTY_CLASSRANGES);
+        Token child;
+
+        child = classAtom();
+        if (child != null) {
+            token.add(child);
+
+            if (ch0 == '-') {
+                commit(token, 1);
+
+                final Token child1 = classAtom();
+                final Token child2 = classRanges();
+                if (child1 != null && child2 != null) {
+                    token.add(child1);
+                    token.add(child2);
+
+                    return token;
+                }
+            }
+
+            child = nonemptyClassRangesNoDash();
+            if (child != null) {
+                token.add(child);
+                return token;
+            }
+
+            return token;
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * NonemptyClassRangesNoDash ::
+     *      ClassAtom
+     *      ClassAtomNoDash NonemptyClassRangesNoDash
+     *      ClassAtomNoDash - ClassAtom ClassRanges
+     */
+    private Token nonemptyClassRangesNoDash() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.NON_EMPTY_CLASSRANGES_NODASH);
+        Token child;
+
+        child = classAtomNoDash();
+        if (child != null) {
+            token.add(child);
+
+            // need to check dash first, as for e.g. [a-b|c-d] will otherwise parse - as an atom
+            if (ch0 == '-') {
+               commit(token, 1);
+
+               final Token child1 = classAtom();
+               final Token child2 = classRanges();
+               if (child1 != null && child2 != null) {
+                   token.add(child1);
+                   return token.add(child2);
+               }
+               //fallthru
+           }
+
+            child = nonemptyClassRangesNoDash();
+            if (child != null) {
+                token.add(child);
+            }
+            return token; // still a class atom
+        }
+
+        child = classAtom();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        restart(startIn, startOut);
+        return null;
+    }
+
+    /*
+     * ClassAtom : - ClassAtomNoDash
+     */
+    private Token classAtom() {
+        final Token token = new Token(Token.Type.CLASSATOM);
+
+        if (ch0 == '-') {
+            return commit(token, 1);
+        }
+
+        final Token child = classAtomNoDash();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        return null;
+    }
+
+    /*
+     * ClassAtomNoDash ::
+     *      SourceCharacter but not one of \ or ] or -
+     *      \ ClassEscape
+     */
+    private Token classAtomNoDash() {
+        final int startIn  = position;
+        final int startOut = sb.length();
+        final Token token  = new Token(Token.Type.CLASSATOM_NODASH);
+
+        switch (ch0) {
+        case ']':
+        case '-':
+        case '\0':
+            return null;
+
+        case '[':
+            // unescaped left square bracket - add escape
+            return commit(token.add("\\"), 1);
+
+        case '\\':
+            commit(token, 1);
+            final Token child = classEscape();
+            if (child != null) {
+                return token.add(child);
+            }
+
+            restart(startIn, startOut);
+            return null;
+
+        default:
+            return commit(token, 1);
+        }
+    }
+
+    /*
+     * ClassEscape ::
+     *      DecimalEscape
+     *      b
+     *      CharacterEscape
+     *      CharacterClassEscape
+     */
+    private Token classEscape() {
+        final Token token = new Token(Token.Type.CLASS_ESCAPE);
+        Token child;
+
+        child = decimalEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        if (ch0 == 'b') {
+            return commit(token, 1);
+        }
+
+        child = characterEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        child = characterClassEscape();
+        if (child != null) {
+            return token.add(child);
+        }
+
+        return null;
+    }
+
+    /*
+     * DecimalDigits
+     */
+    private Token decimalDigits() {
+        if (!isDecimalDigit(ch0)) {
+            return null;
+        }
+
+        final Token token = new Token(Token.Type.DECIMALDIGITS);
+        while (isDecimalDigit(ch0)) {
+            commit(token, 1);
+        }
+
+        return token;
+    }
+
+    private static boolean isDecimalDigit(final char ch) {
+        return ch >= '0' && ch <= '9';
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Mon Feb 11 21:26:06 2013 +0530
@@ -377,7 +377,7 @@
      * @param args other arguments (beside self) to bind the function to
      * @return the bound function
      */
-    public abstract ScriptFunction makeBoundFunction(Object self, Object[] args);
+    protected abstract ScriptFunction makeBoundFunction(Object self, Object[] args);
 
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Mon Feb 11 21:26:06 2013 +0530
@@ -38,7 +38,7 @@
  * Instances of this class are created during codegen and stored in script classes'
  * constants array to reduce function instantiation overhead during runtime.
  */
-public class ScriptFunctionData {
+public final class ScriptFunctionData {
 
     // per-function object flags
     private static final int IS_STRICT  = 0b0000_0001;
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Mon Feb 11 21:26:06 2013 +0530
@@ -28,34 +28,17 @@
 import java.security.CodeSource;
 
 /**
- * Responsible for loading generated and disk based classes.
+ * Responsible for loading script generated classes.
  *
  */
 final class ScriptLoader extends NashornLoader {
     /**
      * Constructor.
      */
-    ScriptLoader(final ClassLoader parent, final Context context) {
+    ScriptLoader(final StructureLoader parent, final Context context) {
         super(parent, context);
     }
 
-    @Override
-    protected synchronized Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
-        checkPackageAccess(name);
-
-        // check the cache first
-        Class<?> cl = findLoadedClass(name);
-        if (cl == null) {
-            cl = getParent().loadClass(name);
-        }
-
-        if (resolve) {
-            resolveClass(cl);
-        }
-
-        return cl;
-    }
-
     // package-private and private stuff below this point
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Feb 11 21:26:06 2013 +0530
@@ -1053,7 +1053,7 @@
      * Return the current context from the object's map.
      * @return Current context.
      */
-    protected final Context getContext() {
+    final Context getContext() {
         return getMap().getContext();
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Mon Feb 11 21:26:06 2013 +0530
@@ -36,8 +36,11 @@
 import java.lang.reflect.Array;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 import java.util.Objects;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
+import jdk.nashorn.internal.ir.debug.JSONWriter;
+import jdk.nashorn.internal.parser.Lexer;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import org.dynalang.dynalink.beans.StaticClass;
 
@@ -265,6 +268,9 @@
 
                 @Override
                 public Object next() {
+                    if (index >= length) {
+                        throw new NoSuchElementException();
+                    }
                     return Array.get(array, index++);
                 }
 
@@ -377,6 +383,28 @@
     }
 
     /**
+     * Returns AST as JSON compatible string. This is used to
+     * implement "parse" function in resources/parse.js script.
+     *
+     * @param code code to be parsed
+     * @param name name of the code source (used for location)
+     * @param includeLoc tells whether to include location information for nodes or not
+     * @return JSON string representation of AST of the supplied code
+     */
+    public static String parse(final String code, final String name, final boolean includeLoc) {
+        return JSONWriter.parse(Context.getContextTrusted(), code, name, includeLoc);
+    }
+
+    /**
+     * Test whether a char is valid JavaScript whitespace
+     * @param ch a char
+     * @return true if valid JavaScript whitespace
+     */
+    public static boolean isJSWhitespace(final char ch) {
+        return Lexer.isJSWhitespace(ch);
+    }
+
+    /**
      * Entering a {@code with} node requires new scope. This is the implementation
      *
      * @param scope      existing scope
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Mon Feb 11 21:26:06 2013 +0530
@@ -37,15 +37,13 @@
 import java.io.OutputStream;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
-import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
 import java.util.StringTokenizer;
 
 /**
  * Global functions supported only in scripting mode.
  */
-public class ScriptingFunctions {
+public final class ScriptingFunctions {
 
     /** Handle to implementation of {@link ScriptingFunctions#readLine} - Nashorn extension */
     public static final MethodHandle READLINE = findOwnMH("readLine", Object.class, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Mon Feb 11 21:26:06 2013 +0530
@@ -43,7 +43,7 @@
  * {@link ScriptObject#findSetMethod(CallSiteDescriptor, org.dynalang.dynalink.linker.LinkRequest)} and
  * serve as the actual encapsulation of the algorithm for creating an appropriate property setter method.
  */
-class SetMethodCreator {
+final class SetMethodCreator {
     // See constructor parameters for description of fields
     private final ScriptObject sobj;
     private final PropertyMap map;
--- a/nashorn/src/jdk/nashorn/internal/runtime/StructureLoader.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/StructureLoader.java	Mon Feb 11 21:26:06 2013 +0530
@@ -104,7 +104,7 @@
             }
         }
 
-        return super.loadClass(name, resolve);
+        return super.loadClassTrusted(name, resolve);
     }
 
 
@@ -117,8 +117,6 @@
         return super.findClass(name);
     }
 
-    private static final boolean IS_JAVA_7 = System.getProperty("java.version").indexOf("1.7") != -1;
-
     /**
      * Generate a layout class.
      * @param name       Name of class.
@@ -133,13 +131,6 @@
         }
 
         final byte[] code = new ObjectClassGenerator(context).generate(descriptor);
-
-        try {
-            return IS_JAVA_7 ? sun.misc.Unsafe.getUnsafe().defineClass(name, code, 0, code.length) : defineClass(name, code, 0, code.length);
-        } catch (final SecurityException e) {
-            throw new AssertionError("Nashorn needs to run in the bootclasspath when using Java7, or the NoClassDefFoundError bug in Java7 will trigger." +
-                                     "(This may not be enough - it has been known to happen anyway. Please use Java8)");
-        }
-
+        return defineClass(name, code, 0, code.length);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Mon Feb 11 21:26:06 2013 +0530
@@ -40,7 +40,7 @@
  * This class supports the handling of scope in a with body.
  *
  */
-public class WithObject extends ScriptObject implements Scope {
+public final class WithObject extends ScriptObject implements Scope {
 
     private static final MethodHandle WITHEXPRESSIONFILTER = findOwnMH("withFilterExpression", Object.class, Object.class);
     private static final MethodHandle WITHSCOPEFILTER      = findOwnMH("withFilterScope",      Object.class, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java	Mon Feb 11 21:26:06 2013 +0530
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.internal.runtime.arrays;
 
+import java.util.NoSuchElementException;
+
 /**
  * Dummy array iterator that has no elements
  */
@@ -41,7 +43,7 @@
 
     @Override
     public Object next() {
-        return null;
+        throw new NoSuchElementException();
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Mon Feb 11 21:26:06 2013 +0530
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.runtime.arrays;
 
+import java.util.NoSuchElementException;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
@@ -71,6 +72,10 @@
 
     @Override
     public Object next() {
-        return indexInArray() ? obj.get(bumpIndex()) : null;
+        if (indexInArray()) {
+            return obj.get(bumpIndex());
+        }
+
+        throw new NoSuchElementException();
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Mon Feb 11 21:26:06 2013 +0530
@@ -29,9 +29,11 @@
 
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
+import jdk.nashorn.internal.codegen.RuntimeCallSite;
 import jdk.nashorn.internal.runtime.options.Options;
 import org.dynalang.dynalink.CallSiteDescriptor;
 import org.dynalang.dynalink.DynamicLinker;
@@ -80,6 +82,20 @@
     }
 
     /**
+     * Bootstrapper for a specialized Runtime call
+     *
+     * @param lookup       lookup
+     * @param initialName  initial name for callsite
+     * @param type         method type for call site
+     *
+     * @return callsite for a runtime node
+     */
+    public static CallSite runtimeBootstrap(final MethodHandles.Lookup lookup, final String initialName, final MethodType type) {
+        return new RuntimeCallSite(type, initialName);
+    }
+
+
+    /**
      * Returns a dynamic invoker for a specified dynamic operation. You can use this method to create a method handle
      * that when invoked acts completely as if it were a Nashorn-linked call site. An overview of available dynamic
      * operations can be found in the <a href="https://github.com/szegedi/dynalink/wiki/User-Guide-0.4">Dynalink User Guide</a>,
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/parser.js	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/parser.js	Mon Feb 11 21:26:06 2013 +0530
@@ -47,7 +47,7 @@
             code = arguments[0];
     }
 
-    var jsonStr = Packages.jdk.nashorn.internal.ir.debug.JSONWriter.parse(code, name, location);
+    var jsonStr = Packages.jdk.nashorn.internal.runtime.ScriptRuntime.parse(code, name, location);
     return JSON.parse(jsonStr,
         function (prop, value) {
             if (typeof(value) == 'string' && prop == "value") {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/sandbox/nashorninternals.js	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/**
+ * Test to check that nashorn "internal" classes in codegen, parser, ir 
+ * packages cannot * be accessed from sandbox scripts.
+ *
+ * @test
+ * @run
+ * @security
+ */
+
+function checkClass(name) {
+    try {
+        Java.type(name);
+        fail("should have thrown exception for: " + name);
+    } catch (e) {
+        if (! (e instanceof java.lang.SecurityException)) {
+            fail("Expected SecurityException, but got " + e);
+        }
+    }
+}
+
+// Not exhaustive - but a representative list of classes
+checkClass("jdk.nashorn.internal.codegen.Compiler");
+checkClass("jdk.nashorn.internal.codegen.objects.MapCreator");
+checkClass("jdk.nashorn.internal.codegen.types.Type");
+checkClass("jdk.nashorn.internal.ir.Node");
+checkClass("jdk.nashorn.internal.ir.FunctionNode");
+checkClass("jdk.nashorn.internal.ir.debug.JSONWriter");
+checkClass("jdk.nashorn.internal.ir.visitor.NodeVisitor");
+checkClass("jdk.nashorn.internal.parser.AbstractParser");
+checkClass("jdk.nashorn.internal.parser.Parser");
+checkClass("jdk.nashorn.internal.parser.JSONParser");
+checkClass("jdk.nashorn.internal.parser.Lexer");
+checkClass("jdk.nashorn.internal.parser.Scanner");
--- a/nashorn/test/script/trusted/JDK-8006529.js	Sat Feb 09 16:58:48 2013 +0100
+++ b/nashorn/test/script/trusted/JDK-8006529.js	Mon Feb 11 21:26:06 2013 +0530
@@ -29,23 +29,74 @@
  * @run
  */
 
+/*
+ * This test script depends on nashorn Compiler internals. It uses reflection
+ * to get access to private field and many public methods of Compiler and
+ * FunctionNode classes. Note that this is trusted code and access to such
+ * internal package classes and methods is okay. But, if you modify any 
+ * Compiler or FunctionNode class, you may have to revisit this script.
+ * We cannot use direct Java class (via dynalink bean linker) to Compiler
+ * and FunctionNode because of package-access check and so reflective calls.
+ */
+
+var Compiler       = Java.type("jdk.nashorn.internal.codegen.Compiler")
+var Context        = Java.type("jdk.nashorn.internal.runtime.Context")
+var Source         = Java.type("jdk.nashorn.internal.runtime.Source")
+var FunctionNode   = Java.type("jdk.nashorn.internal.ir.FunctionNode")
+
+// Compiler class methods and fields
+
+// Compiler.compile(Source, Context)
+var compilerMethod = Compiler.class.getMethod("compiler", Source.class, Context.class);
+// Compiler.compile()
+var compileMethod  = Compiler.class.getMethod("compile");
+
+// NOTE: private field. But this is a trusted test!
+// Compiler.functionNode
+var functionNodeField = Compiler.class.getDeclaredField("functionNode");
+functionNodeField.setAccessible(true);
+
+// FunctionNode methods
+
+// FunctionNode.getFunctions method
+var getFunctionsMethod = FunctionNode.class.getMethod("getFunctions");
+
+// These are method names of methods in FunctionNode class
+var allAssertionList = ['isVarArg', 'needsParentScope', 'needsCallee', 'needsScope', 'needsSelfSymbol', 'isSplit', 'hasEval', 'hasWith', 'hasDeepWithOrEval', 'varsInScope', 'isStrictMode']
+
+// corresponding Method objects of FunctionNode class
+var functionNodeMethods = {};
+// initialize FunctionNode methods
+(function() {
+    for (var f in allAssertionList) {
+        var method = allAssertionList[f];
+        functionNodeMethods[method] = FunctionNode.class.getMethod(method);
+    }
+})();
+
+// returns "script" functionNode from Compiler instance
+function getScriptNode(compiler) {
+    // compiler.functionNode
+    return functionNodeField.get(compiler);
+}
+
+// returns functionNode.getFunctions().get(0)
+function getFirstFunction(functionNode) {
+    // functionNode.getFunctions().get(0)
+    return getFunctionsMethod.invoke(functionNode).get(0);
+}
+
 // compile(script) -- compiles a script specified as a string with its 
 // source code, returns a jdk.nashorn.internal.ir.FunctionNode object 
 // representing it.
-var compile = (function() {
-    var Compiler       = Java.type("jdk.nashorn.internal.codegen.Compiler")
-    var Context        = Java.type("jdk.nashorn.internal.runtime.Context")
-    var Source         = Java.type("jdk.nashorn.internal.runtime.Source")
-    var CompilerAccess = Java.type("jdk.nashorn.internal.codegen.CompilerAccess")
-    return function(source) {
-	    var compiler = Compiler.compiler(new Source("<no name>", source), Context.getContext())
-        compiler.compile()
-        return CompilerAccess.getScriptNode(compiler)
-    }
-})();
+function compile(source) {
+   var compiler = compilerMethod.invoke(null,
+       new Source("<no name>", source), Context.getContext())
+   compileMethod.invoke(compiler);
+   return getScriptNode(compiler)
+};
 
 var allAssertions = (function() {
-    var allAssertionList = ['isVarArg', 'needsParentScope', 'needsCallee', 'needsScope', 'needsSelfSymbol', 'isSplit', 'hasEval', 'hasWith', 'hasDeepWithOrEval', 'varsInScope', 'isStrictMode']
     var allAssertions = {}
     for(var assertion in allAssertionList) {
         allAssertions[allAssertionList[assertion]] = true
@@ -53,6 +104,7 @@
     return allAssertions;
 })();
 
+
 // test(f[, assertions...]) tests whether all the specified assertions on the
 // passed function node are true.
 function test(f) {
@@ -66,10 +118,7 @@
     }
     for(var assertion in allAssertions) {
         var expectedValue = !!assertions[assertion]
-        if(f[assertion] == null) {
-            throw "Can't find " + assertion + " on " + f;
-        }
-        if(f[assertion]() !== expectedValue) {
+        if(functionNodeMethods[assertion].invoke(f) !== expectedValue) {
             throw "Expected " + assertion + " === " + expectedValue + " for " + f;
         }
     }
@@ -79,7 +128,7 @@
 // assertions are true in the first function in the given script; "script"
 // is a string with the source text of the script.
 function testFirstFn(script) {
-    arguments[0] = compile(script).functions[0]
+    arguments[0] = getFirstFunction(compile(script))
     test.apply(null, arguments)
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.Arrays;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class BooleanAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+    }
+
+    @Test
+    public void accessFieldBoolean() throws ScriptException {
+        e.eval("var p_boolean = o.publicBoolean;");
+        assertEquals(o.publicBoolean, e.get("p_boolean"));
+        assertEquals("boolean", e.eval("typeof p_boolean;"));
+        e.eval("o.publicBoolean = false;");
+        assertEquals(false, o.publicBoolean);
+    }
+
+    @Test
+    public void accessFieldBooleanArray() throws ScriptException {
+        e.eval("var p_boolean_array = o.publicBooleanArray;");
+        assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]"));
+        assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array")));
+        e.eval("var t_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+                "t_boolean_arr[0] = true;" +
+                "t_boolean_arr[1] = false;" +
+                "t_boolean_arr[2] = false;" +
+                "o.publicBooleanArray = t_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { true, false, false }, o.publicBooleanArray));
+        e.eval("o.publicBooleanArray[0] = false;");
+        assertEquals(false, o.publicBooleanArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldBoolean() throws ScriptException {
+        e.eval("var ps_boolean = SharedObject.publicStaticBoolean;");
+        assertEquals(SharedObject.publicStaticBoolean, e.get("ps_boolean"));
+        assertEquals("boolean", e.eval("typeof ps_boolean;"));
+        e.eval("SharedObject.publicStaticBoolean = false;");
+        assertEquals(false, SharedObject.publicStaticBoolean);
+    }
+
+    @Test
+    public void accessStaticFieldBooleanArray() throws ScriptException {
+        e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;");
+        assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]"));
+        assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array")));
+        e.eval("var ts_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+                "ts_boolean_arr[0] = true;" +
+                "ts_boolean_arr[1] = false;" +
+                "ts_boolean_arr[2] = true;" +
+                "SharedObject.publicStaticBooleanArray = ts_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { true, false, true }, SharedObject.publicStaticBooleanArray));
+        e.eval("SharedObject.publicStaticBooleanArray[0] = false;");
+        assertEquals(false, SharedObject.publicStaticBooleanArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldBoolean() throws ScriptException {
+        e.eval("var pf_boolean = o.publicFinalBoolean;");
+        assertEquals(o.publicFinalBoolean, e.get("pf_boolean"));
+        assertEquals("boolean", e.eval("typeof pf_boolean;"));
+        e.eval("o.publicFinalBoolean = false;");
+        assertEquals(true, o.publicFinalBoolean);
+    }
+
+    @Test
+    public void accessFinalFieldBooleanArray() throws ScriptException {
+        e.eval("var pf_boolean_array = o.publicFinalBooleanArray;");
+        assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]"));
+        assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array")));
+        e.eval("var tf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+                "tf_boolean_arr[0] = false;" +
+                "tf_boolean_arr[1] = false;" +
+                "tf_boolean_arr[2] = true;" +
+                "o.publicOFinalbjectArray = tf_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { false, false, true, false }, o.publicFinalBooleanArray));
+        e.eval("o.publicFinalBooleanArray[0] = true;");
+        assertEquals(true, o.publicFinalBooleanArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBoolean() throws ScriptException {
+        e.eval("var psf_boolean = SharedObject.publicStaticFinalBoolean;");
+        assertEquals(SharedObject.publicStaticFinalBoolean, e.get("psf_boolean"));
+        assertEquals("boolean", e.eval("typeof psf_boolean;"));
+        e.eval("SharedObject.publicStaticFinalBoolean = false;");
+        assertEquals(true, SharedObject.publicStaticFinalBoolean);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBooleanArray() throws ScriptException {
+        e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;");
+        assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]"));
+        assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array")));
+        e.eval("var tsf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+                "tsf_boolean_arr[0] = false;" +
+                "tsf_boolean_arr[1] = true;" +
+                "tsf_boolean_arr[2] = false;" +
+                "SharedObject.publicStaticFinalBooleanArray = tsf_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { false, true, false, false }, SharedObject.publicStaticFinalBooleanArray));
+        e.eval("SharedObject.publicStaticFinalBooleanArray[0] = true;");
+        assertEquals(true, SharedObject.publicStaticFinalBooleanArray[0]);
+    }
+
+    @Test
+    public void accessFieldBooleanBoxing() throws ScriptException {
+        e.eval("var p_boolean_box = o.publicBooleanBox;");
+        assertEquals(o.publicBooleanBox, e.get("p_boolean_box"));
+        assertEquals("boolean", e.eval("typeof p_boolean_box;"));
+        e.eval("o.publicBooleanBox = false;");
+        assertEquals(false, (boolean)o.publicBooleanBox);
+    }
+
+    @Test
+    public void accessStaticFieldBooleanBoxing() throws ScriptException {
+        e.eval("var ps_boolean_box = SharedObject.publicStaticBooleanBox;");
+        assertEquals(SharedObject.publicStaticBooleanBox, e.get("ps_boolean_box"));
+        assertEquals("boolean", e.eval("typeof ps_boolean_box;"));
+        e.eval("SharedObject.publicStaticBooleanBox = false;");
+        assertEquals(false, (boolean)SharedObject.publicStaticBooleanBox);
+    }
+
+    @Test
+    public void accessFinalFieldBooleanBoxing() throws ScriptException {
+        e.eval("var pf_boolean_box = o.publicFinalBooleanBox;");
+        assertEquals(o.publicFinalBooleanBox, e.get("pf_boolean_box"));
+        assertEquals("boolean", e.eval("typeof pf_boolean_box;"));
+        e.eval("o.publicFinalBooleanBox = false;");
+        assertEquals(true, (boolean)o.publicFinalBooleanBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBooleanBoxing() throws ScriptException {
+        e.eval("var psf_boolean_box = SharedObject.publicStaticFinalBooleanBox;");
+        assertEquals(SharedObject.publicStaticFinalBooleanBox, e.get("psf_boolean_box"));
+        assertEquals("boolean", e.eval("typeof psf_boolean_box;"));
+        e.eval("SharedObject.publicStaticFinalBooleanBox = false;");
+        assertEquals(true, (boolean)SharedObject.publicStaticFinalBooleanBox);
+    }
+
+    @Test
+    public void accessVolatileField() throws ScriptException {
+        e.eval("var pv_boolean = o.volatileBoolean;");
+        assertEquals(o.volatileBoolean, e.get("pv_boolean"));
+        assertEquals("boolean", e.eval("typeof pv_boolean;"));
+        e.eval("o.volatileBoolean = false;");
+        assertEquals(false, o.volatileBoolean);
+    }
+
+    @Test
+    public void accessTransientField() throws ScriptException {
+        e.eval("var pt_boolean = o.transientBoolean;");
+        assertEquals(o.transientBoolean, e.get("pt_boolean"));
+        assertEquals("boolean", e.eval("typeof pt_boolean;"));
+        e.eval("o.transientBoolean = false;");
+        assertEquals(false, o.transientBoolean);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,453 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Locale;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class MethodAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o.setEngine(e);
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.internal.access.Person;");
+    }
+
+    @Test
+    public void accessMethodthrowsCheckedException() throws ScriptException {
+        e.eval("try {" +
+                "    var a = java.lang.Long.parseLong('foo');" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "    var isNumberException = e instanceof java.lang.NumberFormatException;" +
+                "} finally {" +
+                "    var isFinalized = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals("Finally called", true, e.get("isFinalized"));
+        assertEquals("Type is NumberFormatException", true, e.get("isNumberException"));
+    }
+
+    @Test
+    public void accessMethodthrowsUnCheckedException() throws ScriptException {
+        e.eval("try {" +
+                "    var a = java.lang.String.valueOf(null);" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "    var isNumberException = e instanceof java.lang.NullPointerException;" +
+                "} finally {" +
+                "    var isFinalized = true;" +
+                "}");
+        assertEquals(true, e.get("isThrown"));
+        assertEquals(true, e.get("isFinalized"));
+        assertEquals(true, e.get("isNumberException"));
+    }
+
+    @Test
+    public void accessMethodStartsThread() throws ScriptException {
+        e.eval("o.methodStartsThread();");
+        assertEquals(false, o.isFinished);
+    }
+
+    @Test
+    public void accessStaticMethod() throws ScriptException {
+        assertEquals(10, e.eval("java.lang.Math.abs(-10);"));
+    }
+
+    @Test
+    public void accessSynchronousMethod() throws ScriptException {
+        e.eval("var v = new java.util.Vector();" + "v.add(10);" + "v.add(20);" + "v.add(30);");
+        assertEquals(10, e.eval("v[0]"));
+        assertEquals(20, e.eval("v[1]"));
+        assertEquals(30, e.eval("v[2]"));
+        assertEquals(3, e.eval("v.size()"));
+    }
+
+    @Test
+    public void accessStaticSynchronousMethod() throws ScriptException {
+        e.eval("var locales = java.util.Calendar.getAvailableLocales();");
+        final Locale[] locales = (Locale[])e.get("locales");
+        assertEquals(locales.length, Calendar.getAvailableLocales().length);
+    }
+
+    @Test
+    public void accessNativeMethod() throws ScriptException {
+        assertEquals(4.0, e.eval("java.lang.StrictMath.log10(10000);"));
+    }
+
+    @Test
+    public void accessConstructorOfAbstractClass() throws ScriptException {
+        e.eval("try {" +
+                "    var a = new java.util.AbstractList();" +
+                "    print('fail');" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals(true, e.get("isThrown"));
+    }
+
+    @Test
+    public void accessMethodVoid() throws ScriptException {
+        o.isAccessed = false;
+        e.eval("o.voidMethod();");
+        assertTrue(o.isAccessed);
+    }
+
+    @Test
+    public void accessMethodBoolean() throws ScriptException {
+        assertEquals(true, e.eval("o.booleanMethod(false);"));
+        assertEquals(false, e.eval("o.booleanMethod(true);"));
+        assertEquals(false, e.eval("o.booleanMethod('false');"));
+        assertEquals(true, e.eval("o.booleanMethod('');"));
+        assertEquals(true, e.eval("o.booleanMethod(0);"));
+    }
+
+    @Test
+    public void accessMethodInt() throws ScriptException {
+        assertEquals(0, e.eval("o.intMethod(0);"));
+        assertEquals(-200, e.eval("o.intMethod(-100);"));
+        assertEquals(0, e.eval("o.intMethod('0');"));
+        assertEquals(-200, e.eval("o.intMethod('-100');"));
+    }
+
+    @Test
+    public void accessMethodLong() throws ScriptException {
+        assertEquals((long)0, e.eval("o.longMethod(0);"));
+        assertEquals((long)400, e.eval("o.longMethod(200);"));
+        assertEquals((long) 0, e.eval("o.longMethod('0');"));
+        assertEquals((long) 400, e.eval("o.longMethod('200');"));
+    }
+
+    @Test
+    public void accessMethodByte() throws ScriptException {
+        assertEquals((byte) 0, e.eval("o.byteMethod(0);"));
+        assertEquals((byte) 10, e.eval("o.byteMethod(5);"));
+        assertEquals((byte) 0, e.eval("o.byteMethod('0');"));
+        assertEquals((byte) 10, e.eval("o.byteMethod('5');"));
+    }
+
+    @Test
+    public void accessMethodShort() throws ScriptException {
+        assertEquals((short)0, e.eval("o.shortMethod(0);"));
+        assertEquals((short)8000, e.eval("o.shortMethod(4000);"));
+        assertEquals((short) 0, e.eval("o.shortMethod('0');"));
+        assertEquals((short) 8000, e.eval("o.shortMethod('4000');"));
+    }
+
+    @Test
+    public void accessMethodChar() throws ScriptException {
+        assertEquals('A', e.eval("o.charMethod('a');"));
+        assertEquals('Z', e.eval("o.charMethod('z');"));
+        assertEquals(o.charMethod((char)0), e.eval("o.charMethod(0);"));
+        assertEquals(o.charMethod((char)3150), e.eval("o.charMethod(3150);"));
+    }
+
+    @Test
+    public void accessMethodFloat() throws ScriptException {
+        assertEquals(0.0f, e.eval("o.floatMethod(0.0);"));
+        assertEquals(4.2f, e.eval("o.floatMethod(2.1);"));
+        assertEquals(0.0f, e.eval("o.floatMethod('0.0');"));
+        assertEquals(4.2f, e.eval("o.floatMethod('2.1');"));
+    }
+
+    @Test
+    public void accessMethodDouble() throws ScriptException {
+        assertEquals(0.0, e.eval("o.doubleMethod(0.0);"));
+        assertEquals(14.0, e.eval("o.doubleMethod(7.0);"));
+        assertEquals(0.0, e.eval("o.doubleMethod('0.0');"));
+        assertEquals(14.0, e.eval("o.doubleMethod('7.0');"));
+    }
+
+    @Test
+    public void accessMethodBooleanBoxing() throws ScriptException {
+        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.FALSE);"));
+        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.TRUE);"));
+        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod('');"));
+        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod('false');"));
+    }
+
+    @Test
+    public void accessMethodIntBoxing() throws ScriptException {
+        assertEquals(0, e.eval("o.intBoxingMethod(0);"));
+        assertEquals(-200, e.eval("o.intBoxingMethod(-100);"));
+        assertTrue((int)e.eval("(new java.lang.Integer(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodLongBoxing() throws ScriptException {
+        assertEquals((long) 0, e.eval("o.longBoxingMethod(0);"));
+        assertEquals((long) 400, e.eval("o.longBoxingMethod(200);"));
+        assertTrue((int)e.eval("(new java.lang.Long(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodByteBoxing() throws ScriptException {
+        assertEquals((byte) 0, e.eval("o.byteBoxingMethod(0);"));
+        assertEquals((byte) 10, e.eval("o.byteBoxingMethod(5);"));
+        assertTrue((int)e.eval("(new java.lang.Byte(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodShortBoxing() throws ScriptException {
+        assertEquals((short) 0, e.eval("o.shortBoxingMethod(0);"));
+        assertEquals((short) 8000, e.eval("o.shortBoxingMethod(4000);"));
+        assertTrue((int)e.eval("(new java.lang.Short(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodCharBoxing() throws ScriptException {
+        assertEquals('A', e.eval("o.charBoxingMethod('a');"));
+        assertEquals('Z', e.eval("o.charBoxingMethod('z');"));
+        assertTrue((int)e.eval("(new java.lang.Character(2)).compareTo(10)") < 0);
+    }
+
+    @Test
+    public void accessMethodFloatBoxing() throws ScriptException {
+        assertEquals(0.0f, e.eval("o.floatBoxingMethod(0.0);"));
+        assertEquals(4.2f, e.eval("o.floatBoxingMethod(2.1);"));
+        assertTrue((int)e.eval("(new java.lang.Float(2.0)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodDoubleBoxing() throws ScriptException {
+        assertEquals(0.0, e.eval("o.doubleBoxingMethod(0.0);"));
+        assertEquals(14.0, e.eval("o.doubleBoxingMethod(7.0);"));
+        assertTrue((int)e.eval("(new java.lang.Double(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodString() throws ScriptException {
+        assertEquals("", e.eval("o.stringMethod('');"));
+        assertEquals("abcabc", e.eval("o.stringMethod('abc');"));
+    }
+
+    @Test
+    public void accessMethodObject() throws ScriptException {
+        e.put("so", new Person(5));
+        e.eval("var rso = o.objectMethod(so);");
+        assertEquals(new Person(10), e.get("rso"));
+    }
+
+    @Test
+    public void accessMethodBooleanArray() throws ScriptException {
+        assertTrue(Arrays.equals(o.booleanArrayMethod(o.publicBooleanArray), (boolean[])e.eval("o.booleanArrayMethod(o.publicBooleanArray);")));
+    }
+
+    @Test
+    public void accessMethodIntArray() throws ScriptException {
+        assertArrayEquals(o.intArrayMethod(o.publicIntArray), (int[])e.eval("o.intArrayMethod(o.publicIntArray);"));
+    }
+
+    @Test
+    public void accessMethodLongArray() throws ScriptException {
+        assertArrayEquals(o.longArrayMethod(o.publicLongArray), (long[])e.eval("o.longArrayMethod(o.publicLongArray);"));
+    }
+
+    @Test
+    public void accessMethodByteArray() throws ScriptException {
+        assertArrayEquals(o.byteArrayMethod(o.publicByteArray), (byte[])e.eval("o.byteArrayMethod(o.publicByteArray);"));
+    }
+
+    @Test
+    public void accessMethodShortArray() throws ScriptException {
+        assertArrayEquals(o.shortArrayMethod(o.publicShortArray), (short[])e.eval("o.shortArrayMethod(o.publicShortArray);"));
+    }
+
+    @Test
+    public void accessMethodCharArray() throws ScriptException {
+        assertArrayEquals(o.charArrayMethod(o.publicCharArray), (char[])e.eval("o.charArrayMethod(o.publicCharArray);"));
+    }
+
+    @Test
+    public void accessMethodFloatArray() throws ScriptException {
+        assertArrayEquals(o.floatArrayMethod(o.publicFloatArray), (float[])e.eval("o.floatArrayMethod(o.publicFloatArray);"), 1e-10f);
+    }
+
+    @Test
+    public void accessMethodDoubleArray() throws ScriptException {
+        assertArrayEquals(o.doubleArrayMethod(o.publicDoubleArray), (double[])e.eval("o.doubleArrayMethod(o.publicDoubleArray);"), 1e-10);
+    }
+
+    @Test
+    public void accessMethodStringArray() throws ScriptException {
+        assertArrayEquals(o.stringArrayMethod(o.publicStringArray), (String[])e.eval("o.stringArrayMethod(o.publicStringArray);"));
+    }
+
+    @Test
+    public void accessMethodObjectArray() throws ScriptException {
+        assertArrayEquals(o.objectArrayMethod(o.publicObjectArray), (Person[])e.eval("o.objectArrayMethod(o.publicObjectArray);"));
+    }
+
+    @Test
+    public void accessDefaultConstructor() throws ScriptException {
+        e.eval("var dc = new Packages.jdk.nashorn.internal.access.Person()");
+        assertEquals(new Person(), e.get("dc"));
+    }
+
+    @Test
+    public void accessCustomConstructor() throws ScriptException {
+        e.eval("var cc = new Packages.jdk.nashorn.internal.access.Person(17)");
+        assertEquals(new Person(17), e.get("cc"));
+    }
+
+    @Test
+    public void accessMethod2PrimitiveParams() throws ScriptException {
+        assertEquals(o.twoParamMethod(50, 40.0), e.eval("o.twoParamMethod(50,40);"));
+    }
+
+    @Test
+    public void accessMethod3PrimitiveParams() throws ScriptException {
+        assertEquals(o.threeParamMethod((short)10, 20L, 'b'), e.eval("o.threeParamMethod(10,20,'b');"));
+    }
+
+    @Test
+    public void accessMethod2ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(200), new Person(300) }, (Person[])e.eval("o.twoObjectParamMethod(new Person(300),new Person(200));"));
+    }
+
+    @Test
+    public void accessMethod3ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.threeObjectParamMethod(new Person(1),new Person(2),new Person(3));"));
+    }
+
+    @Test
+    public void accessMethod8ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.eightObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6),new Person(7),new Person(8));"));
+    }
+
+    @Test
+    public void accessMethod9ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.nineObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
+    }
+
+    @Test
+    public void accessMethodObjectEllipsis() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
+        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodObjectEllipsis()"));
+        assertArrayEquals(new Person[] { new Person(9) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(9))"));
+    }
+
+    @Test
+    public void accessMethodPrimitiveEllipsis() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(1), new Person(3), new Person(2) }, (Person[])e.eval("o.methodPrimitiveEllipsis(1,3,2);"));
+        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodPrimitiveEllipsis();"));
+        assertArrayEquals(o.methodPrimitiveEllipsis(9, 8, 7, 6, 5, 4, 3, 2, 1), (Person[])e.eval("o.methodPrimitiveEllipsis(9,8,7,6,5,4,3,2,1);"));
+    }
+
+    @Test
+    public void accessMethodMixedEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { new Person(1), 12, "hello", true }, (Object[])e.eval("o.methodMixedEllipsis(new Person(1),12,'hello',true);"));
+        assertArrayEquals(new Object[] {}, (Object[])e.eval("o.methodMixedEllipsis();"));
+    }
+
+    @Test
+    public void accessMethodObjectWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { "hello", 12, 15, 16 }, (Object[])e.eval("o.methodObjectWithEllipsis('hello',12,15,16);"));
+        assertArrayEquals(new Object[] { "hello" }, (Object[])e.eval("o.methodObjectWithEllipsis('hello');"));
+    }
+
+    @Test
+    public void accessMethodPrimitiveWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { 14, 12L, 15L, 16L }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(14,12,15,16);"));
+        assertArrayEquals(new Object[] { 12 }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(12);"));
+    }
+
+    @Test
+    public void accessMethodMixedWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80 }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
+        assertArrayEquals(new Object[] { "Nashorn", 15 }, (Object[])e.eval("o.methodMixedWithEllipsis('Nashorn',15);"));
+    }
+
+    @Test
+    public void accessMethodOverloaded() throws ScriptException {
+        assertEquals(0, e.eval("o.overloadedMethod(0);"));
+        assertEquals(2000, e.eval("o.overloadedMethod(1000);"));
+        assertEquals(2, e.eval("o.overloadedMethod('10');"));
+        assertEquals(7, e.eval("o.overloadedMethod('Nashorn');"));
+        assertEquals(4, e.eval("o.overloadedMethod('true');"));
+        assertEquals(1, e.eval("o.overloadedMethod(true);"));
+        assertEquals(0, e.eval("o.overloadedMethod(false);"));
+        assertEquals(44, e.eval("o.overloadedMethod(new Person(22));"));
+        assertEquals(0, e.eval("o.overloadedMethod(new Person());"));
+    }
+
+    @Test
+    public void accessMethodDoubleVSintOverloaded() throws ScriptException {
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.01);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(100.02);"));
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0);"));
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000);"));
+    }
+
+    @Test
+    public void accessJavaMethodIntFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodInt(a) {"
+                + "return o.thirdLevelMethodInt(a);"
+                + "}");
+        assertEquals(50, e.eval("o.firstLevelMethodInt(10);"));
+    }
+
+    @Test
+    public void accessJavaMethodIntegerFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodInteger(a) {"
+                + "return o.thirdLevelMethodInteger(a);"
+                + "}");
+        assertEquals(100, e.eval("o.firstLevelMethodInteger(10);"));
+    }
+
+    @Test
+    public void accessJavaMethodObjectFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodObject(p) {"
+                + "return o.thirdLevelMethodObject(p);"
+                + "}");
+        assertEquals(new Person(100), e.eval("o.firstLevelMethodObject(new Person(10));"));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,776 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class NumberAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+    }
+
+    // --------------------------------long
+    // tests------------------------------------
+    @Test
+    public void accessFieldLong() throws ScriptException {
+        e.eval("var p_long = o.publicLong;");
+        assertEquals(o.publicLong, e.get("p_long"));
+        e.eval("o.publicLong = 12;");
+        assertEquals(12, o.publicLong);
+    }
+
+    @Test
+    public void accessFieldLongArray() throws ScriptException {
+        e.eval("var p_long_array = o.publicLongArray;");
+        assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];"));
+        assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array"));
+        e.eval("var t_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+                "t_long_arr[0] = -189009;" +
+                "t_long_arr[1] = 456;" +
+                "t_long_arr[2] = 600000001;" +
+                "o.publicLongArray = t_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { -189009, 456, 600000001 }, o.publicLongArray);
+        e.eval("o.publicLongArray[0] = 10;");
+        assertEquals(10, o.publicLongArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldLong() throws ScriptException {
+        e.eval("var ps_long = SharedObject.publicStaticLong;");
+        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
+        e.eval("SharedObject.publicStaticLong = 120;");
+        assertEquals(120, SharedObject.publicStaticLong);
+    }
+
+    @Test
+    public void accessStaticFieldLongArray() throws ScriptException {
+        e.eval("var ps_long_array = SharedObject.publicStaticLongArray;");
+        assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array"));
+        e.eval("var ts_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+                "ts_long_arr[0] = -189009;" +
+                "ts_long_arr[1] = 456;" +
+                "ts_long_arr[2] = 600000001;" +
+                "SharedObject.publicStaticLongArray = ts_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { -189009, 456, 600000001 }, SharedObject.publicStaticLongArray);
+        e.eval("SharedObject.publicStaticLongArray[0] = 10;");
+        assertEquals(10, SharedObject.publicStaticLongArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldLong() throws ScriptException {
+        e.eval("var pf_long = o.publicFinalLong;");
+        assertEquals(o.publicFinalLong, e.get("pf_long"));
+        e.eval("o.publicFinalLong = 120;");
+        assertEquals(13353333333333333L, o.publicFinalLong);
+    }
+
+    @Test
+    public void accessFinalFieldLongArray() throws ScriptException {
+        e.eval("var pf_long_array = o.publicFinalLongArray;");
+        assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];"));
+        assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array"));
+        e.eval("var tf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+                "tf_long_arr[0] = -189009;" +
+                "tf_long_arr[1] = 456;" +
+                "tf_long_arr[2] = 600000001;" +
+                "o.publicFinalLongArray = tf_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { 1901733333333L, -2247355555L, 3977377777L }, o.publicFinalLongArray);
+        e.eval("o.publicFinalLongArray[0] = 10;");
+        assertEquals(10, o.publicFinalLongArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLong() throws ScriptException {
+        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
+        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
+        e.eval("SharedObject.publicStaticFinalLong = 120;");
+        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLongArray() throws ScriptException {
+        e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;");
+        assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array"));
+        e.eval("var tsf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+                "tsf_long_arr[0] = -189009;" +
+                "tsf_long_arr[1] = 456;" +
+                "tsf_long_arr[2] = 600000001;" +
+                "SharedObject.publicStaticFinalLongArray = tsf_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { 19017383333L, -2247358L, 39773787L }, SharedObject.publicStaticFinalLongArray);
+        e.eval("SharedObject.publicStaticFinalLongArray[0] = 10;");
+        assertEquals(10, SharedObject.publicStaticFinalLongArray[0]);
+    }
+
+    // --------------------------------int
+    // tests------------------------------------
+    @Test
+    public void accessFieldInt() throws ScriptException {
+        e.eval("var p_int = o.publicInt;");
+        assertEquals(o.publicInt, e.get("p_int"));
+        e.eval("o.publicInt = 14;");
+        assertEquals(14, o.publicInt);
+    }
+
+    @Test
+    public void accessFieldIntArray() throws ScriptException {
+        e.eval("var p_int_array = o.publicIntArray;");
+        assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];"));
+        assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array"));
+        e.eval("var t_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+                "t_int_arr[0] = 4;" +
+                "t_int_arr[1] = 5;" +
+                "t_int_arr[2] = 6;" +
+                "o.publicIntArray = t_int_arr;");
+        assertArrayEquals(new int[] { 4, 5, 6 }, o.publicIntArray);
+        e.eval("o.publicIntArray[0] = 100;");
+        assertEquals(100, o.publicIntArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldInt() throws ScriptException {
+        e.eval("var ps_int = SharedObject.publicStaticInt;");
+        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
+        e.eval("SharedObject.publicStaticInt = 140;");
+        assertEquals(140, SharedObject.publicStaticInt);
+    }
+
+    @Test
+    public void accessStaticFieldIntArray() throws ScriptException {
+        e.eval("var ps_int_array = SharedObject.publicStaticIntArray;");
+        assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array"));
+        e.eval("var ts_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+                "ts_int_arr[0] = 4;" +
+                "ts_int_arr[1] = 5;" +
+                "ts_int_arr[2] = 6;" +
+                "SharedObject.publicStaticIntArray = ts_int_arr;");
+        assertArrayEquals(new int[] { 4, 5, 6 }, SharedObject.publicStaticIntArray);
+        e.eval("SharedObject.publicStaticIntArray[0] = 100;");
+        assertEquals(100, SharedObject.publicStaticIntArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldInt() throws ScriptException {
+        e.eval("var pf_int = o.publicFinalInt;");
+        assertEquals(o.publicFinalInt, e.get("pf_int"));
+
+        e.eval("o.publicFinalInt = 10;");
+        assertEquals(20712023, o.publicFinalInt);
+    }
+
+    @Test
+    public void accessFinalFieldIntArray() throws ScriptException {
+        e.eval("var pf_int_array = o.publicFinalIntArray;");
+        assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];"));
+        assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array"));
+        e.eval("var tf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+                "tf_int_arr[0] = 4;" +
+                "tf_int_arr[1] = 5;" +
+                "tf_int_arr[2] = 6;" +
+                "o.publicFinalIntArray = tf_int_arr;");
+        assertArrayEquals(new int[] { 50, 80, 130, 210, 340 }, o.publicFinalIntArray);
+        e.eval("o.publicFinalIntArray[0] = 100;");
+        assertEquals(100, o.publicFinalIntArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldInt() throws ScriptException {
+        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
+        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
+        e.eval("SharedObject.publicStaticFinalInt = 140;");
+        assertEquals(207182023, SharedObject.publicStaticFinalInt);
+    }
+
+    @Test
+    public void accessStaticFinalFieldIntArray() throws ScriptException {
+        e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;");
+        assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array"));
+        e.eval("var tsf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+                "tsf_int_arr[0] = 4;" +
+                "tsf_int_arr[1] = 5;" +
+                "tsf_int_arr[2] = 6;" +
+                "SharedObject.publicStaticFinalIntArray = tsf_int_arr;");
+        assertArrayEquals(new int[] { 1308, 210, 340 }, SharedObject.publicStaticFinalIntArray);
+        e.eval("SharedObject.publicStaticFinalIntArray[0] = 100;");
+        assertEquals(100, SharedObject.publicStaticFinalIntArray[0]);
+    }
+
+    // --------------------------------byte
+    // tests------------------------------------
+    @Test
+    public void accessFieldByte() throws ScriptException {
+        e.eval("var p_byte = o.publicByte;");
+        assertEquals(o.publicByte, e.get("p_byte"));
+        e.eval("o.publicByte = 16;");
+        assertEquals(16, o.publicByte);
+    }
+
+    @Test
+    public void accessFieldByteArray() throws ScriptException {
+        e.eval("var p_byte_array = o.publicByteArray;");
+        assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];"));
+        assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array"));
+        e.eval("var t_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+                "t_byte_arr[0] = -18;" +
+                "t_byte_arr[1] = 56;" +
+                "t_byte_arr[2] = 60;" +
+                "o.publicByteArray = t_byte_arr;");
+        assertArrayEquals(new byte[] { -18, 56, 60 }, o.publicByteArray);
+        e.eval("o.publicByteArray[0] = 100;");
+        assertEquals(100, o.publicByteArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldByte() throws ScriptException {
+        e.eval("var ps_byte = SharedObject.publicStaticByte;");
+        assertEquals(SharedObject.publicStaticByte, e.get("ps_byte"));
+        e.eval("SharedObject.publicStaticByte = 16;");
+        assertEquals(16, SharedObject.publicStaticByte);
+    }
+
+    @Test
+    public void accessStaticFieldByteArray() throws ScriptException {
+        e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;");
+        assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array"));
+        e.eval("var ts_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+                "ts_byte_arr[0] = -18;" +
+                "ts_byte_arr[1] = 56;" +
+                "ts_byte_arr[2] = 60;" +
+                "SharedObject.publicStaticByteArray = ts_byte_arr;");
+        assertArrayEquals(new byte[] { -18, 56, 60 }, SharedObject.publicStaticByteArray);
+        e.eval("SharedObject.publicStaticByteArray[0] = -90;");
+        assertEquals(-90, SharedObject.publicStaticByteArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldByte() throws ScriptException {
+        e.eval("var pf_byte = o.publicFinalByte;");
+        assertEquals(o.publicFinalByte, e.get("pf_byte"));
+        e.eval("o.publicFinalByte = 16;");
+        assertEquals(-7, o.publicFinalByte);
+    }
+
+    @Test
+    public void accessFinalFieldByteArray() throws ScriptException {
+        e.eval("var pf_byte_array = o.publicFinalByteArray;");
+        assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];"));
+        assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array"));
+        e.eval("var tf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+                "tf_byte_arr[0] = -18;" +
+                "tf_byte_arr[1] = 56;" +
+                "tf_byte_arr[2] = 60;" +
+                "o.publicFinalByteArray = tf_byte_arr;");
+        assertArrayEquals(new byte[] { 1, 3, 6, 17, -128 }, o.publicFinalByteArray);
+        e.eval("o.publicFinalByteArray[0] = -90;");
+        assertEquals(-90, o.publicFinalByteArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByte() throws ScriptException {
+        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
+        assertEquals(SharedObject.publicStaticFinalByte, e.get("psf_byte"));
+        e.eval("SharedObject.publicStaticFinalByte = 16;");
+        assertEquals(-70, SharedObject.publicStaticFinalByte);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByteArray() throws ScriptException {
+        e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;");
+        assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array"));
+        e.eval("var tsf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+                "tsf_byte_arr[0] = -18;" +
+                "tsf_byte_arr[1] = 56;" +
+                "tsf_byte_arr[2] = 60;" +
+                "SharedObject.publicStaticFinalByteArray = tsf_byte_arr;");
+        assertArrayEquals(new byte[] { 17, -128, 81 }, SharedObject.publicStaticFinalByteArray);
+        e.eval("SharedObject.publicStaticFinalByteArray[0] = -90;");
+        assertEquals(-90, SharedObject.publicStaticFinalByteArray[0]);
+    }
+
+    // --------------------------------short
+    // tests------------------------------------
+    @Test
+    public void accessFieldShort() throws ScriptException {
+        e.eval("var p_short = o.publicShort;");
+        assertEquals(o.publicShort, e.get("p_short"));
+        e.eval("o.publicShort = 18;");
+        assertEquals(18, o.publicShort);
+    }
+
+    @Test
+    public void accessFieldShortArray() throws ScriptException {
+        e.eval("var p_short_array = o.publicShortArray;");
+        assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];"));
+        assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array"));
+        e.eval("var t_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+                "t_short_arr[0] = 90;" +
+                "t_short_arr[1] = 5;" +
+                "t_short_arr[2] = -6000;" +
+                "o.publicShortArray = t_short_arr;");
+        assertArrayEquals(new short[] { 90, 5, -6000 }, o.publicShortArray);
+        e.eval("o.publicShortArray[0] = -1000;");
+        assertEquals(-1000, o.publicShortArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldShort() throws ScriptException {
+        e.eval("var ps_short = SharedObject.publicStaticShort;");
+        assertEquals(SharedObject.publicStaticShort, e.get("ps_short"));
+        e.eval("SharedObject.publicStaticShort = 180;");
+        assertEquals(180, SharedObject.publicStaticShort);
+    }
+
+    @Test
+    public void accessStaticFieldShortArray() throws ScriptException {
+        e.eval("var ps_short_array = SharedObject.publicStaticShortArray;");
+        assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array"));
+        e.eval("var ts_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+                "ts_short_arr[0] = 90;" +
+                "ts_short_arr[1] = 5;" +
+                "ts_short_arr[2] = -6000;" +
+                "SharedObject.publicStaticShortArray = ts_short_arr;");
+        assertArrayEquals(new short[] { 90, 5, -6000 }, SharedObject.publicStaticShortArray);
+        e.eval("SharedObject.publicStaticShortArray[0] = -1000;");
+        assertEquals(-1000, SharedObject.publicStaticShortArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldShort() throws ScriptException {
+        e.eval("var pf_short = o.publicFinalShort;");
+        assertEquals(o.publicFinalShort, e.get("pf_short"));
+        e.eval("o.publicFinalShort = 180;");
+        assertEquals(31220, o.publicFinalShort);
+    }
+
+    @Test
+    public void accessFinalFieldShortArray() throws ScriptException {
+        e.eval("var pf_short_array = o.publicFinalShortArray;");
+        assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];"));
+        assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array"));
+        e.eval("var tf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+                "tf_short_arr[0] = 90;" +
+                "tf_short_arr[1] = 5;" +
+                "tf_short_arr[2] = -6000;" +
+                "o.publicFinalShortArray = tf_short_arr;");
+        assertArrayEquals(new short[] { 12240, 9200, -17289, 1200, 12 }, o.publicFinalShortArray);
+        e.eval("o.publicFinalShortArray[0] = -1000;");
+        assertEquals(-1000, o.publicFinalShortArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShort() throws ScriptException {
+        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
+        assertEquals(SharedObject.publicStaticFinalShort, e.get("psf_short"));
+        e.eval("SharedObject.publicStaticFinalShort = 180;");
+        assertEquals(8888, SharedObject.publicStaticFinalShort);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShortArray() throws ScriptException {
+        e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;");
+        assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array"));
+        e.eval("var tsf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+                "tsf_short_arr[0] = 90;" +
+                "tsf_short_arr[1] = 5;" +
+                "tsf_short_arr[2] = -6000;" +
+                "SharedObject.publicStaticFinalShortArray = tsf_short_arr;");
+        assertArrayEquals(new short[] { 8240, 9280, -1289, 120, 812 }, SharedObject.publicStaticFinalShortArray);
+        e.eval("SharedObject.publicStaticFinalShortArray[0] = -1000;");
+        assertEquals(-1000, SharedObject.publicStaticFinalShortArray[0]);
+    }
+
+    // --------------------------------char
+    // tests------------------------------------
+    @Test
+    public void accessFieldChar() throws ScriptException {
+        e.eval("var p_char = o.publicChar;");
+        assertEquals(o.publicChar, e.get("p_char"));
+        e.eval("o.publicChar = 'S';");
+        assertEquals('S', o.publicChar);
+        e.eval("o.publicChar = 10;");
+        assertEquals(10, o.publicChar);
+        e.eval("try {"
+                + "    o.publicChar = 'Big string';" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals(10, o.publicChar);
+    }
+
+    @Test
+    public void accessFieldCharArray() throws ScriptException {
+        e.eval("var p_char_array = o.publicCharArray;");
+        assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];"));
+        assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array"));
+        e.eval("var t_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+                "t_char_arr[0] = 'F';" +
+                "t_char_arr[1] = 'o';" +
+                "t_char_arr[2] = 'o';" +
+                "o.publicCharArray = t_char_arr;");
+        assertArrayEquals("Foo".toCharArray(), o.publicCharArray);
+        e.eval("o.publicCharArray[0] = 'Z';");
+        assertEquals('Z', o.publicCharArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldChar() throws ScriptException {
+        e.eval("var ps_char = SharedObject.publicStaticChar;");
+        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
+        e.eval("SharedObject.publicStaticChar = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticChar);
+    }
+
+    @Test
+    public void accessStaticFieldCharArray() throws ScriptException {
+        e.eval("var ps_char_array = SharedObject.publicStaticCharArray;");
+        assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array"));
+        e.eval("var ts_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+                "ts_char_arr[0] = 'G';" +
+                "ts_char_arr[1] = 'o';" +
+                "ts_char_arr[2] = 'o';" +
+                "SharedObject.publicStaticCharArray = ts_char_arr;");
+        assertArrayEquals("Goo".toCharArray(), SharedObject.publicStaticCharArray);
+        e.eval("SharedObject.publicStaticCharArray[0] = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticCharArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldChar() throws ScriptException {
+        e.eval("var pf_char = o.publicFinalChar;");
+        assertEquals(o.publicFinalChar, e.get("pf_char"));
+        e.eval("o.publicFinalChar = 'S';");
+        assertEquals('E', o.publicFinalChar);
+    }
+
+    @Test
+    public void accessFinalCharArray() throws ScriptException {
+        e.eval("var pf_char_array = o.publicFinalCharArray;");
+        assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];"));
+        assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array"));
+        e.eval("var tf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+                "tf_char_arr[0] = 'F';" +
+                "tf_char_arr[1] = 'o';" +
+                "tf_char_arr[2] = 'o';" +
+                "o.publicFinalCharArray = tf_char_arr;");
+        assertArrayEquals("Nashorn hello".toCharArray(), o.publicFinalCharArray);
+        e.eval("o.publicFinalCharArray[0] = 'Z';");
+        assertEquals('Z', o.publicFinalCharArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldChar() throws ScriptException {
+        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
+        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
+        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
+        assertEquals('K', SharedObject.publicStaticFinalChar);
+    }
+
+    @Test
+    public void accessStaticFinalFieldCharArray() throws ScriptException {
+        e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;");
+        assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array"));
+        e.eval("var tsf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+                "tsf_char_arr[0] = 'Z';" +
+                "tsf_char_arr[1] = 'o';" +
+                "tsf_char_arr[2] = 'o';" +
+                "SharedObject.publicStaticFinalCharArray = tsf_char_arr;");
+        assertArrayEquals("StaticString".toCharArray(), SharedObject.publicStaticFinalCharArray);
+        e.eval("SharedObject.publicStaticFinalCharArray[0] = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticFinalCharArray[0]);
+    }
+
+    // --------------------------------float
+    // tests------------------------------------
+    @Test
+    public void accessFieldFloat() throws ScriptException {
+        e.eval("var p_float = o.publicFloat;");
+        assertEquals(o.publicFloat, e.get("p_float"));
+        o.publicFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(o.publicFloat)"));
+        o.publicFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloat"));
+        o.publicFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloat"));
+        e.eval("o.publicFloat = 20;");
+        assertEquals(20, o.publicFloat, 1e-10);
+        e.eval("o.publicFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(o.publicFloat));
+        e.eval("o.publicFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloat));
+        e.eval("o.publicFloat = -1.0/0.0;");
+        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloat, 1e-10);
+    }
+
+    @Test
+    public void accessFieldFloatArray() throws ScriptException {
+        e.eval("var p_float_array = o.publicFloatArray;");
+        assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];"));
+        assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f);
+        e.eval("var t_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+                "t_float_arr[0] = 9.0;" +
+                "t_float_arr[1] = 5.12345;" +
+                "t_float_arr[2] = -60.03;" +
+                "o.publicFloatArray = t_float_arr;");
+        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
+        e.eval("o.publicFloatArray[0] = -513.2;");
+        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFieldFloat() throws ScriptException {
+        e.eval("var ps_float = SharedObject.publicStaticFloat;");
+        assertEquals(SharedObject.publicStaticFloat, e.get("ps_float"));
+        SharedObject.publicStaticFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
+        SharedObject.publicStaticFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
+        SharedObject.publicStaticFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
+        e.eval("SharedObject.publicStaticFloat = 20.0;");
+        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
+        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+    }
+
+    @Test
+    public void accessStaticFieldFloatArray() throws ScriptException {
+        e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;");
+        assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f);
+        e.eval("var ts_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+                "ts_float_arr[0] = 9.0;" +
+                "ts_float_arr[1] = 5.12345;" +
+                "ts_float_arr[2] = -60.03;" +
+                "SharedObject.publicStaticFloatArray = ts_float_arr;");
+        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFloatArray[0] = -513.2;");
+        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
+    }
+
+    @Test
+    public void accessFinalFloat() throws ScriptException {
+        e.eval("var pf_float = o.publicFinalFloat;");
+        assertEquals(o.publicFinalFloat, e.get("pf_float"));
+        e.eval("o.publicFinalFloat = 20.0;");
+        assertEquals(7.72e8f, o.publicFinalFloat, 1e-10);
+    }
+
+    @Test
+    public void accessFinalFloatArray() throws ScriptException {
+        e.eval("var pf_float_array = o.publicFinalFloatArray;");
+        assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];"));
+        assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f);
+        e.eval("var tf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+                "tf_float_arr[0] = 9.0;" +
+                "tf_float_arr[1] = 5.12345;" +
+                "tf_float_arr[2] = -60.03;" +
+                "o.publicFinalFloatArray = tf_float_arr;");
+        assertArrayEquals(new float[] { -131.012f, 189.32f, -31.32e8f, 3.72f }, o.publicFinalFloatArray, 1e-10f);
+        e.eval("o.publicFinalFloatArray[0] = -513.2;");
+        assertEquals(-513.2f, o.publicFinalFloatArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloat() throws ScriptException {
+        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
+        assertEquals(SharedObject.publicStaticFinalFloat, e.get("psf_float"));
+        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
+        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloatArray() throws ScriptException {
+        e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;");
+        assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f);
+        e.eval("var tsf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+                "tsf_float_arr[0] = 9.0;" +
+                "tsf_float_arr[1] = 5.12345;" +
+                "tsf_float_arr[2] = -60.03;" +
+                "SharedObject.publicStaticFinalFloatArray = tsf_float_arr;");
+        assertArrayEquals(new float[] { -8131.012f, 9.32f, -138.32e8f, 0.72f }, SharedObject.publicStaticFinalFloatArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFinalFloatArray[0] = -513.2;");
+        assertEquals(-513.2f, SharedObject.publicStaticFinalFloatArray[0], 1e-10f);
+    }
+
+    // --------------------------------double
+    // tests------------------------------------
+    @Test
+    public void accessFieldDouble() throws ScriptException {
+        e.eval("var p_double = o.publicDouble;");
+        assertEquals(o.publicDouble, e.get("p_double"));
+        o.publicDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(o.publicDouble)"));
+        o.publicDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDouble"));
+        o.publicDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDouble"));
+        e.eval("o.publicDouble = 30;");
+        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDouble));
+        e.eval("o.publicDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(o.publicDouble));
+        e.eval("o.publicDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
+        e.eval("o.publicDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
+    }
+
+    @Test
+    public void accessFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var p_double_array = o.publicDoubleArray;");
+        assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];"));
+        assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10);
+        e.eval("var t_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+                "t_double_arr[0] = 9e10;" +
+                "t_double_arr[1] = 0.677777;" +
+                "t_double_arr[2] = -0.0000001;" +
+                "o.publicDoubleArray = t_double_arr;");
+        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, o.publicDoubleArray, 1e-10f);
+        e.eval("o.publicDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, o.publicDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFieldDouble() throws ScriptException {
+        e.eval("var ps_double = SharedObject.publicStaticDouble;");
+        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
+        SharedObject.publicStaticDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
+        SharedObject.publicStaticDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
+        SharedObject.publicStaticDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
+        e.eval("SharedObject.publicStaticDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+    }
+
+    @Test
+    public void accessStaticFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;");
+        assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10);
+        e.eval("var ts_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+                "ts_double_arr[0] = 9e10;" +
+                "ts_double_arr[1] = 0.677777;" +
+                "ts_double_arr[2] = -0.0000001;" +
+                "SharedObject.publicStaticDoubleArray = ts_double_arr;");
+        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, SharedObject.publicStaticDoubleArray, 1e-10f);
+        e.eval("SharedObject.publicStaticDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, SharedObject.publicStaticDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessFinalFieldDouble() throws ScriptException {
+        e.eval("var pf_double = o.publicFinalDouble;");
+        assertEquals(o.publicFinalDouble, e.get("pf_double"));
+        e.eval("o.publicFinalDouble = 30.0;");
+        assertEquals(Double.doubleToLongBits(1.3412e20), Double.doubleToLongBits(o.publicFinalDouble));
+    }
+
+    @Test
+    public void accessFinalFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var pf_double_array = o.publicFinalDoubleArray;");
+        assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];"));
+        assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10);
+        e.eval("var tf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+                "tf_double_arr[0] = 9e10;" +
+                "tf_double_arr[1] = 0.677777;" +
+                "tf_double_arr[2] = -0.0000001;" +
+                "o.publicFinalDoubleArray = tf_double_arr;");
+        assertArrayEquals(new double[] { 0.725e80, 0.12e10, 8e-3, 1.00077 }, o.publicFinalDoubleArray, 1e-10f);
+        e.eval("o.publicFinalDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, o.publicFinalDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFinalFieldDouble() throws ScriptException {
+        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
+        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
+        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
+    }
+
+    @Test
+    public void accessStaticFinalFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;");
+        assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10);
+        e.eval("var tsf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+                "tsf_double_arr[0] = 9e10;" +
+                "tsf_double_arr[1] = 0.677777;" +
+                "tsf_double_arr[2] = -0.0000001;" +
+                "SharedObject.publicStaticFinalDoubleArray = tsf_double_arr;");
+        assertArrayEquals(new double[] { 8.725e80, 0.82e10, 18e-3, 1.08077 }, SharedObject.publicStaticFinalDoubleArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFinalDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, SharedObject.publicStaticFinalDoubleArray[0], 1e-10f);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class NumberBoxingTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+    }
+
+    // --------------------------------long
+    // tests------------------------------------
+    @Test
+    public void accessFieldLongBoxing() throws ScriptException {
+        e.eval("var p_long = o.publicLongBox;");
+        assertEquals(o.publicLongBox, e.get("p_long"));
+        e.eval("o.publicLongBox = 12;");
+        assertEquals(Long.valueOf(12), o.publicLongBox);
+    }
+
+    @Test
+    public void accessStaticFieldLongBoxing() throws ScriptException {
+        e.eval("var ps_long = SharedObject.publicStaticLong;");
+        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
+        e.eval("SharedObject.publicStaticLong = 120;");
+        assertEquals(120, SharedObject.publicStaticLong);
+    }
+
+    @Test
+    public void accessFinalFieldLongBoxing() throws ScriptException {
+        e.eval("var pf_long = o.publicFinalLongBox;");
+        assertEquals(o.publicFinalLongBox, e.get("pf_long"));
+        e.eval("o.publicFinalLongBox = 120;");
+        assertEquals(Long.valueOf(9377333334L), o.publicFinalLongBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLongBoxing() throws ScriptException {
+        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
+        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
+        e.eval("SharedObject.publicStaticFinalLong = 120;");
+        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
+    }
+
+    // --------------------------------int
+    // tests------------------------------------
+    @Test
+    public void accessFieldIntBoxing() throws ScriptException {
+        e.eval("var p_int = o.publicIntBox;");
+        assertEquals(o.publicIntBox, e.get("p_int"));
+        e.eval("o.publicIntBox = 14;");
+        assertEquals(Integer.valueOf(14), o.publicIntBox);
+    }
+
+    @Test
+    public void accessStaticFieldIntBoxing() throws ScriptException {
+        e.eval("var ps_int = SharedObject.publicStaticInt;");
+        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
+        e.eval("SharedObject.publicStaticInt = 140;");
+        assertEquals(140, SharedObject.publicStaticInt);
+    }
+
+    @Test
+    public void accessFinalFieldIntBoxing() throws ScriptException {
+        e.eval("var pf_int = o.publicFinalIntBox;");
+        assertEquals(o.publicFinalIntBox, e.get("pf_int"));
+        e.eval("o.publicFinalIntBox = 10;");
+        assertEquals(Integer.valueOf(207512301), o.publicFinalIntBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldIntBoxing() throws ScriptException {
+        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
+        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
+        e.eval("SharedObject.publicStaticFinalInt = 140;");
+        assertEquals(207182023, SharedObject.publicStaticFinalInt);
+    }
+
+    // --------------------------------byte
+    // tests------------------------------------
+    @Test
+    public void accessFieldByteBoxing() throws ScriptException {
+        e.eval("var p_byte = o.publicByteBox;");
+        assertEquals(o.publicByteBox, e.get("p_byte"));
+        e.eval("o.publicByteBox = 16;");
+        assertEquals(Byte.valueOf((byte)16), o.publicByteBox);
+    }
+
+    @Test
+    public void accessStaticFieldByteBoxing() throws ScriptException {
+        e.eval("var ps_byte = SharedObject.publicStaticByte;");
+        assertEquals(SharedObject.publicStaticByte, e.get("ps_byte"));
+        e.eval("SharedObject.publicStaticByte = 16;");
+        assertEquals(16, SharedObject.publicStaticByte);
+    }
+
+    @Test
+    public void accessFinalFieldByteBoxing() throws ScriptException {
+        e.eval("var pf_byte = o.publicFinalByteBox;");
+        assertEquals(o.publicFinalByteBox, e.get("pf_byte"));
+        e.eval("o.publicFinalByteBox = 16;");
+        assertEquals(Byte.valueOf((byte)19), o.publicFinalByteBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByteBoxing() throws ScriptException {
+        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
+        assertEquals(SharedObject.publicStaticFinalByte, e.get("psf_byte"));
+        e.eval("SharedObject.publicStaticFinalByte = 16;");
+        assertEquals(-70, SharedObject.publicStaticFinalByte);
+    }
+
+    // --------------------------------short
+    // tests------------------------------------
+    @Test
+    public void accessFieldShortBoxing() throws ScriptException {
+        e.eval("var p_short = o.publicShortBox;");
+        assertEquals(o.publicShortBox, e.get("p_short"));
+        e.eval("o.publicShortBox = 18;");
+        assertEquals(Short.valueOf((short)18), o.publicShortBox);
+    }
+
+    @Test
+    public void accessStaticFieldShortBoxing() throws ScriptException {
+        e.eval("var ps_short = SharedObject.publicStaticShort;");
+        assertEquals(SharedObject.publicStaticShort, e.get("ps_short"));
+        e.eval("SharedObject.publicStaticShort = 180;");
+        assertEquals(180, SharedObject.publicStaticShort);
+    }
+
+    @Test
+    public void accessFinalFieldShortBoxing() throws ScriptException {
+        e.eval("var pf_short = o.publicFinalShortBox;");
+        assertEquals(o.publicFinalShortBox, e.get("pf_short"));
+        e.eval("o.publicFinalShortBox = 180;");
+        assertEquals(Short.valueOf((short)-26777), o.publicFinalShortBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShortBoxing() throws ScriptException {
+        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
+        assertEquals(SharedObject.publicStaticFinalShort, e.get("psf_short"));
+        e.eval("SharedObject.publicStaticFinalShort = 180;");
+        assertEquals(8888, SharedObject.publicStaticFinalShort);
+    }
+
+    // --------------------------------char
+    // tests------------------------------------
+    @Test
+    public void accessFieldCharBoxing() throws ScriptException {
+        e.eval("var p_char = o.publicCharBox;");
+        assertEquals(o.publicCharBox, e.get("p_char"));
+        e.eval("o.publicCharBox = 'S';");
+        assertEquals(Character.valueOf('S'), o.publicCharBox);
+        e.eval("try {" +
+                "    o.publicCharBox = 'Big string';" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals(Character.valueOf('S'), o.publicCharBox);
+    }
+
+    @Test
+    public void accessStaticFieldCharBoxing() throws ScriptException {
+        e.eval("var ps_char = SharedObject.publicStaticChar;");
+        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
+        e.eval("SharedObject.publicStaticChar = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticChar);
+    }
+
+    @Test
+    public void accessFinalFieldCharBoxing() throws ScriptException {
+        e.eval("var pf_char = o.publicFinalCharBox;");
+        assertEquals(o.publicFinalCharBox, e.get("pf_char"));
+        e.eval("o.publicFinalCharBox = 'S';");
+        assertEquals(Character.valueOf('F'), o.publicFinalCharBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldCharBoxing() throws ScriptException {
+        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
+        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
+        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
+        assertEquals('K', SharedObject.publicStaticFinalChar);
+    }
+
+    // --------------------------------float
+    // tests------------------------------------
+    @Test
+    public void accessFieldFloatBoxing() throws ScriptException {
+        e.eval("var p_float = o.publicFloatBox;");
+        assertEquals(o.publicFloatBox, e.get("p_float"));
+        o.publicFloatBox = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(o.publicFloatBox)"));
+        o.publicFloatBox = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloatBox"));
+        o.publicFloatBox = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloatBox"));
+        e.eval("o.publicFloatBox = 20;");
+        assertEquals(20, o.publicFloatBox, 1e-10);
+        e.eval("o.publicFloatBox = 0.0/0.0;");
+        assertTrue(Float.isNaN(o.publicFloatBox));
+        e.eval("o.publicFloatBox = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloatBox));
+        e.eval("o.publicFloatBox = -1.0/0.0;");
+        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloatBox, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFieldFloatBoxing() throws ScriptException {
+        e.eval("var ps_float = SharedObject.publicStaticFloat;");
+        assertEquals(SharedObject.publicStaticFloat, e.get("ps_float"));
+        SharedObject.publicStaticFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
+        SharedObject.publicStaticFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
+        SharedObject.publicStaticFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
+        e.eval("SharedObject.publicStaticFloat = 20.0;");
+        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
+        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+    }
+
+    @Test
+    public void accessFinalFloatBoxing() throws ScriptException {
+        e.eval("var pf_float = o.publicFinalFloatBox;");
+        assertEquals(o.publicFinalFloatBox, e.get("pf_float"));
+        e.eval("o.publicFinalFloatBox = 20.0;");
+        assertEquals(1.372e4f, o.publicFinalFloatBox, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloatBoxing() throws ScriptException {
+        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
+        assertEquals(SharedObject.publicStaticFinalFloat, e.get("psf_float"));
+        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
+        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
+    }
+
+    // --------------------------------double
+    // tests------------------------------------
+    @Test
+    public void accessFieldDoubleBoxing() throws ScriptException {
+        e.eval("var p_double = o.publicDoubleBox;");
+        assertEquals(o.publicDoubleBox, e.get("p_double"));
+        o.publicDoubleBox = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(o.publicDoubleBox)"));
+        o.publicDoubleBox = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDoubleBox"));
+        o.publicDoubleBox = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDoubleBox"));
+        e.eval("o.publicDoubleBox = 30;");
+        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = 0.0/0.0;");
+        assertTrue(Double.isNaN(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
+    }
+
+    @Test
+    public void accessStaticFieldDoubleBoxing() throws ScriptException {
+        e.eval("var ps_double = SharedObject.publicStaticDouble;");
+        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
+        SharedObject.publicStaticDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
+        SharedObject.publicStaticDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
+        SharedObject.publicStaticDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
+        e.eval("SharedObject.publicStaticDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+    }
+
+    @Test
+    public void accessFinalFieldDoubleBoxing() throws ScriptException {
+        e.eval("var pf_double = o.publicFinalDoubleBox;");
+        assertEquals(o.publicFinalDoubleBox, e.get("pf_double"));
+        e.eval("o.publicFinalDoubleBox = 30.0;");
+        assertEquals(Double.doubleToLongBits(1.412e-12), Double.doubleToLongBits(o.publicFinalDoubleBox));
+    }
+
+    @Test
+    public void accessStaticFinalFieldDoubleBoxing() throws ScriptException {
+        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
+        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
+        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class ObjectAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.internal.access.Person;");
+    }
+
+    @Test
+    public void accessFieldObject() throws ScriptException {
+        e.eval("var p_object = o.publicObject;");
+        assertEquals(o.publicObject, e.get("p_object"));
+        assertEquals("object", e.eval("typeof p_object;"));
+        e.eval("o.publicObject = new Person(14);");
+        assertEquals(new Person(14), o.publicObject);
+    }
+
+    @Test
+    public void accessFieldObjectArray() throws ScriptException {
+        e.eval("var p_object_array = o.publicObjectArray;");
+        assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
+        assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
+        e.eval("var t_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+                "t_object_arr[0] = new Person(100);" +
+                "t_object_arr[1] = new Person(120);" +
+                "t_object_arr[2] = new Person(140);" +
+                "o.publicObjectArray = t_object_arr;");
+        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, o.publicObjectArray);
+        e.eval("o.publicObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), o.publicObjectArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldObject() throws ScriptException {
+        e.eval("var ps_object = SharedObject.publicStaticObject;");
+        assertEquals(SharedObject.publicStaticObject, e.get("ps_object"));
+        assertEquals("object", e.eval("typeof ps_object;"));
+        e.eval("SharedObject.publicStaticObject = new Person(16);");
+        assertEquals(new Person(16), SharedObject.publicStaticObject);
+    }
+
+    @Test
+    public void accessStaticFieldObjectArray() throws ScriptException {
+        e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
+        assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
+        e.eval("var ts_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+                "ts_object_arr[0] = new Person(100);" +
+                "ts_object_arr[1] = new Person(120);" +
+                "ts_object_arr[2] = new Person(140);" +
+                "SharedObject.publicStaticObjectArray = ts_object_arr;");
+        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, SharedObject.publicStaticObjectArray);
+        e.eval("SharedObject.publicStaticObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), SharedObject.publicStaticObjectArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldObject() throws ScriptException {
+        e.eval("var pf_object = o.publicFinalObject;");
+        assertEquals(o.publicFinalObject, e.get("pf_object"));
+        assertEquals("object", e.eval("typeof pf_object;"));
+        e.eval("o.publicFinalObject = new Person(-999);");
+        assertEquals(new Person(1024), o.publicFinalObject);
+    }
+
+    @Test
+    public void accessFinalFieldObjectArray() throws ScriptException {
+        e.eval("var pf_object_array = o.publicFinalObjectArray;");
+        assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
+        assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
+        e.eval("var tf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+                "tf_object_arr[0] = new Person(100);" +
+                "tf_object_arr[1] = new Person(120);" +
+                "tf_object_arr[2] = new Person(140);" +
+                "o.publicOFinalbjectArray = tf_object_arr;");
+        assertArrayEquals(new Person[] { new Person(-900), new Person(1000), new Person(180) }, o.publicFinalObjectArray);
+        e.eval("o.publicFinalObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), o.publicFinalObjectArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldObject() throws ScriptException {
+        e.eval("var psf_object = SharedObject.publicStaticFinalObject;");
+        assertEquals(SharedObject.publicStaticFinalObject, e.get("psf_object"));
+        assertEquals("object", e.eval("typeof psf_object;"));
+        e.eval("SharedObject.publicStaticFinalObject = new Person(6);");
+        assertEquals(new Person(2048), SharedObject.publicStaticFinalObject);
+    }
+
+    @Test
+    public void accessStaticFinalFieldObjectArray() throws ScriptException {
+        e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
+        assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
+        e.eval("var tsf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+                "tsf_object_arr[0] = new Person(100);" +
+                "tsf_object_arr[1] = new Person(120);" +
+                "tsf_object_arr[2] = new Person(140);" +
+                "SharedObject.publicStaticFinalObjectArray = tsf_object_arr;");
+        assertArrayEquals(new Person[] { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) }, SharedObject.publicStaticFinalObjectArray);
+        e.eval("SharedObject.publicStaticFinalObjectArray[0] = new Person(90);");
+        assertEquals(new Person(90), SharedObject.publicStaticFinalObjectArray[0]);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+public class Person {
+
+    public int id = 0;
+
+    public Person() {
+    }
+
+    public Person(final int code) {
+        this.id = code;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj != null && obj instanceof Person) {
+            final Person o = (Person)obj;
+            return this.id == o.id;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return id;
+    }
+
+    @Override
+    public String toString() {
+        return "Person(" + id + ")";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+public class SharedObject {
+
+    // Public fields
+    public String                 publicString                  = "PublicString";
+    public String[]               publicStringArray             = { "ArrayString[0]", "ArrayString[1]", "ArrayString[2]", "ArrayString[3]" };
+    public Person                 publicObject                  = new Person(256);
+    public Person[]               publicObjectArray             = { new Person(4), new Person(-422), new Person(14) };
+    public boolean                publicBoolean                 = true;
+    public boolean[]              publicBooleanArray            = { true, false, false, true };
+    public Boolean                publicBooleanBox              = true;
+    public long                   publicLong                    = 933333333333333333L;
+    public long[]                 publicLongArray               = { 99012333333333L, -124355555L, 89777777777L };
+    public Long                   publicLongBox                 = 9333333333L;
+    public int                    publicInt                     = 2076543123;
+    public int[]                  publicIntArray                = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 };
+    public Integer                publicIntBox                  = 20765123;
+    public byte                   publicByte                    = -128;
+    public byte[]                 publicByteArray               = { 1, 2, 4, 8, 16, 32, 64, 127, -128 };
+    public Byte                   publicByteBox                 = 127;
+    public short                  publicShort                   = 32000;
+    public short[]                publicShortArray              = { 3240, 8900, -16789, 1, 12 };
+    public Short                  publicShortBox                = Short.MIN_VALUE;
+    public float                  publicFloat                   = 0.7e6f;
+    public float[]                publicFloatArray              = { -32.01f, 89.3f, -1.3e8f, 3.1f };
+    public Float                  publicFloatBox                = 1.377e4f;
+    public double                 publicDouble                  = 1.34e20;
+    public double[]               publicDoubleArray             = { 0.75e80, 8e-43, 1.000077, 0.123e10 };
+    public Double                 publicDoubleBox               = 1.4e-19;
+    public char                   publicChar                    = 'A';
+    public char[]                 publicCharArray               = "Hello Nashorn".toCharArray();
+    public Character              publicCharBox                 = 'B';
+    // Public static fields
+    public static String          publicStaticString            = "PublicStaticString";
+    public static String[]        publicStaticStringArray       = { "StaticArrayString[0]", "StaticArrayString[1]", "StaticArrayString[2]", "StaticArrayString[3]" };
+    public static Person          publicStaticObject            = new Person(512);
+    public static Person[]        publicStaticObjectArray       = { new Person(40), new Person(-22), new Person(18) };
+    public static boolean         publicStaticBoolean           = true;
+    public static boolean[]       publicStaticBooleanArray      = { false, false, false, true };
+    public static Boolean         publicStaticBooleanBox        = true;
+    public static long            publicStaticLong              = 13333333333333333L;
+    public static long[]          publicStaticLongArray         = { 19012333333333L, -224355555L, 39777777777L };
+    public static Long            publicStaticLongBox           = 9333333334L;
+    public static int             publicStaticInt               = 207654323;
+    public static int[]           publicStaticIntArray          = { 5, 8, 13, 21, 34 };
+    public static Integer         publicStaticIntBox            = 2075123;
+    public static byte            publicStaticByte              = -12;
+    public static byte[]          publicStaticByteArray         = { 16, 32, 64, 127, -128 };
+    public static Byte            publicStaticByteBox           = 17;
+    public static short           publicStaticShort             = 320;
+    public static short[]         publicStaticShortArray        = { 1240, 900, -1789, 100, 12 };
+    public static Short           publicStaticShortBox          = -16777;
+    public static float           publicStaticFloat             = 7.7e8f;
+    public static float[]         publicStaticFloatArray        = { -131.01f, 189.3f, -31.3e8f, 3.7f };
+    public static Float           publicStaticFloatBox          = 1.37e4f;
+    public static double          publicStaticDouble            = 1.341e20;
+    public static double[]        publicStaticDoubleArray       = { 0.75e80, 0.123e10, 8e-43, 1.000077 };
+    public static Double          publicStaticDoubleBox         = 1.41e-12;
+    public static char            publicStaticChar              = 'C';
+    public static char[]          publicStaticCharArray         = "Nashorn".toCharArray();
+    public static Character       publicStaticCharBox           = 'D';
+    // Public final fields
+    public final String           publicFinalString             = "PublicFinalString";
+    public final String[]         publicFinalStringArray        = { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" };
+    public final Person           publicFinalObject             = new Person(1024);
+    public final Person[]         publicFinalObjectArray        = { new Person(-900), new Person(1000), new Person(180) };
+    public final boolean          publicFinalBoolean            = true;
+    public final boolean[]        publicFinalBooleanArray       = { false, false, true, false };
+    public final Boolean          publicFinalBooleanBox         = true;
+    public final long             publicFinalLong               = 13353333333333333L;
+    public final long[]           publicFinalLongArray          = { 1901733333333L, -2247355555L, 3977377777L };
+    public final Long             publicFinalLongBox            = 9377333334L;
+    public final int              publicFinalInt                = 20712023;
+    public final int[]            publicFinalIntArray           = { 50, 80, 130, 210, 340 };
+    public final Integer          publicFinalIntBox             = 207512301;
+    public final byte             publicFinalByte               = -7;
+    public final byte[]           publicFinalByteArray          = { 1, 3, 6, 17, -128 };
+    public final Byte             publicFinalByteBox            = 19;
+    public final short            publicFinalShort              = 31220;
+    public final short[]          publicFinalShortArray         = { 12240, 9200, -17289, 1200, 12 };
+    public final Short            publicFinalShortBox           = -26777;
+    public final float            publicFinalFloat              = 7.72e8f;
+    public final float[]          publicFinalFloatArray         = { -131.012f, 189.32f, -31.32e8f, 3.72f };
+    public final Float            publicFinalFloatBox           = 1.372e4f;
+    public final double           publicFinalDouble             = 1.3412e20;
+    public final double[]         publicFinalDoubleArray        = { 0.725e80, 0.12e10, 8e-3, 1.00077 };
+    public final Double           publicFinalDoubleBox          = 1.412e-12;
+    public final char             publicFinalChar               = 'E';
+    public final char[]           publicFinalCharArray          = "Nashorn hello".toCharArray();
+    public final Character        publicFinalCharBox            = 'F';
+    // Public static final fields
+    public static final String    publicStaticFinalString       = "PublicStaticFinalString";
+    public static final String[]  publicStaticFinalStringArray  = { "StaticFinalArrayString[0]", "StaticFinalArrayString[1]", "StaticFinalArrayString[2]", "StaticFinalArrayString[3]" };
+    public static final Person    publicStaticFinalObject       = new Person(2048);
+    public static final Person[]  publicStaticFinalObjectArray  = { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) };
+    public static final boolean   publicStaticFinalBoolean      = true;
+    public static final boolean[] publicStaticFinalBooleanArray = { false, true, false, false };
+    public static final Boolean   publicStaticFinalBooleanBox   = true;
+    public static final long      publicStaticFinalLong         = 8333333333333L;
+    public static final long[]    publicStaticFinalLongArray    = { 19017383333L, -2247358L, 39773787L };
+    public static final Long      publicStaticFinalLongBox      = 9377388334L;
+    public static final int       publicStaticFinalInt          = 207182023;
+    public static final int[]     publicStaticFinalIntArray     = { 1308, 210, 340 };
+    public static final Integer   publicStaticFinalIntBox       = 2078301;
+    public static final byte      publicStaticFinalByte         = -70;
+    public static final byte[]    publicStaticFinalByteArray    = { 17, -128, 81 };
+    public static final Byte      publicStaticFinalByteBox      = 91;
+    public static final short     publicStaticFinalShort        = 8888;
+    public static final short[]   publicStaticFinalShortArray   = { 8240, 9280, -1289, 120, 812 };
+    public static final Short     publicStaticFinalShortBox     = -26;
+    public static final float     publicStaticFinalFloat        = 0.72e8f;
+    public static final float[]   publicStaticFinalFloatArray   = { -8131.012f, 9.32f, -138.32e8f, 0.72f };
+    public static final Float     publicStaticFinalFloatBox     = 1.2e4f;
+    public static final double    publicStaticFinalDouble       = 1.8e12;
+    public static final double[]  publicStaticFinalDoubleArray  = { 8.725e80, 0.82e10, 18e-3, 1.08077 };
+    public static final Double    publicStaticFinalDoubleBox    = 1.5612e-13;
+    public static final char      publicStaticFinalChar         = 'K';
+    public static final char[]    publicStaticFinalCharArray    = "StaticString".toCharArray();
+    public static final Character publicStaticFinalCharBox      = 'L';
+
+    // Special vars
+    public volatile boolean       volatileBoolean               = true;
+    public transient boolean      transientBoolean              = true;
+
+    // For methods testing
+    public boolean                isAccessed                    = false;
+    public volatile boolean       isFinished                    = false;
+
+    private ScriptEngine engine;
+
+    public ScriptEngine getEngine() {
+        return engine;
+    }
+
+    public void setEngine(ScriptEngine engine) {
+        this.engine = engine;
+    }
+
+    public void voidMethod() {
+        isAccessed = true;
+    }
+
+    public boolean booleanMethod(final boolean arg) {
+        return !arg;
+    }
+
+    public Boolean booleanBoxingMethod(final Boolean arg) {
+        return !arg.booleanValue();
+    }
+
+    public boolean[] booleanArrayMethod(final boolean arg[]) {
+        final boolean[] res = new boolean[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = !arg[i];
+        }
+        return res;
+    }
+
+    public int intMethod(final int arg) {
+        return arg + arg;
+    }
+
+    public Integer intBoxingMethod(final Integer arg) {
+        return arg + arg;
+    }
+
+    public int[] intArrayMethod(final int arg[]) {
+        final int[] res = new int[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public long longMethod(final long arg) {
+        return arg + arg;
+    }
+
+    public Long longBoxingMethod(final Long arg) {
+        return arg + arg;
+    }
+
+    public long[] longArrayMethod(final long[] arg) {
+        final long[] res = new long[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public byte byteMethod(final byte arg) {
+        return (byte)(arg + arg);
+    }
+
+    public Byte byteBoxingMethod(final Byte arg) {
+        return (byte)(arg + arg);
+    }
+
+    public byte[] byteArrayMethod(final byte[] arg) {
+        final byte[] res = new byte[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = (byte)(arg[i] * 2);
+        }
+        return res;
+    }
+
+    public char charMethod(final char arg) {
+        return Character.toUpperCase(arg);
+    }
+
+    public Character charBoxingMethod(final Character arg) {
+        return Character.toUpperCase(arg);
+    }
+
+    public char[] charArrayMethod(final char[] arg) {
+        final char[] res = new char[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = Character.toUpperCase(arg[i]);
+        }
+        return res;
+    }
+
+    public short shortMethod(final short arg) {
+        return (short)(arg + arg);
+    }
+
+    public Short shortBoxingMethod(final Short arg) {
+        return (short)(arg + arg);
+    }
+
+    public short[] shortArrayMethod(final short[] arg) {
+        final short[] res = new short[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = (short)(arg[i] * 2);
+        }
+        return res;
+    }
+
+    public float floatMethod(final float arg) {
+        return arg + arg;
+    }
+
+    public Float floatBoxingMethod(final Float arg) {
+        return arg + arg;
+    }
+
+    public float[] floatArrayMethod(final float[] arg) {
+        final float[] res = new float[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public double doubleMethod(final double arg) {
+        return arg + arg;
+    }
+
+    public Double doubleBoxingMethod(final Double arg) {
+        return arg + arg;
+    }
+
+    public double[] doubleArrayMethod(final double[] arg) {
+        final double[] res = new double[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public String stringMethod(final String str) {
+        return str + str;
+    }
+
+    public String[] stringArrayMethod(final String[] arr) {
+        final int l = arr.length;
+        final String[] res = new String[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = arr[l - i - 1];
+        }
+        return res;
+    }
+
+    public Person[] objectArrayMethod(final Person[] arr) {
+        final Person[] res = new Person[arr.length];
+        for (int i = 0; i < arr.length; i++) {
+            res[i] = new Person(i + 100);
+        }
+        return res;
+    }
+
+    public Person objectMethod(final Person t) {
+        t.id *= 2;
+        return t;
+    }
+
+    public int twoParamMethod(final long l, final double d) {
+        return (int)(l + d);
+    }
+
+    public int threeParamMethod(final short s, final long l, final char c) {
+        return (int)(s + l + c);
+    }
+
+    public Person[] twoObjectParamMethod(final Person arg1, final Person arg2) {
+        return new Person[] { arg2, arg1 };
+    }
+
+    public Person[] threeObjectParamMethod(final Person arg1, final Person arg2, final Person arg3) {
+        return new Person[] { arg3, arg2, arg1 };
+    }
+
+    public Person[] eightObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8) {
+        return new Person[] { arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
+    }
+
+    public Person[] nineObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8, final Person arg9) {
+        return new Person[] { arg9, arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
+    }
+
+    public Person[] methodObjectEllipsis(final Person... args) {
+        final int l = args.length;
+        final Person[] res = new Person[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = args[l - i - 1];
+        }
+        return res;
+    }
+
+    public Person[] methodPrimitiveEllipsis(final int... args) {
+        final int l = args.length;
+        final Person[] res = new Person[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = new Person(args[i]);
+        }
+        return res;
+    }
+
+    public Object[] methodMixedEllipsis(final Object... args) {
+        return args;
+    }
+
+    public Object[] methodObjectWithEllipsis(final String arg, final int... args) {
+        final Object[] res = new Object[args.length + 1];
+        res[0] = arg;
+        for (int i = 0; i < args.length; i++) {
+            res[i + 1] = args[i];
+        }
+        return res;
+    }
+
+    public Object[] methodPrimitiveWithEllipsis(final int arg, final long... args) {
+        final Object[] res = new Object[args.length + 1];
+        res[0] = arg;
+        for (int i = 0; i < args.length; i++) {
+            res[i + 1] = args[i];
+        }
+        return res;
+    }
+
+    public Object[] methodMixedWithEllipsis(final String arg1, final int arg2, final Object... args) {
+        final Object[] res = new Object[args.length + 2];
+        res[0] = arg1;
+        res[1] = arg2;
+        System.arraycopy(args, 0, res, 2, args.length);
+        return res;
+    }
+
+    public void methodStartsThread() {
+        isFinished = false;
+
+        final Thread t = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(1000);
+                    isFinished = true;
+                } catch (final InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        t.start();
+    }
+
+    public String overloadedMethodDoubleVSint(int arg) {
+        return "int";
+    }
+
+    public String overloadedMethodDoubleVSint(double arg) {
+        return "double";
+    }
+
+    public int overloadedMethod(int arg) {
+        return arg*2;
+    }
+
+    public int overloadedMethod(String arg) {
+        return arg.length();
+    }
+
+    public int overloadedMethod(boolean arg) {
+        return (arg) ? 1 : 0;
+    }
+
+    public int overloadedMethod(Person arg) {
+        return arg.id*2;
+    }
+
+    public int firstLevelMethodInt(int arg) throws ScriptException, NoSuchMethodException {
+        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInt", arg);
+    }
+
+    public int thirdLevelMethodInt(int arg) {
+        return arg*5;
+    }
+
+    public int firstLevelMethodInteger(Integer arg) throws ScriptException, NoSuchMethodException {
+        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInteger", arg);
+    }
+
+    public int thirdLevelMethodInteger(Integer arg) {
+        return arg*10;
+    }
+
+    public Person firstLevelMethodObject(Person p) throws ScriptException, NoSuchMethodException {
+        return (Person) ((Invocable)engine).invokeFunction("secondLevelMethodObject", p);
+    }
+
+    public Person thirdLevelMethodObject(Person p) {
+        p.id *= 10;
+        return p;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Mon Feb 11 21:26:06 2013 +0530
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class StringAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = new SharedObject();
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
+    }
+
+    @Test
+    public void accessFieldString() throws ScriptException {
+        e.eval("var p_string = o.publicString;");
+        assertEquals(o.publicString, e.get("p_string"));
+        assertEquals("string", e.eval("typeof p_string;"));
+        e.eval("o.publicString = 'changedString';");
+        assertEquals("changedString", o.publicString);
+    }
+
+    @Test
+    public void accessFieldStringArray() throws ScriptException {
+        e.eval("var p_string_array = o.publicStringArray;");
+        assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]"));
+        assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array"));
+        e.eval("var t_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+                "t_string_arr[0] = 'abc';" +
+                "t_string_arr[1] = '123';" +
+                "t_string_arr[2] = 'xyzzzz';" +
+                "o.publicStringArray = t_string_arr;");
+        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, o.publicStringArray);
+        e.eval("o.publicStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", o.publicStringArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldString() throws ScriptException {
+        e.eval("var ps_string = SharedObject.publicStaticString;");
+        assertEquals(SharedObject.publicStaticString, e.get("ps_string"));
+        assertEquals("string", e.eval("typeof ps_string;"));
+        e.eval("SharedObject.publicStaticString = 'changedString';");
+        assertEquals("changedString", SharedObject.publicStaticString);
+    }
+
+    @Test
+    public void accessStaticFieldStringArray() throws ScriptException {
+        e.eval("var ps_string_array = SharedObject.publicStaticStringArray;");
+        assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array"));
+        e.eval("var ts_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+                "ts_string_arr[0] = 'abc';" +
+                "ts_string_arr[1] = '123';" +
+                "ts_string_arr[2] = 'xyzzzz';" +
+                "SharedObject.publicStaticStringArray = ts_string_arr;");
+        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, SharedObject.publicStaticStringArray);
+        e.eval("SharedObject.publicStaticStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", SharedObject.publicStaticStringArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldString() throws ScriptException {
+        e.eval("var pf_string = o.publicFinalString;");
+        assertEquals(o.publicFinalString, e.get("pf_string"));
+        assertEquals("string", e.eval("typeof pf_string;"));
+        e.eval("o.publicFinalString = 'changedString';");
+        assertEquals("PublicFinalString", o.publicFinalString);
+    }
+
+    @Test
+    public void accessFinalFieldStringArray() throws ScriptException {
+        e.eval("var pf_string_array = o.publicFinalStringArray;");
+        assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]"));
+        assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array"));
+        e.eval("var tf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+                "tf_string_arr[0] = 'abc';" +
+                "tf_string_arr[1] = '123';" +
+                "tf_string_arr[2] = 'xyzzzz';" +
+                "o.publicFinalStringArray = tf_string_arr;");
+        assertArrayEquals(new String[] { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" }, o.publicFinalStringArray);
+        e.eval("o.publicFinalStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", o.publicFinalStringArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldString() throws ScriptException {
+        e.eval("var psf_string = SharedObject.publicStaticFinalString;");
+        assertEquals(SharedObject.publicStaticFinalString, e.get("psf_string"));
+        assertEquals("string", e.eval("typeof psf_string;"));
+        e.eval("SharedObject.publicStaticFinalString = 'changedString';");
+        assertEquals("PublicStaticFinalString", SharedObject.publicStaticFinalString);
+    }
+
+    @Test
+    public void accessStaticFinalFieldStringArray() throws ScriptException {
+        e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;");
+        assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array"));
+        e.eval("var tsf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+                "tsf_string_arr[0] = 'abc';" +
+                "tsf_string_arr[1] = '123';" +
+                "tsf_string_arr[2] = 'xyzzzz';" +
+                "SharedObject.publicStaticFinalStringArray = tsf_string_arr;");
+        assertArrayEquals(new String[] { "StaticFinalArrayString[0]",
+                    "StaticFinalArrayString[1]",
+                    "StaticFinalArrayString[2]",
+                    "StaticFinalArrayString[3]" },
+                SharedObject.publicStaticFinalStringArray);
+        e.eval("SharedObject.publicStaticFinalStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", SharedObject.publicStaticFinalStringArray[0]);
+    }
+
+}
--- a/nashorn/test/src/jdk/nashorn/internal/access/BooleanAccessTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Arrays;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class BooleanAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-    }
-
-    @Test
-    public void accessFieldBoolean() throws ScriptException {
-        e.eval("var p_boolean = o.publicBoolean;");
-        assertEquals(o.publicBoolean, e.get("p_boolean"));
-        assertEquals("boolean", e.eval("typeof p_boolean;"));
-        e.eval("o.publicBoolean = false;");
-        assertEquals(false, o.publicBoolean);
-    }
-
-    @Test
-    public void accessFieldBooleanArray() throws ScriptException {
-        e.eval("var p_boolean_array = o.publicBooleanArray;");
-        assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]"));
-        assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array")));
-        e.eval("var t_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
-                "t_boolean_arr[0] = true;" +
-                "t_boolean_arr[1] = false;" +
-                "t_boolean_arr[2] = false;" +
-                "o.publicBooleanArray = t_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { true, false, false }, o.publicBooleanArray));
-        e.eval("o.publicBooleanArray[0] = false;");
-        assertEquals(false, o.publicBooleanArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldBoolean() throws ScriptException {
-        e.eval("var ps_boolean = SharedObject.publicStaticBoolean;");
-        assertEquals(SharedObject.publicStaticBoolean, e.get("ps_boolean"));
-        assertEquals("boolean", e.eval("typeof ps_boolean;"));
-        e.eval("SharedObject.publicStaticBoolean = false;");
-        assertEquals(false, SharedObject.publicStaticBoolean);
-    }
-
-    @Test
-    public void accessStaticFieldBooleanArray() throws ScriptException {
-        e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;");
-        assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]"));
-        assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array")));
-        e.eval("var ts_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
-                "ts_boolean_arr[0] = true;" +
-                "ts_boolean_arr[1] = false;" +
-                "ts_boolean_arr[2] = true;" +
-                "SharedObject.publicStaticBooleanArray = ts_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { true, false, true }, SharedObject.publicStaticBooleanArray));
-        e.eval("SharedObject.publicStaticBooleanArray[0] = false;");
-        assertEquals(false, SharedObject.publicStaticBooleanArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldBoolean() throws ScriptException {
-        e.eval("var pf_boolean = o.publicFinalBoolean;");
-        assertEquals(o.publicFinalBoolean, e.get("pf_boolean"));
-        assertEquals("boolean", e.eval("typeof pf_boolean;"));
-        e.eval("o.publicFinalBoolean = false;");
-        assertEquals(true, o.publicFinalBoolean);
-    }
-
-    @Test
-    public void accessFinalFieldBooleanArray() throws ScriptException {
-        e.eval("var pf_boolean_array = o.publicFinalBooleanArray;");
-        assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]"));
-        assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array")));
-        e.eval("var tf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
-                "tf_boolean_arr[0] = false;" +
-                "tf_boolean_arr[1] = false;" +
-                "tf_boolean_arr[2] = true;" +
-                "o.publicOFinalbjectArray = tf_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { false, false, true, false }, o.publicFinalBooleanArray));
-        e.eval("o.publicFinalBooleanArray[0] = true;");
-        assertEquals(true, o.publicFinalBooleanArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBoolean() throws ScriptException {
-        e.eval("var psf_boolean = SharedObject.publicStaticFinalBoolean;");
-        assertEquals(SharedObject.publicStaticFinalBoolean, e.get("psf_boolean"));
-        assertEquals("boolean", e.eval("typeof psf_boolean;"));
-        e.eval("SharedObject.publicStaticFinalBoolean = false;");
-        assertEquals(true, SharedObject.publicStaticFinalBoolean);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBooleanArray() throws ScriptException {
-        e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;");
-        assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]"));
-        assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array")));
-        e.eval("var tsf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
-                "tsf_boolean_arr[0] = false;" +
-                "tsf_boolean_arr[1] = true;" +
-                "tsf_boolean_arr[2] = false;" +
-                "SharedObject.publicStaticFinalBooleanArray = tsf_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { false, true, false, false }, SharedObject.publicStaticFinalBooleanArray));
-        e.eval("SharedObject.publicStaticFinalBooleanArray[0] = true;");
-        assertEquals(true, SharedObject.publicStaticFinalBooleanArray[0]);
-    }
-
-    @Test
-    public void accessFieldBooleanBoxing() throws ScriptException {
-        e.eval("var p_boolean_box = o.publicBooleanBox;");
-        assertEquals(o.publicBooleanBox, e.get("p_boolean_box"));
-        assertEquals("boolean", e.eval("typeof p_boolean_box;"));
-        e.eval("o.publicBooleanBox = false;");
-        assertEquals(false, (boolean)o.publicBooleanBox);
-    }
-
-    @Test
-    public void accessStaticFieldBooleanBoxing() throws ScriptException {
-        e.eval("var ps_boolean_box = SharedObject.publicStaticBooleanBox;");
-        assertEquals(SharedObject.publicStaticBooleanBox, e.get("ps_boolean_box"));
-        assertEquals("boolean", e.eval("typeof ps_boolean_box;"));
-        e.eval("SharedObject.publicStaticBooleanBox = false;");
-        assertEquals(false, (boolean)SharedObject.publicStaticBooleanBox);
-    }
-
-    @Test
-    public void accessFinalFieldBooleanBoxing() throws ScriptException {
-        e.eval("var pf_boolean_box = o.publicFinalBooleanBox;");
-        assertEquals(o.publicFinalBooleanBox, e.get("pf_boolean_box"));
-        assertEquals("boolean", e.eval("typeof pf_boolean_box;"));
-        e.eval("o.publicFinalBooleanBox = false;");
-        assertEquals(true, (boolean)o.publicFinalBooleanBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBooleanBoxing() throws ScriptException {
-        e.eval("var psf_boolean_box = SharedObject.publicStaticFinalBooleanBox;");
-        assertEquals(SharedObject.publicStaticFinalBooleanBox, e.get("psf_boolean_box"));
-        assertEquals("boolean", e.eval("typeof psf_boolean_box;"));
-        e.eval("SharedObject.publicStaticFinalBooleanBox = false;");
-        assertEquals(true, (boolean)SharedObject.publicStaticFinalBooleanBox);
-    }
-
-    @Test
-    public void accessVolatileField() throws ScriptException {
-        e.eval("var pv_boolean = o.volatileBoolean;");
-        assertEquals(o.volatileBoolean, e.get("pv_boolean"));
-        assertEquals("boolean", e.eval("typeof pv_boolean;"));
-        e.eval("o.volatileBoolean = false;");
-        assertEquals(false, o.volatileBoolean);
-    }
-
-    @Test
-    public void accessTransientField() throws ScriptException {
-        e.eval("var pt_boolean = o.transientBoolean;");
-        assertEquals(o.transientBoolean, e.get("pt_boolean"));
-        assertEquals("boolean", e.eval("typeof pt_boolean;"));
-        e.eval("o.transientBoolean = false;");
-        assertEquals(false, o.transientBoolean);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/MethodAccessTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,453 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Locale;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class MethodAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o.setEngine(e);
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.internal.access.Person;");
-    }
-
-    @Test
-    public void accessMethodthrowsCheckedException() throws ScriptException {
-        e.eval("try {" +
-                "    var a = java.lang.Long.parseLong('foo');" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "    var isNumberException = e instanceof java.lang.NumberFormatException;" +
-                "} finally {" +
-                "    var isFinalized = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals("Finally called", true, e.get("isFinalized"));
-        assertEquals("Type is NumberFormatException", true, e.get("isNumberException"));
-    }
-
-    @Test
-    public void accessMethodthrowsUnCheckedException() throws ScriptException {
-        e.eval("try {" +
-                "    var a = java.lang.String.valueOf(null);" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "    var isNumberException = e instanceof java.lang.NullPointerException;" +
-                "} finally {" +
-                "    var isFinalized = true;" +
-                "}");
-        assertEquals(true, e.get("isThrown"));
-        assertEquals(true, e.get("isFinalized"));
-        assertEquals(true, e.get("isNumberException"));
-    }
-
-    @Test
-    public void accessMethodStartsThread() throws ScriptException {
-        e.eval("o.methodStartsThread();");
-        assertEquals(false, o.isFinished);
-    }
-
-    @Test
-    public void accessStaticMethod() throws ScriptException {
-        assertEquals(10, e.eval("java.lang.Math.abs(-10);"));
-    }
-
-    @Test
-    public void accessSynchronousMethod() throws ScriptException {
-        e.eval("var v = new java.util.Vector();" + "v.add(10);" + "v.add(20);" + "v.add(30);");
-        assertEquals(10, e.eval("v[0]"));
-        assertEquals(20, e.eval("v[1]"));
-        assertEquals(30, e.eval("v[2]"));
-        assertEquals(3, e.eval("v.size()"));
-    }
-
-    @Test
-    public void accessStaticSynchronousMethod() throws ScriptException {
-        e.eval("var locales = java.util.Calendar.getAvailableLocales();");
-        final Locale[] locales = (Locale[])e.get("locales");
-        assertEquals(locales.length, Calendar.getAvailableLocales().length);
-    }
-
-    @Test
-    public void accessNativeMethod() throws ScriptException {
-        assertEquals(4.0, e.eval("java.lang.StrictMath.log10(10000);"));
-    }
-
-    @Test
-    public void accessConstructorOfAbstractClass() throws ScriptException {
-        e.eval("try {" +
-                "    var a = new java.util.AbstractList();" +
-                "    print('fail');" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals(true, e.get("isThrown"));
-    }
-
-    @Test
-    public void accessMethodVoid() throws ScriptException {
-        o.isAccessed = false;
-        e.eval("o.voidMethod();");
-        assertTrue(o.isAccessed);
-    }
-
-    @Test
-    public void accessMethodBoolean() throws ScriptException {
-        assertEquals(true, e.eval("o.booleanMethod(false);"));
-        assertEquals(false, e.eval("o.booleanMethod(true);"));
-        assertEquals(false, e.eval("o.booleanMethod('false');"));
-        assertEquals(true, e.eval("o.booleanMethod('');"));
-        assertEquals(true, e.eval("o.booleanMethod(0);"));
-    }
-
-    @Test
-    public void accessMethodInt() throws ScriptException {
-        assertEquals(0, e.eval("o.intMethod(0);"));
-        assertEquals(-200, e.eval("o.intMethod(-100);"));
-        assertEquals(0, e.eval("o.intMethod('0');"));
-        assertEquals(-200, e.eval("o.intMethod('-100');"));
-    }
-
-    @Test
-    public void accessMethodLong() throws ScriptException {
-        assertEquals((long)0, e.eval("o.longMethod(0);"));
-        assertEquals((long)400, e.eval("o.longMethod(200);"));
-        assertEquals((long) 0, e.eval("o.longMethod('0');"));
-        assertEquals((long) 400, e.eval("o.longMethod('200');"));
-    }
-
-    @Test
-    public void accessMethodByte() throws ScriptException {
-        assertEquals((byte) 0, e.eval("o.byteMethod(0);"));
-        assertEquals((byte) 10, e.eval("o.byteMethod(5);"));
-        assertEquals((byte) 0, e.eval("o.byteMethod('0');"));
-        assertEquals((byte) 10, e.eval("o.byteMethod('5');"));
-    }
-
-    @Test
-    public void accessMethodShort() throws ScriptException {
-        assertEquals((short)0, e.eval("o.shortMethod(0);"));
-        assertEquals((short)8000, e.eval("o.shortMethod(4000);"));
-        assertEquals((short) 0, e.eval("o.shortMethod('0');"));
-        assertEquals((short) 8000, e.eval("o.shortMethod('4000');"));
-    }
-
-    @Test
-    public void accessMethodChar() throws ScriptException {
-        assertEquals('A', e.eval("o.charMethod('a');"));
-        assertEquals('Z', e.eval("o.charMethod('z');"));
-        assertEquals(o.charMethod((char)0), e.eval("o.charMethod(0);"));
-        assertEquals(o.charMethod((char)3150), e.eval("o.charMethod(3150);"));
-    }
-
-    @Test
-    public void accessMethodFloat() throws ScriptException {
-        assertEquals(0.0f, e.eval("o.floatMethod(0.0);"));
-        assertEquals(4.2f, e.eval("o.floatMethod(2.1);"));
-        assertEquals(0.0f, e.eval("o.floatMethod('0.0');"));
-        assertEquals(4.2f, e.eval("o.floatMethod('2.1');"));
-    }
-
-    @Test
-    public void accessMethodDouble() throws ScriptException {
-        assertEquals(0.0, e.eval("o.doubleMethod(0.0);"));
-        assertEquals(14.0, e.eval("o.doubleMethod(7.0);"));
-        assertEquals(0.0, e.eval("o.doubleMethod('0.0');"));
-        assertEquals(14.0, e.eval("o.doubleMethod('7.0');"));
-    }
-
-    @Test
-    public void accessMethodBooleanBoxing() throws ScriptException {
-        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.FALSE);"));
-        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.TRUE);"));
-        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod('');"));
-        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod('false');"));
-    }
-
-    @Test
-    public void accessMethodIntBoxing() throws ScriptException {
-        assertEquals(0, e.eval("o.intBoxingMethod(0);"));
-        assertEquals(-200, e.eval("o.intBoxingMethod(-100);"));
-        assertTrue((int)e.eval("(new java.lang.Integer(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodLongBoxing() throws ScriptException {
-        assertEquals((long) 0, e.eval("o.longBoxingMethod(0);"));
-        assertEquals((long) 400, e.eval("o.longBoxingMethod(200);"));
-        assertTrue((int)e.eval("(new java.lang.Long(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodByteBoxing() throws ScriptException {
-        assertEquals((byte) 0, e.eval("o.byteBoxingMethod(0);"));
-        assertEquals((byte) 10, e.eval("o.byteBoxingMethod(5);"));
-        assertTrue((int)e.eval("(new java.lang.Byte(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodShortBoxing() throws ScriptException {
-        assertEquals((short) 0, e.eval("o.shortBoxingMethod(0);"));
-        assertEquals((short) 8000, e.eval("o.shortBoxingMethod(4000);"));
-        assertTrue((int)e.eval("(new java.lang.Short(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodCharBoxing() throws ScriptException {
-        assertEquals('A', e.eval("o.charBoxingMethod('a');"));
-        assertEquals('Z', e.eval("o.charBoxingMethod('z');"));
-        assertTrue((int)e.eval("(new java.lang.Character(2)).compareTo(10)") < 0);
-    }
-
-    @Test
-    public void accessMethodFloatBoxing() throws ScriptException {
-        assertEquals(0.0f, e.eval("o.floatBoxingMethod(0.0);"));
-        assertEquals(4.2f, e.eval("o.floatBoxingMethod(2.1);"));
-        assertTrue((int)e.eval("(new java.lang.Float(2.0)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodDoubleBoxing() throws ScriptException {
-        assertEquals(0.0, e.eval("o.doubleBoxingMethod(0.0);"));
-        assertEquals(14.0, e.eval("o.doubleBoxingMethod(7.0);"));
-        assertTrue((int)e.eval("(new java.lang.Double(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodString() throws ScriptException {
-        assertEquals("", e.eval("o.stringMethod('');"));
-        assertEquals("abcabc", e.eval("o.stringMethod('abc');"));
-    }
-
-    @Test
-    public void accessMethodObject() throws ScriptException {
-        e.put("so", new Person(5));
-        e.eval("var rso = o.objectMethod(so);");
-        assertEquals(new Person(10), e.get("rso"));
-    }
-
-    @Test
-    public void accessMethodBooleanArray() throws ScriptException {
-        assertTrue(Arrays.equals(o.booleanArrayMethod(o.publicBooleanArray), (boolean[])e.eval("o.booleanArrayMethod(o.publicBooleanArray);")));
-    }
-
-    @Test
-    public void accessMethodIntArray() throws ScriptException {
-        assertArrayEquals(o.intArrayMethod(o.publicIntArray), (int[])e.eval("o.intArrayMethod(o.publicIntArray);"));
-    }
-
-    @Test
-    public void accessMethodLongArray() throws ScriptException {
-        assertArrayEquals(o.longArrayMethod(o.publicLongArray), (long[])e.eval("o.longArrayMethod(o.publicLongArray);"));
-    }
-
-    @Test
-    public void accessMethodByteArray() throws ScriptException {
-        assertArrayEquals(o.byteArrayMethod(o.publicByteArray), (byte[])e.eval("o.byteArrayMethod(o.publicByteArray);"));
-    }
-
-    @Test
-    public void accessMethodShortArray() throws ScriptException {
-        assertArrayEquals(o.shortArrayMethod(o.publicShortArray), (short[])e.eval("o.shortArrayMethod(o.publicShortArray);"));
-    }
-
-    @Test
-    public void accessMethodCharArray() throws ScriptException {
-        assertArrayEquals(o.charArrayMethod(o.publicCharArray), (char[])e.eval("o.charArrayMethod(o.publicCharArray);"));
-    }
-
-    @Test
-    public void accessMethodFloatArray() throws ScriptException {
-        assertArrayEquals(o.floatArrayMethod(o.publicFloatArray), (float[])e.eval("o.floatArrayMethod(o.publicFloatArray);"), 1e-10f);
-    }
-
-    @Test
-    public void accessMethodDoubleArray() throws ScriptException {
-        assertArrayEquals(o.doubleArrayMethod(o.publicDoubleArray), (double[])e.eval("o.doubleArrayMethod(o.publicDoubleArray);"), 1e-10);
-    }
-
-    @Test
-    public void accessMethodStringArray() throws ScriptException {
-        assertArrayEquals(o.stringArrayMethod(o.publicStringArray), (String[])e.eval("o.stringArrayMethod(o.publicStringArray);"));
-    }
-
-    @Test
-    public void accessMethodObjectArray() throws ScriptException {
-        assertArrayEquals(o.objectArrayMethod(o.publicObjectArray), (Person[])e.eval("o.objectArrayMethod(o.publicObjectArray);"));
-    }
-
-    @Test
-    public void accessDefaultConstructor() throws ScriptException {
-        e.eval("var dc = new Packages.jdk.nashorn.internal.access.Person()");
-        assertEquals(new Person(), e.get("dc"));
-    }
-
-    @Test
-    public void accessCustomConstructor() throws ScriptException {
-        e.eval("var cc = new Packages.jdk.nashorn.internal.access.Person(17)");
-        assertEquals(new Person(17), e.get("cc"));
-    }
-
-    @Test
-    public void accessMethod2PrimitiveParams() throws ScriptException {
-        assertEquals(o.twoParamMethod(50, 40.0), e.eval("o.twoParamMethod(50,40);"));
-    }
-
-    @Test
-    public void accessMethod3PrimitiveParams() throws ScriptException {
-        assertEquals(o.threeParamMethod((short)10, 20L, 'b'), e.eval("o.threeParamMethod(10,20,'b');"));
-    }
-
-    @Test
-    public void accessMethod2ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(200), new Person(300) }, (Person[])e.eval("o.twoObjectParamMethod(new Person(300),new Person(200));"));
-    }
-
-    @Test
-    public void accessMethod3ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.threeObjectParamMethod(new Person(1),new Person(2),new Person(3));"));
-    }
-
-    @Test
-    public void accessMethod8ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.eightObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6),new Person(7),new Person(8));"));
-    }
-
-    @Test
-    public void accessMethod9ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.nineObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
-    }
-
-    @Test
-    public void accessMethodObjectEllipsis() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
-        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodObjectEllipsis()"));
-        assertArrayEquals(new Person[] { new Person(9) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(9))"));
-    }
-
-    @Test
-    public void accessMethodPrimitiveEllipsis() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(1), new Person(3), new Person(2) }, (Person[])e.eval("o.methodPrimitiveEllipsis(1,3,2);"));
-        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodPrimitiveEllipsis();"));
-        assertArrayEquals(o.methodPrimitiveEllipsis(9, 8, 7, 6, 5, 4, 3, 2, 1), (Person[])e.eval("o.methodPrimitiveEllipsis(9,8,7,6,5,4,3,2,1);"));
-    }
-
-    @Test
-    public void accessMethodMixedEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { new Person(1), 12, "hello", true }, (Object[])e.eval("o.methodMixedEllipsis(new Person(1),12,'hello',true);"));
-        assertArrayEquals(new Object[] {}, (Object[])e.eval("o.methodMixedEllipsis();"));
-    }
-
-    @Test
-    public void accessMethodObjectWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { "hello", 12, 15, 16 }, (Object[])e.eval("o.methodObjectWithEllipsis('hello',12,15,16);"));
-        assertArrayEquals(new Object[] { "hello" }, (Object[])e.eval("o.methodObjectWithEllipsis('hello');"));
-    }
-
-    @Test
-    public void accessMethodPrimitiveWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { 14, 12L, 15L, 16L }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(14,12,15,16);"));
-        assertArrayEquals(new Object[] { 12 }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(12);"));
-    }
-
-    @Test
-    public void accessMethodMixedWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80 }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
-        assertArrayEquals(new Object[] { "Nashorn", 15 }, (Object[])e.eval("o.methodMixedWithEllipsis('Nashorn',15);"));
-    }
-
-    @Test
-    public void accessMethodOverloaded() throws ScriptException {
-        assertEquals(0, e.eval("o.overloadedMethod(0);"));
-        assertEquals(2000, e.eval("o.overloadedMethod(1000);"));
-        assertEquals(2, e.eval("o.overloadedMethod('10');"));
-        assertEquals(7, e.eval("o.overloadedMethod('Nashorn');"));
-        assertEquals(4, e.eval("o.overloadedMethod('true');"));
-        assertEquals(1, e.eval("o.overloadedMethod(true);"));
-        assertEquals(0, e.eval("o.overloadedMethod(false);"));
-        assertEquals(44, e.eval("o.overloadedMethod(new Person(22));"));
-        assertEquals(0, e.eval("o.overloadedMethod(new Person());"));
-    }
-
-    @Test
-    public void accessMethodDoubleVSintOverloaded() throws ScriptException {
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.01);"));
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(100.02);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000);"));
-    }
-
-    @Test
-    public void accessJavaMethodIntFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodInt(a) {"
-                + "return o.thirdLevelMethodInt(a);"
-                + "}");
-        assertEquals(50, e.eval("o.firstLevelMethodInt(10);"));
-    }
-
-    @Test
-    public void accessJavaMethodIntegerFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodInteger(a) {"
-                + "return o.thirdLevelMethodInteger(a);"
-                + "}");
-        assertEquals(100, e.eval("o.firstLevelMethodInteger(10);"));
-    }
-
-    @Test
-    public void accessJavaMethodObjectFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodObject(p) {"
-                + "return o.thirdLevelMethodObject(p);"
-                + "}");
-        assertEquals(new Person(100), e.eval("o.firstLevelMethodObject(new Person(10));"));
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/NumberAccessTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,776 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class NumberAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-    }
-
-    // --------------------------------long
-    // tests------------------------------------
-    @Test
-    public void accessFieldLong() throws ScriptException {
-        e.eval("var p_long = o.publicLong;");
-        assertEquals(o.publicLong, e.get("p_long"));
-        e.eval("o.publicLong = 12;");
-        assertEquals(12, o.publicLong);
-    }
-
-    @Test
-    public void accessFieldLongArray() throws ScriptException {
-        e.eval("var p_long_array = o.publicLongArray;");
-        assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];"));
-        assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array"));
-        e.eval("var t_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
-                "t_long_arr[0] = -189009;" +
-                "t_long_arr[1] = 456;" +
-                "t_long_arr[2] = 600000001;" +
-                "o.publicLongArray = t_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { -189009, 456, 600000001 }, o.publicLongArray);
-        e.eval("o.publicLongArray[0] = 10;");
-        assertEquals(10, o.publicLongArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldLong() throws ScriptException {
-        e.eval("var ps_long = SharedObject.publicStaticLong;");
-        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
-        e.eval("SharedObject.publicStaticLong = 120;");
-        assertEquals(120, SharedObject.publicStaticLong);
-    }
-
-    @Test
-    public void accessStaticFieldLongArray() throws ScriptException {
-        e.eval("var ps_long_array = SharedObject.publicStaticLongArray;");
-        assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array"));
-        e.eval("var ts_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
-                "ts_long_arr[0] = -189009;" +
-                "ts_long_arr[1] = 456;" +
-                "ts_long_arr[2] = 600000001;" +
-                "SharedObject.publicStaticLongArray = ts_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { -189009, 456, 600000001 }, SharedObject.publicStaticLongArray);
-        e.eval("SharedObject.publicStaticLongArray[0] = 10;");
-        assertEquals(10, SharedObject.publicStaticLongArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldLong() throws ScriptException {
-        e.eval("var pf_long = o.publicFinalLong;");
-        assertEquals(o.publicFinalLong, e.get("pf_long"));
-        e.eval("o.publicFinalLong = 120;");
-        assertEquals(13353333333333333L, o.publicFinalLong);
-    }
-
-    @Test
-    public void accessFinalFieldLongArray() throws ScriptException {
-        e.eval("var pf_long_array = o.publicFinalLongArray;");
-        assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];"));
-        assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array"));
-        e.eval("var tf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
-                "tf_long_arr[0] = -189009;" +
-                "tf_long_arr[1] = 456;" +
-                "tf_long_arr[2] = 600000001;" +
-                "o.publicFinalLongArray = tf_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { 1901733333333L, -2247355555L, 3977377777L }, o.publicFinalLongArray);
-        e.eval("o.publicFinalLongArray[0] = 10;");
-        assertEquals(10, o.publicFinalLongArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLong() throws ScriptException {
-        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
-        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
-        e.eval("SharedObject.publicStaticFinalLong = 120;");
-        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLongArray() throws ScriptException {
-        e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;");
-        assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array"));
-        e.eval("var tsf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
-                "tsf_long_arr[0] = -189009;" +
-                "tsf_long_arr[1] = 456;" +
-                "tsf_long_arr[2] = 600000001;" +
-                "SharedObject.publicStaticFinalLongArray = tsf_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { 19017383333L, -2247358L, 39773787L }, SharedObject.publicStaticFinalLongArray);
-        e.eval("SharedObject.publicStaticFinalLongArray[0] = 10;");
-        assertEquals(10, SharedObject.publicStaticFinalLongArray[0]);
-    }
-
-    // --------------------------------int
-    // tests------------------------------------
-    @Test
-    public void accessFieldInt() throws ScriptException {
-        e.eval("var p_int = o.publicInt;");
-        assertEquals(o.publicInt, e.get("p_int"));
-        e.eval("o.publicInt = 14;");
-        assertEquals(14, o.publicInt);
-    }
-
-    @Test
-    public void accessFieldIntArray() throws ScriptException {
-        e.eval("var p_int_array = o.publicIntArray;");
-        assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];"));
-        assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array"));
-        e.eval("var t_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
-                "t_int_arr[0] = 4;" +
-                "t_int_arr[1] = 5;" +
-                "t_int_arr[2] = 6;" +
-                "o.publicIntArray = t_int_arr;");
-        assertArrayEquals(new int[] { 4, 5, 6 }, o.publicIntArray);
-        e.eval("o.publicIntArray[0] = 100;");
-        assertEquals(100, o.publicIntArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldInt() throws ScriptException {
-        e.eval("var ps_int = SharedObject.publicStaticInt;");
-        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
-        e.eval("SharedObject.publicStaticInt = 140;");
-        assertEquals(140, SharedObject.publicStaticInt);
-    }
-
-    @Test
-    public void accessStaticFieldIntArray() throws ScriptException {
-        e.eval("var ps_int_array = SharedObject.publicStaticIntArray;");
-        assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array"));
-        e.eval("var ts_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
-                "ts_int_arr[0] = 4;" +
-                "ts_int_arr[1] = 5;" +
-                "ts_int_arr[2] = 6;" +
-                "SharedObject.publicStaticIntArray = ts_int_arr;");
-        assertArrayEquals(new int[] { 4, 5, 6 }, SharedObject.publicStaticIntArray);
-        e.eval("SharedObject.publicStaticIntArray[0] = 100;");
-        assertEquals(100, SharedObject.publicStaticIntArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldInt() throws ScriptException {
-        e.eval("var pf_int = o.publicFinalInt;");
-        assertEquals(o.publicFinalInt, e.get("pf_int"));
-
-        e.eval("o.publicFinalInt = 10;");
-        assertEquals(20712023, o.publicFinalInt);
-    }
-
-    @Test
-    public void accessFinalFieldIntArray() throws ScriptException {
-        e.eval("var pf_int_array = o.publicFinalIntArray;");
-        assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];"));
-        assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array"));
-        e.eval("var tf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
-                "tf_int_arr[0] = 4;" +
-                "tf_int_arr[1] = 5;" +
-                "tf_int_arr[2] = 6;" +
-                "o.publicFinalIntArray = tf_int_arr;");
-        assertArrayEquals(new int[] { 50, 80, 130, 210, 340 }, o.publicFinalIntArray);
-        e.eval("o.publicFinalIntArray[0] = 100;");
-        assertEquals(100, o.publicFinalIntArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldInt() throws ScriptException {
-        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
-        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
-        e.eval("SharedObject.publicStaticFinalInt = 140;");
-        assertEquals(207182023, SharedObject.publicStaticFinalInt);
-    }
-
-    @Test
-    public void accessStaticFinalFieldIntArray() throws ScriptException {
-        e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;");
-        assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array"));
-        e.eval("var tsf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
-                "tsf_int_arr[0] = 4;" +
-                "tsf_int_arr[1] = 5;" +
-                "tsf_int_arr[2] = 6;" +
-                "SharedObject.publicStaticFinalIntArray = tsf_int_arr;");
-        assertArrayEquals(new int[] { 1308, 210, 340 }, SharedObject.publicStaticFinalIntArray);
-        e.eval("SharedObject.publicStaticFinalIntArray[0] = 100;");
-        assertEquals(100, SharedObject.publicStaticFinalIntArray[0]);
-    }
-
-    // --------------------------------byte
-    // tests------------------------------------
-    @Test
-    public void accessFieldByte() throws ScriptException {
-        e.eval("var p_byte = o.publicByte;");
-        assertEquals(o.publicByte, e.get("p_byte"));
-        e.eval("o.publicByte = 16;");
-        assertEquals(16, o.publicByte);
-    }
-
-    @Test
-    public void accessFieldByteArray() throws ScriptException {
-        e.eval("var p_byte_array = o.publicByteArray;");
-        assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];"));
-        assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array"));
-        e.eval("var t_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
-                "t_byte_arr[0] = -18;" +
-                "t_byte_arr[1] = 56;" +
-                "t_byte_arr[2] = 60;" +
-                "o.publicByteArray = t_byte_arr;");
-        assertArrayEquals(new byte[] { -18, 56, 60 }, o.publicByteArray);
-        e.eval("o.publicByteArray[0] = 100;");
-        assertEquals(100, o.publicByteArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldByte() throws ScriptException {
-        e.eval("var ps_byte = SharedObject.publicStaticByte;");
-        assertEquals(SharedObject.publicStaticByte, e.get("ps_byte"));
-        e.eval("SharedObject.publicStaticByte = 16;");
-        assertEquals(16, SharedObject.publicStaticByte);
-    }
-
-    @Test
-    public void accessStaticFieldByteArray() throws ScriptException {
-        e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;");
-        assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array"));
-        e.eval("var ts_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
-                "ts_byte_arr[0] = -18;" +
-                "ts_byte_arr[1] = 56;" +
-                "ts_byte_arr[2] = 60;" +
-                "SharedObject.publicStaticByteArray = ts_byte_arr;");
-        assertArrayEquals(new byte[] { -18, 56, 60 }, SharedObject.publicStaticByteArray);
-        e.eval("SharedObject.publicStaticByteArray[0] = -90;");
-        assertEquals(-90, SharedObject.publicStaticByteArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldByte() throws ScriptException {
-        e.eval("var pf_byte = o.publicFinalByte;");
-        assertEquals(o.publicFinalByte, e.get("pf_byte"));
-        e.eval("o.publicFinalByte = 16;");
-        assertEquals(-7, o.publicFinalByte);
-    }
-
-    @Test
-    public void accessFinalFieldByteArray() throws ScriptException {
-        e.eval("var pf_byte_array = o.publicFinalByteArray;");
-        assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];"));
-        assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array"));
-        e.eval("var tf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
-                "tf_byte_arr[0] = -18;" +
-                "tf_byte_arr[1] = 56;" +
-                "tf_byte_arr[2] = 60;" +
-                "o.publicFinalByteArray = tf_byte_arr;");
-        assertArrayEquals(new byte[] { 1, 3, 6, 17, -128 }, o.publicFinalByteArray);
-        e.eval("o.publicFinalByteArray[0] = -90;");
-        assertEquals(-90, o.publicFinalByteArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByte() throws ScriptException {
-        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
-        assertEquals(SharedObject.publicStaticFinalByte, e.get("psf_byte"));
-        e.eval("SharedObject.publicStaticFinalByte = 16;");
-        assertEquals(-70, SharedObject.publicStaticFinalByte);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByteArray() throws ScriptException {
-        e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;");
-        assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array"));
-        e.eval("var tsf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
-                "tsf_byte_arr[0] = -18;" +
-                "tsf_byte_arr[1] = 56;" +
-                "tsf_byte_arr[2] = 60;" +
-                "SharedObject.publicStaticFinalByteArray = tsf_byte_arr;");
-        assertArrayEquals(new byte[] { 17, -128, 81 }, SharedObject.publicStaticFinalByteArray);
-        e.eval("SharedObject.publicStaticFinalByteArray[0] = -90;");
-        assertEquals(-90, SharedObject.publicStaticFinalByteArray[0]);
-    }
-
-    // --------------------------------short
-    // tests------------------------------------
-    @Test
-    public void accessFieldShort() throws ScriptException {
-        e.eval("var p_short = o.publicShort;");
-        assertEquals(o.publicShort, e.get("p_short"));
-        e.eval("o.publicShort = 18;");
-        assertEquals(18, o.publicShort);
-    }
-
-    @Test
-    public void accessFieldShortArray() throws ScriptException {
-        e.eval("var p_short_array = o.publicShortArray;");
-        assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];"));
-        assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array"));
-        e.eval("var t_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
-                "t_short_arr[0] = 90;" +
-                "t_short_arr[1] = 5;" +
-                "t_short_arr[2] = -6000;" +
-                "o.publicShortArray = t_short_arr;");
-        assertArrayEquals(new short[] { 90, 5, -6000 }, o.publicShortArray);
-        e.eval("o.publicShortArray[0] = -1000;");
-        assertEquals(-1000, o.publicShortArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldShort() throws ScriptException {
-        e.eval("var ps_short = SharedObject.publicStaticShort;");
-        assertEquals(SharedObject.publicStaticShort, e.get("ps_short"));
-        e.eval("SharedObject.publicStaticShort = 180;");
-        assertEquals(180, SharedObject.publicStaticShort);
-    }
-
-    @Test
-    public void accessStaticFieldShortArray() throws ScriptException {
-        e.eval("var ps_short_array = SharedObject.publicStaticShortArray;");
-        assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array"));
-        e.eval("var ts_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
-                "ts_short_arr[0] = 90;" +
-                "ts_short_arr[1] = 5;" +
-                "ts_short_arr[2] = -6000;" +
-                "SharedObject.publicStaticShortArray = ts_short_arr;");
-        assertArrayEquals(new short[] { 90, 5, -6000 }, SharedObject.publicStaticShortArray);
-        e.eval("SharedObject.publicStaticShortArray[0] = -1000;");
-        assertEquals(-1000, SharedObject.publicStaticShortArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldShort() throws ScriptException {
-        e.eval("var pf_short = o.publicFinalShort;");
-        assertEquals(o.publicFinalShort, e.get("pf_short"));
-        e.eval("o.publicFinalShort = 180;");
-        assertEquals(31220, o.publicFinalShort);
-    }
-
-    @Test
-    public void accessFinalFieldShortArray() throws ScriptException {
-        e.eval("var pf_short_array = o.publicFinalShortArray;");
-        assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];"));
-        assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array"));
-        e.eval("var tf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
-                "tf_short_arr[0] = 90;" +
-                "tf_short_arr[1] = 5;" +
-                "tf_short_arr[2] = -6000;" +
-                "o.publicFinalShortArray = tf_short_arr;");
-        assertArrayEquals(new short[] { 12240, 9200, -17289, 1200, 12 }, o.publicFinalShortArray);
-        e.eval("o.publicFinalShortArray[0] = -1000;");
-        assertEquals(-1000, o.publicFinalShortArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShort() throws ScriptException {
-        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
-        assertEquals(SharedObject.publicStaticFinalShort, e.get("psf_short"));
-        e.eval("SharedObject.publicStaticFinalShort = 180;");
-        assertEquals(8888, SharedObject.publicStaticFinalShort);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShortArray() throws ScriptException {
-        e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;");
-        assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array"));
-        e.eval("var tsf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
-                "tsf_short_arr[0] = 90;" +
-                "tsf_short_arr[1] = 5;" +
-                "tsf_short_arr[2] = -6000;" +
-                "SharedObject.publicStaticFinalShortArray = tsf_short_arr;");
-        assertArrayEquals(new short[] { 8240, 9280, -1289, 120, 812 }, SharedObject.publicStaticFinalShortArray);
-        e.eval("SharedObject.publicStaticFinalShortArray[0] = -1000;");
-        assertEquals(-1000, SharedObject.publicStaticFinalShortArray[0]);
-    }
-
-    // --------------------------------char
-    // tests------------------------------------
-    @Test
-    public void accessFieldChar() throws ScriptException {
-        e.eval("var p_char = o.publicChar;");
-        assertEquals(o.publicChar, e.get("p_char"));
-        e.eval("o.publicChar = 'S';");
-        assertEquals('S', o.publicChar);
-        e.eval("o.publicChar = 10;");
-        assertEquals(10, o.publicChar);
-        e.eval("try {"
-                + "    o.publicChar = 'Big string';" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals(10, o.publicChar);
-    }
-
-    @Test
-    public void accessFieldCharArray() throws ScriptException {
-        e.eval("var p_char_array = o.publicCharArray;");
-        assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];"));
-        assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array"));
-        e.eval("var t_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
-                "t_char_arr[0] = 'F';" +
-                "t_char_arr[1] = 'o';" +
-                "t_char_arr[2] = 'o';" +
-                "o.publicCharArray = t_char_arr;");
-        assertArrayEquals("Foo".toCharArray(), o.publicCharArray);
-        e.eval("o.publicCharArray[0] = 'Z';");
-        assertEquals('Z', o.publicCharArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldChar() throws ScriptException {
-        e.eval("var ps_char = SharedObject.publicStaticChar;");
-        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
-        e.eval("SharedObject.publicStaticChar = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticChar);
-    }
-
-    @Test
-    public void accessStaticFieldCharArray() throws ScriptException {
-        e.eval("var ps_char_array = SharedObject.publicStaticCharArray;");
-        assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array"));
-        e.eval("var ts_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
-                "ts_char_arr[0] = 'G';" +
-                "ts_char_arr[1] = 'o';" +
-                "ts_char_arr[2] = 'o';" +
-                "SharedObject.publicStaticCharArray = ts_char_arr;");
-        assertArrayEquals("Goo".toCharArray(), SharedObject.publicStaticCharArray);
-        e.eval("SharedObject.publicStaticCharArray[0] = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticCharArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldChar() throws ScriptException {
-        e.eval("var pf_char = o.publicFinalChar;");
-        assertEquals(o.publicFinalChar, e.get("pf_char"));
-        e.eval("o.publicFinalChar = 'S';");
-        assertEquals('E', o.publicFinalChar);
-    }
-
-    @Test
-    public void accessFinalCharArray() throws ScriptException {
-        e.eval("var pf_char_array = o.publicFinalCharArray;");
-        assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];"));
-        assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array"));
-        e.eval("var tf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
-                "tf_char_arr[0] = 'F';" +
-                "tf_char_arr[1] = 'o';" +
-                "tf_char_arr[2] = 'o';" +
-                "o.publicFinalCharArray = tf_char_arr;");
-        assertArrayEquals("Nashorn hello".toCharArray(), o.publicFinalCharArray);
-        e.eval("o.publicFinalCharArray[0] = 'Z';");
-        assertEquals('Z', o.publicFinalCharArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldChar() throws ScriptException {
-        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
-        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
-        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
-        assertEquals('K', SharedObject.publicStaticFinalChar);
-    }
-
-    @Test
-    public void accessStaticFinalFieldCharArray() throws ScriptException {
-        e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;");
-        assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array"));
-        e.eval("var tsf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
-                "tsf_char_arr[0] = 'Z';" +
-                "tsf_char_arr[1] = 'o';" +
-                "tsf_char_arr[2] = 'o';" +
-                "SharedObject.publicStaticFinalCharArray = tsf_char_arr;");
-        assertArrayEquals("StaticString".toCharArray(), SharedObject.publicStaticFinalCharArray);
-        e.eval("SharedObject.publicStaticFinalCharArray[0] = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticFinalCharArray[0]);
-    }
-
-    // --------------------------------float
-    // tests------------------------------------
-    @Test
-    public void accessFieldFloat() throws ScriptException {
-        e.eval("var p_float = o.publicFloat;");
-        assertEquals(o.publicFloat, e.get("p_float"));
-        o.publicFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(o.publicFloat)"));
-        o.publicFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloat"));
-        o.publicFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloat"));
-        e.eval("o.publicFloat = 20;");
-        assertEquals(20, o.publicFloat, 1e-10);
-        e.eval("o.publicFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(o.publicFloat));
-        e.eval("o.publicFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloat));
-        e.eval("o.publicFloat = -1.0/0.0;");
-        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloat, 1e-10);
-    }
-
-    @Test
-    public void accessFieldFloatArray() throws ScriptException {
-        e.eval("var p_float_array = o.publicFloatArray;");
-        assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];"));
-        assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f);
-        e.eval("var t_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
-                "t_float_arr[0] = 9.0;" +
-                "t_float_arr[1] = 5.12345;" +
-                "t_float_arr[2] = -60.03;" +
-                "o.publicFloatArray = t_float_arr;");
-        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
-        e.eval("o.publicFloatArray[0] = -513.2;");
-        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFieldFloat() throws ScriptException {
-        e.eval("var ps_float = SharedObject.publicStaticFloat;");
-        assertEquals(SharedObject.publicStaticFloat, e.get("ps_float"));
-        SharedObject.publicStaticFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
-        SharedObject.publicStaticFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
-        SharedObject.publicStaticFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
-        e.eval("SharedObject.publicStaticFloat = 20.0;");
-        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
-        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-    }
-
-    @Test
-    public void accessStaticFieldFloatArray() throws ScriptException {
-        e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;");
-        assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f);
-        e.eval("var ts_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
-                "ts_float_arr[0] = 9.0;" +
-                "ts_float_arr[1] = 5.12345;" +
-                "ts_float_arr[2] = -60.03;" +
-                "SharedObject.publicStaticFloatArray = ts_float_arr;");
-        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFloatArray[0] = -513.2;");
-        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
-    }
-
-    @Test
-    public void accessFinalFloat() throws ScriptException {
-        e.eval("var pf_float = o.publicFinalFloat;");
-        assertEquals(o.publicFinalFloat, e.get("pf_float"));
-        e.eval("o.publicFinalFloat = 20.0;");
-        assertEquals(7.72e8f, o.publicFinalFloat, 1e-10);
-    }
-
-    @Test
-    public void accessFinalFloatArray() throws ScriptException {
-        e.eval("var pf_float_array = o.publicFinalFloatArray;");
-        assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];"));
-        assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f);
-        e.eval("var tf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
-                "tf_float_arr[0] = 9.0;" +
-                "tf_float_arr[1] = 5.12345;" +
-                "tf_float_arr[2] = -60.03;" +
-                "o.publicFinalFloatArray = tf_float_arr;");
-        assertArrayEquals(new float[] { -131.012f, 189.32f, -31.32e8f, 3.72f }, o.publicFinalFloatArray, 1e-10f);
-        e.eval("o.publicFinalFloatArray[0] = -513.2;");
-        assertEquals(-513.2f, o.publicFinalFloatArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloat() throws ScriptException {
-        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
-        assertEquals(SharedObject.publicStaticFinalFloat, e.get("psf_float"));
-        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
-        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloatArray() throws ScriptException {
-        e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;");
-        assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f);
-        e.eval("var tsf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
-                "tsf_float_arr[0] = 9.0;" +
-                "tsf_float_arr[1] = 5.12345;" +
-                "tsf_float_arr[2] = -60.03;" +
-                "SharedObject.publicStaticFinalFloatArray = tsf_float_arr;");
-        assertArrayEquals(new float[] { -8131.012f, 9.32f, -138.32e8f, 0.72f }, SharedObject.publicStaticFinalFloatArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFinalFloatArray[0] = -513.2;");
-        assertEquals(-513.2f, SharedObject.publicStaticFinalFloatArray[0], 1e-10f);
-    }
-
-    // --------------------------------double
-    // tests------------------------------------
-    @Test
-    public void accessFieldDouble() throws ScriptException {
-        e.eval("var p_double = o.publicDouble;");
-        assertEquals(o.publicDouble, e.get("p_double"));
-        o.publicDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(o.publicDouble)"));
-        o.publicDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDouble"));
-        o.publicDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDouble"));
-        e.eval("o.publicDouble = 30;");
-        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDouble));
-        e.eval("o.publicDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(o.publicDouble));
-        e.eval("o.publicDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
-        e.eval("o.publicDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
-    }
-
-    @Test
-    public void accessFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var p_double_array = o.publicDoubleArray;");
-        assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];"));
-        assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10);
-        e.eval("var t_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
-                "t_double_arr[0] = 9e10;" +
-                "t_double_arr[1] = 0.677777;" +
-                "t_double_arr[2] = -0.0000001;" +
-                "o.publicDoubleArray = t_double_arr;");
-        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, o.publicDoubleArray, 1e-10f);
-        e.eval("o.publicDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, o.publicDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFieldDouble() throws ScriptException {
-        e.eval("var ps_double = SharedObject.publicStaticDouble;");
-        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
-        SharedObject.publicStaticDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
-        SharedObject.publicStaticDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
-        SharedObject.publicStaticDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
-        e.eval("SharedObject.publicStaticDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-    }
-
-    @Test
-    public void accessStaticFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;");
-        assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10);
-        e.eval("var ts_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
-                "ts_double_arr[0] = 9e10;" +
-                "ts_double_arr[1] = 0.677777;" +
-                "ts_double_arr[2] = -0.0000001;" +
-                "SharedObject.publicStaticDoubleArray = ts_double_arr;");
-        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, SharedObject.publicStaticDoubleArray, 1e-10f);
-        e.eval("SharedObject.publicStaticDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, SharedObject.publicStaticDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessFinalFieldDouble() throws ScriptException {
-        e.eval("var pf_double = o.publicFinalDouble;");
-        assertEquals(o.publicFinalDouble, e.get("pf_double"));
-        e.eval("o.publicFinalDouble = 30.0;");
-        assertEquals(Double.doubleToLongBits(1.3412e20), Double.doubleToLongBits(o.publicFinalDouble));
-    }
-
-    @Test
-    public void accessFinalFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var pf_double_array = o.publicFinalDoubleArray;");
-        assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];"));
-        assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10);
-        e.eval("var tf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
-                "tf_double_arr[0] = 9e10;" +
-                "tf_double_arr[1] = 0.677777;" +
-                "tf_double_arr[2] = -0.0000001;" +
-                "o.publicFinalDoubleArray = tf_double_arr;");
-        assertArrayEquals(new double[] { 0.725e80, 0.12e10, 8e-3, 1.00077 }, o.publicFinalDoubleArray, 1e-10f);
-        e.eval("o.publicFinalDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, o.publicFinalDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFinalFieldDouble() throws ScriptException {
-        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
-        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
-        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
-    }
-
-    @Test
-    public void accessStaticFinalFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;");
-        assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10);
-        e.eval("var tsf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
-                "tsf_double_arr[0] = 9e10;" +
-                "tsf_double_arr[1] = 0.677777;" +
-                "tsf_double_arr[2] = -0.0000001;" +
-                "SharedObject.publicStaticFinalDoubleArray = tsf_double_arr;");
-        assertArrayEquals(new double[] { 8.725e80, 0.82e10, 18e-3, 1.08077 }, SharedObject.publicStaticFinalDoubleArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFinalDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, SharedObject.publicStaticFinalDoubleArray[0], 1e-10f);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/NumberBoxingTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,348 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class NumberBoxingTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-    }
-
-    // --------------------------------long
-    // tests------------------------------------
-    @Test
-    public void accessFieldLongBoxing() throws ScriptException {
-        e.eval("var p_long = o.publicLongBox;");
-        assertEquals(o.publicLongBox, e.get("p_long"));
-        e.eval("o.publicLongBox = 12;");
-        assertEquals(Long.valueOf(12), o.publicLongBox);
-    }
-
-    @Test
-    public void accessStaticFieldLongBoxing() throws ScriptException {
-        e.eval("var ps_long = SharedObject.publicStaticLong;");
-        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
-        e.eval("SharedObject.publicStaticLong = 120;");
-        assertEquals(120, SharedObject.publicStaticLong);
-    }
-
-    @Test
-    public void accessFinalFieldLongBoxing() throws ScriptException {
-        e.eval("var pf_long = o.publicFinalLongBox;");
-        assertEquals(o.publicFinalLongBox, e.get("pf_long"));
-        e.eval("o.publicFinalLongBox = 120;");
-        assertEquals(Long.valueOf(9377333334L), o.publicFinalLongBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLongBoxing() throws ScriptException {
-        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
-        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
-        e.eval("SharedObject.publicStaticFinalLong = 120;");
-        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
-    }
-
-    // --------------------------------int
-    // tests------------------------------------
-    @Test
-    public void accessFieldIntBoxing() throws ScriptException {
-        e.eval("var p_int = o.publicIntBox;");
-        assertEquals(o.publicIntBox, e.get("p_int"));
-        e.eval("o.publicIntBox = 14;");
-        assertEquals(Integer.valueOf(14), o.publicIntBox);
-    }
-
-    @Test
-    public void accessStaticFieldIntBoxing() throws ScriptException {
-        e.eval("var ps_int = SharedObject.publicStaticInt;");
-        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
-        e.eval("SharedObject.publicStaticInt = 140;");
-        assertEquals(140, SharedObject.publicStaticInt);
-    }
-
-    @Test
-    public void accessFinalFieldIntBoxing() throws ScriptException {
-        e.eval("var pf_int = o.publicFinalIntBox;");
-        assertEquals(o.publicFinalIntBox, e.get("pf_int"));
-        e.eval("o.publicFinalIntBox = 10;");
-        assertEquals(Integer.valueOf(207512301), o.publicFinalIntBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldIntBoxing() throws ScriptException {
-        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
-        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
-        e.eval("SharedObject.publicStaticFinalInt = 140;");
-        assertEquals(207182023, SharedObject.publicStaticFinalInt);
-    }
-
-    // --------------------------------byte
-    // tests------------------------------------
-    @Test
-    public void accessFieldByteBoxing() throws ScriptException {
-        e.eval("var p_byte = o.publicByteBox;");
-        assertEquals(o.publicByteBox, e.get("p_byte"));
-        e.eval("o.publicByteBox = 16;");
-        assertEquals(Byte.valueOf((byte)16), o.publicByteBox);
-    }
-
-    @Test
-    public void accessStaticFieldByteBoxing() throws ScriptException {
-        e.eval("var ps_byte = SharedObject.publicStaticByte;");
-        assertEquals(SharedObject.publicStaticByte, e.get("ps_byte"));
-        e.eval("SharedObject.publicStaticByte = 16;");
-        assertEquals(16, SharedObject.publicStaticByte);
-    }
-
-    @Test
-    public void accessFinalFieldByteBoxing() throws ScriptException {
-        e.eval("var pf_byte = o.publicFinalByteBox;");
-        assertEquals(o.publicFinalByteBox, e.get("pf_byte"));
-        e.eval("o.publicFinalByteBox = 16;");
-        assertEquals(Byte.valueOf((byte)19), o.publicFinalByteBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByteBoxing() throws ScriptException {
-        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
-        assertEquals(SharedObject.publicStaticFinalByte, e.get("psf_byte"));
-        e.eval("SharedObject.publicStaticFinalByte = 16;");
-        assertEquals(-70, SharedObject.publicStaticFinalByte);
-    }
-
-    // --------------------------------short
-    // tests------------------------------------
-    @Test
-    public void accessFieldShortBoxing() throws ScriptException {
-        e.eval("var p_short = o.publicShortBox;");
-        assertEquals(o.publicShortBox, e.get("p_short"));
-        e.eval("o.publicShortBox = 18;");
-        assertEquals(Short.valueOf((short)18), o.publicShortBox);
-    }
-
-    @Test
-    public void accessStaticFieldShortBoxing() throws ScriptException {
-        e.eval("var ps_short = SharedObject.publicStaticShort;");
-        assertEquals(SharedObject.publicStaticShort, e.get("ps_short"));
-        e.eval("SharedObject.publicStaticShort = 180;");
-        assertEquals(180, SharedObject.publicStaticShort);
-    }
-
-    @Test
-    public void accessFinalFieldShortBoxing() throws ScriptException {
-        e.eval("var pf_short = o.publicFinalShortBox;");
-        assertEquals(o.publicFinalShortBox, e.get("pf_short"));
-        e.eval("o.publicFinalShortBox = 180;");
-        assertEquals(Short.valueOf((short)-26777), o.publicFinalShortBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShortBoxing() throws ScriptException {
-        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
-        assertEquals(SharedObject.publicStaticFinalShort, e.get("psf_short"));
-        e.eval("SharedObject.publicStaticFinalShort = 180;");
-        assertEquals(8888, SharedObject.publicStaticFinalShort);
-    }
-
-    // --------------------------------char
-    // tests------------------------------------
-    @Test
-    public void accessFieldCharBoxing() throws ScriptException {
-        e.eval("var p_char = o.publicCharBox;");
-        assertEquals(o.publicCharBox, e.get("p_char"));
-        e.eval("o.publicCharBox = 'S';");
-        assertEquals(Character.valueOf('S'), o.publicCharBox);
-        e.eval("try {" +
-                "    o.publicCharBox = 'Big string';" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals(Character.valueOf('S'), o.publicCharBox);
-    }
-
-    @Test
-    public void accessStaticFieldCharBoxing() throws ScriptException {
-        e.eval("var ps_char = SharedObject.publicStaticChar;");
-        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
-        e.eval("SharedObject.publicStaticChar = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticChar);
-    }
-
-    @Test
-    public void accessFinalFieldCharBoxing() throws ScriptException {
-        e.eval("var pf_char = o.publicFinalCharBox;");
-        assertEquals(o.publicFinalCharBox, e.get("pf_char"));
-        e.eval("o.publicFinalCharBox = 'S';");
-        assertEquals(Character.valueOf('F'), o.publicFinalCharBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldCharBoxing() throws ScriptException {
-        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
-        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
-        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
-        assertEquals('K', SharedObject.publicStaticFinalChar);
-    }
-
-    // --------------------------------float
-    // tests------------------------------------
-    @Test
-    public void accessFieldFloatBoxing() throws ScriptException {
-        e.eval("var p_float = o.publicFloatBox;");
-        assertEquals(o.publicFloatBox, e.get("p_float"));
-        o.publicFloatBox = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(o.publicFloatBox)"));
-        o.publicFloatBox = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloatBox"));
-        o.publicFloatBox = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloatBox"));
-        e.eval("o.publicFloatBox = 20;");
-        assertEquals(20, o.publicFloatBox, 1e-10);
-        e.eval("o.publicFloatBox = 0.0/0.0;");
-        assertTrue(Float.isNaN(o.publicFloatBox));
-        e.eval("o.publicFloatBox = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloatBox));
-        e.eval("o.publicFloatBox = -1.0/0.0;");
-        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloatBox, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFieldFloatBoxing() throws ScriptException {
-        e.eval("var ps_float = SharedObject.publicStaticFloat;");
-        assertEquals(SharedObject.publicStaticFloat, e.get("ps_float"));
-        SharedObject.publicStaticFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
-        SharedObject.publicStaticFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
-        SharedObject.publicStaticFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
-        e.eval("SharedObject.publicStaticFloat = 20.0;");
-        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
-        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-    }
-
-    @Test
-    public void accessFinalFloatBoxing() throws ScriptException {
-        e.eval("var pf_float = o.publicFinalFloatBox;");
-        assertEquals(o.publicFinalFloatBox, e.get("pf_float"));
-        e.eval("o.publicFinalFloatBox = 20.0;");
-        assertEquals(1.372e4f, o.publicFinalFloatBox, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloatBoxing() throws ScriptException {
-        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
-        assertEquals(SharedObject.publicStaticFinalFloat, e.get("psf_float"));
-        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
-        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
-    }
-
-    // --------------------------------double
-    // tests------------------------------------
-    @Test
-    public void accessFieldDoubleBoxing() throws ScriptException {
-        e.eval("var p_double = o.publicDoubleBox;");
-        assertEquals(o.publicDoubleBox, e.get("p_double"));
-        o.publicDoubleBox = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(o.publicDoubleBox)"));
-        o.publicDoubleBox = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDoubleBox"));
-        o.publicDoubleBox = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDoubleBox"));
-        e.eval("o.publicDoubleBox = 30;");
-        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = 0.0/0.0;");
-        assertTrue(Double.isNaN(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
-    }
-
-    @Test
-    public void accessStaticFieldDoubleBoxing() throws ScriptException {
-        e.eval("var ps_double = SharedObject.publicStaticDouble;");
-        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
-        SharedObject.publicStaticDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
-        SharedObject.publicStaticDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
-        SharedObject.publicStaticDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
-        e.eval("SharedObject.publicStaticDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-    }
-
-    @Test
-    public void accessFinalFieldDoubleBoxing() throws ScriptException {
-        e.eval("var pf_double = o.publicFinalDoubleBox;");
-        assertEquals(o.publicFinalDoubleBox, e.get("pf_double"));
-        e.eval("o.publicFinalDoubleBox = 30.0;");
-        assertEquals(Double.doubleToLongBits(1.412e-12), Double.doubleToLongBits(o.publicFinalDoubleBox));
-    }
-
-    @Test
-    public void accessStaticFinalFieldDoubleBoxing() throws ScriptException {
-        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
-        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
-        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/ObjectAccessTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class ObjectAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.internal.access.Person;");
-    }
-
-    @Test
-    public void accessFieldObject() throws ScriptException {
-        e.eval("var p_object = o.publicObject;");
-        assertEquals(o.publicObject, e.get("p_object"));
-        assertEquals("object", e.eval("typeof p_object;"));
-        e.eval("o.publicObject = new Person(14);");
-        assertEquals(new Person(14), o.publicObject);
-    }
-
-    @Test
-    public void accessFieldObjectArray() throws ScriptException {
-        e.eval("var p_object_array = o.publicObjectArray;");
-        assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
-        assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
-        e.eval("var t_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
-                "t_object_arr[0] = new Person(100);" +
-                "t_object_arr[1] = new Person(120);" +
-                "t_object_arr[2] = new Person(140);" +
-                "o.publicObjectArray = t_object_arr;");
-        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, o.publicObjectArray);
-        e.eval("o.publicObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), o.publicObjectArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldObject() throws ScriptException {
-        e.eval("var ps_object = SharedObject.publicStaticObject;");
-        assertEquals(SharedObject.publicStaticObject, e.get("ps_object"));
-        assertEquals("object", e.eval("typeof ps_object;"));
-        e.eval("SharedObject.publicStaticObject = new Person(16);");
-        assertEquals(new Person(16), SharedObject.publicStaticObject);
-    }
-
-    @Test
-    public void accessStaticFieldObjectArray() throws ScriptException {
-        e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
-        assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
-        e.eval("var ts_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
-                "ts_object_arr[0] = new Person(100);" +
-                "ts_object_arr[1] = new Person(120);" +
-                "ts_object_arr[2] = new Person(140);" +
-                "SharedObject.publicStaticObjectArray = ts_object_arr;");
-        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, SharedObject.publicStaticObjectArray);
-        e.eval("SharedObject.publicStaticObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), SharedObject.publicStaticObjectArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldObject() throws ScriptException {
-        e.eval("var pf_object = o.publicFinalObject;");
-        assertEquals(o.publicFinalObject, e.get("pf_object"));
-        assertEquals("object", e.eval("typeof pf_object;"));
-        e.eval("o.publicFinalObject = new Person(-999);");
-        assertEquals(new Person(1024), o.publicFinalObject);
-    }
-
-    @Test
-    public void accessFinalFieldObjectArray() throws ScriptException {
-        e.eval("var pf_object_array = o.publicFinalObjectArray;");
-        assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
-        assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
-        e.eval("var tf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
-                "tf_object_arr[0] = new Person(100);" +
-                "tf_object_arr[1] = new Person(120);" +
-                "tf_object_arr[2] = new Person(140);" +
-                "o.publicOFinalbjectArray = tf_object_arr;");
-        assertArrayEquals(new Person[] { new Person(-900), new Person(1000), new Person(180) }, o.publicFinalObjectArray);
-        e.eval("o.publicFinalObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), o.publicFinalObjectArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldObject() throws ScriptException {
-        e.eval("var psf_object = SharedObject.publicStaticFinalObject;");
-        assertEquals(SharedObject.publicStaticFinalObject, e.get("psf_object"));
-        assertEquals("object", e.eval("typeof psf_object;"));
-        e.eval("SharedObject.publicStaticFinalObject = new Person(6);");
-        assertEquals(new Person(2048), SharedObject.publicStaticFinalObject);
-    }
-
-    @Test
-    public void accessStaticFinalFieldObjectArray() throws ScriptException {
-        e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
-        assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
-        e.eval("var tsf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
-                "tsf_object_arr[0] = new Person(100);" +
-                "tsf_object_arr[1] = new Person(120);" +
-                "tsf_object_arr[2] = new Person(140);" +
-                "SharedObject.publicStaticFinalObjectArray = tsf_object_arr;");
-        assertArrayEquals(new Person[] { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) }, SharedObject.publicStaticFinalObjectArray);
-        e.eval("SharedObject.publicStaticFinalObjectArray[0] = new Person(90);");
-        assertEquals(new Person(90), SharedObject.publicStaticFinalObjectArray[0]);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/Person.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-public class Person {
-
-    public int id = 0;
-
-    public Person() {
-    }
-
-    public Person(final int code) {
-        this.id = code;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (obj != null && obj instanceof Person) {
-            final Person o = (Person)obj;
-            return this.id == o.id;
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return id;
-    }
-
-    @Override
-    public String toString() {
-        return "Person(" + id + ")";
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/SharedObject.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import javax.script.Invocable;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-
-public class SharedObject {
-
-    // Public fields
-    public String                 publicString                  = "PublicString";
-    public String[]               publicStringArray             = { "ArrayString[0]", "ArrayString[1]", "ArrayString[2]", "ArrayString[3]" };
-    public Person                 publicObject                  = new Person(256);
-    public Person[]               publicObjectArray             = { new Person(4), new Person(-422), new Person(14) };
-    public boolean                publicBoolean                 = true;
-    public boolean[]              publicBooleanArray            = { true, false, false, true };
-    public Boolean                publicBooleanBox              = true;
-    public long                   publicLong                    = 933333333333333333L;
-    public long[]                 publicLongArray               = { 99012333333333L, -124355555L, 89777777777L };
-    public Long                   publicLongBox                 = 9333333333L;
-    public int                    publicInt                     = 2076543123;
-    public int[]                  publicIntArray                = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 };
-    public Integer                publicIntBox                  = 20765123;
-    public byte                   publicByte                    = -128;
-    public byte[]                 publicByteArray               = { 1, 2, 4, 8, 16, 32, 64, 127, -128 };
-    public Byte                   publicByteBox                 = 127;
-    public short                  publicShort                   = 32000;
-    public short[]                publicShortArray              = { 3240, 8900, -16789, 1, 12 };
-    public Short                  publicShortBox                = Short.MIN_VALUE;
-    public float                  publicFloat                   = 0.7e6f;
-    public float[]                publicFloatArray              = { -32.01f, 89.3f, -1.3e8f, 3.1f };
-    public Float                  publicFloatBox                = 1.377e4f;
-    public double                 publicDouble                  = 1.34e20;
-    public double[]               publicDoubleArray             = { 0.75e80, 8e-43, 1.000077, 0.123e10 };
-    public Double                 publicDoubleBox               = 1.4e-19;
-    public char                   publicChar                    = 'A';
-    public char[]                 publicCharArray               = "Hello Nashorn".toCharArray();
-    public Character              publicCharBox                 = 'B';
-    // Public static fields
-    public static String          publicStaticString            = "PublicStaticString";
-    public static String[]        publicStaticStringArray       = { "StaticArrayString[0]", "StaticArrayString[1]", "StaticArrayString[2]", "StaticArrayString[3]" };
-    public static Person          publicStaticObject            = new Person(512);
-    public static Person[]        publicStaticObjectArray       = { new Person(40), new Person(-22), new Person(18) };
-    public static boolean         publicStaticBoolean           = true;
-    public static boolean[]       publicStaticBooleanArray      = { false, false, false, true };
-    public static Boolean         publicStaticBooleanBox        = true;
-    public static long            publicStaticLong              = 13333333333333333L;
-    public static long[]          publicStaticLongArray         = { 19012333333333L, -224355555L, 39777777777L };
-    public static Long            publicStaticLongBox           = 9333333334L;
-    public static int             publicStaticInt               = 207654323;
-    public static int[]           publicStaticIntArray          = { 5, 8, 13, 21, 34 };
-    public static Integer         publicStaticIntBox            = 2075123;
-    public static byte            publicStaticByte              = -12;
-    public static byte[]          publicStaticByteArray         = { 16, 32, 64, 127, -128 };
-    public static Byte            publicStaticByteBox           = 17;
-    public static short           publicStaticShort             = 320;
-    public static short[]         publicStaticShortArray        = { 1240, 900, -1789, 100, 12 };
-    public static Short           publicStaticShortBox          = -16777;
-    public static float           publicStaticFloat             = 7.7e8f;
-    public static float[]         publicStaticFloatArray        = { -131.01f, 189.3f, -31.3e8f, 3.7f };
-    public static Float           publicStaticFloatBox          = 1.37e4f;
-    public static double          publicStaticDouble            = 1.341e20;
-    public static double[]        publicStaticDoubleArray       = { 0.75e80, 0.123e10, 8e-43, 1.000077 };
-    public static Double          publicStaticDoubleBox         = 1.41e-12;
-    public static char            publicStaticChar              = 'C';
-    public static char[]          publicStaticCharArray         = "Nashorn".toCharArray();
-    public static Character       publicStaticCharBox           = 'D';
-    // Public final fields
-    public final String           publicFinalString             = "PublicFinalString";
-    public final String[]         publicFinalStringArray        = { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" };
-    public final Person           publicFinalObject             = new Person(1024);
-    public final Person[]         publicFinalObjectArray        = { new Person(-900), new Person(1000), new Person(180) };
-    public final boolean          publicFinalBoolean            = true;
-    public final boolean[]        publicFinalBooleanArray       = { false, false, true, false };
-    public final Boolean          publicFinalBooleanBox         = true;
-    public final long             publicFinalLong               = 13353333333333333L;
-    public final long[]           publicFinalLongArray          = { 1901733333333L, -2247355555L, 3977377777L };
-    public final Long             publicFinalLongBox            = 9377333334L;
-    public final int              publicFinalInt                = 20712023;
-    public final int[]            publicFinalIntArray           = { 50, 80, 130, 210, 340 };
-    public final Integer          publicFinalIntBox             = 207512301;
-    public final byte             publicFinalByte               = -7;
-    public final byte[]           publicFinalByteArray          = { 1, 3, 6, 17, -128 };
-    public final Byte             publicFinalByteBox            = 19;
-    public final short            publicFinalShort              = 31220;
-    public final short[]          publicFinalShortArray         = { 12240, 9200, -17289, 1200, 12 };
-    public final Short            publicFinalShortBox           = -26777;
-    public final float            publicFinalFloat              = 7.72e8f;
-    public final float[]          publicFinalFloatArray         = { -131.012f, 189.32f, -31.32e8f, 3.72f };
-    public final Float            publicFinalFloatBox           = 1.372e4f;
-    public final double           publicFinalDouble             = 1.3412e20;
-    public final double[]         publicFinalDoubleArray        = { 0.725e80, 0.12e10, 8e-3, 1.00077 };
-    public final Double           publicFinalDoubleBox          = 1.412e-12;
-    public final char             publicFinalChar               = 'E';
-    public final char[]           publicFinalCharArray          = "Nashorn hello".toCharArray();
-    public final Character        publicFinalCharBox            = 'F';
-    // Public static final fields
-    public static final String    publicStaticFinalString       = "PublicStaticFinalString";
-    public static final String[]  publicStaticFinalStringArray  = { "StaticFinalArrayString[0]", "StaticFinalArrayString[1]", "StaticFinalArrayString[2]", "StaticFinalArrayString[3]" };
-    public static final Person    publicStaticFinalObject       = new Person(2048);
-    public static final Person[]  publicStaticFinalObjectArray  = { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) };
-    public static final boolean   publicStaticFinalBoolean      = true;
-    public static final boolean[] publicStaticFinalBooleanArray = { false, true, false, false };
-    public static final Boolean   publicStaticFinalBooleanBox   = true;
-    public static final long      publicStaticFinalLong         = 8333333333333L;
-    public static final long[]    publicStaticFinalLongArray    = { 19017383333L, -2247358L, 39773787L };
-    public static final Long      publicStaticFinalLongBox      = 9377388334L;
-    public static final int       publicStaticFinalInt          = 207182023;
-    public static final int[]     publicStaticFinalIntArray     = { 1308, 210, 340 };
-    public static final Integer   publicStaticFinalIntBox       = 2078301;
-    public static final byte      publicStaticFinalByte         = -70;
-    public static final byte[]    publicStaticFinalByteArray    = { 17, -128, 81 };
-    public static final Byte      publicStaticFinalByteBox      = 91;
-    public static final short     publicStaticFinalShort        = 8888;
-    public static final short[]   publicStaticFinalShortArray   = { 8240, 9280, -1289, 120, 812 };
-    public static final Short     publicStaticFinalShortBox     = -26;
-    public static final float     publicStaticFinalFloat        = 0.72e8f;
-    public static final float[]   publicStaticFinalFloatArray   = { -8131.012f, 9.32f, -138.32e8f, 0.72f };
-    public static final Float     publicStaticFinalFloatBox     = 1.2e4f;
-    public static final double    publicStaticFinalDouble       = 1.8e12;
-    public static final double[]  publicStaticFinalDoubleArray  = { 8.725e80, 0.82e10, 18e-3, 1.08077 };
-    public static final Double    publicStaticFinalDoubleBox    = 1.5612e-13;
-    public static final char      publicStaticFinalChar         = 'K';
-    public static final char[]    publicStaticFinalCharArray    = "StaticString".toCharArray();
-    public static final Character publicStaticFinalCharBox      = 'L';
-
-    // Special vars
-    public volatile boolean       volatileBoolean               = true;
-    public transient boolean      transientBoolean              = true;
-
-    // For methods testing
-    public boolean                isAccessed                    = false;
-    public volatile boolean       isFinished                    = false;
-
-    private ScriptEngine engine;
-
-    public ScriptEngine getEngine() {
-        return engine;
-    }
-
-    public void setEngine(ScriptEngine engine) {
-        this.engine = engine;
-    }
-
-    public void voidMethod() {
-        isAccessed = true;
-    }
-
-    public boolean booleanMethod(final boolean arg) {
-        return !arg;
-    }
-
-    public Boolean booleanBoxingMethod(final Boolean arg) {
-        return !arg.booleanValue();
-    }
-
-    public boolean[] booleanArrayMethod(final boolean arg[]) {
-        final boolean[] res = new boolean[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = !arg[i];
-        }
-        return res;
-    }
-
-    public int intMethod(final int arg) {
-        return arg + arg;
-    }
-
-    public Integer intBoxingMethod(final Integer arg) {
-        return arg + arg;
-    }
-
-    public int[] intArrayMethod(final int arg[]) {
-        final int[] res = new int[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public long longMethod(final long arg) {
-        return arg + arg;
-    }
-
-    public Long longBoxingMethod(final Long arg) {
-        return arg + arg;
-    }
-
-    public long[] longArrayMethod(final long[] arg) {
-        final long[] res = new long[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public byte byteMethod(final byte arg) {
-        return (byte)(arg + arg);
-    }
-
-    public Byte byteBoxingMethod(final Byte arg) {
-        return (byte)(arg + arg);
-    }
-
-    public byte[] byteArrayMethod(final byte[] arg) {
-        final byte[] res = new byte[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = (byte)(arg[i] * 2);
-        }
-        return res;
-    }
-
-    public char charMethod(final char arg) {
-        return Character.toUpperCase(arg);
-    }
-
-    public Character charBoxingMethod(final Character arg) {
-        return Character.toUpperCase(arg);
-    }
-
-    public char[] charArrayMethod(final char[] arg) {
-        final char[] res = new char[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = Character.toUpperCase(arg[i]);
-        }
-        return res;
-    }
-
-    public short shortMethod(final short arg) {
-        return (short)(arg + arg);
-    }
-
-    public Short shortBoxingMethod(final Short arg) {
-        return (short)(arg + arg);
-    }
-
-    public short[] shortArrayMethod(final short[] arg) {
-        final short[] res = new short[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = (short)(arg[i] * 2);
-        }
-        return res;
-    }
-
-    public float floatMethod(final float arg) {
-        return arg + arg;
-    }
-
-    public Float floatBoxingMethod(final Float arg) {
-        return arg + arg;
-    }
-
-    public float[] floatArrayMethod(final float[] arg) {
-        final float[] res = new float[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public double doubleMethod(final double arg) {
-        return arg + arg;
-    }
-
-    public Double doubleBoxingMethod(final Double arg) {
-        return arg + arg;
-    }
-
-    public double[] doubleArrayMethod(final double[] arg) {
-        final double[] res = new double[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public String stringMethod(final String str) {
-        return str + str;
-    }
-
-    public String[] stringArrayMethod(final String[] arr) {
-        final int l = arr.length;
-        final String[] res = new String[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = arr[l - i - 1];
-        }
-        return res;
-    }
-
-    public Person[] objectArrayMethod(final Person[] arr) {
-        final Person[] res = new Person[arr.length];
-        for (int i = 0; i < arr.length; i++) {
-            res[i] = new Person(i + 100);
-        }
-        return res;
-    }
-
-    public Person objectMethod(final Person t) {
-        t.id *= 2;
-        return t;
-    }
-
-    public int twoParamMethod(final long l, final double d) {
-        return (int)(l + d);
-    }
-
-    public int threeParamMethod(final short s, final long l, final char c) {
-        return (int)(s + l + c);
-    }
-
-    public Person[] twoObjectParamMethod(final Person arg1, final Person arg2) {
-        return new Person[] { arg2, arg1 };
-    }
-
-    public Person[] threeObjectParamMethod(final Person arg1, final Person arg2, final Person arg3) {
-        return new Person[] { arg3, arg2, arg1 };
-    }
-
-    public Person[] eightObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8) {
-        return new Person[] { arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
-    }
-
-    public Person[] nineObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8, final Person arg9) {
-        return new Person[] { arg9, arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
-    }
-
-    public Person[] methodObjectEllipsis(final Person... args) {
-        final int l = args.length;
-        final Person[] res = new Person[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = args[l - i - 1];
-        }
-        return res;
-    }
-
-    public Person[] methodPrimitiveEllipsis(final int... args) {
-        final int l = args.length;
-        final Person[] res = new Person[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = new Person(args[i]);
-        }
-        return res;
-    }
-
-    public Object[] methodMixedEllipsis(final Object... args) {
-        return args;
-    }
-
-    public Object[] methodObjectWithEllipsis(final String arg, final int... args) {
-        final Object[] res = new Object[args.length + 1];
-        res[0] = arg;
-        for (int i = 0; i < args.length; i++) {
-            res[i + 1] = args[i];
-        }
-        return res;
-    }
-
-    public Object[] methodPrimitiveWithEllipsis(final int arg, final long... args) {
-        final Object[] res = new Object[args.length + 1];
-        res[0] = arg;
-        for (int i = 0; i < args.length; i++) {
-            res[i + 1] = args[i];
-        }
-        return res;
-    }
-
-    public Object[] methodMixedWithEllipsis(final String arg1, final int arg2, final Object... args) {
-        final Object[] res = new Object[args.length + 2];
-        res[0] = arg1;
-        res[1] = arg2;
-        System.arraycopy(args, 0, res, 2, args.length);
-        return res;
-    }
-
-    public void methodStartsThread() {
-        isFinished = false;
-
-        final Thread t = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    Thread.sleep(1000);
-                    isFinished = true;
-                } catch (final InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-
-        t.start();
-    }
-
-    public String overloadedMethodDoubleVSint(int arg) {
-        return "int";
-    }
-
-    public String overloadedMethodDoubleVSint(double arg) {
-        return "double";
-    }
-
-    public int overloadedMethod(int arg) {
-        return arg*2;
-    }
-
-    public int overloadedMethod(String arg) {
-        return arg.length();
-    }
-
-    public int overloadedMethod(boolean arg) {
-        return (arg) ? 1 : 0;
-    }
-
-    public int overloadedMethod(Person arg) {
-        return arg.id*2;
-    }
-
-    public int firstLevelMethodInt(int arg) throws ScriptException, NoSuchMethodException {
-        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInt", arg);
-    }
-
-    public int thirdLevelMethodInt(int arg) {
-        return arg*5;
-    }
-
-    public int firstLevelMethodInteger(Integer arg) throws ScriptException, NoSuchMethodException {
-        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInteger", arg);
-    }
-
-    public int thirdLevelMethodInteger(Integer arg) {
-        return arg*10;
-    }
-
-    public Person firstLevelMethodObject(Person p) throws ScriptException, NoSuchMethodException {
-        return (Person) ((Invocable)engine).invokeFunction("secondLevelMethodObject", p);
-    }
-
-    public Person thirdLevelMethodObject(Person p) {
-        p.id *= 10;
-        return p;
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/access/StringAccessTest.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.access;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class StringAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = new SharedObject();
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.internal.access.SharedObject;");
-    }
-
-    @Test
-    public void accessFieldString() throws ScriptException {
-        e.eval("var p_string = o.publicString;");
-        assertEquals(o.publicString, e.get("p_string"));
-        assertEquals("string", e.eval("typeof p_string;"));
-        e.eval("o.publicString = 'changedString';");
-        assertEquals("changedString", o.publicString);
-    }
-
-    @Test
-    public void accessFieldStringArray() throws ScriptException {
-        e.eval("var p_string_array = o.publicStringArray;");
-        assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]"));
-        assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array"));
-        e.eval("var t_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
-                "t_string_arr[0] = 'abc';" +
-                "t_string_arr[1] = '123';" +
-                "t_string_arr[2] = 'xyzzzz';" +
-                "o.publicStringArray = t_string_arr;");
-        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, o.publicStringArray);
-        e.eval("o.publicStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", o.publicStringArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldString() throws ScriptException {
-        e.eval("var ps_string = SharedObject.publicStaticString;");
-        assertEquals(SharedObject.publicStaticString, e.get("ps_string"));
-        assertEquals("string", e.eval("typeof ps_string;"));
-        e.eval("SharedObject.publicStaticString = 'changedString';");
-        assertEquals("changedString", SharedObject.publicStaticString);
-    }
-
-    @Test
-    public void accessStaticFieldStringArray() throws ScriptException {
-        e.eval("var ps_string_array = SharedObject.publicStaticStringArray;");
-        assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array"));
-        e.eval("var ts_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
-                "ts_string_arr[0] = 'abc';" +
-                "ts_string_arr[1] = '123';" +
-                "ts_string_arr[2] = 'xyzzzz';" +
-                "SharedObject.publicStaticStringArray = ts_string_arr;");
-        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, SharedObject.publicStaticStringArray);
-        e.eval("SharedObject.publicStaticStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", SharedObject.publicStaticStringArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldString() throws ScriptException {
-        e.eval("var pf_string = o.publicFinalString;");
-        assertEquals(o.publicFinalString, e.get("pf_string"));
-        assertEquals("string", e.eval("typeof pf_string;"));
-        e.eval("o.publicFinalString = 'changedString';");
-        assertEquals("PublicFinalString", o.publicFinalString);
-    }
-
-    @Test
-    public void accessFinalFieldStringArray() throws ScriptException {
-        e.eval("var pf_string_array = o.publicFinalStringArray;");
-        assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]"));
-        assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array"));
-        e.eval("var tf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
-                "tf_string_arr[0] = 'abc';" +
-                "tf_string_arr[1] = '123';" +
-                "tf_string_arr[2] = 'xyzzzz';" +
-                "o.publicFinalStringArray = tf_string_arr;");
-        assertArrayEquals(new String[] { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" }, o.publicFinalStringArray);
-        e.eval("o.publicFinalStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", o.publicFinalStringArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldString() throws ScriptException {
-        e.eval("var psf_string = SharedObject.publicStaticFinalString;");
-        assertEquals(SharedObject.publicStaticFinalString, e.get("psf_string"));
-        assertEquals("string", e.eval("typeof psf_string;"));
-        e.eval("SharedObject.publicStaticFinalString = 'changedString';");
-        assertEquals("PublicStaticFinalString", SharedObject.publicStaticFinalString);
-    }
-
-    @Test
-    public void accessStaticFinalFieldStringArray() throws ScriptException {
-        e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;");
-        assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array"));
-        e.eval("var tsf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
-                "tsf_string_arr[0] = 'abc';" +
-                "tsf_string_arr[1] = '123';" +
-                "tsf_string_arr[2] = 'xyzzzz';" +
-                "SharedObject.publicStaticFinalStringArray = tsf_string_arr;");
-        assertArrayEquals(new String[] { "StaticFinalArrayString[0]",
-                    "StaticFinalArrayString[1]",
-                    "StaticFinalArrayString[2]",
-                    "StaticFinalArrayString[3]" },
-                SharedObject.publicStaticFinalStringArray);
-        e.eval("SharedObject.publicStaticFinalStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", SharedObject.publicStaticFinalStringArray[0]);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerAccess.java	Sat Feb 09 16:58:48 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-
-package jdk.nashorn.internal.codegen;
-
-import java.lang.reflect.Field;
-import jdk.nashorn.internal.ir.FunctionNode;
-
-/**
- * Since Compiler class doesn't give us access to its private {@code functionNode} field, we use this reflection-based
- * access-check disabling helper to get to it in compilation tests.
- *
- */
-public class CompilerAccess {
-    private static final Field FUNCTION_NODE_FIELD = getCompilerFunctionNodeField();
-    static {
-        FUNCTION_NODE_FIELD.setAccessible(true);
-    }
-
-    /**
-     * Given a compiler, return its {@code functionNode} field, representing the root function (i.e. the compiled script).
-     * @param compiler the compiler that already run its {@link Compiler#compile()} method.
-     * @return the root function node representing the compiled script.
-     * @throws IllegalAccessException
-     */
-    public static FunctionNode getScriptNode(Compiler compiler) throws IllegalAccessException {
-        return (FunctionNode)FUNCTION_NODE_FIELD.get(compiler);
-    }
-
-    private static Field getCompilerFunctionNodeField() {
-        try {
-            return Compiler.class.getDeclaredField("functionNode");
-        } catch (NoSuchFieldException e) {
-            throw new AssertionError("", e);
-        }
-    }
-}