Merge
authorsla
Mon, 17 Nov 2014 09:36:40 +0100
changeset 27666 0b48f6967bbc
parent 27665 cd67470cd230 (current diff)
parent 27646 74c92bdda9b5 (diff)
child 27667 3c814b51da6c
Merge
common/autoconf/config.h.in
common/autoconf/spec.sh.in
common/bin/boot_cycle.sh
common/bin/compare-objects.sh
hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/test/compiler/7068051/Test7068051.sh
hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
hotspot/test/gc/startup_warnings/TestIncGC.java
langtools/test/com/sun/javadoc/testJavaFX/C.java
langtools/test/com/sun/javadoc/testJavaFX/D.java
--- a/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 a137992d750c72f6f944f341aa19b0d0d96afe0c jdk9-b35
 41df50e7303daf73c0d661ef601c4fe250915de5 jdk9-b36
 b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
+948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
+4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
--- a/.hgtags-top-repo	Sat Nov 15 02:51:48 2014 +0000
+++ b/.hgtags-top-repo	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
 201d4e235d597a25a2d3ee1404394789ba386119 jdk9-b36
 723a67b0c442391447b1d8aad8b249d06d1032e8 jdk9-b37
+d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
+512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
--- a/common/autoconf/basics.m4	Sat Nov 15 02:51:48 2014 +0000
+++ b/common/autoconf/basics.m4	Mon Nov 17 09:36:40 2014 +0100
@@ -684,8 +684,6 @@
   AC_SUBST(CONF_NAME, $CONF_NAME)
   AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT)
 
-  # Most of the probed defines are put into config.h
-  AC_CONFIG_HEADERS([$OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in])
   # The spec.gmk file contains all variables for the make system.
   AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
   # The hotspot-spec.gmk file contains legacy variables for the hotspot make system.
@@ -694,8 +692,6 @@
   AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
   # The compare.sh is used to compare the build output to other builds.
   AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
-  # Spec.sh is currently used by compare-objects.sh
-  AC_CONFIG_FILES([$OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in])
   # The generated Makefile knows where the spec.gmk is and where the source is.
   # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
   # which will look for generated configurations
--- a/common/autoconf/config.h.in	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#define PACKAGE_NAME "openjdk"
-#define PACKAGE_TARNAME "openjdk"
-#define PACKAGE_VERSION "version-0.1"
-#define PACKAGE_STRING "openjdk version-0.1"
-#define PACKAGE_BUGREPORT "build-infra-dev@openjdk.java.net"
-#define PACKAGE_URL ""
-#define STDC_HEADERS
-#define HAVE_SYS_TYPES_H
-#define HAVE_SYS_STAT_H
-#define HAVE_STDLIB_H
-#define HAVE_STRING_H
-#define HAVE_MEMORY_H
-#define HAVE_STRINGS_H
-#define HAVE_INTTYPES_H
-#define HAVE_STDINT_H
-#define HAVE_UNISTD_H
-#define SIZEOF_INT_P 8
-#define HAVE_CUPS_CUPS_H
-#define HAVE_CUPS_PPD_H
-#define HAVE_LIBJPEG
-#define HAVE_LIBGIF
-#define HAVE_LIBZ
-#define HAVE_LIBM
-#define HAVE_ALTZONE
--- a/common/autoconf/generated-configure.sh	Sat Nov 15 02:51:48 2014 +0000
+++ b/common/autoconf/generated-configure.sh	Mon Nov 17 09:36:40 2014 +0100
@@ -3944,7 +3944,7 @@
     pulse)
       PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
     x11)
-      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel" ;;
+      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
     ccache)
       PKGHANDLER_COMMAND="sudo yum install ccache" ;;
   esac
@@ -4328,7 +4328,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1414663067
+DATE_WHEN_GENERATED=1415179461
 
 ###############################################################################
 #
@@ -15338,9 +15338,6 @@
   OUTPUT_ROOT=$OUTPUT_ROOT
 
 
-  # Most of the probed defines are put into config.h
-  ac_config_headers="$ac_config_headers $OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in"
-
   # The spec.gmk file contains all variables for the make system.
   ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
 
@@ -15353,9 +15350,6 @@
   # The compare.sh is used to compare the build output to other builds.
   ac_config_files="$ac_config_files $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in"
 
-  # Spec.sh is currently used by compare-objects.sh
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in"
-
   # The generated Makefile knows where the spec.gmk is and where the source is.
   # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
   # which will look for generated configurations
@@ -43279,32 +43273,40 @@
   # Check for X Windows
   #
 
-  # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
-  # Make a simple check for the libraries at the sysroot, and setup --x-includes and
-  # --x-libraries for the sysroot, if that seems to be correct.
-  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
-    if test "x$SYSROOT" != "x"; then
-      if test "x$x_includes" = xNONE; then
-        if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
-          x_includes="$SYSROOT/usr/X11R6/include"
-        elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
-          x_includes="$SYSROOT/usr/include"
-        fi
-      fi
-      if test "x$x_libraries" = xNONE; then
-        if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
-          x_libraries="$SYSROOT/usr/X11R6/lib"
-        elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-          x_libraries="$SYSROOT/usr/lib64"
-        elif test -f "$SYSROOT/usr/lib/libX11.so"; then
-          x_libraries="$SYSROOT/usr/lib"
-        fi
-      fi
-    fi
-  fi
-
-  # Now let autoconf do it's magic
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+  if test "x$X11_NOT_NEEDED" = xyes; then
+    if test "x${with_x}" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: X11 is not used, so --with-x is ignored" >&5
+$as_echo "$as_me: WARNING: X11 is not used, so --with-x is ignored" >&2;}
+    fi
+    X_CFLAGS=
+    X_LIBS=
+  else
+    # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
+    # Make a simple check for the libraries at the sysroot, and setup --x-includes and
+    # --x-libraries for the sysroot, if that seems to be correct.
+    if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+      if test "x$SYSROOT" != "x"; then
+        if test "x$x_includes" = xNONE; then
+          if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
+            x_includes="$SYSROOT/usr/X11R6/include"
+          elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
+            x_includes="$SYSROOT/usr/include"
+          fi
+        fi
+        if test "x$x_libraries" = xNONE; then
+          if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
+            x_libraries="$SYSROOT/usr/X11R6/lib"
+          elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+            x_libraries="$SYSROOT/usr/lib64"
+          elif test -f "$SYSROOT/usr/lib/libX11.so"; then
+            x_libraries="$SYSROOT/usr/lib"
+          fi
+        fi
+      fi
+    fi
+
+    # Now let autoconf do it's magic
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
 $as_echo_n "checking for X... " >&6; }
 
 
@@ -43497,7 +43499,7 @@
 $as_echo "libraries $x_libraries, headers $x_includes" >&6; }
 fi
 
-  if test "$no_x" = yes; then
+    if test "$no_x" = yes; then
   # Not all programs may use this symbol, but it does not hurt to define it.
 
 $as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h
@@ -43988,13 +43990,13 @@
 fi
 
 
-  # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
-  # this doesn't make sense so we remove it.
-  if test "x$COMPILE_TYPE" = xcross; then
-    X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[^ ]*//g'`
-  fi
-
-  if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
+    # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
+    # this doesn't make sense so we remove it.
+    if test "x$COMPILE_TYPE" = xcross; then
+      X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[^ ]*//g'`
+    fi
+
+    if test "x$no_x" = xyes; then
 
   # Print a helpful message on how to acquire the necessary build dependency.
   # x11 is the help tag: freetype, cups, pulse, alsa etc
@@ -44025,34 +44027,34 @@
     fi
   fi
 
-    as_fn_error $? "Could not find X11 libraries. $HELP_MSG" "$LINENO" 5
-  fi
-
-  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    OPENWIN_HOME="/usr/openwin"
-    X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
-    X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
-  fi
-
-  ac_ext=c
+      as_fn_error $? "Could not find X11 libraries. $HELP_MSG" "$LINENO" 5
+    fi
+
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      OPENWIN_HOME="/usr/openwin"
+      X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
+      X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
+    fi
+
+    ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-  OLD_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
-
-  # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
-  for ac_header in X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h
+    OLD_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
+
+    # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
+    for ac_header in X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
-        # include <X11/Xlib.h>
-        # include <X11/Xutil.h>
+          # include <X11/Xlib.h>
+          # include <X11/Xutil.h>
 
 
 "
@@ -44060,48 +44062,15 @@
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
- X11_A_OK=yes
-else
-  X11_A_OK=no; break
-fi
-
-done
-
-
-  # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
-  # defined in libawt_xawt.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if XlinearGradient is defined in Xrender.h" >&5
-$as_echo_n "checking if XlinearGradient is defined in Xrender.h... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/extensions/Xrender.h>
-int
-main ()
-{
-XLinearGradient x;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-  CFLAGS="$OLD_CFLAGS"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-  if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
+ X11_HEADERS_OK=yes
+else
+  X11_HEADERS_OK=no; break
+fi
+
+done
+
+
+    if test "x$X11_HEADERS_OK" = xno; then
 
   # Print a helpful message on how to acquire the necessary build dependency.
   # x11 is the help tag: freetype, cups, pulse, alsa etc
@@ -44132,8 +44101,42 @@
     fi
   fi
 
-    as_fn_error $? "Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG" "$LINENO" 5
-  fi
+      as_fn_error $? "Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG" "$LINENO" 5
+    fi
+
+    # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
+    # defined in libawt_xawt.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if XlinearGradient is defined in Xrender.h" >&5
+$as_echo_n "checking if XlinearGradient is defined in Xrender.h... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/extensions/Xrender.h>
+int
+main ()
+{
+XLinearGradient x;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+         X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+    CFLAGS="$OLD_CFLAGS"
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  fi # X11_NOT_NEEDED
 
 
 
@@ -44435,6 +44438,8 @@
 fi
 
 
+  # Need to specify explicitly since it needs to be overridden on some versions of macosx
+  FREETYPE_BASE_NAME=freetype
   FREETYPE_CFLAGS=
   FREETYPE_LIBS=
   FREETYPE_BUNDLE_LIB_PATH=
@@ -44475,8 +44480,8 @@
   fi
   # Now check if configure found a version of 'msbuild.exe'
   if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src" >&5
-$as_echo "$as_me: WARNING: Can't find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can not find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src" >&5
+$as_echo "$as_me: WARNING: Can not find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src" >&2;}
     BUILD_FREETYPE=no
   fi
 
@@ -44576,30 +44581,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
   METHOD="--with-freetype-src"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -44904,30 +44934,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
   METHOD="--with-freetype"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -45493,30 +45548,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -45796,30 +45876,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -46090,30 +46195,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -46384,30 +46514,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -46679,30 +46834,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -46975,30 +47155,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -47267,30 +47472,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib/i386-linux-gnu"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -47559,30 +47789,55 @@
   POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib32"
   METHOD="well-known location"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
 $as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-    FOUND_FREETYPE=yes
-
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-      FOUND_FREETYPE=no
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
       fi
     fi
   fi
@@ -48141,9 +48396,9 @@
   fi
 
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
-        FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
-      else
-        FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
+        FREETYPE_LIBS="$FREETYPE_LIB_PATH/$FREETYPE_BASE_NAME.lib"
+      else
+        FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
       fi
     fi
 
@@ -51078,7 +51333,43 @@
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-DEFS=-DHAVE_CONFIG_H
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
 
 ac_libobjs=
 ac_ltlibobjs=
@@ -51512,15 +51803,11 @@
 "*) set x $ac_config_files; shift; ac_config_files=$*;;
 esac
 
-case $ac_config_headers in *"
-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
-esac
 
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
-config_headers="$ac_config_headers"
 
 _ACEOF
 
@@ -51541,15 +51828,10 @@
       --recheck    update $as_me by reconfiguring in the same conditions
       --file=FILE[:TEMPLATE]
                    instantiate the configuration file FILE
-      --header=FILE[:TEMPLATE]
-                   instantiate the configuration header FILE
 
 Configuration files:
 $config_files
 
-Configuration headers:
-$config_headers
-
 Report bugs to <build-dev@openjdk.java.net>.
 OpenJDK home page: <http://openjdk.java.net>."
 
@@ -51612,18 +51894,7 @@
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    as_fn_error $? "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
-  --help | --hel | -h )
+  --he | --h |  --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -51679,12 +51950,10 @@
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "$OUTPUT_ROOT/config.h") CONFIG_HEADERS="$CONFIG_HEADERS $OUTPUT_ROOT/config.h:$AUTOCONF_DIR/config.h.in" ;;
     "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
     "$OUTPUT_ROOT/hotspot-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in" ;;
     "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
     "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
-    "$OUTPUT_ROOT/spec.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in" ;;
     "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -51698,7 +51967,6 @@
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
   test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
@@ -51886,116 +52154,8 @@
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
-# Set up the scripts for CONFIG_HEADERS section.
-# No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
-if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
-BEGIN {
-_ACEOF
-
-# Transform confdefs.h into an awk script `defines.awk', embedded as
-# here-document in config.status, that substitutes the proper values into
-# config.h.in to produce config.h.
-
-# Create a delimiter string that does not exist in confdefs.h, to ease
-# handling of long lines.
-ac_delim='%!_!# '
-for ac_last_try in false false :; do
-  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_tt"; then
-    break
-  elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-
-# For the awk script, D is an array of macro values keyed by name,
-# likewise P contains macro parameters if any.  Preserve backslash
-# newline sequences.
-
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-sed -n '
-s/.\{148\}/&'"$ac_delim"'/g
-t rset
-:rset
-s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
-t def
-d
-:def
-s/\\$//
-t bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3"/p
-s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
-d
-:bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3\\\\\\n"\\/p
-t cont
-s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
-t cont
-d
-:cont
-n
-s/.\{148\}/&'"$ac_delim"'/g
-t clear
-:clear
-s/\\$//
-t bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/"/p
-d
-:bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
-b cont
-' <confdefs.h | sed '
-s/'"$ac_delim"'/"\\\
-"/g' >>$CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-  for (key in D) D_is_set[key] = 1
-  FS = ""
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
-  line = \$ 0
-  split(line, arg, " ")
-  if (arg[1] == "#") {
-    defundef = arg[2]
-    mac1 = arg[3]
-  } else {
-    defundef = substr(arg[1], 2)
-    mac1 = arg[2]
-  }
-  split(mac1, mac2, "(") #)
-  macro = mac2[1]
-  prefix = substr(line, 1, index(line, defundef) - 1)
-  if (D_is_set[macro]) {
-    # Preserve the white space surrounding the "#".
-    print prefix "define", macro P[macro] D[macro]
-    next
-  } else {
-    # Replace #undef with comments.  This is necessary, for example,
-    # in the case of _POSIX_SOURCE, which is predefined and required
-    # on some systems where configure will not decide to define it.
-    if (defundef == "undef") {
-      print "/*", prefix defundef, macro, "*/"
-      next
-    }
-  }
-}
-{ print }
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
-fi # test -n "$CONFIG_HEADERS"
-
-
-eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    "
+
+eval set X "  :F $CONFIG_FILES      "
 shift
 for ac_tag
 do
@@ -52203,30 +52363,7 @@
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-  if test x"$ac_file" != x-; then
-    {
-      $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
-    } >"$ac_tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f "$ac_file"
-      mv "$ac_tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    fi
-  else
-    $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5
-  fi
- ;;
+
 
 
   esac
--- a/common/autoconf/help.m4	Sat Nov 15 02:51:48 2014 +0000
+++ b/common/autoconf/help.m4	Mon Nov 17 09:36:40 2014 +0100
@@ -131,7 +131,7 @@
     pulse)
       PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
     x11)
-      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel" ;;
+      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
     ccache)
       PKGHANDLER_COMMAND="sudo yum install ccache" ;;
   esac
--- a/common/autoconf/libraries.m4	Sat Nov 15 02:51:48 2014 +0000
+++ b/common/autoconf/libraries.m4	Mon Nov 17 09:36:40 2014 +0100
@@ -91,85 +91,93 @@
   # Check for X Windows
   #
 
-  # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
-  # Make a simple check for the libraries at the sysroot, and setup --x-includes and
-  # --x-libraries for the sysroot, if that seems to be correct.
-  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
-    if test "x$SYSROOT" != "x"; then
-      if test "x$x_includes" = xNONE; then
-        if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
-          x_includes="$SYSROOT/usr/X11R6/include"
-        elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
-          x_includes="$SYSROOT/usr/include"
+  if test "x$X11_NOT_NEEDED" = xyes; then
+    if test "x${with_x}" != x; then
+      AC_MSG_WARN([X11 is not used, so --with-x is ignored])
+    fi
+    X_CFLAGS=
+    X_LIBS=
+  else
+    # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
+    # Make a simple check for the libraries at the sysroot, and setup --x-includes and
+    # --x-libraries for the sysroot, if that seems to be correct.
+    if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+      if test "x$SYSROOT" != "x"; then
+        if test "x$x_includes" = xNONE; then
+          if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
+            x_includes="$SYSROOT/usr/X11R6/include"
+          elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
+            x_includes="$SYSROOT/usr/include"
+          fi
         fi
-      fi
-      if test "x$x_libraries" = xNONE; then
-        if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
-          x_libraries="$SYSROOT/usr/X11R6/lib"
-        elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-          x_libraries="$SYSROOT/usr/lib64"
-        elif test -f "$SYSROOT/usr/lib/libX11.so"; then
-          x_libraries="$SYSROOT/usr/lib"
+        if test "x$x_libraries" = xNONE; then
+          if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
+            x_libraries="$SYSROOT/usr/X11R6/lib"
+          elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+            x_libraries="$SYSROOT/usr/lib64"
+          elif test -f "$SYSROOT/usr/lib/libX11.so"; then
+            x_libraries="$SYSROOT/usr/lib"
+          fi
         fi
       fi
     fi
-  fi
 
-  # Now let autoconf do it's magic
-  AC_PATH_X
-  AC_PATH_XTRA
+    # Now let autoconf do it's magic
+    AC_PATH_X
+    AC_PATH_XTRA
 
-  # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
-  # this doesn't make sense so we remove it.
-  if test "x$COMPILE_TYPE" = xcross; then
-    X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
-  fi
+    # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
+    # this doesn't make sense so we remove it.
+    if test "x$COMPILE_TYPE" = xcross; then
+      X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
+    fi
 
-  if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
-    HELP_MSG_MISSING_DEPENDENCY([x11])
-    AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
-  fi
+    if test "x$no_x" = xyes; then
+      HELP_MSG_MISSING_DEPENDENCY([x11])
+      AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
+    fi
 
-  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    OPENWIN_HOME="/usr/openwin"
-    X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
-    X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-        -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
-  fi
+    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+      OPENWIN_HOME="/usr/openwin"
+      X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
+      X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+          -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
+    fi
+
+    AC_LANG_PUSH(C)
+    OLD_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
 
-  AC_LANG_PUSH(C)
-  OLD_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
-
-  # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
-  AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
-      [X11_A_OK=yes],
-      [X11_A_OK=no; break],
-      [
-        # include <X11/Xlib.h>
-        # include <X11/Xutil.h>
-      ]
-  )
+    # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
+    AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
+        [X11_HEADERS_OK=yes],
+        [X11_HEADERS_OK=no; break],
+        [
+          # include <X11/Xlib.h>
+          # include <X11/Xutil.h>
+        ]
+    )
 
-  # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
-  # defined in libawt_xawt.
-  AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h])
-  AC_COMPILE_IFELSE(
-      [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],
-          [[XLinearGradient x;]])],
-      [AC_MSG_RESULT([yes])],
-      [AC_MSG_RESULT([no])
-       X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"])
+    if test "x$X11_HEADERS_OK" = xno; then
+      HELP_MSG_MISSING_DEPENDENCY([x11])
+      AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
+    fi
 
-  CFLAGS="$OLD_CFLAGS"
-  AC_LANG_POP(C)
+    # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
+    # defined in libawt_xawt.
+    AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h])
+    AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],
+            [[XLinearGradient x;]])],
+        [AC_MSG_RESULT([yes])],
+        [AC_MSG_RESULT([no])
+         X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"])
 
-  if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
-    HELP_MSG_MISSING_DEPENDENCY([x11])
-    AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
-  fi
+    CFLAGS="$OLD_CFLAGS"
+    AC_LANG_POP(C)
+  fi # X11_NOT_NEEDED
 
   AC_SUBST(X_CFLAGS)
   AC_SUBST(X_LIBS)
@@ -264,7 +272,7 @@
   fi
   # Now check if configure found a version of 'msbuild.exe'
   if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
-    AC_MSG_WARN([Can't find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
+    AC_MSG_WARN([Can not find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
     BUILD_FREETYPE=no
   fi
 
@@ -335,27 +343,50 @@
   POTENTIAL_FREETYPE_LIB_PATH="$2"
   METHOD="$3"
 
-  # First check if the files exists.
-  if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # We found an arbitrary include file. That's a good sign.
+  # Let's start with an optimistic view of the world :-)
+  FOUND_FREETYPE=yes
+
+  # First look for the canonical freetype main include file ft2build.h.
+  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+      # Fail.
+      FOUND_FREETYPE=no
+    fi
+  fi
+  
+  if test "x$FOUND_FREETYPE" = xyes; then
+    # Include file found, let's continue the sanity check.
     AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
-    FOUND_FREETYPE=yes
 
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+    # Reset to default value
+    FREETYPE_BASE_NAME=freetype
+    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
-      FOUND_FREETYPE=no
+      if test "x$OPENJDK_TARGET_OS" = xmacosx \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+        # for the .6 version explicitly.
+        FREETYPE_BASE_NAME=freetype.6
+        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+        AC_MSG_NOTICE([Compensating for missing symlink by using version 6 explicitly])
+      else
+        AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
+        FOUND_FREETYPE=no
+      fi
     else
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
         # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
-          AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
+        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+          AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location.])
           FOUND_FREETYPE=no
         fi
       elif test "x$OPENJDK_TARGET_OS" = xsolaris \
           && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
         # Found lib in isa dir, use that instead.
         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+        AC_MSG_NOTICE([Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead])
       fi
     fi
   fi
@@ -392,6 +423,8 @@
   AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
       [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
 
+  # Need to specify explicitly since it needs to be overridden on some versions of macosx
+  FREETYPE_BASE_NAME=freetype
   FREETYPE_CFLAGS=
   FREETYPE_LIBS=
   FREETYPE_BUNDLE_LIB_PATH=
@@ -575,9 +608,9 @@
     if test "x$FREETYPE_LIBS" = x; then
       BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
       if test "x$OPENJDK_TARGET_OS" = xwindows; then
-        FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
+        FREETYPE_LIBS="$FREETYPE_LIB_PATH/$FREETYPE_BASE_NAME.lib"
       else
-        FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
+        FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
       fi
     fi
 
--- a/common/autoconf/spec.sh.in	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#
-# Copyright (c) 2011, 2012, 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.
-#
-
-CAT="@CAT@"
-CD=cd
-CP="@CP@"
-DIFF="@DIFF@"
-ECHO="@ECHO@"
-FIND="@FIND@"
-GREP="@GREP@"
-RM="@RM@"
-SED="@SED@"
-
-POST_STRIP_CMD="@POST_STRIP_CMD@"
--- a/common/bin/boot_cycle.sh	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2012, 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.
-#
-
-# The boot_cycle.sh script performs two complete image builds (no javadoc though....)
-# where the second build uses the first build as the boot jdk.
-#
-# This is useful to verify that the build is self hoisting and assists
-# in flushing out bugs. You can follow up with compare_objects.sh to check
-# that the two boot_cycle_?/images/j2sdk are identical. They should be.
-#
-# Usage:
-# Specify the configure arguments to boot_cycle.sh, for example:
-#
-#    sh common/bin/boot_cycle.sh --enable-debug --with-jvm-variants=server
-#
-# The same arguments will be used for both builds, except of course --with-boot-jdk
-# that will be adjusted to boot_cycle_1 for the second build.
-
-SCRIPT_DIR=`pwd`/`dirname $0`
-ROOT_DIR=`(cd $SCRIPT_DIR/../.. ; pwd)`
-BUILD_DIR=$ROOT_DIR/build
-mkdir -p $BUILD_DIR
-AUTOCONF_DIR=`(cd $SCRIPT_DIR/../autoconf ; pwd)`
-BOOT_CYCLE_1_DIR=$BUILD_DIR/boot_cycle_1
-BOOT_CYCLE_2_DIR=$BUILD_DIR/boot_cycle_2
-
-# Create the boot cycle dirs in the build directory.
-mkdir -p $BOOT_CYCLE_1_DIR
-mkdir -p $BOOT_CYCLE_2_DIR
-
-cd $BOOT_CYCLE_1_DIR
-# Configure!
-sh $AUTOCONF_DIR/configure "$@"
-# Now build!
-make images
-
-if ! test -x $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java ; then
-    echo Failed to build the executable $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java
-    exit 1
-fi
-
-cd $BOOT_CYCLE_2_DIR
-# Pickup the configure arguments, but drop any --with-boot-jdk=....
-# and add the correct --with-boot-jdk=...boot_cycle_1... at the end.
-ARGUMENTS="`cat $BOOT_CYCLE_1_DIR/configure-arguments|sed 's/--with-boot-jdk=[^ ]*//'` --with-boot-jdk=$BOOT_CYCLE_1_DIR/images/j2sdk-image"
-# Configure using these adjusted arguments.
-sh $AUTOCONF_DIR/configure $ARGUMENTS
-# Now build!
-make images
-
-if ! test -x $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java ; then
-    echo Failed to build the final executable $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java
-    exit 1
-fi
-
-
--- a/common/bin/compare-objects.sh	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2012, 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.
-#
-
-# MANUAL
-#
-# ./common/bin/compare-objects.sh old_jdk_build_dir new_jdk_build_dir
-#
-# Compares object files
-#
-
-if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
-    echo "bash ./common/bin/compare-objects.sh old_jdk_build_dir new_jdk_build_dir <pattern>"
-    echo ""
-    echo "Compare object files"
-    echo ""
-    exit 10
-fi
-
-#######
-#
-# List of files (grep patterns) that are ignored
-# 
-# 1) hotspot object files
-IGNORE="-e hotspot"
-
-# 2) various build artifacts: sizer.32.o sizer.64.o dummyodbc.o
-#    these are produced during build and then e.g run to produce other data
-#    i.e not directly put into build => safe to ignore
-IGNORE="${IGNORE} -e sizer.32.o -e sizer.64.o"
-IGNORE="${IGNORE} -e dummyodbc.o"
-IGNORE="${IGNORE} -e genSolarisConstants.o"
-IGNORE="${IGNORE} -e genUnixConstants.o"
-
-OLD="$1"
-NEW="$2"
-shift; shift
-PATTERN="$*"
-
-if [ -f $NEW/spec.sh ]; then
-    . $NEW/spec.sh
-elif [ -f $NEW/../../spec.sh ]; then
-    . $NEW/../../spec.sh
-elif [ -f $OLD/spec.sh ]; then
-    . $OLD/spec.sh
-elif [ -f $OLD/../../spec.sh ]; then
-    . $OLD/../../spec.sh
-else
-    echo "Unable to find spec.sh"
-    echo "Giving up"
-    exit 1
-fi
-
-export COMPARE_ROOT=/tmp/cimages.$USER/objects
-mkdir -p $COMPARE_ROOT
-
-(${CD} $OLD && ${FIND} . -name '*.o') > $COMPARE_ROOT/list.old
-(${CD} $NEW && ${FIND} . -name '*.o') > $COMPARE_ROOT/list.new
-
-# On macosx JobjC is build in both i386 and x86_64 variant (universial binary)
-#   but new build only builds the x86_64
-# Remove the 386 variants from comparison...to avoid "false" positives
-${GREP} -v 'JObjC.dst/Objects-normal/i386' $COMPARE_ROOT/list.old > $COMPARE_ROOT/list.old.new
-${CP} $COMPARE_ROOT/list.old $COMPARE_ROOT/list.old.full
-${CP} $COMPARE_ROOT/list.old.new $COMPARE_ROOT/list.old
-
-findnew() {
-    arg_1=$1
-    arg_2=$2
-
-    # special case 1 unpack-cmd => unpackexe
-    arg_1=`${ECHO} $arg_1 | ${SED} 's!unpack-cmd!unpackexe!g'`
-    arg_2=`${ECHO} $arg_2 | ${SED} 's!unpack-cmd!unpackexe!g'`
-
-    # special case 2 /JObjC.dst/ => /libjobjc/
-    arg_1=`${ECHO} $arg_1 | ${SED} 's!/JObjC.dst/!/libjobjc/!g'`
-    arg_2=`${ECHO} $arg_2 | ${SED} 's!/JObjC.dst/!/libjobjc/!g'`
-
-    full=`${ECHO} $arg_1 | ${SED} 's!\.!\\\.!g'`
-    medium=`${ECHO} $arg_1 | ${SED} 's!.*/\([^/]*/[^/]*\)!\1!'`
-    short=`${ECHO} $arg_2 | ${SED} 's!\.!\\\.!g'`
-    if [ "`${GREP} -c "/$full" $COMPARE_ROOT/list.new`" -eq 1 ]
-    then
-	${ECHO} $NEW/$arg_1
-	return
-    fi
-
-    if [ "`${GREP} -c "$medium" $COMPARE_ROOT/list.new`" -eq 1 ]
-    then
-	${GREP} "$medium" $COMPARE_ROOT/list.new
-	return
-    fi
-
-    if [ "`${GREP} -c "/$short" $COMPARE_ROOT/list.new`" -eq 1 ]
-    then
-	${GREP} "/$short" $COMPARE_ROOT/list.new
-	return
-    fi
-
-    # old style has "dir" before obj{64}
-    dir=`${ECHO} $arg_1 | ${SED} 's!.*/\([^/]*\)/obj[64]*.*!\1!g'`
-    if [ -n "$dir" -a "$dir" != "$arg_1" ]
-    then
-	if [ "`${GREP} $dir $COMPARE_ROOT/list.new | ${GREP} -c "/$short"`" -eq 1 ]
-	then
-	    ${GREP} $dir $COMPARE_ROOT/list.new | ${GREP} "/$short"
-	    return
-	fi
-
-	# Try with lib$dir/
-	if [ "`${GREP} "lib$dir/" $COMPARE_ROOT/list.new | ${GREP} -c "/$short"`" -eq 1 ]
-	then
-	    ${GREP} "lib$dir/" $COMPARE_ROOT/list.new | ${GREP} "/$short"
-	    return
-	fi
-
-	# Try with $dir_objs
-	if [ "`${GREP} "${dir}_objs" $COMPARE_ROOT/list.new | ${GREP} -c "/$short"`" -eq 1 ]
-	then
-	    ${GREP} "${dir}_objs" $COMPARE_ROOT/list.new | ${GREP} "/$short"
-	    return
-	fi
-    fi
-
-    # check for some specifics...
-    for i in demo hotspot jobjc
-    do
-	if [ "`${ECHO} $full | ${GREP} -c $i`" -gt 0 ]
-	then
-	    if [ "`${GREP} $i $COMPARE_ROOT/list.new | ${GREP} -c "/$short"`" -eq 1 ]
-	    then
-		${GREP} $i $COMPARE_ROOT/list.new | ${GREP} "/$short"
-		return
-	    fi
-	fi
-    done
-
-    # check for specific demo
-    demo=`${ECHO} $arg_1 | ${SED} 's!.*/demo/jvmti/\([^/]*\)/.*!\1!g'`
-    if [ -n "$demo" -a "$dir" != "$demo" ]
-    then
-	if [ "`${GREP} $demo $COMPARE_ROOT/list.new | ${GREP} -c "/$short"`" -eq 1 ]
-	then
-	    ${GREP} $demo $COMPARE_ROOT/list.new | ${GREP} "/$short"
-	    return
-	fi
-    fi
-
-    return
-}
-
-compare() {
-    old=$1
-    new=$2
-    ${DIFF} $old $new > /dev/null
-    res=$?
-    if [ $res -eq 0 ]
-    then
-	${ECHO} 0
-	return
-    fi
-
-    # check if stripped objects gives equality
-    ${CP} $old $COMPARE_ROOT/`basename $old`.old
-    ${CP} $new $COMPARE_ROOT/`basename $old`.new
-    ${POST_STRIP_CMD} $COMPARE_ROOT/`basename $old`.old $COMPARE_ROOT/`basename $old`.new > /dev/null 2>&1
-    ${DIFF} $COMPARE_ROOT/`basename $old`.old $COMPARE_ROOT/`basename $old`.new > /dev/null
-    res=$?
-    ${RM} $COMPARE_ROOT/`basename $old`.old $COMPARE_ROOT/`basename $old`.new
-    if [ $res -eq 0 ]
-    then
-	${ECHO} S
-	return
-    fi
-
-    name=`basename $1 | ${SED} 's!\.o!!'`
-    cntold=`strings $old | ${GREP} -c $name`
-    cntnew=`strings $new | ${GREP} -c $name`
-    
-    if [ $cntold -gt 0 -a $cntnew -gt 0 ]
-    then
-	${ECHO} F
-	return
-    fi
-
-    ${ECHO} 1
-}
-
-for F in `${CAT} $COMPARE_ROOT/list.old`
-do
-    if [ "${IGNORE}" ] && [ "`${ECHO} $F | ${GREP} ${IGNORE}`" ]
-    then
-	#
-	# skip ignored files
-        #
-	continue;
-    fi
-
-    if [ "$PATTERN" ] && [ `${ECHO} $F | ${GREP} -c $PATTERN` -eq 0 ]
-    then
-	continue;
-    fi
-
-    f=`basename $F`
-    o=$OLD/$F
-    n=`findnew $F $f`
-
-    if [ "$n" ]
-    then	
-	n="$NEW/$n"
-	${ECHO} `compare $o $n` : $f : $o : $n
-    else
-	${ECHO} "- : $f : $o "
-    fi
-done
--- a/corba/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/corba/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 9bc2dbd3dfb8c9fa88e00056b8b93a81ee6d306e jdk9-b35
 ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
 7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
+8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
+53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Mon Nov 17 09:36:40 2014 +0100
@@ -166,16 +166,15 @@
  *
  *
  * @implNote
- * As described above it is possible to specify, at runtime, an alternative ORBSingleton class and
- * an alternative ORB implementation class, via the system properties {@code org.omg.CORBA.ORBSingletonClass}
- * and {@code org.omg.CORBA.ORBClass} respectively.
- * The class loading strategy is organized, such that, in the case of the ORBSingleton
- * the system class loader is used to load the alternative singleton ORB.
- * Thus, it is necessary that an application's CLASSPATH
- * includes the classes for this alternative ORBSingleton, when specified.
+ * When a singleton ORB is configured via the system property,
+ * or orb.properties, it will be
+ * located, and loaded via the system class loader.
+ * Thus, where appropriate, it is necessary that
+ * the classes for this alternative ORBSingleton are available on the application's class path.
+ * It should be noted that the singleton ORB is system wide.
  *
- * In the case of specifying an alternative ORB implementation class, the loading
- * strategy will use the thread context class loader, as appropriate.
+ * When a per-application ORB is created via the 2-arg init methods,
+ * then it will be located using the thread context class loader.
  *
  * @since   JDK1.2
  */
@@ -295,6 +294,11 @@
      * creating <code>TypeCode</code> objects are invoked.
      *
      * @return the singleton ORB
+     *
+     * @implNote
+     * When configured via the system property, or orb.properties,
+     * the system-wide singleton ORB is located via the
+     * system class loader.
      */
     public static synchronized ORB init() {
         if (singleton == null) {
@@ -354,6 +358,10 @@
      *             method; may be <code>null</code>
      * @param props application-specific properties; may be <code>null</code>
      * @return the newly-created ORB instance
+     *
+     * @implNote
+     * When configured via the system property, or orb.properties,
+     * the ORB is located via the thread context class loader.
      */
     public static ORB init(String[] args, Properties props) {
         //
@@ -392,6 +400,10 @@
      * @param app the applet; may be <code>null</code>
      * @param props applet-specific properties; may be <code>null</code>
      * @return the newly-created ORB instance
+     *
+     * @implNote
+     * When configured via the system property, or orb.properties,
+     * the ORB is located via the thread context class loader.
      */
     public static ORB init(Applet app, Properties props) {
         String className;
--- a/hotspot/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -440,3 +440,5 @@
 438cb613151c4bd290bb732697517cba1cafcb04 jdk9-b35
 464ab653fbb17eb518d8ef60f8df301de7ef00d0 jdk9-b36
 b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
+c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
+9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java	Mon Nov 17 09:36:40 2014 +0100
@@ -64,8 +64,8 @@
   }
 
   // Accessing spaces
-  public EdenSpace eden() {
-    return (EdenSpace) VMObjectFactory.newObject(EdenSpace.class, edenSpaceField.getValue(addr));
+  public ContiguousSpace eden() {
+    return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));
   }
 
   public ContiguousSpace from() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** <P> Class EdenSpace describes eden-space in new
-    generation. (Currently it does not add any significant
-    functionality beyond ContiguousSpace.) */
-
-public class EdenSpace extends ContiguousSpace {
-  public EdenSpace(Address addr) {
-    super(addr);
-  }
-}
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3513,7 +3513,7 @@
                  Rtags            = R3_ARG1,
                  Rindex           = R5_ARG3;
 
-  const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+  const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
 
   // --------------------------------------------------------------------------
   // Check if fast case is possible.
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3196,7 +3196,7 @@
   assert(0 <= con_size_in_bytes && Assembler::is_simm13(con_size_in_bytes), "illegal object size");
   assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, "object size is not multiple of alignment");
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     ba(slow_case);
     delayed()->nop();
@@ -3331,7 +3331,7 @@
   assert_different_registers(top, t1, t2, t3, G4, G5 /* preserve G4 and G5 */);
   Label do_refill, discard_tlab;
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     ba(slow_case);
     delayed()->nop();
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3309,7 +3309,7 @@
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   if(UseTLAB) {
     Register RoldTopValue = RallocatedObject;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1767,7 +1767,7 @@
     // at [FETCH], below, will never observe a biased encoding (*101b).
     // If this invariant is not held we risk exclusion (safety) failure.
     if (UseBiasedLocking && !UseOptoBiasInlining) {
-      biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters);
+      biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters);
     }
 
 #if INCLUDE_RTM_OPT
@@ -2946,7 +2946,7 @@
                                    Label& slow_case) {
   assert(obj == rax, "obj must be in rax, for cmpxchg");
   assert_different_registers(obj, var_size_in_bytes, t1);
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     jmp(slow_case);
   } else {
     Register end = t1;
@@ -4419,7 +4419,7 @@
   assert_different_registers(top, thread_reg, t1, t2, /* preserve: */ rbx, rdx);
   Label do_refill, discard_tlab;
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     jmp(slow_case);
   }
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3214,7 +3214,7 @@
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   const Register thread = rcx;
   if (UseTLAB || allow_shared_alloc) {
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3269,7 +3269,7 @@
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   if (UseTLAB) {
     __ movptr(rax, Address(r15_thread, in_bytes(JavaThread::tlab_top_offset())));
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -2608,7 +2608,10 @@
   assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
   assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
   if (UseLargePages) {
-    Solaris::setup_large_pages(addr, bytes, alignment_hint);
+    size_t page_size = Solaris::page_size_for_alignment(alignment_hint);
+    if (page_size > (size_t) vm_page_size()) {
+      Solaris::setup_large_pages(addr, bytes, page_size);
+    }
   }
 }
 
--- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -31,6 +31,11 @@
 
 // Implementation of class OrderAccess.
 
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
 inline void OrderAccess::loadload()   { acquire(); }
 inline void OrderAccess::storestore() { release(); }
 inline void OrderAccess::loadstore()  { acquire(); }
@@ -46,9 +51,7 @@
 }
 
 inline void OrderAccess::release() {
-  // Avoid hitting the same cache-line from
-  // different threads.
-  volatile jint local_dummy = 0;
+  compiler_barrier();
 }
 
 inline void OrderAccess::fence() {
@@ -62,34 +65,34 @@
   }
 }
 
-inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
-inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
-inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
-inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
-inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
-inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
-inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
-inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
+inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { jbyte   v = *p; compiler_barrier(); return v; }
+inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { jshort  v = *p; compiler_barrier(); return v; }
+inline jint     OrderAccess::load_acquire(volatile jint*    p) { jint    v = *p; compiler_barrier(); return v; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { jlong   v = Atomic::load(p); compiler_barrier(); return v; }
+inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { jubyte  v = *p; compiler_barrier(); return v; }
+inline jushort  OrderAccess::load_acquire(volatile jushort* p) { jushort v = *p; compiler_barrier(); return v; }
+inline juint    OrderAccess::load_acquire(volatile juint*   p) { juint   v = *p; compiler_barrier(); return v; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { julong  v = Atomic::load((volatile jlong*)p); compiler_barrier(); return v; }
+inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { jfloat  v = *p; compiler_barrier(); return v; }
+inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { jdouble v = jdouble_cast(Atomic::load((volatile jlong*)p)); compiler_barrier(); return v; }
 
-inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t*   p) { return *p; }
-inline void*    OrderAccess::load_ptr_acquire(volatile void*       p) { return *(void* volatile *)p; }
-inline void*    OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
+inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t*   p) { intptr_t v = *p; compiler_barrier(); return v; }
+inline void*    OrderAccess::load_ptr_acquire(volatile void*       p) { void*    v = *(void* volatile *)p; compiler_barrier(); return v; }
+inline void*    OrderAccess::load_ptr_acquire(const volatile void* p) { void*    v = *(void* const volatile *)p; compiler_barrier(); return v; }
 
-inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
-inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
-inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
-inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { compiler_barrier(); Atomic::store(v, p); }
+inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { compiler_barrier(); Atomic::store((jlong)v, (volatile jlong*)p); }
+inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { compiler_barrier(); *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); }
 
-inline void     OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
-inline void     OrderAccess::release_store_ptr(volatile void*     p, void*    v) { *(void* volatile *)p = v; }
+inline void     OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store_ptr(volatile void*     p, void*    v) { compiler_barrier(); *(void* volatile *)p = v; }
 
 inline void     OrderAccess::store_fence(jbyte*  p, jbyte  v) {
   __asm__ volatile (  "xchgb (%2),%0"
--- a/hotspot/src/share/vm/Xusage.txt	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/Xusage.txt	Mon Nov 17 09:36:40 2014 +0100
@@ -7,7 +7,6 @@
     -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                       prepend in front of bootstrap class path
     -Xnoclassgc       disable class garbage collection
-    -Xincgc           enable incremental garbage collection
     -Xloggc:<file>    log GC status to a file with time stamps
     -Xbatch           disable background compilation
     -Xms<size>        set initial Java heap size
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -68,7 +68,10 @@
 // ciMethod::ciMethod
 //
 // Loaded method.
-ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
+ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
+  ciMetadata(h_m()),
+  _holder(holder)
+{
   assert(h_m() != NULL, "no null method");
 
   // These fields are always filled in in loaded methods.
@@ -124,7 +127,6 @@
   // generating _signature may allow GC and therefore move m.
   // These fields are always filled in.
   _name = env->get_symbol(h_m()->name());
-  _holder = env->get_instance_klass(h_m()->method_holder());
   ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
   constantPoolHandle cpool = h_m()->constants();
   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -91,7 +91,7 @@
   BCEscapeAnalyzer*   _bcea;
 #endif
 
-  ciMethod(methodHandle h_m);
+  ciMethod(methodHandle h_m, ciInstanceKlass* holder);
   ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor);
 
   Method* get_Method() const {
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -239,7 +239,7 @@
 ciObject* ciObjectFactory::get(oop key) {
   ASSERT_IN_VM;
 
-  assert(key == NULL || Universe::heap()->is_in_reserved(key), "must be");
+  assert(Universe::heap()->is_in_reserved(key), "must be");
 
   NonPermObject* &bucket = find_non_perm(key);
   if (bucket != NULL) {
@@ -260,10 +260,10 @@
 }
 
 // ------------------------------------------------------------------
-// ciObjectFactory::get
+// ciObjectFactory::get_metadata
 //
-// Get the ciObject corresponding to some oop.  If the ciObject has
-// already been created, it is returned.  Otherwise, a new ciObject
+// Get the ciMetadata corresponding to some Metadata. If the ciMetadata has
+// already been created, it is returned. Otherwise, a new ciMetadata
 // is created.
 ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
   ASSERT_IN_VM;
@@ -290,9 +290,9 @@
   }
 #endif
   if (!is_found_at(index, key, _ci_metadata)) {
-    // The ciObject does not yet exist.  Create it and insert it
+    // The ciMetadata does not yet exist. Create it and insert it
     // into the cache.
-    ciMetadata* new_object = create_new_object(key);
+    ciMetadata* new_object = create_new_metadata(key);
     init_ident_of(new_object);
     assert(new_object->is_metadata(), "must be");
 
@@ -344,15 +344,28 @@
 }
 
 // ------------------------------------------------------------------
-// ciObjectFactory::create_new_object
+// ciObjectFactory::create_new_metadata
 //
-// Create a new ciObject from a Metadata*.
+// Create a new ciMetadata from a Metadata*.
 //
-// Implementation note: this functionality could be virtual behavior
-// of the oop itself.  For now, we explicitly marshal the object.
-ciMetadata* ciObjectFactory::create_new_object(Metadata* o) {
+// Implementation note: in order to keep Metadata live, an auxiliary ciObject
+// is used, which points to it's holder.
+ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
   EXCEPTION_CONTEXT;
 
+  // Hold metadata from unloading by keeping it's holder alive.
+  if (_initialized && o->is_klass()) {
+    Klass* holder = ((Klass*)o);
+    if (holder->oop_is_instance() && InstanceKlass::cast(holder)->is_anonymous()) {
+      // Though ciInstanceKlass records class loader oop, it's not enough to keep
+      // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
+      // It is enough to record a ciObject, since cached elements are never removed
+      // during ciObjectFactory lifetime. ciObjectFactory itself is created for
+      // every compilation and lives for the whole duration of the compilation.
+      ciObject* h = get(holder->klass_holder());
+    }
+  }
+
   if (o->is_klass()) {
     KlassHandle h_k(THREAD, (Klass*)o);
     Klass* k = (Klass*)o;
@@ -365,14 +378,16 @@
     }
   } else if (o->is_method()) {
     methodHandle h_m(THREAD, (Method*)o);
-    return new (arena()) ciMethod(h_m);
+    ciEnv *env = CURRENT_THREAD_ENV;
+    ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder());
+    return new (arena()) ciMethod(h_m, holder);
   } else if (o->is_methodData()) {
     // Hold methodHandle alive - might not be necessary ???
     methodHandle h_m(THREAD, ((MethodData*)o)->method());
     return new (arena()) ciMethodData((MethodData*)o);
   }
 
-  // The oop is of some type not supported by the compiler interface.
+  // The Metadata* is of some type not supported by the compiler interface.
   ShouldNotReachHere();
   return NULL;
 }
@@ -701,7 +716,7 @@
 // If there is no entry in the cache corresponding to this oop, return
 // the null tail of the bucket into which the oop should be inserted.
 ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
-  assert(Universe::heap()->is_in_reserved_or_null(key), "must be");
+  assert(Universe::heap()->is_in_reserved(key), "must be");
   ciMetadata* klass = get_metadata(key->klass());
   NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
   for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
--- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -73,7 +73,7 @@
   void insert(int index, ciMetadata* obj, GrowableArray<ciMetadata*>* objects);
 
   ciObject* create_new_object(oop o);
-  ciMetadata* create_new_object(Metadata* o);
+  ciMetadata* create_new_metadata(Metadata* o);
 
   void ensure_metadata_alive(ciMetadata* m);
 
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -43,7 +43,7 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
-unsigned int align_code_offset(int offset) {
+unsigned int CodeBlob::align_code_offset(int offset) {
   // align the size to CodeEntryAlignment
   return
     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
--- a/hotspot/src/share/vm/code/codeBlob.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/code/codeBlob.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -83,6 +83,7 @@
  public:
   // Returns the space needed for CodeBlob
   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
+  static unsigned int align_code_offset(int offset);
 
   // Creation
   // a) simple CodeBlob
@@ -207,7 +208,7 @@
   }
 };
 
-
+class WhiteBox;
 //----------------------------------------------------------------------------------------------------
 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
 
@@ -215,6 +216,7 @@
   friend class VMStructs;
   friend class AdapterBlob;
   friend class MethodHandlesAdapterBlob;
+  friend class WhiteBox;
 
  private:
   // Creation support
--- a/hotspot/src/share/vm/code/codeCache.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -305,7 +305,7 @@
   MemoryService::add_code_heap_memory_pool(heap, name);
 }
 
-CodeHeap* CodeCache::get_code_heap(CodeBlob* cb) {
+CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
   assert(cb != NULL, "CodeBlob is null");
   FOR_ALL_HEAPS(heap) {
     if ((*heap)->contains(cb)) {
--- a/hotspot/src/share/vm/code/codeCache.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -77,6 +77,7 @@
 class CodeCache : AllStatic {
   friend class VMStructs;
   friend class NMethodIterator;
+  friend class WhiteBox;
  private:
   // CodeHeaps of the cache
   static GrowableArray<CodeHeap*>* _heaps;
@@ -98,7 +99,7 @@
   static void initialize_heaps();                             // Initializes the CodeHeaps
   // Creates a new heap with the given name and size, containing CodeBlobs of the given type
   static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
-  static CodeHeap* get_code_heap(CodeBlob* cb);               // Returns the CodeHeap for the given CodeBlob
+  static CodeHeap* get_code_heap(const CodeBlob* cb);         // Returns the CodeHeap for the given CodeBlob
   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
   // Returns the name of the VM option to set the size of the corresponding CodeHeap
   static const char* get_code_heap_flag_name(int code_blob_type);
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -35,6 +35,7 @@
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/nativeLookup.hpp"
+#include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
@@ -1963,6 +1964,12 @@
     if (comp == NULL) {
       ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
     } else {
+      if (WhiteBoxAPI && WhiteBox::compilation_locked) {
+        MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
+        while (WhiteBox::compilation_locked) {
+          locker.wait(Mutex::_no_safepoint_check_flag);
+        }
+      }
       comp->compile_method(&ci_env, target, osr_bci);
     }
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -89,9 +89,3 @@
     _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
   }
 }
-
-// Returns true if the incremental mode is enabled.
-bool ConcurrentMarkSweepPolicy::has_soft_ended_eden()
-{
-  return CMSIncrementalMode;
-}
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -42,9 +42,6 @@
   virtual void initialize_size_policy(size_t init_eden_size,
                                       size_t init_promo_size,
                                       size_t init_survivor_size);
-
-  // Returns true if the incremental mode is enabled.
-  virtual bool has_soft_ended_eden();
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSCOLLECTORPOLICY_HPP
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -2083,17 +2083,13 @@
 }
 
 // Support for compaction
-
 void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp,end,block_is_obj,block_size);
+  scan_and_forward(this, cp);
   // Prepare_for_compaction() uses the space between live objects
   // so that later phase can skip dead space quickly.  So verification
   // of the free lists doesn't work after.
 }
 
-#define obj_size(q) adjustObjectSize(oop(q)->size())
-#define adjust_obj_size(s) adjustObjectSize(s)
-
 void CompactibleFreeListSpace::adjust_pointers() {
   // In other versions of adjust_pointers(), a bail out
   // based on the amount of live data in the generation
@@ -2101,12 +2097,12 @@
   // Cannot test used() == 0 here because the free lists have already
   // been mangled by the compaction.
 
-  SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+  scan_and_adjust_pointers(this);
   // See note about verification in prepare_for_compaction().
 }
 
 void CompactibleFreeListSpace::compact() {
-  SCAN_AND_COMPACT(obj_size);
+  scan_and_compact(this);
 }
 
 // Fragmentation metric = 1 - [sum of (fbs**2) / (sum of fbs)**2]
@@ -2629,7 +2625,7 @@
   // Get the #blocks we want to claim
   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
   assert(n_blks > 0, "Error");
-  assert(ResizePLAB || n_blks == OldPLABSize, "Error");
+  assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error");
   // In some cases, when the application has a phase change,
   // there may be a sudden and sharp shift in the object survival
   // profile, and updating the counts at the end of a scavenge
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -73,6 +73,13 @@
   friend class CMSCollector;
   // Local alloc buffer for promotion into this space.
   friend class CFLS_LAB;
+  // Allow scan_and_* functions to call (private) overrides of the auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space);
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_compact(SpaceType* space);
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
 
   // "Size" of chunks of work (executed during parallel remark phases
   // of CMS collection); this probably belongs in CMSCollector, although
@@ -288,6 +295,28 @@
     _bt.freed(start, size);
   }
 
+  // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return end();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call
+  }
+
+  inline size_t adjust_obj_size(size_t size) const {
+    return adjustObjectSize(size);
+  }
+
+  inline size_t obj_size(const HeapWord* addr) const {
+    return adjustObjectSize(oop(addr)->size());
+  }
+
  protected:
   // Reset the indexed free list to its initial empty condition.
   void resetIndexedFreeListArray();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -167,16 +167,6 @@
 };
 
 
-// Wrapper class to temporarily disable icms during a foreground cms collection.
-class ICMSDisabler: public StackObj {
- public:
-  // The ctor disables icms and wakes up the thread so it notices the change;
-  // the dtor re-enables icms.  Note that the CMSCollector methods will check
-  // CMSIncrementalMode.
-  ICMSDisabler()  { CMSCollector::disable_icms(); CMSCollector::start_icms(); }
-  ~ICMSDisabler() { CMSCollector::enable_icms(); }
-};
-
 //////////////////////////////////////////////////////////////////
 //  Concurrent Mark-Sweep Generation /////////////////////////////
 //////////////////////////////////////////////////////////////////
@@ -363,7 +353,6 @@
   _cms_used_at_gc0_end = 0;
   _allow_duty_cycle_reduction = false;
   _valid_bits = 0;
-  _icms_duty_cycle = CMSIncrementalDutyCycle;
 }
 
 double CMSStats::cms_free_adjustment_factor(size_t free) const {
@@ -442,86 +431,17 @@
   return work - deadline;
 }
 
-// Return a duty cycle based on old_duty_cycle and new_duty_cycle, limiting the
-// amount of change to prevent wild oscillation.
-unsigned int CMSStats::icms_damped_duty_cycle(unsigned int old_duty_cycle,
-                                              unsigned int new_duty_cycle) {
-  assert(old_duty_cycle <= 100, "bad input value");
-  assert(new_duty_cycle <= 100, "bad input value");
-
-  // Note:  use subtraction with caution since it may underflow (values are
-  // unsigned).  Addition is safe since we're in the range 0-100.
-  unsigned int damped_duty_cycle = new_duty_cycle;
-  if (new_duty_cycle < old_duty_cycle) {
-    const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 5U);
-    if (new_duty_cycle + largest_delta < old_duty_cycle) {
-      damped_duty_cycle = old_duty_cycle - largest_delta;
-    }
-  } else if (new_duty_cycle > old_duty_cycle) {
-    const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 15U);
-    if (new_duty_cycle > old_duty_cycle + largest_delta) {
-      damped_duty_cycle = MIN2(old_duty_cycle + largest_delta, 100U);
-    }
-  }
-  assert(damped_duty_cycle <= 100, "invalid duty cycle computed");
-
-  if (CMSTraceIncrementalPacing) {
-    gclog_or_tty->print(" [icms_damped_duty_cycle(%d,%d) = %d] ",
-                           old_duty_cycle, new_duty_cycle, damped_duty_cycle);
-  }
-  return damped_duty_cycle;
-}
-
-unsigned int CMSStats::icms_update_duty_cycle_impl() {
-  assert(CMSIncrementalPacing && valid(),
-         "should be handled in icms_update_duty_cycle()");
-
-  double cms_time_so_far = cms_timer().seconds();
-  double scaled_duration = cms_duration_per_mb() * _cms_used_at_gc0_end / M;
-  double scaled_duration_remaining = fabsd(scaled_duration - cms_time_so_far);
-
-  // Avoid division by 0.
-  double time_until_full = MAX2(time_until_cms_gen_full(), 0.01);
-  double duty_cycle_dbl = 100.0 * scaled_duration_remaining / time_until_full;
-
-  unsigned int new_duty_cycle = MIN2((unsigned int)duty_cycle_dbl, 100U);
-  if (new_duty_cycle > _icms_duty_cycle) {
-    // Avoid very small duty cycles (1 or 2); 0 is allowed.
-    if (new_duty_cycle > 2) {
-      _icms_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle,
-                                                new_duty_cycle);
-    }
-  } else if (_allow_duty_cycle_reduction) {
-    // The duty cycle is reduced only once per cms cycle (see record_cms_end()).
-    new_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle, new_duty_cycle);
-    // Respect the minimum duty cycle.
-    unsigned int min_duty_cycle = (unsigned int)CMSIncrementalDutyCycleMin;
-    _icms_duty_cycle = MAX2(new_duty_cycle, min_duty_cycle);
-  }
-
-  if (PrintGCDetails || CMSTraceIncrementalPacing) {
-    gclog_or_tty->print(" icms_dc=%d ", _icms_duty_cycle);
-  }
-
-  _allow_duty_cycle_reduction = false;
-  return _icms_duty_cycle;
-}
-
 #ifndef PRODUCT
 void CMSStats::print_on(outputStream *st) const {
   st->print(" gc0_alpha=%d,cms_alpha=%d", _gc0_alpha, _cms_alpha);
   st->print(",gc0_dur=%g,gc0_per=%g,gc0_promo=" SIZE_FORMAT,
                gc0_duration(), gc0_period(), gc0_promoted());
-  st->print(",cms_dur=%g,cms_dur_per_mb=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
-            cms_duration(), cms_duration_per_mb(),
-            cms_period(), cms_allocated());
+  st->print(",cms_dur=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
+            cms_duration(), cms_period(), cms_allocated());
   st->print(",cms_since_beg=%g,cms_since_end=%g",
             cms_time_since_begin(), cms_time_since_end());
   st->print(",cms_used_beg=" SIZE_FORMAT ",cms_used_end=" SIZE_FORMAT,
             _cms_used_at_gc0_begin, _cms_used_at_gc0_end);
-  if (CMSIncrementalMode) {
-    st->print(",dc=%d", icms_duty_cycle());
-  }
 
   if (valid()) {
     st->print(",promo_rate=%g,cms_alloc_rate=%g",
@@ -579,8 +499,6 @@
 #endif
   _collection_count_start(0),
   _verifying(false),
-  _icms_start_limit(NULL),
-  _icms_stop_limit(NULL),
   _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"),
   _completed_initialization(false),
   _collector_policy(cp),
@@ -1116,137 +1034,6 @@
   }
 }
 
-static inline size_t percent_of_space(Space* space, HeapWord* addr)
-{
-  size_t delta = pointer_delta(addr, space->bottom());
-  return (size_t)(delta * 100.0 / (space->capacity() / HeapWordSize));
-}
-
-void CMSCollector::icms_update_allocation_limits()
-{
-  Generation* young = GenCollectedHeap::heap()->get_gen(0);
-  EdenSpace* eden = young->as_DefNewGeneration()->eden();
-
-  const unsigned int duty_cycle = stats().icms_update_duty_cycle();
-  if (CMSTraceIncrementalPacing) {
-    stats().print();
-  }
-
-  assert(duty_cycle <= 100, "invalid duty cycle");
-  if (duty_cycle != 0) {
-    // The duty_cycle is a percentage between 0 and 100; convert to words and
-    // then compute the offset from the endpoints of the space.
-    size_t free_words = eden->free() / HeapWordSize;
-    double free_words_dbl = (double)free_words;
-    size_t duty_cycle_words = (size_t)(free_words_dbl * duty_cycle / 100.0);
-    size_t offset_words = (free_words - duty_cycle_words) / 2;
-
-    _icms_start_limit = eden->top() + offset_words;
-    _icms_stop_limit = eden->end() - offset_words;
-
-    // The limits may be adjusted (shifted to the right) by
-    // CMSIncrementalOffset, to allow the application more mutator time after a
-    // young gen gc (when all mutators were stopped) and before CMS starts and
-    // takes away one or more cpus.
-    if (CMSIncrementalOffset != 0) {
-      double adjustment_dbl = free_words_dbl * CMSIncrementalOffset / 100.0;
-      size_t adjustment = (size_t)adjustment_dbl;
-      HeapWord* tmp_stop = _icms_stop_limit + adjustment;
-      if (tmp_stop > _icms_stop_limit && tmp_stop < eden->end()) {
-        _icms_start_limit += adjustment;
-        _icms_stop_limit = tmp_stop;
-      }
-    }
-  }
-  if (duty_cycle == 0 || (_icms_start_limit == _icms_stop_limit)) {
-    _icms_start_limit = _icms_stop_limit = eden->end();
-  }
-
-  // Install the new start limit.
-  eden->set_soft_end(_icms_start_limit);
-
-  if (CMSTraceIncrementalMode) {
-    gclog_or_tty->print(" icms alloc limits:  "
-                           PTR_FORMAT "," PTR_FORMAT
-                           " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
-                           p2i(_icms_start_limit), p2i(_icms_stop_limit),
-                           percent_of_space(eden, _icms_start_limit),
-                           percent_of_space(eden, _icms_stop_limit));
-    if (Verbose) {
-      gclog_or_tty->print("eden:  ");
-      eden->print_on(gclog_or_tty);
-    }
-  }
-}
-
-// Any changes here should try to maintain the invariant
-// that if this method is called with _icms_start_limit
-// and _icms_stop_limit both NULL, then it should return NULL
-// and not notify the icms thread.
-HeapWord*
-CMSCollector::allocation_limit_reached(Space* space, HeapWord* top,
-                                       size_t word_size)
-{
-  // A start_limit equal to end() means the duty cycle is 0, so treat that as a
-  // nop.
-  if (CMSIncrementalMode && _icms_start_limit != space->end()) {
-    if (top <= _icms_start_limit) {
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               p2i(top), p2i(_icms_stop_limit),
-                               percent_of_space(space, _icms_stop_limit));
-      }
-      ConcurrentMarkSweepThread::start_icms();
-      assert(top < _icms_stop_limit, "Tautology");
-      if (word_size < pointer_delta(_icms_stop_limit, top)) {
-        return _icms_stop_limit;
-      }
-
-      // The allocation will cross both the _start and _stop limits, so do the
-      // stop notification also and return end().
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               p2i(top), p2i(space->end()),
-                               percent_of_space(space, space->end()));
-      }
-      ConcurrentMarkSweepThread::stop_icms();
-      return space->end();
-    }
-
-    if (top <= _icms_stop_limit) {
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" stop limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               top, space->end(),
-                               percent_of_space(space, space->end()));
-      }
-      ConcurrentMarkSweepThread::stop_icms();
-      return space->end();
-    }
-
-    if (CMSTraceIncrementalMode) {
-      space->print_on(gclog_or_tty);
-      gclog_or_tty->stamp();
-      gclog_or_tty->print_cr(" end limit top=" PTR_FORMAT
-                             ", new limit=" PTR_FORMAT,
-                             top, NULL);
-    }
-  }
-
-  return NULL;
-}
-
 oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
   assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
   // allocate, copy and if necessary update promoinfo --
@@ -1289,14 +1076,6 @@
 }
 
 
-HeapWord*
-ConcurrentMarkSweepGeneration::allocation_limit_reached(Space* space,
-                                             HeapWord* top,
-                                             size_t word_sz)
-{
-  return collector()->allocation_limit_reached(space, top, word_sz);
-}
-
 // IMPORTANT: Notes on object size recognition in CMS.
 // ---------------------------------------------------
 // A block of storage in the CMS generation is always in
@@ -1809,9 +1588,6 @@
   // we want to do a foreground collection.
   _foregroundGCIsActive = true;
 
-  // Disable incremental mode during a foreground collection.
-  ICMSDisabler icms_disabler;
-
   // release locks and wait for a notify from the background collector
   // releasing the locks in only necessary for phases which
   // do yields to improve the granularity of the collection.
@@ -2135,7 +1911,7 @@
 
 void CMSCollector::print_eden_and_survivor_chunk_arrays() {
   DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
-  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* eden_space = dng->eden();
   ContiguousSpace* from_space = dng->from();
   ContiguousSpace* to_space   = dng->to();
   // Eden
@@ -2783,10 +2559,6 @@
   //
   _cmsGen->update_counters(cms_used);
 
-  if (CMSIncrementalMode) {
-    icms_update_allocation_limits();
-  }
-
   bitMapLock()->unlock();
   releaseFreelistLocks();
 
@@ -4272,12 +4044,10 @@
   assert_lock_strong(_bit_map_lock);
   _bit_map_lock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // It is possible for whichever thread initiated the yield request
   // not to get a chance to wake up and take the bitmap lock between
@@ -4307,7 +4077,6 @@
                    ConcurrentMarkSweepThread::should_yield() &&
                    !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -5238,7 +5007,7 @@
 
 void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
   DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
-  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* eden_space = dng->eden();
   ContiguousSpace* from_space = dng->from();
   ContiguousSpace* to_space   = dng->to();
 
@@ -5410,7 +5179,7 @@
     while (!pst->is_task_claimed(/* reference */ nth_task)) {
       // We claimed task # nth_task; compute its boundaries.
       if (chunk_top == 0) {  // no samples were taken
-        assert(nth_task == 0 && n_tasks == 1, "Can have only 1 EdenSpace task");
+        assert(nth_task == 0 && n_tasks == 1, "Can have only 1 eden task");
         start = space->bottom();
         end   = space->top();
       } else if (nth_task == 0) {
@@ -5788,7 +5557,7 @@
   // process_roots (which currently doesn't know how to
   // parallelize such a scan), but rather will be broken up into
   // a set of parallel tasks (via the sampling that the [abortable]
-  // preclean phase did of EdenSpace, plus the [two] tasks of
+  // preclean phase did of eden, plus the [two] tasks of
   // scanning the [two] survivor spaces. Further fine-grain
   // parallelization of the scanning of the survivor spaces
   // themselves, and of precleaning of the younger gen itself
@@ -6474,19 +6243,16 @@
         assert_lock_strong(bitMapLock());
         bitMapLock()->unlock();
         ConcurrentMarkSweepThread::desynchronize(true);
-        ConcurrentMarkSweepThread::acknowledge_yield_request();
         stopTimer();
         if (PrintCMSStatistics != 0) {
           incrementYields();
         }
-        icms_wait();
 
         // See the comment in coordinator_yield()
         for (unsigned i = 0; i < CMSYieldSleepCount &&
                          ConcurrentMarkSweepThread::should_yield() &&
                          !CMSCollector::foregroundGCIsActive(); ++i) {
           os::sleep(Thread::current(), 1, false);
-          ConcurrentMarkSweepThread::acknowledge_yield_request();
         }
 
         ConcurrentMarkSweepThread::synchronize(true);
@@ -6509,10 +6275,6 @@
     _collectorState = Idling;
   }
 
-  // Stop incremental mode after a cycle completes, so that any future cycles
-  // are triggered by allocation.
-  stop_icms();
-
   NOT_PRODUCT(
     if (RotateCMSCollectionTypes) {
       _cmsGen->rotate_debug_collection_type();
@@ -6964,12 +6726,10 @@
   _bit_map->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0;
@@ -6978,7 +6738,6 @@
        !CMSCollector::foregroundGCIsActive();
        ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7124,19 +6883,16 @@
   _bitMap->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                    ConcurrentMarkSweepThread::should_yield() &&
                    !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7196,19 +6952,16 @@
   // Relinquish the bit map lock
   _bit_map->lock()->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7354,19 +7107,16 @@
   assert_lock_strong(_bitMap->lock());
   _bitMap->lock()->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7388,7 +7138,7 @@
   _finger = ptr + obj->size();
   assert(_finger > ptr, "we just incremented it above");
   // On large heaps, it may take us some time to get through
-  // the marking phase (especially if running iCMS). During
+  // the marking phase. During
   // this time it's possible that a lot of mutations have
   // accumulated in the card table and the mod union table --
   // these mutation records are redundant until we have
@@ -7505,7 +7255,7 @@
   _finger = ptr + obj->size();
   assert(_finger > ptr, "we just incremented it above");
   // On large heaps, it may take us some time to get through
-  // the marking phase (especially if running iCMS). During
+  // the marking phase. During
   // this time it's possible that a lot of mutations have
   // accumulated in the card table and the mod union table --
   // these mutation records are redundant until we have
@@ -7994,20 +7744,16 @@
   bml->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
 
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
-
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -8675,19 +8421,16 @@
   _bitMap->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -356,7 +356,6 @@
   size_t _gc0_promoted;         // bytes promoted per gc0
   double _cms_duration;
   double _cms_duration_pre_sweep; // time from initiation to start of sweep
-  double _cms_duration_per_mb;
   double _cms_period;
   size_t _cms_allocated;        // bytes of direct allocation per gc0 period
 
@@ -383,17 +382,7 @@
 
   unsigned int _valid_bits;
 
-  unsigned int _icms_duty_cycle;        // icms duty cycle (0-100).
-
  protected:
-
-  // Return a duty cycle that avoids wild oscillations, by limiting the amount
-  // of change between old_duty_cycle and new_duty_cycle (the latter is treated
-  // as a recommended value).
-  static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle,
-                                             unsigned int new_duty_cycle);
-  unsigned int icms_update_duty_cycle_impl();
-
   // In support of adjusting of cms trigger ratios based on history
   // of concurrent mode failure.
   double cms_free_adjustment_factor(size_t free) const;
@@ -426,7 +415,6 @@
   size_t gc0_promoted() const   { return _gc0_promoted; }
   double cms_period() const          { return _cms_period; }
   double cms_duration() const        { return _cms_duration; }
-  double cms_duration_per_mb() const { return _cms_duration_per_mb; }
   size_t cms_allocated() const       { return _cms_allocated; }
 
   size_t cms_used_at_gc0_end() const { return _cms_used_at_gc0_end;}
@@ -458,12 +446,6 @@
 
   // End of higher level statistics.
 
-  // Returns the cms incremental mode duty cycle, as a percentage (0-100).
-  unsigned int icms_duty_cycle() const { return _icms_duty_cycle; }
-
-  // Update the duty cycle and return the new value.
-  unsigned int icms_update_duty_cycle();
-
   // Debugging.
   void print_on(outputStream* st) const PRODUCT_RETURN;
   void print() const { print_on(gclog_or_tty); }
@@ -725,13 +707,6 @@
   // Timing, allocation and promotion statistics, used for scheduling.
   CMSStats      _stats;
 
-  // Allocation limits installed in the young gen, used only in
-  // CMSIncrementalMode.  When an allocation in the young gen would cross one of
-  // these limits, the cms generation is notified and the cms thread is started
-  // or stopped, respectively.
-  HeapWord*     _icms_start_limit;
-  HeapWord*     _icms_stop_limit;
-
   enum CMS_op_type {
     CMS_op_checkpointRootsInitial,
     CMS_op_checkpointRootsFinal
@@ -867,10 +842,6 @@
   // collector.
   bool waitForForegroundGC();
 
-  // Incremental mode triggering:  recompute the icms duty cycle and set the
-  // allocation limits in the young gen.
-  void icms_update_allocation_limits();
-
   size_t block_size_using_printezis_bits(HeapWord* addr) const;
   size_t block_size_if_printezis_bits(HeapWord* addr) const;
   HeapWord* next_card_start_after_block(HeapWord* addr) const;
@@ -928,9 +899,6 @@
   void promoted(bool par, HeapWord* start,
                 bool is_obj_array, size_t obj_size);
 
-  HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                     size_t word_size);
-
   void getFreelistLocks() const;
   void releaseFreelistLocks() const;
   bool haveFreelistLocks() const;
@@ -1001,14 +969,6 @@
   // Timers/stats for gc scheduling and incremental mode pacing.
   CMSStats& stats() { return _stats; }
 
-  // Convenience methods that check whether CMSIncrementalMode is enabled and
-  // forward to the corresponding methods in ConcurrentMarkSweepThread.
-  static void start_icms();
-  static void stop_icms();    // Called at the end of the cms cycle.
-  static void disable_icms(); // Called before a foreground collection.
-  static void enable_icms();  // Called after a foreground collection.
-  void icms_wait();          // Called at yield points.
-
   // Adaptive size policy
   AdaptiveSizePolicy* size_policy();
 
@@ -1211,9 +1171,6 @@
     return allocate(size, tlab);
   }
 
-  // Incremental mode triggering.
-  HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                     size_t word_size);
 
   // Used by CMSStats to track direct allocation.  The value is sampled and
   // reset after each young gen collection.
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -234,36 +234,6 @@
   }
 }
 
-inline void CMSCollector::start_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::start_icms();
-  }
-}
-
-inline void CMSCollector::stop_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::stop_icms();
-  }
-}
-
-inline void CMSCollector::disable_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::disable_icms();
-  }
-}
-
-inline void CMSCollector::enable_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::enable_icms();
-  }
-}
-
-inline void CMSCollector::icms_wait() {
-  if (CMSIncrementalMode) {
-    cmsThread()->icms_wait();
-  }
-}
-
 inline void CMSCollector::save_sweep_limits() {
   _cmsGen->save_sweep_limit();
 }
@@ -363,12 +333,6 @@
   _cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration,
     cur_duration, _cms_alpha);
 
-  // Avoid division by 0.
-  const size_t cms_used_mb = MAX2(_cms_used_at_cms_begin / M, (size_t)1);
-  _cms_duration_per_mb = AdaptiveWeightedAverage::exp_avg(_cms_duration_per_mb,
-                                 cur_duration / cms_used_mb,
-                                 _cms_alpha);
-
   _cms_end_time.update();
   _cms_alpha = _saved_alpha;
   _allow_duty_cycle_reduction = true;
@@ -400,15 +364,6 @@
   return (gc0_promoted() + cms_allocated()) / gc0_period();
 }
 
-inline unsigned int CMSStats::icms_update_duty_cycle() {
-  // Update the duty cycle only if pacing is enabled and the stats are valid
-  // (after at least one young gen gc and one cms cycle have completed).
-  if (CMSIncrementalPacing && valid()) {
-    return icms_update_duty_cycle_impl();
-  }
-  return _icms_duty_cycle;
-}
-
 inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
   cmsSpace()->save_sweep_limit();
 }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -49,13 +49,6 @@
 int  ConcurrentMarkSweepThread::_CMS_flag         = CMS_nil;
 
 volatile jint ConcurrentMarkSweepThread::_pending_yields      = 0;
-volatile jint ConcurrentMarkSweepThread::_pending_decrements  = 0;
-
-volatile jint ConcurrentMarkSweepThread::_icms_disabled   = 0;
-volatile bool ConcurrentMarkSweepThread::_should_run     = false;
-// When icms is enabled, the icms thread is stopped until explicitly
-// started.
-volatile bool ConcurrentMarkSweepThread::_should_stop    = true;
 
 SurrogateLockerThread*
      ConcurrentMarkSweepThread::_slt = NULL;
@@ -99,7 +92,6 @@
     }
   }
   _sltMonitor = SLT_lock;
-  assert(!CMSIncrementalMode || icms_is_enabled(), "Error");
 }
 
 void ConcurrentMarkSweepThread::run() {
@@ -184,11 +176,6 @@
 }
 
 void ConcurrentMarkSweepThread::stop() {
-  if (CMSIncrementalMode) {
-    // Disable incremental mode and wake up the thread so it notices the change.
-    disable_icms();
-    start_icms();
-  }
   // it is ok to take late safepoints here, if needed
   {
     MutexLockerEx x(Terminator_lock);
@@ -387,23 +374,13 @@
 
 void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
   while (!_should_terminate) {
-    if (CMSIncrementalMode) {
-      icms_wait();
-      if(CMSWaitDuration >= 0) {
-        // Wait until the next synchronous GC, a concurrent full gc
-        // request or a timeout, whichever is earlier.
-        wait_on_cms_lock_for_scavenge(CMSWaitDuration);
-      }
-      return;
+    if(CMSWaitDuration >= 0) {
+      // Wait until the next synchronous GC, a concurrent full gc
+      // request or a timeout, whichever is earlier.
+      wait_on_cms_lock_for_scavenge(CMSWaitDuration);
     } else {
-      if(CMSWaitDuration >= 0) {
-        // Wait until the next synchronous GC, a concurrent full gc
-        // request or a timeout, whichever is earlier.
-        wait_on_cms_lock_for_scavenge(CMSWaitDuration);
-      } else {
-        // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
-        wait_on_cms_lock(CMSCheckInterval);
-      }
+      // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
+      wait_on_cms_lock(CMSCheckInterval);
     }
     // Check if we should start a CMS collection cycle
     if (_collector->shouldConcurrentCollect()) {
@@ -414,42 +391,6 @@
   }
 }
 
-// Incremental CMS
-void ConcurrentMarkSweepThread::start_icms() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-  trace_state("start_icms");
-  _should_run = true;
-  iCMS_lock->notify_all();
-}
-
-void ConcurrentMarkSweepThread::stop_icms() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-  if (!_should_stop) {
-    trace_state("stop_icms");
-    _should_stop = true;
-    _should_run = false;
-    asynchronous_yield_request();
-    iCMS_lock->notify_all();
-  }
-}
-
-void ConcurrentMarkSweepThread::icms_wait() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  if (_should_stop && icms_is_enabled()) {
-    MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-    trace_state("pause_icms");
-    _collector->stats().stop_cms_timer();
-    while(!_should_run && icms_is_enabled()) {
-      iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
-    }
-    _collector->stats().start_cms_timer();
-    _should_stop = false;
-    trace_state("pause_icms end");
-  }
-}
-
 // Note: this method, although exported by the ConcurrentMarkSweepThread,
 // which is a non-JavaThread, can only be called by a JavaThread.
 // Currently this is done at vm creation time (post-vm-init) by the
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -64,20 +64,11 @@
   static bool clear_CMS_flag(int b)         { return (_CMS_flag &= ~b) != 0; }
   void sleepBeforeNextCycle();
 
-  // CMS thread should yield for a young gen collection, direct allocation,
-  // and iCMS activity.
+  // CMS thread should yield for a young gen collection and direct allocations
   static char _pad_1[64 - sizeof(jint)];    // prevent cache-line sharing
   static volatile jint _pending_yields;
-  static volatile jint _pending_decrements; // decrements to _pending_yields
   static char _pad_2[64 - sizeof(jint)];    // prevent cache-line sharing
 
-  // Tracing messages, enabled by CMSTraceThreadState.
-  static inline void trace_state(const char* desc);
-
-  static volatile int _icms_disabled;   // a counter to track #iCMS disable & enable
-  static volatile bool _should_run;     // iCMS may run
-  static volatile bool _should_stop;    // iCMS should stop
-
   // debugging
   void verify_ok_to_terminate() const PRODUCT_RETURN;
 
@@ -135,44 +126,13 @@
   void wait_on_cms_lock_for_scavenge(long t_millis);
 
   // The CMS thread will yield during the work portion of its cycle
-  // only when requested to.  Both synchronous and asychronous requests
-  // are provided:
-  // (1) A synchronous request is used for young gen collections and
-  //     for direct allocations.  The requesting thread increments
-  //     _pending_yields at the beginning of an operation, and decrements
-  //     _pending_yields when that operation is completed.
-  //     In turn, the CMS thread yields when _pending_yields is positive,
-  //     and continues to yield until the value reverts to 0.
-  // (2) An asynchronous request, on the other hand, is used by iCMS
-  //     for the stop_icms() operation. A single yield satisfies all of
-  //     the outstanding asynch yield requests, of which there may
-  //     occasionally be several in close succession. To accomplish
-  //     this, an asynch-requesting thread atomically increments both
-  //     _pending_yields and _pending_decrements. An asynchr requesting
-  //     thread does not wait and "acknowledge" completion of an operation
-  //     and deregister the request, like the synchronous version described
-  //     above does. In turn, after yielding, the CMS thread decrements both
-  //     _pending_yields and _pending_decrements by the value seen in
-  //     _pending_decrements before the decrement.
-  //  NOTE: The above scheme is isomorphic to having two request counters,
-  //  one for async requests and one for sync requests, and for the CMS thread
-  //  to check the sum of the two counters to decide whether it should yield
-  //  and to clear only the async counter when it yields. However, it turns out
-  //  to be more efficient for CMS code to just check a single counter
-  //  _pending_yields that holds the sum (of both sync and async requests), and
-  //  a second counter _pending_decrements that only holds the async requests,
-  //  for greater efficiency, since in a typical CMS run, there are many more
-  //  potential (i.e. static) yield points than there are actual
-  //  (i.e. dynamic) yields because of requests, which are few and far between.
-  //
-  // Note that, while "_pending_yields >= _pending_decrements" is an invariant,
-  // we cannot easily test that invariant, since the counters are manipulated via
-  // atomic instructions without explicit locking and we cannot read
-  // the two counters atomically together: one suggestion is to
-  // use (for example) 16-bit counters so as to be able to read the
-  // two counters atomically even on 32-bit platforms. Notice that
-  // the second assert in acknowledge_yield_request() below does indeed
-  // check a form of the above invariant, albeit indirectly.
+  // only when requested to.
+  // A synchronous request is used for young gen collections and
+  // for direct allocations.  The requesting thread increments
+  // _pending_yields at the beginning of an operation, and decrements
+  // _pending_yields when that operation is completed.
+  // In turn, the CMS thread yields when _pending_yields is positive,
+  // and continues to yield until the value reverts to 0.
 
   static void increment_pending_yields()   {
     Atomic::inc(&_pending_yields);
@@ -182,67 +142,9 @@
     Atomic::dec(&_pending_yields);
     assert(_pending_yields >= 0, "can't be negative");
   }
-  static void asynchronous_yield_request() {
-    assert(CMSIncrementalMode, "Currently only used w/iCMS");
-    increment_pending_yields();
-    Atomic::inc(&_pending_decrements);
-    assert(_pending_decrements >= 0, "can't be negative");
-  }
-  static void acknowledge_yield_request() {
-    jint decrement = _pending_decrements;
-    if (decrement > 0) {
-      assert(CMSIncrementalMode, "Currently only used w/iCMS");
-      // Order important to preserve: _pending_yields >= _pending_decrements
-      Atomic::add(-decrement, &_pending_decrements);
-      Atomic::add(-decrement, &_pending_yields);
-      assert(_pending_decrements >= 0, "can't be negative");
-      assert(_pending_yields >= 0, "can't be negative");
-    }
-  }
   static bool should_yield()   { return _pending_yields > 0; }
-
-  // CMS incremental mode.
-  static void start_icms(); // notify thread to start a quantum of work
-  static void stop_icms();  // request thread to stop working
-  void icms_wait();         // if asked to stop, wait until notified to start
-
-  // Incremental mode is enabled globally by the flag CMSIncrementalMode.  It
-  // must also be enabled/disabled dynamically to allow foreground collections.
-#define ICMS_ENABLING_ASSERT                                                      \
-          assert((CMSIncrementalMode  && _icms_disabled >= 0) ||                  \
-                 (!CMSIncrementalMode && _icms_disabled <= 0), "Error")
-
-  static inline void enable_icms() {
-    ICMS_ENABLING_ASSERT;
-    Atomic::dec(&_icms_disabled);
-  }
-  static inline void disable_icms() {
-   ICMS_ENABLING_ASSERT;
-   Atomic::inc(&_icms_disabled);
-  }
-  static inline bool icms_is_disabled() {
-   ICMS_ENABLING_ASSERT;
-   return _icms_disabled > 0;
-  }
-  static inline bool icms_is_enabled() {
-   return !icms_is_disabled();
-  }
 };
 
-inline void ConcurrentMarkSweepThread::trace_state(const char* desc) {
-  if (CMSTraceThreadState) {
-    char buf[128];
-    TimeStamp& ts = gclog_or_tty->time_stamp();
-    if (!ts.is_updated()) {
-      ts.update();
-    }
-    jio_snprintf(buf, sizeof(buf), " [%.3f:  CMSThread %s] ",
-                 ts.seconds(), desc);
-    buf[sizeof(buf) - 1] = '\0';
-    gclog_or_tty->print("%s", buf);
-  }
-}
-
 // For scoped increment/decrement of (synchronous) yield requests
 class CMSSynchronousYieldRequest: public StackObj {
  public:
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -207,12 +207,6 @@
   MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
   assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
   if (gch->total_full_collections() == _full_gc_count_before) {
-    // Disable iCMS until the full collection is done, and
-    // remember that we did so.
-    CMSCollector::disable_icms();
-    _disabled_icms = true;
-    // In case CMS thread was in icms_wait(), wake it up.
-    CMSCollector::start_icms();
     // Nudge the CMS thread to start a concurrent collection.
     CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
   } else {
@@ -276,8 +270,4 @@
       FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
     }
   }
-  // Enable iCMS back if we disabled it earlier.
-  if (_disabled_icms) {
-    CMSCollector::enable_icms();
-  }
 }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -128,13 +128,11 @@
 // VM operation to invoke a concurrent collection of the heap as a
 // GenCollectedHeap heap.
 class VM_GenCollectFullConcurrent: public VM_GC_Operation {
-  bool _disabled_icms;
  public:
   VM_GenCollectFullConcurrent(unsigned int gc_count_before,
                               unsigned int full_gc_count_before,
                               GCCause::Cause gc_cause)
-    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
-      _disabled_icms(false)
+    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */)
   {
     assert(FullGCCount_lock != NULL, "Error");
     assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1248,7 +1248,7 @@
   // The same as above but assume that the caller holds the Heap_lock.
   void collect_locked(GCCause::Cause cause);
 
-  virtual void copy_allocation_context_stats(const jint* contexts,
+  virtual bool copy_allocation_context_stats(const jint* contexts,
                                              jlong* totals,
                                              jbyte* accuracy,
                                              jint len);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -25,8 +25,9 @@
 #include "precompiled.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.hpp"
 
-void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
+bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
                                                     jlong* totals,
                                                     jbyte* accuracy,
                                                     jint len) {
+  return false;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1585,34 +1585,22 @@
   }
 };
 
+uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) {
+  assert(n_workers > 0, "Active gc workers should be greater than 0");
+  const uint overpartition_factor = 4;
+  const uint min_chunk_size = MAX2(n_regions / n_workers, 1U);
+  return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
+}
+
 void
-G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) {
+G1CollectorPolicy::record_concurrent_mark_cleanup_end(uint n_workers) {
   _collectionSetChooser->clear();
 
-  uint region_num = _g1->num_regions();
-  const uint OverpartitionFactor = 4;
-  uint WorkUnit;
-  // The use of MinChunkSize = 8 in the original code
-  // causes some assertion failures when the total number of
-  // region is less than 8.  The code here tries to fix that.
-  // Should the original code also be fixed?
-  if (no_of_gc_threads > 0) {
-    const uint MinWorkUnit = MAX2(region_num / no_of_gc_threads, 1U);
-    WorkUnit = MAX2(region_num / (no_of_gc_threads * OverpartitionFactor),
-                    MinWorkUnit);
-  } else {
-    assert(no_of_gc_threads > 0,
-      "The active gc workers should be greater than 0");
-    // In a product build do something reasonable to avoid a crash.
-    const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U);
-    WorkUnit =
-      MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor),
-           MinWorkUnit);
-  }
-  _collectionSetChooser->prepare_for_par_region_addition(_g1->num_regions(),
-                                                         WorkUnit);
-  ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, WorkUnit, (uint) no_of_gc_threads);
-  _g1->workers()->run_task(&parKnownGarbageTask);
+  uint n_regions = _g1->num_regions();
+  uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions);
+  _collectionSetChooser->prepare_for_par_region_addition(n_regions, chunk_size);
+  ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers);
+  _g1->workers()->run_task(&par_known_garbage_task);
 
   _collectionSetChooser->sort_regions();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -612,6 +612,10 @@
                                           uint desired_min_length,
                                           uint desired_max_length);
 
+  // Calculate and return chunk size (in number of regions) for parallel
+  // concurrent mark cleanup.
+  uint calculate_parallel_work_chunk_size(uint n_workers, uint n_regions);
+
   // Check whether a given young length (young_length) fits into the
   // given target pause time and whether the prediction for the amount
   // of objects to be copied for the given length will fit into the
@@ -687,7 +691,7 @@
 
   // Record start, end, and completion of cleanup.
   void record_concurrent_mark_cleanup_start();
-  void record_concurrent_mark_cleanup_end(int no_of_gc_threads);
+  void record_concurrent_mark_cleanup_end(uint n_workers);
   void record_concurrent_mark_cleanup_completed();
 
   // Records the information about the heap size for reporting in
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -97,13 +97,6 @@
   FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
 }
 
-void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
-  if (_g1->is_in_g1_reserved(mr.start())) {
-    _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size));
-    if (_start_first == NULL) _start_first = mr.start();
-  }
-}
-
 class ScanRSClosure : public HeapRegionClosure {
   size_t _cards_done, _cards;
   G1CollectedHeap* _g1h;
@@ -303,15 +296,6 @@
 
   _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i);
 
-  // Now there should be no dirty cards.
-  if (G1RSLogCheckCardTable) {
-    CountNonCleanMemRegionClosure cl(_g1);
-    _ct_bs->mod_card_iterate(&cl);
-    // XXX This isn't true any more: keeping cards of young regions
-    // marked dirty broke it.  Need some reasonable fix.
-    guarantee(cl.n() == 0, "Card table should be clean.");
-  }
-
   _g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -151,19 +151,6 @@
   }
 };
 
-class CountNonCleanMemRegionClosure: public MemRegionClosure {
-  G1CollectedHeap* _g1;
-  int _n;
-  HeapWord* _start_first;
-public:
-  CountNonCleanMemRegionClosure(G1CollectedHeap* g1) :
-    _g1(g1), _n(0), _start_first(NULL)
-  {}
-  void do_MemRegion(MemRegion mr);
-  int n() { return _n; };
-  HeapWord* start_first() { return _start_first; }
-};
-
 class UpdateRSOopClosure: public ExtendedOopClosure {
   HeapRegion* _from;
   G1RemSet* _rs;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -108,10 +108,6 @@
   develop(bool, G1RSBarrierRegionFilter, true,                              \
           "If true, generate region filtering code in RS barrier")          \
                                                                             \
-  develop(bool, G1RSLogCheckCardTable, false,                               \
-          "If true, verify that no dirty cards remain after RS log "        \
-          "processing.")                                                    \
-                                                                            \
   diagnostic(bool, G1PrintRegionLivenessInfo, false,                        \
             "Prints the liveness information for all regions in the heap "  \
             "at the end of a marking cycle.")                               \
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -960,6 +960,10 @@
   verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
 }
 
+void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
+  scan_and_forward(this, cp);
+}
+
 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
 // away eventually.
 
@@ -1043,12 +1047,6 @@
   }
 }
 
-#define block_is_always_obj(q) true
-void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
-}
-#undef block_is_always_obj
-
 G1OffsetTableContigSpace::
 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
                          MemRegion mr) :
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -187,8 +187,6 @@
   HeapWord* block_start(const void* p);
   HeapWord* block_start_const(const void* p) const;
 
-  void prepare_for_compaction(CompactPoint* cp);
-
   // Add offset table update.
   virtual HeapWord* allocate(size_t word_size);
   HeapWord* par_allocate(size_t word_size);
@@ -210,6 +208,9 @@
 
 class HeapRegion: public G1OffsetTableContigSpace {
   friend class VMStructs;
+  // Allow scan_and_forward to call (private) overrides for auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
  private:
 
   // The remembered set for this region.
@@ -219,6 +220,20 @@
 
   G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; }
 
+  // Auxiliary functions for scan_and_forward support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return top();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return true; // Always true, since scan_limit is top
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return HeapRegion::block_size(addr); // Avoid virtual call
+  }
+
  protected:
   // The index of this region in the heap region sequence.
   uint  _hrm_index;
@@ -340,6 +355,9 @@
   // and the amount of unallocated words if called on top()
   size_t block_size(const HeapWord* p) const;
 
+  // Override for scan_and_forward support.
+  void prepare_for_compaction(CompactPoint* cp);
+
   inline HeapWord* par_allocate_no_bot_updates(size_t word_size);
   inline HeapWord* allocate_no_bot_updates(size_t word_size);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -426,11 +426,19 @@
                                          mtGC);
   G1BlockOffsetSharedArray oa(heap, bot_storage);
   bot_storage->commit_regions(0, num_regions_in_test);
-  HeapRegion hr0(0, &oa, heap);
-  HeapRegion hr1(1, &oa, heap);
-  HeapRegion hr2(2, &oa, heap);
-  HeapRegion hr3(3, &oa, heap);
-  HeapRegion hr4(4, &oa, heap);
+
+  // Set up memory regions for the heap regions.
+  MemRegion mr0(heap.start(), HeapRegion::GrainWords);
+  MemRegion mr1(mr0.end(), HeapRegion::GrainWords);
+  MemRegion mr2(mr1.end(), HeapRegion::GrainWords);
+  MemRegion mr3(mr2.end(), HeapRegion::GrainWords);
+  MemRegion mr4(mr3.end(), HeapRegion::GrainWords);
+
+  HeapRegion hr0(0, &oa, mr0);
+  HeapRegion hr1(1, &oa, mr1);
+  HeapRegion hr2(2, &oa, mr2);
+  HeapRegion hr3(3, &oa, mr3);
+  HeapRegion hr4(4, &oa, mr4);
   l.add_ordered(&hr1);
   l.add_ordered(&hr0);
   l.add_ordered(&hr3);
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -27,6 +27,7 @@
 
 #include "gc_implementation/shared/markSweep.hpp"
 #include "gc_interface/collectedHeap.hpp"
+#include "oops/markOop.inline.hpp"
 #include "utilities/stack.inline.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -644,10 +644,13 @@
   // For each context in contexts, set the corresponding entries in the totals
   // and accuracy arrays to the current values held by the statistics.  Each
   // array should be of length len.
-  virtual void copy_allocation_context_stats(const jint* contexts,
+  // Returns true if there are more stats available.
+  virtual bool copy_allocation_context_stats(const jint* contexts,
                                              jlong* totals,
                                              jbyte* accuracy,
-                                             jint len) { }
+                                             jint len) {
+    return false;
+  }
 
   /////////////// Unit tests ///////////////
 
--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -401,8 +401,10 @@
   static bool        is_astore      (Code code)    { return (code == _astore || code == _astore_0 || code == _astore_1
                                                                              || code == _astore_2 || code == _astore_3); }
 
+  static bool        is_const       (Code code)    { return (_aconst_null <= code && code <= _ldc2_w); }
   static bool        is_zero_const  (Code code)    { return (code == _aconst_null || code == _iconst_0
                                                            || code == _fconst_0 || code == _dconst_0); }
+  static bool        is_return      (Code code)    { return (_ireturn <= code && code <= _return); }
   static bool        is_invoke      (Code code)    { return (_invokevirtual <= code && code <= _invokedynamic); }
   static bool        has_receiver   (Code code)    { assert(is_invoke(code), "");  return code == _invokevirtual ||
                                                                                           code == _invokespecial ||
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -189,11 +189,6 @@
     return CollectorPolicy::CollectorPolicyKind;
   }
 
-  // Returns true if a collector has eden space with soft end.
-  virtual bool has_soft_ended_eden() {
-    return false;
-  }
-
   // Do any updates required to global flags that are due to heap initialization
   // changes
   virtual void post_heap_initialize() = 0;
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -194,11 +194,7 @@
                 (HeapWord*)_virtual_space.high());
   Universe::heap()->barrier_set()->resize_covered_region(cmr);
 
-  if (GenCollectedHeap::heap()->collector_policy()->has_soft_ended_eden()) {
-    _eden_space = new ConcEdenSpace(this);
-  } else {
-    _eden_space = new EdenSpace(this);
-  }
+  _eden_space = new ContiguousSpace();
   _from_space = new ContiguousSpace();
   _to_space   = new ContiguousSpace();
 
@@ -1038,38 +1034,12 @@
     if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
       _next_gen->sample_eden_chunk();
     }
-    return result;
-  }
-  do {
-    HeapWord* old_limit = eden()->soft_end();
-    if (old_limit < eden()->end()) {
-      // Tell the next generation we reached a limit.
-      HeapWord* new_limit =
-        next_gen()->allocation_limit_reached(eden(), eden()->top(), word_size);
-      if (new_limit != NULL) {
-        Atomic::cmpxchg_ptr(new_limit, eden()->soft_end_addr(), old_limit);
-      } else {
-        assert(eden()->soft_end() == eden()->end(),
-               "invalid state after allocation_limit_reached returned null");
-      }
-    } else {
-      // The allocation failed and the soft limit is equal to the hard limit,
-      // there are no reasons to do an attempt to allocate
-      assert(old_limit == eden()->end(), "sanity check");
-      break;
-    }
-    // Try to allocate until succeeded or the soft limit can't be adjusted
-    result = eden()->par_allocate(word_size);
-  } while (result == NULL);
-
-  // If the eden is full and the last collection bailed out, we are running
-  // out of heap space, and we try to allocate the from-space, too.
-  // allocate_from_space can't be inlined because that would introduce a
-  // circular dependency at compile time.
-  if (result == NULL) {
+  } else {
+    // If the eden is full and the last collection bailed out, we are running
+    // out of heap space, and we try to allocate the from-space, too.
+    // allocate_from_space can't be inlined because that would introduce a
+    // circular dependency at compile time.
     result = allocate_from_space(word_size);
-  } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
-    _next_gen->sample_eden_chunk();
   }
   return result;
 }
@@ -1083,11 +1053,6 @@
   return res;
 }
 
-void DefNewGeneration::gc_prologue(bool full) {
-  // Ensure that _end and _soft_end are the same in eden space.
-  eden()->set_soft_end(eden()->end());
-}
-
 size_t DefNewGeneration::tlab_capacity() const {
   return eden()->capacity();
 }
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -32,7 +32,6 @@
 #include "memory/generation.inline.hpp"
 #include "utilities/stack.hpp"
 
-class EdenSpace;
 class ContiguousSpace;
 class ScanClosure;
 class STWGCTimer;
@@ -132,7 +131,7 @@
   void adjust_desired_tenuring_threshold();
 
   // Spaces
-  EdenSpace*       _eden_space;
+  ContiguousSpace* _eden_space;
   ContiguousSpace* _from_space;
   ContiguousSpace* _to_space;
 
@@ -214,9 +213,9 @@
   virtual Generation::Name kind() { return Generation::DefNew; }
 
   // Accessing spaces
-  EdenSpace*       eden() const           { return _eden_space; }
-  ContiguousSpace* from() const           { return _from_space;  }
-  ContiguousSpace* to()   const           { return _to_space;    }
+  ContiguousSpace* eden() const           { return _eden_space; }
+  ContiguousSpace* from() const           { return _from_space; }
+  ContiguousSpace* to()   const           { return _to_space;   }
 
   virtual CompactibleSpace* first_compaction_space() const;
 
@@ -282,8 +281,6 @@
 
   HeapWord* par_allocate(size_t word_size, bool is_tlab);
 
-  // Prologue & Epilogue
-  virtual void gc_prologue(bool full);
   virtual void gc_epilogue(bool full);
 
   // Save the tops for eden, from, and to
--- a/hotspot/src/share/vm/memory/generation.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/generation.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -265,14 +265,6 @@
   // Like "allocate", but performs any necessary locking internally.
   virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;
 
-  // A 'younger' gen has reached an allocation limit, and uses this to notify
-  // the next older gen.  The return value is a new limit, or NULL if none.  The
-  // caller must do the necessary locking.
-  virtual HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                             size_t word_size) {
-    return NULL;
-  }
-
   // Some generation may offer a region for shared, contiguous allocation,
   // via inlined code (by exporting the address of the top and end fields
   // defining the extent of the contiguous allocation region.)
--- a/hotspot/src/share/vm/memory/space.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/space.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -438,52 +438,8 @@
   }
 }
 
-#define block_is_always_obj(q) true
-#define obj_size(q) oop(q)->size()
-#define adjust_obj_size(s) s
-
-void CompactibleSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, end, block_is_obj, block_size);
-}
-
-// Faster object search.
 void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, top, block_is_always_obj, obj_size);
-}
-
-void Space::adjust_pointers() {
-  // adjust all the interior pointers to point at the new locations of objects
-  // Used by MarkSweep::mark_sweep_phase3()
-
-  // First check to see if there is any work to be done.
-  if (used() == 0) {
-    return;  // Nothing to do.
-  }
-
-  // Otherwise...
-  HeapWord* q = bottom();
-  HeapWord* t = end();
-
-  debug_only(HeapWord* prev_q = NULL);
-  while (q < t) {
-    if (oop(q)->is_gc_marked()) {
-      // q is alive
-
-      // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
-
-      debug_only(prev_q = q);
-
-      q += size;
-    } else {
-      // q is not a live object.  But we're not in a compactible space,
-      // So we don't have live ranges.
-      debug_only(prev_q = q);
-      q += block_size(q);
-      assert(q > prev_q, "we should be moving forward through memory");
-    }
-  }
-  assert(q == t, "just checking");
+  scan_and_forward(this, cp);
 }
 
 void CompactibleSpace::adjust_pointers() {
@@ -492,11 +448,11 @@
     return;   // Nothing to do.
   }
 
-  SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+  scan_and_adjust_pointers(this);
 }
 
 void CompactibleSpace::compact() {
-  SCAN_AND_COMPACT(obj_size);
+  scan_and_compact(this);
 }
 
 void Space::print_short() const { print_short_on(tty); }
@@ -684,13 +640,12 @@
 }
 
 // This version requires locking.
-inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
-                                                HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
   assert(Heap_lock->owned_by_self() ||
          (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()),
          "not locked");
   HeapWord* obj = top();
-  if (pointer_delta(end_value, obj) >= size) {
+  if (pointer_delta(end(), obj) >= size) {
     HeapWord* new_top = obj + size;
     set_top(new_top);
     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
@@ -701,11 +656,10 @@
 }
 
 // This version is lock-free.
-inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size,
-                                                    HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) {
   do {
     HeapWord* obj = top();
-    if (pointer_delta(end_value, obj) >= size) {
+    if (pointer_delta(end(), obj) >= size) {
       HeapWord* new_top = obj + size;
       HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
       // result can be one of two:
@@ -744,12 +698,12 @@
 
 // Requires locking.
 HeapWord* ContiguousSpace::allocate(size_t size) {
-  return allocate_impl(size, end());
+  return allocate_impl(size);
 }
 
 // Lock-free.
 HeapWord* ContiguousSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, end());
+  return par_allocate_impl(size);
 }
 
 void ContiguousSpace::allocate_temporary_filler(int factor) {
@@ -784,49 +738,6 @@
   }
 }
 
-void EdenSpace::clear(bool mangle_space) {
-  ContiguousSpace::clear(mangle_space);
-  set_soft_end(end());
-}
-
-// Requires locking.
-HeapWord* EdenSpace::allocate(size_t size) {
-  return allocate_impl(size, soft_end());
-}
-
-// Lock-free.
-HeapWord* EdenSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, soft_end());
-}
-
-HeapWord* ConcEdenSpace::par_allocate(size_t size)
-{
-  do {
-    // The invariant is top() should be read before end() because
-    // top() can't be greater than end(), so if an update of _soft_end
-    // occurs between 'end_val = end();' and 'top_val = top();' top()
-    // also can grow up to the new end() and the condition
-    // 'top_val > end_val' is true. To ensure the loading order
-    // OrderAccess::loadload() is required after top() read.
-    HeapWord* obj = top();
-    OrderAccess::loadload();
-    if (pointer_delta(*soft_end_addr(), obj) >= size) {
-      HeapWord* new_top = obj + size;
-      HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
-      // result can be one of two:
-      //  the old top value: the exchange succeeded
-      //  otherwise: the new value of the top is returned.
-      if (result == obj) {
-        assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
-        return obj;
-      }
-    } else {
-      return NULL;
-    }
-  } while (true);
-}
-
-
 HeapWord* OffsetTableContigSpace::initialize_threshold() {
   return _offsets.initialize_threshold();
 }
--- a/hotspot/src/share/vm/memory/space.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/space.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -41,19 +41,6 @@
 // implementations for keeping track of free and used space,
 // for iterating over objects and free blocks, etc.
 
-// Here's the Space hierarchy:
-//
-// - Space               -- an abstract base class describing a heap area
-//   - CompactibleSpace  -- a space supporting compaction
-//     - CompactibleFreeListSpace -- (used for CMS generation)
-//     - ContiguousSpace -- a compactible space in which all free space
-//                          is contiguous
-//       - EdenSpace     -- contiguous space used as nursery
-//         - ConcEdenSpace -- contiguous space with a 'soft end safe' allocation
-//       - OffsetTableContigSpace -- contiguous space with a block offset array
-//                          that allows "fast" block_start calls
-//         - TenuredSpace -- (used for TenuredGeneration)
-
 // Forward decls.
 class Space;
 class BlockOffsetArray;
@@ -238,7 +225,7 @@
 
   // Mark-sweep-compact support: all spaces can update pointers to objects
   // moving as a part of compaction.
-  virtual void adjust_pointers();
+  virtual void adjust_pointers() = 0;
 
   // PrintHeapAtGC support
   virtual void print() const;
@@ -339,7 +326,36 @@
 // necessarily, a space that is normally contiguous.  But, for example, a
 // free-list-based space whose normal collection is a mark-sweep without
 // compaction could still support compaction in full GC's.
-
+//
+// The compaction operations are implemented by the
+// scan_and_{adjust_pointers,compact,forward} function templates.
+// The following are, non-virtual, auxiliary functions used by these function templates:
+// - scan_limit()
+// - scanned_block_is_obj()
+// - scanned_block_size()
+// - adjust_obj_size()
+// - obj_size()
+// These functions are to be used exclusively by the scan_and_* function templates,
+// and must be defined for all (non-abstract) subclasses of CompactibleSpace.
+//
+// NOTE: Any subclasses to CompactibleSpace wanting to change/define the behavior
+// in any of the auxiliary functions must also override the corresponding
+// prepare_for_compaction/adjust_pointers/compact functions using them.
+// If not, such changes will not be used or have no effect on the compaction operations.
+//
+// This translates to the following dependencies:
+// Overrides/definitions of
+//  - scan_limit
+//  - scanned_block_is_obj
+//  - scanned_block_size
+// require override/definition of prepare_for_compaction().
+// Similar dependencies exist between
+//  - adjust_obj_size  and adjust_pointers()
+//  - obj_size         and compact().
+//
+// Additionally, this also means that changes to block_size() or block_is_obj() that
+// should be effective during the compaction operations must provide a corresponding
+// definition of scanned_block_size/scanned_block_is_obj respectively.
 class CompactibleSpace: public Space {
   friend class VMStructs;
   friend class CompactibleFreeListSpace;
@@ -347,6 +363,15 @@
   HeapWord* _compaction_top;
   CompactibleSpace* _next_compaction_space;
 
+  // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+  inline size_t adjust_obj_size(size_t size) const {
+    return size;
+  }
+
+  inline size_t obj_size(const HeapWord* addr) const {
+    return oop(addr)->size();
+  }
+
 public:
   CompactibleSpace() :
    _compaction_top(NULL), _next_compaction_space(NULL) {}
@@ -390,7 +415,7 @@
   // "cp->compaction_space" up-to-date.  Offset tables may be updated in
   // this phase as if the final copy had occurred; if so, "cp->threshold"
   // indicates when the next such action should be taken.
-  virtual void prepare_for_compaction(CompactPoint* cp);
+  virtual void prepare_for_compaction(CompactPoint* cp) = 0;
   // MarkSweep support phase3
   virtual void adjust_pointers();
   // MarkSweep support phase4
@@ -449,6 +474,25 @@
   // words remaining after this operation.
   bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,
                         size_t word_len);
+
+  // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
+  // The space argument should be a subclass of CompactibleSpace, implementing
+  // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
+  // and possibly also overriding obj_size(), and adjust_obj_size().
+  // These functions should avoid virtual calls whenever possible.
+
+  // Frequently calls adjust_obj_size().
+  template <class SpaceType>
+  static inline void scan_and_adjust_pointers(SpaceType* space);
+
+  // Frequently calls obj_size().
+  template <class SpaceType>
+  static inline void scan_and_compact(SpaceType* space);
+
+  // Frequently calls scanned_block_is_obj() and scanned_block_size().
+  // Requires the scan_limit() function.
+  template <class SpaceType>
+  static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
 };
 
 class GenSpaceMangler;
@@ -458,6 +502,25 @@
 class ContiguousSpace: public CompactibleSpace {
   friend class OneContigSpaceCardGeneration;
   friend class VMStructs;
+  // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
+
+ private:
+  // Auxiliary functions for scan_and_forward support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return top();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return true; // Always true, since scan_limit is top
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return oop(addr)->size();
+  }
+
  protected:
   HeapWord* _top;
   HeapWord* _concurrent_iteration_safe_limit;
@@ -467,8 +530,8 @@
   GenSpaceMangler* mangler() { return _mangler; }
 
   // Allocation helpers (return NULL if full).
-  inline HeapWord* allocate_impl(size_t word_size, HeapWord* end_value);
-  inline HeapWord* par_allocate_impl(size_t word_size, HeapWord* end_value);
+  inline HeapWord* allocate_impl(size_t word_size);
+  inline HeapWord* par_allocate_impl(size_t word_size);
 
  public:
   ContiguousSpace();
@@ -622,7 +685,6 @@
   // Used to increase collection frequency.  "factor" of 0 means entire
   // space.
   void allocate_temporary_filler(int factor);
-
 };
 
 
@@ -685,56 +747,6 @@
   {}
 };
 
-
-// Class EdenSpace describes eden-space in new generation.
-
-class DefNewGeneration;
-
-class EdenSpace : public ContiguousSpace {
-  friend class VMStructs;
- private:
-  DefNewGeneration* _gen;
-
-  // _soft_end is used as a soft limit on allocation.  As soft limits are
-  // reached, the slow-path allocation code can invoke other actions and then
-  // adjust _soft_end up to a new soft limit or to end().
-  HeapWord* _soft_end;
-
- public:
-  EdenSpace(DefNewGeneration* gen) :
-   _gen(gen), _soft_end(NULL) {}
-
-  // Get/set just the 'soft' limit.
-  HeapWord* soft_end()               { return _soft_end; }
-  HeapWord** soft_end_addr()         { return &_soft_end; }
-  void set_soft_end(HeapWord* value) { _soft_end = value; }
-
-  // Override.
-  void clear(bool mangle_space);
-
-  // Set both the 'hard' and 'soft' limits (_end and _soft_end).
-  void set_end(HeapWord* value) {
-    set_soft_end(value);
-    ContiguousSpace::set_end(value);
-  }
-
-  // Allocation (return NULL if full)
-  HeapWord* allocate(size_t word_size);
-  HeapWord* par_allocate(size_t word_size);
-};
-
-// Class ConcEdenSpace extends EdenSpace for the sake of safe
-// allocation while soft-end is being modified concurrently
-
-class ConcEdenSpace : public EdenSpace {
- public:
-  ConcEdenSpace(DefNewGeneration* gen) : EdenSpace(gen) { }
-
-  // Allocation (return NULL if full)
-  HeapWord* par_allocate(size_t word_size);
-};
-
-
 // A ContigSpace that Supports an efficient "block_start" operation via
 // a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with
 // other spaces.)  This is the abstract base class for old generation
--- a/hotspot/src/share/vm/memory/space.inline.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/memory/space.inline.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,9 @@
 #ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP
 #define SHARE_VM_MEMORY_SPACE_INLINE_HPP
 
+#include "gc_implementation/shared/liveRange.hpp"
+#include "gc_implementation/shared/markSweep.inline.hpp"
+#include "gc_implementation/shared/spaceDecorator.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "memory/space.hpp"
 #include "memory/universe.hpp"
@@ -35,272 +38,6 @@
   return block_start_const(p);
 }
 
-#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) {            \
-  /* Compute the new addresses for the live objects and store it in the mark \
-   * Used by universe::mark_sweep_phase2()                                   \
-   */                                                                        \
-  HeapWord* compact_top; /* This is where we are currently compacting to. */ \
-                                                                             \
-  /* We're sure to be here before any objects are compacted into this        \
-   * space, so this is a good time to initialize this:                       \
-   */                                                                        \
-  set_compaction_top(bottom());                                              \
-                                                                             \
-  if (cp->space == NULL) {                                                   \
-    assert(cp->gen != NULL, "need a generation");                            \
-    assert(cp->threshold == NULL, "just checking");                          \
-    assert(cp->gen->first_compaction_space() == this, "just checking");      \
-    cp->space = cp->gen->first_compaction_space();                           \
-    compact_top = cp->space->bottom();                                       \
-    cp->space->set_compaction_top(compact_top);                              \
-    cp->threshold = cp->space->initialize_threshold();                       \
-  } else {                                                                   \
-    compact_top = cp->space->compaction_top();                               \
-  }                                                                          \
-                                                                             \
-  /* We allow some amount of garbage towards the bottom of the space, so     \
-   * we don't start compacting before there is a significant gain to be made.\
-   * Occasionally, we want to ensure a full compaction, which is determined  \
-   * by the MarkSweepAlwaysCompactCount parameter.                           \
-   */                                                                        \
-  uint invocations = MarkSweep::total_invocations();                         \
-  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);       \
-                                                                             \
-  size_t allowed_deadspace = 0;                                              \
-  if (skip_dead) {                                                           \
-    const size_t ratio = allowed_dead_ratio();                               \
-    allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize;           \
-  }                                                                          \
-                                                                             \
-  HeapWord* q = bottom();                                                    \
-  HeapWord* t = scan_limit();                                                \
-                                                                             \
-  HeapWord*  end_of_live= q;    /* One byte beyond the last byte of the last \
-                                   live object. */                           \
-  HeapWord*  first_dead = end();/* The first dead object. */                 \
-  LiveRange* liveRange  = NULL; /* The current live range, recorded in the   \
-                                   first header of preceding free area. */   \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  const intx interval = PrefetchScanIntervalInBytes;                         \
-                                                                             \
-  while (q < t) {                                                            \
-    assert(!block_is_obj(q) ||                                               \
-           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||   \
-           oop(q)->mark()->has_bias_pattern(),                               \
-           "these are the only valid states during a mark sweep");           \
-    if (block_is_obj(q) && oop(q)->is_gc_marked()) {                         \
-      /* prefetch beyond q */                                                \
-      Prefetch::write(q, interval);                                          \
-      size_t size = block_size(q);                                           \
-      compact_top = cp->space->forward(oop(q), size, cp, compact_top);       \
-      q += size;                                                             \
-      end_of_live = q;                                                       \
-    } else {                                                                 \
-      /* run over all the contiguous dead objects */                         \
-      HeapWord* end = q;                                                     \
-      do {                                                                   \
-        /* prefetch beyond end */                                            \
-        Prefetch::write(end, interval);                                      \
-        end += block_size(end);                                              \
-      } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\
-                                                                             \
-      /* see if we might want to pretend this object is alive so that        \
-       * we don't have to compact quite as often.                            \
-       */                                                                    \
-      if (allowed_deadspace > 0 && q == compact_top) {                       \
-        size_t sz = pointer_delta(end, q);                                   \
-        if (insert_deadspace(allowed_deadspace, q, sz)) {                    \
-          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);     \
-          q = end;                                                           \
-          end_of_live = end;                                                 \
-          continue;                                                          \
-        }                                                                    \
-      }                                                                      \
-                                                                             \
-      /* otherwise, it really is a free region. */                           \
-                                                                             \
-      /* for the previous LiveRange, record the end of the live objects. */  \
-      if (liveRange) {                                                       \
-        liveRange->set_end(q);                                               \
-      }                                                                      \
-                                                                             \
-      /* record the current LiveRange object.                                \
-       * liveRange->start() is overlaid on the mark word.                    \
-       */                                                                    \
-      liveRange = (LiveRange*)q;                                             \
-      liveRange->set_start(end);                                             \
-      liveRange->set_end(end);                                               \
-                                                                             \
-      /* see if this is the first dead region. */                            \
-      if (q < first_dead) {                                                  \
-        first_dead = q;                                                      \
-      }                                                                      \
-                                                                             \
-      /* move on to the next object */                                       \
-      q = end;                                                               \
-    }                                                                        \
-  }                                                                          \
-                                                                             \
-  assert(q == t, "just checking");                                           \
-  if (liveRange != NULL) {                                                   \
-    liveRange->set_end(q);                                                   \
-  }                                                                          \
-  _end_of_live = end_of_live;                                                \
-  if (end_of_live < first_dead) {                                            \
-    first_dead = end_of_live;                                                \
-  }                                                                          \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  /* save the compaction_top of the compaction space. */                     \
-  cp->space->set_compaction_top(compact_top);                                \
-}
-
-#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) {                             \
-  /* adjust all the interior pointers to point at the new locations of objects  \
-   * Used by MarkSweep::mark_sweep_phase3() */                                  \
-                                                                                \
-  HeapWord* q = bottom();                                                       \
-  HeapWord* t = _end_of_live;  /* Established by "prepare_for_compaction". */   \
-                                                                                \
-  assert(_first_dead <= _end_of_live, "Stands to reason, no?");                 \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    /* we have a chunk of the space which hasn't moved and we've                \
-     * reinitialized the mark word during the previous pass, so we can't        \
-     * use is_gc_marked for the traversal. */                                   \
-    HeapWord* end = _first_dead;                                                \
-                                                                                \
-    while (q < end) {                                                           \
-      /* I originally tried to conjoin "block_start(q) == q" to the             \
-       * assertion below, but that doesn't work, because you can't              \
-       * accurately traverse previous objects to get to the current one         \
-       * after their pointers have been                                         \
-       * updated, until the actual compaction is done.  dld, 4/00 */            \
-      assert(block_is_obj(q),                                                   \
-             "should be at block boundaries, and should be looking at objs");   \
-                                                                                \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-                                                                                \
-      q += size;                                                                \
-    }                                                                           \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ This is funky.  Using this to read the previously written          \
-       * LiveRange.  See also use below. */                                     \
-      q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx interval = PrefetchScanIntervalInBytes;                            \
-                                                                                \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-  while (q < t) {                                                               \
-    /* prefetch beyond q */                                                     \
-    Prefetch::write(q, interval);                                               \
-    if (oop(q)->is_gc_marked()) {                                               \
-      /* q is alive */                                                          \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    } else {                                                                    \
-      /* q is not a live object, so its mark should point at the next           \
-       * live object */                                                         \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  assert(q == t, "just checking");                                              \
-}
-
-#define SCAN_AND_COMPACT(obj_size) {                                            \
-  /* Copy all live objects to their new location                                \
-   * Used by MarkSweep::mark_sweep_phase4() */                                  \
-                                                                                \
-  HeapWord*       q = bottom();                                                 \
-  HeapWord* const t = _end_of_live;                                             \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    debug_only(                                                                 \
-    /* we have a chunk of the space which hasn't moved and we've reinitialized  \
-     * the mark word during the previous pass, so we can't use is_gc_marked for \
-     * the traversal. */                                                        \
-    HeapWord* const end = _first_dead;                                          \
-                                                                                \
-    while (q < end) {                                                           \
-      size_t size = obj_size(q);                                                \
-      assert(!oop(q)->is_gc_marked(),                                           \
-             "should be unmarked (special dense prefix handling)");             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-    )  /* debug_only */                                                         \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ Funky */                                                           \
-      q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer();               \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx scan_interval = PrefetchScanIntervalInBytes;                       \
-  const intx copy_interval = PrefetchCopyIntervalInBytes;                       \
-  while (q < t) {                                                               \
-    if (!oop(q)->is_gc_marked()) {                                              \
-      /* mark is pointer to next marked oop */                                  \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    } else {                                                                    \
-      /* prefetch beyond q */                                                   \
-      Prefetch::read(q, scan_interval);                                         \
-                                                                                \
-      /* size and destination */                                                \
-      size_t size = obj_size(q);                                                \
-      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();                \
-                                                                                \
-      /* prefetch beyond compaction_top */                                      \
-      Prefetch::write(compaction_top, copy_interval);                           \
-                                                                                \
-      /* copy object and reinit its mark */                                     \
-      assert(q != compaction_top, "everything in this pass should be moving");  \
-      Copy::aligned_conjoint_words(q, compaction_top, size);                    \
-      oop(compaction_top)->init_mark();                                         \
-      assert(oop(compaction_top)->klass() != NULL, "should have a class");      \
-                                                                                \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  /* Let's remember if we were empty before we did the compaction. */           \
-  bool was_empty = used_region().is_empty();                                    \
-  /* Reset space after compaction is complete */                                \
-  reset_after_compaction();                                                     \
-  /* We do this clear, below, since it has overloaded meanings for some */      \
-  /* space subtypes.  For example, OffsetTableContigSpace's that were   */      \
-  /* compacted into will have had their offset table thresholds updated */      \
-  /* continuously, but those that weren't need to have their thresholds */      \
-  /* re-initialized.  Also mangles unused area for debugging.           */      \
-  if (used_region().is_empty()) {                                               \
-    if (!was_empty) clear(SpaceDecorator::Mangle);                              \
-  } else {                                                                      \
-    if (ZapUnusedHeapArea) mangle_unused_area();                                \
-  }                                                                             \
-}
-
 inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
   HeapWord* res = ContiguousSpace::allocate(size);
   if (res != NULL) {
@@ -334,4 +71,263 @@
   return _offsets.block_start(p);
 }
 
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) {
+  // Compute the new addresses for the live objects and store it in the mark
+  // Used by universe::mark_sweep_phase2()
+  HeapWord* compact_top; // This is where we are currently compacting to.
+
+  // We're sure to be here before any objects are compacted into this
+  // space, so this is a good time to initialize this:
+  space->set_compaction_top(space->bottom());
+
+  if (cp->space == NULL) {
+    assert(cp->gen != NULL, "need a generation");
+    assert(cp->threshold == NULL, "just checking");
+    assert(cp->gen->first_compaction_space() == space, "just checking");
+    cp->space = cp->gen->first_compaction_space();
+    compact_top = cp->space->bottom();
+    cp->space->set_compaction_top(compact_top);
+    cp->threshold = cp->space->initialize_threshold();
+  } else {
+    compact_top = cp->space->compaction_top();
+  }
+
+  // We allow some amount of garbage towards the bottom of the space, so
+  // we don't start compacting before there is a significant gain to be made.
+  // Occasionally, we want to ensure a full compaction, which is determined
+  // by the MarkSweepAlwaysCompactCount parameter.
+  uint invocations = MarkSweep::total_invocations();
+  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);
+
+  size_t allowed_deadspace = 0;
+  if (skip_dead) {
+    const size_t ratio = space->allowed_dead_ratio();
+    allowed_deadspace = (space->capacity() * ratio / 100) / HeapWordSize;
+  }
+
+  HeapWord* q = space->bottom();
+  HeapWord* t = space->scan_limit();
+
+  HeapWord*  end_of_live= q;            // One byte beyond the last byte of the last
+                                        // live object.
+  HeapWord*  first_dead = space->end(); // The first dead object.
+  LiveRange* liveRange  = NULL;         // The current live range, recorded in the
+                                        // first header of preceding free area.
+  space->_first_dead = first_dead;
+
+  const intx interval = PrefetchScanIntervalInBytes;
+
+  while (q < t) {
+    assert(!space->scanned_block_is_obj(q) ||
+           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||
+           oop(q)->mark()->has_bias_pattern(),
+           "these are the only valid states during a mark sweep");
+    if (space->scanned_block_is_obj(q) && oop(q)->is_gc_marked()) {
+      // prefetch beyond q
+      Prefetch::write(q, interval);
+      size_t size = space->scanned_block_size(q);
+      compact_top = cp->space->forward(oop(q), size, cp, compact_top);
+      q += size;
+      end_of_live = q;
+    } else {
+      // run over all the contiguous dead objects
+      HeapWord* end = q;
+      do {
+        // prefetch beyond end
+        Prefetch::write(end, interval);
+        end += space->scanned_block_size(end);
+      } while (end < t && (!space->scanned_block_is_obj(end) || !oop(end)->is_gc_marked()));
+
+      // see if we might want to pretend this object is alive so that
+      // we don't have to compact quite as often.
+      if (allowed_deadspace > 0 && q == compact_top) {
+        size_t sz = pointer_delta(end, q);
+        if (space->insert_deadspace(allowed_deadspace, q, sz)) {
+          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);
+          q = end;
+          end_of_live = end;
+          continue;
+        }
+      }
+
+      // otherwise, it really is a free region.
+
+      // for the previous LiveRange, record the end of the live objects.
+      if (liveRange) {
+        liveRange->set_end(q);
+      }
+
+      // record the current LiveRange object.
+      // liveRange->start() is overlaid on the mark word.
+      liveRange = (LiveRange*)q;
+      liveRange->set_start(end);
+      liveRange->set_end(end);
+
+      // see if this is the first dead region.
+      if (q < first_dead) {
+        first_dead = q;
+      }
+
+      // move on to the next object
+      q = end;
+    }
+  }
+
+  assert(q == t, "just checking");
+  if (liveRange != NULL) {
+    liveRange->set_end(q);
+  }
+  space->_end_of_live = end_of_live;
+  if (end_of_live < first_dead) {
+    first_dead = end_of_live;
+  }
+  space->_first_dead = first_dead;
+
+  // save the compaction_top of the compaction space.
+  cp->space->set_compaction_top(compact_top);
+}
+
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
+  // adjust all the interior pointers to point at the new locations of objects
+  // Used by MarkSweep::mark_sweep_phase3()
+
+  HeapWord* q = space->bottom();
+  HeapWord* t = space->_end_of_live;  // Established by "prepare_for_compaction".
+
+  assert(space->_first_dead <= space->_end_of_live, "Stands to reason, no?");
+
+  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+    // we have a chunk of the space which hasn't moved and we've
+    // reinitialized the mark word during the previous pass, so we can't
+    // use is_gc_marked for the traversal.
+    HeapWord* end = space->_first_dead;
+
+    while (q < end) {
+      // I originally tried to conjoin "block_start(q) == q" to the
+      // assertion below, but that doesn't work, because you can't
+      // accurately traverse previous objects to get to the current one
+      // after their pointers have been
+      // updated, until the actual compaction is done.  dld, 4/00
+      assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs");
+
+      // point all the oops to the new location
+      size_t size = oop(q)->adjust_pointers();
+      size = space->adjust_obj_size(size);
+
+      q += size;
+    }
+
+    if (space->_first_dead == t) {
+      q = t;
+    } else {
+      // $$$ This is funky.  Using this to read the previously written
+      // LiveRange.  See also use below.
+      q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
+    }
+  }
+
+  const intx interval = PrefetchScanIntervalInBytes;
+
+  debug_only(HeapWord* prev_q = NULL);
+  while (q < t) {
+    // prefetch beyond q
+    Prefetch::write(q, interval);
+    if (oop(q)->is_gc_marked()) {
+      // q is alive
+      // point all the oops to the new location
+      size_t size = oop(q)->adjust_pointers();
+      size = space->adjust_obj_size(size);
+      debug_only(prev_q = q);
+      q += size;
+    } else {
+      // q is not a live object, so its mark should point at the next
+      // live object
+      debug_only(prev_q = q);
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();
+      assert(q > prev_q, "we should be moving forward through memory");
+    }
+  }
+
+  assert(q == t, "just checking");
+}
+
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_compact(SpaceType* space) {
+  // Copy all live objects to their new location
+  // Used by MarkSweep::mark_sweep_phase4()
+
+  HeapWord*       q = space->bottom();
+  HeapWord* const t = space->_end_of_live;
+  debug_only(HeapWord* prev_q = NULL);
+
+  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+    #ifdef ASSERT // Debug only
+      // we have a chunk of the space which hasn't moved and we've reinitialized
+      // the mark word during the previous pass, so we can't use is_gc_marked for
+      // the traversal.
+      HeapWord* const end = space->_first_dead;
+
+      while (q < end) {
+        size_t size = space->obj_size(q);
+        assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
+        prev_q = q;
+        q += size;
+      }
+    #endif
+
+    if (space->_first_dead == t) {
+      q = t;
+    } else {
+      // $$$ Funky
+      q = (HeapWord*) oop(space->_first_dead)->mark()->decode_pointer();
+    }
+  }
+
+  const intx scan_interval = PrefetchScanIntervalInBytes;
+  const intx copy_interval = PrefetchCopyIntervalInBytes;
+  while (q < t) {
+    if (!oop(q)->is_gc_marked()) {
+      // mark is pointer to next marked oop
+      debug_only(prev_q = q);
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();
+      assert(q > prev_q, "we should be moving forward through memory");
+    } else {
+      // prefetch beyond q
+      Prefetch::read(q, scan_interval);
+
+      // size and destination
+      size_t size = space->obj_size(q);
+      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();
+
+      // prefetch beyond compaction_top
+      Prefetch::write(compaction_top, copy_interval);
+
+      // copy object and reinit its mark
+      assert(q != compaction_top, "everything in this pass should be moving");
+      Copy::aligned_conjoint_words(q, compaction_top, size);
+      oop(compaction_top)->init_mark();
+      assert(oop(compaction_top)->klass() != NULL, "should have a class");
+
+      debug_only(prev_q = q);
+      q += size;
+    }
+  }
+
+  // Let's remember if we were empty before we did the compaction.
+  bool was_empty = space->used_region().is_empty();
+  // Reset space after compaction is complete
+  space->reset_after_compaction();
+  // We do this clear, below, since it has overloaded meanings for some
+  // space subtypes.  For example, OffsetTableContigSpace's that were
+  // compacted into will have had their offset table thresholds updated
+  // continuously, but those that weren't need to have their thresholds
+  // re-initialized.  Also mangles unused area for debugging.
+  if (space->used_region().is_empty()) {
+    if (!was_empty) space->clear(SpaceDecorator::Mangle);
+  } else {
+    if (ZapUnusedHeapArea) space->mangle_unused_area();
+  }
+}
 #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP
--- a/hotspot/src/share/vm/oops/method.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -588,6 +588,15 @@
   return true;
 }
 
+bool Method::is_constant_getter() const {
+  int last_index = code_size() - 1;
+  // Check if the first 1-3 bytecodes are a constant push
+  // and the last bytecode is a return.
+  return (2 <= code_size() && code_size() <= 4 &&
+          Bytecodes::is_const(java_code_at(0)) &&
+          Bytecodes::length_for(java_code_at(0)) == last_index &&
+          Bytecodes::is_return(java_code_at(last_index)));
+}
 
 bool Method::is_initializer() const {
   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
--- a/hotspot/src/share/vm/oops/method.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/oops/method.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -595,6 +595,9 @@
   // returns true if the method is an accessor function (setter/getter).
   bool is_accessor() const;
 
+  // returns true if the method does nothing but return a constant of primitive type
+  bool is_constant_getter() const;
+
   // returns true if the method is an initializer (<init> or <clinit>).
   bool is_initializer() const;
 
--- a/hotspot/src/share/vm/oops/methodData.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1134,7 +1134,7 @@
   _tenure_traps = 0;
   _num_loops = 0;
   _num_blocks = 0;
-  _would_profile = true;
+  _would_profile = unknown;
 
 #if INCLUDE_RTM_OPT
   _rtm_state = NoRTM; // No RTM lock eliding by default
--- a/hotspot/src/share/vm/oops/methodData.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -2096,7 +2096,8 @@
   short             _num_loops;
   short             _num_blocks;
   // Does this method contain anything worth profiling?
-  bool              _would_profile;
+  enum WouldProfile {unknown, no_profile, profile};
+  WouldProfile      _would_profile;
 
   // Size of _data array in bytes.  (Excludes header and extra_data fields.)
   int _data_size;
@@ -2270,8 +2271,8 @@
   }
 #endif
 
-  void set_would_profile(bool p)              { _would_profile = p;    }
-  bool would_profile() const                  { return _would_profile; }
+  void set_would_profile(bool p)              { _would_profile = p ? profile : no_profile; }
+  bool would_profile() const                  { return _would_profile != no_profile; }
 
   int num_loops() const                       { return _num_loops;  }
   void set_num_loops(int n)                   { _num_loops = n;     }
--- a/hotspot/src/share/vm/opto/doCall.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -794,7 +794,7 @@
   Node* ex_klass_node = NULL;
   if (has_ex_handler() && !ex_type->klass_is_exact()) {
     Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes());
-    ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+    ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
 
     // Compute the exception klass a little more cleverly.
     // Obvious solution is to simple do a LoadKlass from the 'ex_node'.
@@ -812,7 +812,7 @@
           continue;
         }
         Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
-        Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+        Node* k = _gvn.transform( LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
         ex_klass_node->init_req( i, k );
       }
       _gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT);
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1154,7 +1154,7 @@
   Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
   if (akls != NULL)  return akls;
   Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
-  return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
+  return _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), k_adr, TypeInstPtr::KLASS));
 }
 
 //-------------------------load_array_length-----------------------------------
@@ -2615,7 +2615,7 @@
   // types load from the super-class display table which is immutable.
   m = mem->memory_at(C->get_alias_index(gvn->type(p2)->is_ptr()));
   Node *kmem = might_be_cache ? m : C->immutable_memory();
-  Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
+  Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, NULL, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
 
   // Compile speed common case: ARE a subtype and we canNOT fail
   if( superklass == nkls )
--- a/hotspot/src/share/vm/opto/library_call.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -3345,7 +3345,7 @@
   if (region == NULL)  never_see_null = true;
   Node* p = basic_plus_adr(mirror, offset);
   const TypeKlassPtr*  kls_type = TypeKlassPtr::OBJECT_OR_NULL;
-  Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
+  Node* kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
   Node* null_ctl = top();
   kls = null_check_oop(kls, &null_ctl, never_see_null);
   if (region != NULL) {
@@ -3517,7 +3517,7 @@
       phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror())));
     // If we fall through, it's a plain class.  Get its _super.
     p = basic_plus_adr(kls, in_bytes(Klass::super_offset()));
-    kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
+    kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
     null_ctl = top();
     kls = null_check_oop(kls, &null_ctl);
     if (null_ctl != top()) {
@@ -3671,7 +3671,7 @@
     args[which_arg] = arg;
 
     Node* p = basic_plus_adr(arg, class_klass_offset);
-    Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type);
+    Node* kls = LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, adr_type, kls_type);
     klasses[which_arg] = _gvn.transform(kls);
   }
 
--- a/hotspot/src/share/vm/opto/macro.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/macro.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1197,8 +1197,7 @@
   }
 
   if (C->env()->dtrace_alloc_probes() ||
-      !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc() ||
-                   (UseConcMarkSweepGC && CMSIncrementalMode))) {
+      !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
     // Force slow-path allocation
     always_slow = true;
     initial_slow_test = NULL;
@@ -2202,7 +2201,7 @@
     Node* klass_node = AllocateNode::Ideal_klass(obj, &_igvn);
     if (klass_node == NULL) {
       Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
-      klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) );
+      klass_node = transform_later(LoadKlassNode::make(_igvn, NULL, mem, k_adr, _igvn.type(k_adr)->is_ptr()));
 #ifdef _LP64
       if (UseCompressedClassPointers && klass_node->is_DecodeNKlass()) {
         assert(klass_node->in(1)->Opcode() == Op_LoadNKlass, "sanity");
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -529,7 +529,7 @@
       // (At this point we can assume disjoint_bases, since types differ.)
       int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
       Node* p1 = basic_plus_adr(dest_klass, ek_offset);
-      Node* n1 = LoadKlassNode::make(_igvn, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
+      Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
       Node* dest_elem_klass = transform_later(n1);
       Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
                                               adr_type,
--- a/hotspot/src/share/vm/opto/memnode.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -861,6 +861,10 @@
 
 
 //=============================================================================
+// Should LoadNode::Ideal() attempt to remove control edges?
+bool LoadNode::can_remove_control() const {
+  return true;
+}
 uint LoadNode::size_of() const { return sizeof(*this); }
 uint LoadNode::cmp( const Node &n ) const
 { return !Type::cmp( _type, ((LoadNode&)n)._type ); }
@@ -1471,7 +1475,7 @@
 }
 
 //------------------------------Ideal------------------------------------------
-// If the load is from Field memory and the pointer is non-null, we can
+// If the load is from Field memory and the pointer is non-null, it might be possible to
 // zero out the control input.
 // If the offset is constant and the base is an object allocation,
 // try to hook me up to the exact initializing store.
@@ -1498,6 +1502,7 @@
       && phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw) {
     // Check for useless control edge in some common special cases
     if (in(MemNode::Control) != NULL
+        && can_remove_control()
         && phase->type(base)->higher_equal(TypePtr::NOTNULL)
         && all_controls_dominate(base, phase->C->start())) {
       // A method-invariant, non-null address (constant or 'this' argument).
@@ -2019,8 +2024,7 @@
 //=============================================================================
 //----------------------------LoadKlassNode::make------------------------------
 // Polymorphic factory method:
-Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
-  Node *ctl = NULL;
+Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, const TypeKlassPtr* tk) {
   // sanity check the alias category against the created node type
   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
   assert(adr_type != NULL, "expecting TypeKlassPtr");
@@ -2040,6 +2044,12 @@
   return klass_value_common(phase);
 }
 
+// In most cases, LoadKlassNode does not have the control input set. If the control
+// input is set, it must not be removed (by LoadNode::Ideal()).
+bool LoadKlassNode::can_remove_control() const {
+  return false;
+}
+
 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
   // Either input is TOP ==> the result is TOP
   const Type *t1 = phase->type( in(MemNode::Memory) );
--- a/hotspot/src/share/vm/opto/memnode.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/memnode.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -148,6 +148,8 @@
 protected:
   virtual uint cmp(const Node &n) const;
   virtual uint size_of() const; // Size is bigger
+  // Should LoadNode::Ideal() attempt to remove control edges?
+  virtual bool can_remove_control() const;
   const Type* const _type;      // What kind of value is loaded?
 public:
 
@@ -171,8 +173,10 @@
   // we are equivalent to.  We look for Load of a Store.
   virtual Node *Identity( PhaseTransform *phase );
 
-  // If the load is from Field memory and the pointer is non-null, we can
+  // If the load is from Field memory and the pointer is non-null, it might be possible to
   // zero out the control input.
+  // If the offset is constant and the base is an object allocation,
+  // try to hook me up to the exact initializing store.
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 
   // Split instance field load through Phi.
@@ -431,6 +435,10 @@
 //------------------------------LoadKlassNode----------------------------------
 // Load a Klass from an object
 class LoadKlassNode : public LoadPNode {
+protected:
+  // In most cases, LoadKlassNode does not have the control input set. If the control
+  // input is set, it must not be removed (by LoadNode::Ideal()).
+  virtual bool can_remove_control() const;
 public:
   LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo)
     : LoadPNode(c, mem, adr, at, tk, mo) {}
@@ -440,8 +448,8 @@
   virtual bool depends_only_on_test() const { return true; }
 
   // Polymorphic factory method:
-  static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at,
-                     const TypeKlassPtr *tk = TypeKlassPtr::OBJECT );
+  static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at,
+                    const TypeKlassPtr* tk = TypeKlassPtr::OBJECT);
 };
 
 //------------------------------LoadNKlassNode---------------------------------
--- a/hotspot/src/share/vm/opto/parse1.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1987,7 +1987,7 @@
   // finalization.  In general this will fold up since the concrete
   // class is often visible so the access flags are constant.
   Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
-  Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
+  Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), klass_addr, TypeInstPtr::KLASS));
 
   Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset()));
   Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
--- a/hotspot/src/share/vm/opto/parseHelper.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/opto/parseHelper.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -156,22 +156,43 @@
   int klass_offset = oopDesc::klass_offset_in_bytes();
   Node* p = basic_plus_adr( ary, ary, klass_offset );
   // p's type is array-of-OOPS plus klass_offset
-  Node* array_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS) );
+  Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS));
   // Get the array klass
   const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr();
 
-  // array_klass's type is generally INexact array-of-oop.  Heroically
-  // cast the array klass to EXACT array and uncommon-trap if the cast
-  // fails.
+  // The type of array_klass is usually INexact array-of-oop.  Heroically
+  // cast array_klass to EXACT array and uncommon-trap if the cast fails.
+  // Make constant out of the inexact array klass, but use it only if the cast
+  // succeeds.
   bool always_see_exact_class = false;
   if (MonomorphicArrayCheck
-      && !too_many_traps(Deoptimization::Reason_array_check)) {
+      && !too_many_traps(Deoptimization::Reason_array_check)
+      && !tak->klass_is_exact()
+      && tak != TypeKlassPtr::OBJECT) {
+      // Regarding the fourth condition in the if-statement from above:
+      //
+      // If the compiler has determined that the type of array 'ary' (represented
+      // by 'array_klass') is java/lang/Object, the compiler must not assume that
+      // the array 'ary' is monomorphic.
+      //
+      // If 'ary' were of type java/lang/Object, this arraystore would have to fail,
+      // because it is not possible to perform a arraystore into an object that is not
+      // a "proper" array.
+      //
+      // Therefore, let's obtain at runtime the type of 'ary' and check if we can still
+      // successfully perform the store.
+      //
+      // The implementation reasons for the condition are the following:
+      //
+      // java/lang/Object is the superclass of all arrays, but it is represented by the VM
+      // as an InstanceKlass. The checks generated by gen_checkcast() (see below) expect
+      // 'array_klass' to be ObjArrayKlass, which can result in invalid memory accesses.
+      //
+      // See issue JDK-8057622 for details.
+
     always_see_exact_class = true;
     // (If no MDO at all, hope for the best, until a trap actually occurs.)
-  }
 
-  // Is the array klass is exactly its defined type?
-  if (always_see_exact_class && !tak->klass_is_exact()) {
     // Make a constant out of the inexact array klass
     const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr();
     Node* con = makecon(extak);
@@ -202,11 +223,15 @@
   // Extract the array element class
   int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset());
   Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
-  Node *a_e_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p2, tak) );
+  // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true,
+  // we must set a control edge from the IfTrue node created by the uncommon_trap above to the
+  // LoadKlassNode.
+  Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL,
+                                                       immutable_memory(), p2, tak));
 
   // Check (the hard way) and throw if not a subklass.
   // Result is ignored, we just need the CFG effects.
-  gen_checkcast( obj, a_e_klass );
+  gen_checkcast(obj, a_e_klass);
 }
 
 
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,8 @@
 
 #include "precompiled.hpp"
 
+#include <new>
+
 #include "code/codeCache.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/universe.hpp"
@@ -37,9 +39,11 @@
 
 #include "runtime/thread.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
 #include "runtime/vm_version.hpp"
+#include "runtime/sweeper.hpp"
 
 #include "utilities/array.hpp"
 #include "utilities/debug.hpp"
@@ -67,6 +71,7 @@
 #define SIZE_T_MAX_VALUE ((size_t) -1)
 
 bool WhiteBox::_used = false;
+volatile bool WhiteBox::compilation_locked = false;
 
 WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
   return (jlong)(void*)JNIHandles::resolve(obj);
@@ -302,13 +307,12 @@
 WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
   jlong addr = 0;
 
-    addr = (jlong)(uintptr_t)os::reserve_memory(size);
-    MemTracker::record_virtual_memory_type((address)addr, mtTest);
+  addr = (jlong)(uintptr_t)os::reserve_memory(size);
+  MemTracker::record_virtual_memory_type((address)addr, mtTest);
 
   return addr;
 WB_END
 
-
 WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
   os::commit_memory((char *)(uintptr_t)addr, size, !ExecMem);
   MemTracker::record_virtual_memory_type((address)(uintptr_t)addr, mtTest);
@@ -728,6 +732,29 @@
 WB_END
 
 
+WB_ENTRY(void, WB_LockCompilation(JNIEnv* env, jobject o, jlong timeout))
+  WhiteBox::compilation_locked = true;
+WB_END
+
+WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
+  MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
+  WhiteBox::compilation_locked = false;
+  mo.notify_all();
+WB_END
+
+void WhiteBox::force_sweep() {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    NMethodSweeper::_should_sweep = true;
+  }
+  NMethodSweeper::possibly_sweep();
+}
+
+WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o))
+  WhiteBox::force_sweep();
+WB_END
+
 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
   ResourceMark rm(THREAD);
   int len;
@@ -774,6 +801,46 @@
   return features_string;
 WB_END
 
+int WhiteBox::get_blob_type(const CodeBlob* code) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  return CodeCache::get_code_heap(code)->code_blob_type();
+}
+
+CodeHeap* WhiteBox::get_code_heap(int blob_type) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  return CodeCache::get_code_heap(blob_type);
+}
+
+struct CodeBlobStub {
+  CodeBlobStub(const CodeBlob* blob) :
+      name(os::strdup(blob->name())),
+      size(blob->size()),
+      blob_type(WhiteBox::get_blob_type(blob)) { }
+  ~CodeBlobStub() { os::free((void*) name); }
+  const char* const name;
+  const int         size;
+  const int         blob_type;
+};
+
+static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) {
+  jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  jobjectArray result = env->NewObjectArray(3, clazz, NULL);
+
+  jstring name = env->NewStringUTF(cb->name);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 0, name);
+
+  jobject obj = integerBox(thread, env, cb->size);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 1, obj);
+
+  obj = integerBox(thread, env, cb->blob_type);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 2, obj);
+
+  return result;
+}
 
 WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
   ResourceMark rm(THREAD);
@@ -790,24 +857,90 @@
   ThreadToNativeFromVM ttn(thread);
   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  result = env->NewObjectArray(3, clazz, NULL);
+  result = env->NewObjectArray(4, clazz, NULL);
   if (result == NULL) {
     return result;
   }
 
+  CodeBlobStub stub(code);
+  jobjectArray codeBlob = codeBlob2objectArray(thread, env, &stub);
+  env->SetObjectArrayElement(result, 0, codeBlob);
+
   jobject level = integerBox(thread, env, code->comp_level());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  env->SetObjectArrayElement(result, 0, level);
+  env->SetObjectArrayElement(result, 1, level);
 
   jbyteArray insts = env->NewByteArray(insts_size);
   CHECK_JNI_EXCEPTION_(env, NULL);
   env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
-  env->SetObjectArrayElement(result, 1, insts);
+  env->SetObjectArrayElement(result, 2, insts);
 
   jobject id = integerBox(thread, env, code->compile_id());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  env->SetObjectArrayElement(result, 2, id);
+  env->SetObjectArrayElement(result, 3, id);
+
+  return result;
+WB_END
+
+CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  BufferBlob* blob;
+  int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob));
+  if (full_size < size) {
+    full_size += round_to(size - full_size, oopSize);
+  }
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
+  }
+  // Track memory usage statistic after releasing CodeCache_lock
+  MemoryService::track_code_cache_memory_usage();
+  ::new (blob) BufferBlob("WB::DummyBlob", full_size);
+  return blob;
+}
+
+WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type))
+    return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
+WB_END
+
+WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr))
+    BufferBlob::free((BufferBlob*) addr);
+WB_END
 
+WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_type))
+  ResourceMark rm;
+  GrowableArray<CodeBlobStub*> blobs;
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeHeap* heap = WhiteBox::get_code_heap(blob_type);
+    if (heap == NULL) {
+      return NULL;
+    }
+    for (CodeBlob* cb = (CodeBlob*) heap->first();
+         cb != NULL; cb = (CodeBlob*) heap->next(cb)) {
+      CodeBlobStub* stub = NEW_RESOURCE_OBJ(CodeBlobStub);
+      new (stub) CodeBlobStub(cb);
+      blobs.append(stub);
+    }
+  }
+  if (blobs.length() == 0) {
+    return NULL;
+  }
+  ThreadToNativeFromVM ttn(thread);
+  jobjectArray result = NULL;
+  jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  result = env->NewObjectArray(blobs.length(), clazz, NULL);
+  if (result == NULL) {
+    return result;
+  }
+  int i = 0;
+  for (GrowableArrayIterator<CodeBlobStub*> it = blobs.begin();
+       it != blobs.end(); ++it) {
+    jobjectArray obj = codeBlob2objectArray(thread, env, *it);
+    env->SetObjectArrayElement(result, i, obj);
+    ++i;
+  }
   return result;
 WB_END
 
@@ -1018,6 +1151,8 @@
       CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},
   {CC"clearMethodState",
       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
+  {CC"lockCompilation",    CC"()V",                   (void*)&WB_LockCompilation},
+  {CC"unlockCompilation",  CC"()V",                   (void*)&WB_UnlockCompilation},
   {CC"isConstantVMFlag",   CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag},
   {CC"isLockedVMFlag",     CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag},
   {CC"setBooleanVMFlag",   CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
@@ -1055,6 +1190,10 @@
   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
                                                       (void*)&WB_GetNMethod         },
+  {CC"forceNMethodSweep",  CC"()V",                   (void*)&WB_ForceNMethodSweep  },
+  {CC"allocateCodeBlob",   CC"(II)J",                 (void*)&WB_AllocateCodeBlob   },
+  {CC"freeCodeBlob",       CC"(J)V",                  (void*)&WB_FreeCodeBlob       },
+  {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
   {CC"getThreadStackSize", CC"()J",                   (void*)&WB_GetThreadStackSize },
   {CC"getThreadRemainingStackSize", CC"()J",          (void*)&WB_GetThreadRemainingStackSize },
 };
--- a/hotspot/src/share/vm/prims/whitebox.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/prims/whitebox.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -54,17 +54,24 @@
     }                                                                  \
   } while (0)
 
+class CodeBlob;
+class CodeHeap;
+
 class WhiteBox : public AllStatic {
  private:
   static bool _used;
  public:
+  static volatile bool compilation_locked;
   static bool used()     { return _used; }
   static void set_used() { _used = true; }
   static int offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol);
   static const char* lookup_jstring(const char* field_name, oop object);
   static bool lookup_bool(const char* field_name, oop object);
-
+  static void force_sweep();
+  static int get_blob_type(const CodeBlob* code);
+  static CodeHeap* get_code_heap(int blob_type);
+  static CodeBlob* allocate_code_blob(int blob_type, int size);
   static int array_bytes_to_length(size_t bytes);
   static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
     JNINativeMethod* method_array, int method_count);
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -317,8 +317,8 @@
  * c. 0 -> (3->2) -> 4.
  *    In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
  *    to enable the profiling to fully occur at level 0. In this case we change the compilation level
- *    of the method to 2, because it'll allow it to run much faster without full profiling while c2
- *    is compiling.
+ *    of the method to 2 while the request is still in-queue, because it'll allow it to run much faster
+ *    without full profiling while c2 is compiling.
  *
  * d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
  *    After a method was once compiled with C1 it can be identified as trivial and be compiled to
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1789,7 +1789,7 @@
 #ifdef ASSERT
 static bool verify_serial_gc_flags() {
   return (UseSerialGC &&
-        !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
+        !(UseParNewGC || (UseConcMarkSweepGC) || UseG1GC ||
           UseParallelGC || UseParallelOldGC));
 }
 #endif // ASSERT
@@ -2203,10 +2203,6 @@
     warning("Using the ParNew young collector with the Serial old collector is deprecated "
         "and will likely be removed in a future release");
   }
-
-  if (CMSIncrementalMode) {
-    warning("Using incremental CMS is deprecated and will likely be removed in a future release");
-  }
 }
 
 void Arguments::check_deprecated_gc_flags() {
@@ -2328,31 +2324,8 @@
   status = status && ArgumentsExt::check_gc_consistency_user();
   status = status && check_stack_pages();
 
-  if (CMSIncrementalMode) {
-    if (!UseConcMarkSweepGC) {
-      jio_fprintf(defaultStream::error_stream(),
-                  "error:  invalid argument combination.\n"
-                  "The CMS collector (-XX:+UseConcMarkSweepGC) must be "
-                  "selected in order\nto use CMSIncrementalMode.\n");
-      status = false;
-    } else {
-      status = status && verify_percentage(CMSIncrementalDutyCycle,
-                                  "CMSIncrementalDutyCycle");
-      status = status && verify_percentage(CMSIncrementalDutyCycleMin,
-                                  "CMSIncrementalDutyCycleMin");
-      status = status && verify_percentage(CMSIncrementalSafetyFactor,
-                                  "CMSIncrementalSafetyFactor");
-      status = status && verify_percentage(CMSIncrementalOffset,
-                                  "CMSIncrementalOffset");
-      status = status && verify_percentage(CMSExpAvgFactor,
-                                  "CMSExpAvgFactor");
-      // If it was not set on the command line, set
-      // CMSInitiatingOccupancyFraction to 1 so icms can initiate cycles early.
-      if (CMSInitiatingOccupancyFraction < 0) {
-        FLAG_SET_DEFAULT(CMSInitiatingOccupancyFraction, 1);
-      }
-    }
-  }
+  status = status && verify_percentage(CMSIncrementalSafetyFactor,
+                                    "CMSIncrementalSafetyFactor");
 
   // CMS space iteration, which FLSVerifyAllHeapreferences entails,
   // insists that we hold the requisite locks so that the iteration is
@@ -2886,14 +2859,6 @@
     // -Xnoclassgc
     } else if (match_option(option, "-Xnoclassgc", &tail)) {
       FLAG_SET_CMDLINE(bool, ClassUnloading, false);
-    // -Xincgc: i-CMS
-    } else if (match_option(option, "-Xincgc", &tail)) {
-      FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
-      FLAG_SET_CMDLINE(bool, CMSIncrementalMode, true);
-    // -Xnoincgc: no i-CMS
-    } else if (match_option(option, "-Xnoincgc", &tail)) {
-      FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
-      FLAG_SET_CMDLINE(bool, CMSIncrementalMode, false);
     // -Xconcgc
     } else if (match_option(option, "-Xconcgc", &tail)) {
       FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
@@ -3723,7 +3688,6 @@
 #if !INCLUDE_ALL_GCS
 static void force_serial_gc() {
   FLAG_SET_DEFAULT(UseSerialGC, true);
-  FLAG_SET_DEFAULT(CMSIncrementalMode, false);  // special CMS suboption
   UNSUPPORTED_GC_OPTION(UseG1GC);
   UNSUPPORTED_GC_OPTION(UseParallelGC);
   UNSUPPORTED_GC_OPTION(UseParallelOldGC);
--- a/hotspot/src/share/vm/runtime/globals.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -1632,30 +1632,10 @@
           "The maximum size of young gen chosen by default per GC worker "  \
           "thread available")                                               \
                                                                             \
-  product(bool, CMSIncrementalMode, false,                                  \
-          "Whether CMS GC should operate in \"incremental\" mode")          \
-                                                                            \
-  product(uintx, CMSIncrementalDutyCycle, 10,                               \
-          "Percentage (0-100) of CMS incremental mode duty cycle. If "      \
-          "CMSIncrementalPacing is enabled, then this is just the initial " \
-          "value.")                                                         \
-                                                                            \
-  product(bool, CMSIncrementalPacing, true,                                 \
-          "Whether the CMS incremental mode duty cycle should be "          \
-          "automatically adjusted")                                         \
-                                                                            \
-  product(uintx, CMSIncrementalDutyCycleMin, 0,                             \
-          "Minimum percentage (0-100) of the CMS incremental duty cycle "   \
-          "used when CMSIncrementalPacing is enabled")                      \
-                                                                            \
   product(uintx, CMSIncrementalSafetyFactor, 10,                            \
           "Percentage (0-100) used to add conservatism when computing the " \
           "duty cycle")                                                     \
                                                                             \
-  product(uintx, CMSIncrementalOffset, 0,                                   \
-          "Percentage (0-100) by which the CMS incremental mode duty cycle "\
-          "is shifted to the right within the period between young GCs")    \
-                                                                            \
   product(uintx, CMSExpAvgFactor, 50,                                       \
           "Percentage (0-100) used to weight the current sample when "      \
           "computing exponential averages for CMS statistics")              \
@@ -1714,15 +1694,6 @@
           "Skip block flux-rate sampling for an epoch unless inter-sweep "  \
           "duration exceeds this threshold in milliseconds")                \
                                                                             \
-  develop(bool, CMSTraceIncrementalMode, false,                             \
-          "Trace CMS incremental mode")                                     \
-                                                                            \
-  develop(bool, CMSTraceIncrementalPacing, false,                           \
-          "Trace CMS incremental mode pacing computation")                  \
-                                                                            \
-  develop(bool, CMSTraceThreadState, false,                                 \
-          "Trace the CMS thread state (enable the trace_state() method)")   \
-                                                                            \
   product(bool, CMSClassUnloadingEnabled, true,                             \
           "Whether class unloading enabled when using CMS GC")              \
                                                                             \
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -72,7 +72,6 @@
 Monitor* CGC_lock                     = NULL;
 Monitor* STS_lock                     = NULL;
 Monitor* SLT_lock                     = NULL;
-Monitor* iCMS_lock                    = NULL;
 Monitor* FullGCCount_lock             = NULL;
 Monitor* CMark_lock                   = NULL;
 Mutex*   CMRegionStack_lock           = NULL;
@@ -88,6 +87,7 @@
 Mutex*   Compile_lock                 = NULL;
 Monitor* MethodCompileQueue_lock      = NULL;
 Monitor* CompileThread_lock           = NULL;
+Monitor* Compilation_lock             = NULL;
 Mutex*   CompileTaskAlloc_lock        = NULL;
 Mutex*   CompileStatistics_lock       = NULL;
 Mutex*   MultiArray_lock              = NULL;
@@ -175,9 +175,6 @@
 
   def(CGC_lock                   , Monitor, special,     true ); // coordinate between fore- and background GC
   def(STS_lock                   , Monitor, leaf,        true );
-  if (UseConcMarkSweepGC) {
-    def(iCMS_lock                  , Monitor, special,     true ); // CMS incremental mode start/stop notification
-  }
   if (UseConcMarkSweepGC || UseG1GC) {
     def(FullGCCount_lock           , Monitor, leaf,        true ); // in support of ExplicitGCInvokesConcurrent
   }
@@ -278,7 +275,9 @@
   def(ProfileVM_lock               , Monitor, special,   false); // used for profiling of the VMThread
   def(CompileThread_lock           , Monitor, nonleaf+5,   false );
   def(PeriodicTask_lock            , Monitor, nonleaf+5,   true);
-
+  if (WhiteBoxAPI) {
+    def(Compilation_lock           , Monitor, leaf,        false );
+  }
 #ifdef INCLUDE_TRACE
   def(JfrMsg_lock                  , Monitor, leaf,        true);
   def(JfrBuffer_lock               , Mutex,   leaf,        true);
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -66,7 +66,6 @@
                                                  // fore- & background GC threads.
 extern Monitor* STS_lock;                        // used for joining/leaving SuspendibleThreadSet.
 extern Monitor* SLT_lock;                        // used in CMS GC for acquiring PLL
-extern Monitor* iCMS_lock;                       // CMS incremental mode start/stop notification
 extern Monitor* FullGCCount_lock;                // in support of "concurrent" full gc
 extern Monitor* CMark_lock;                      // used for concurrent mark thread coordination
 extern Mutex*   CMRegionStack_lock;              // used for protecting accesses to the CM region stack
@@ -91,6 +90,7 @@
 extern Mutex*   Compile_lock;                    // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
 extern Monitor* MethodCompileQueue_lock;         // a lock held when method compilations are enqueued, dequeued
 extern Monitor* CompileThread_lock;              // a lock held by compile threads during compilation system initialization
+extern Monitor* Compilation_lock;                // a lock used to pause compilation
 extern Mutex*   CompileTaskAlloc_lock;           // a lock held when CompileTasks are allocated
 extern Mutex*   CompileStatistics_lock;          // a lock held when updating compilation statistics
 extern Mutex*   MultiArray_lock;                 // a lock used to guard allocation of multi-dim arrays
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -54,13 +54,17 @@
 // Simple methods are as good being compiled with C1 as C2.
 // Determine if a given method is such a case.
 bool SimpleThresholdPolicy::is_trivial(Method* method) {
-  if (method->is_accessor()) return true;
-  if (method->code() != NULL) {
-    MethodData* mdo = method->method_data();
-    if (mdo != NULL && mdo->num_loops() == 0 &&
-        (method->code_size() < 5  || (mdo->num_blocks() < 4) && (method->code_size() < 15))) {
-      return !mdo->would_profile();
-    }
+  if (method->is_accessor() ||
+      method->is_constant_getter()) {
+    return true;
+  }
+  if (method->has_loops() || method->code_size() >= 15) {
+    return false;
+  }
+  MethodData* mdo = method->method_data();
+  if (mdo != NULL && !mdo->would_profile() &&
+      (method->code_size() < 5  || (mdo->num_blocks() < 4))) {
+    return true;
   }
   return false;
 }
--- a/hotspot/src/share/vm/runtime/sweeper.hpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,8 @@
 #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
 #define SHARE_VM_RUNTIME_SWEEPER_HPP
 
+class WhiteBox;
+
 #include "utilities/ticks.hpp"
 // An NmethodSweeper is an incremental cleaner for:
 //    - cleanup inline caches
@@ -52,6 +54,8 @@
 //     nmethod's space is freed.
 
 class NMethodSweeper : public AllStatic {
+  friend class WhiteBox;
+ private:
   static long      _traversals;                   // Stack scan count, also sweep ID.
   static long      _total_nof_code_cache_sweeps;  // Total number of full sweeps of the code cache
   static long      _time_counter;                 // Virtual time used to periodically invoke sweeper
@@ -88,7 +92,6 @@
   static void handle_safepoint_request();
   static void do_stack_scanning();
   static void possibly_sweep();
-
  public:
   static long traversal_count()              { return _traversals; }
   static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Mon Nov 17 09:36:40 2014 +0100
@@ -527,12 +527,10 @@
   nonstatic_field(DefNewGeneration,            _next_gen,                                     Generation*)                           \
   nonstatic_field(DefNewGeneration,            _tenuring_threshold,                           uint)                                  \
   nonstatic_field(DefNewGeneration,            _age_table,                                    ageTable)                              \
-  nonstatic_field(DefNewGeneration,            _eden_space,                                   EdenSpace*)                            \
+  nonstatic_field(DefNewGeneration,            _eden_space,                                   ContiguousSpace*)                      \
   nonstatic_field(DefNewGeneration,            _from_space,                                   ContiguousSpace*)                      \
   nonstatic_field(DefNewGeneration,            _to_space,                                     ContiguousSpace*)                      \
                                                                                                                                      \
-  nonstatic_field(EdenSpace,                   _gen,                                          DefNewGeneration*)                     \
-                                                                                                                                     \
   nonstatic_field(Generation,                  _reserved,                                     MemRegion)                             \
   nonstatic_field(Generation,                  _virtual_space,                                VirtualSpace)                          \
   nonstatic_field(Generation,                  _level,                                        int)                                   \
@@ -1490,7 +1488,6 @@
   declare_toplevel_type(BitMap)                                           \
            declare_type(CompactibleSpace,             Space)              \
            declare_type(ContiguousSpace,              CompactibleSpace)   \
-           declare_type(EdenSpace,                    ContiguousSpace)    \
            declare_type(OffsetTableContigSpace,       ContiguousSpace)    \
            declare_type(TenuredSpace,                 OffsetTableContigSpace) \
   declare_toplevel_type(BarrierSet)                                       \
@@ -1532,7 +1529,6 @@
   declare_toplevel_type(CollectedHeap*)                                   \
   declare_toplevel_type(ContiguousSpace*)                                 \
   declare_toplevel_type(DefNewGeneration*)                                \
-  declare_toplevel_type(EdenSpace*)                                       \
   declare_toplevel_type(GenCollectedHeap*)                                \
   declare_toplevel_type(Generation*)                                      \
   declare_toplevel_type(GenerationSpec**)                                 \
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl	Mon Nov 17 09:36:40 2014 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2014, 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
@@ -59,6 +59,7 @@
   void set_starttime(const Ticks&amp; time) {}
   void set_endtime(const Ticks&amp; time) {}
   bool should_commit() const { return false; }
+  static bool is_enabled() { return false; }
   void commit() const {}
 };
 
--- a/hotspot/test/TEST.groups	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/TEST.groups	Mon Nov 17 09:36:40 2014 +0100
@@ -174,11 +174,8 @@
   gc/g1/TestShrinkToOneRegion.java \
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/startup_warnings/TestCMS.java \
-  gc/startup_warnings/TestCMSIncrementalMode.java \
-  gc/startup_warnings/TestCMSNoIncrementalMode.java \
   gc/startup_warnings/TestDefaultMaxRAMFraction.java \
   gc/startup_warnings/TestDefNewCMS.java \
-  gc/startup_warnings/TestIncGC.java \
   gc/startup_warnings/TestParallelGC.java \
   gc/startup_warnings/TestParallelScavengeSerialOld.java \
   gc/startup_warnings/TestParNewCMS.java \
@@ -273,8 +270,6 @@
   gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
   gc/concurrentMarkSweep/ \
   gc/startup_warnings/TestCMS.java \
-  gc/startup_warnings/TestCMSIncrementalMode.java \
-  gc/startup_warnings/TestCMSNoIncrementalMode.java \
   gc/startup_warnings/TestDefNewCMS.java \
   gc/startup_warnings/TestParNewCMS.java
 
@@ -431,7 +426,8 @@
   compiler/8005033/Test8005033.java \
   compiler/8005419/Test8005419.java \
   compiler/8005956/PolynomialRoot.java \
-  compiler/8007294/Test8007294.java
+  compiler/8007294/Test8007294.java \
+  compiler/EliminateAutoBox/UnsignedLoads.java
 
 hotspot_compiler_3 = \
   compiler/8007722/Test8007722.java \
--- a/hotspot/test/compiler/7068051/Test7068051.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/compiler/7068051/Test7068051.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -26,57 +26,116 @@
  * @test
  * @bug 7068051
  * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440
+ * @library /testlibrary
  *
- * @run shell/timeout=300 Test7068051.sh
+ * @run main/othervm -showversion -Xbatch Test7068051
  */
 
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-import java.util.zip.*;
+import com.oracle.java.testlibrary.JDKToolLauncher;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 public class Test7068051 {
+    private static final String SELF_NAME = Test7068051.class.getSimpleName();
+    private static final String SELF_FILE_NAME = SELF_NAME + ".java";
+    private static final String JAR_NAME = "foo.jar";
+    private static final String TEST_PATH = System.getProperty("test.src");
+    private static final Path CURRENT_DIR = Paths.get(".");
+    private static final Path TEST_SOURCE_PATH = Paths.get(TEST_PATH, SELF_FILE_NAME);
 
-    public static void main (String[] args) throws Throwable {
-
-        ZipFile zf = new ZipFile(args[0]);
+    public static void main (String[] args) throws IOException {
+        createTestJarFile();
+        System.out.println("Running test...");
 
-        Enumeration<? extends ZipEntry> entries = zf.entries();
-        ArrayList<String> names = new ArrayList<String>();
-        while (entries.hasMoreElements()) {
-            names.add(entries.nextElement().getName());
-        }
+        try (ZipFile zf = new ZipFile(JAR_NAME)) {
 
-        byte[] bytes = new byte[16];
-        for (String name : names) {
-            ZipEntry e = zf.getEntry(name);
+            Enumeration<? extends ZipEntry> entries = zf.entries();
+            ArrayList<String> names = new ArrayList<String>();
+            while (entries.hasMoreElements()) {
+                names.add(entries.nextElement().getName());
+            }
 
-            if (e.isDirectory())
-                continue;
-
-            final InputStream is = zf.getInputStream(e);
+            byte[] bytes = new byte[16];
+            for (String name : names) {
+                ZipEntry e = zf.getEntry(name);
 
-            try  {
-                while (is.read(bytes) >= 0) {
+                if (e.isDirectory()) {
+                    continue;
                 }
-                is.close();
 
-            } catch (IOException x) {
-                 System.out.println("..................................");
-                 System.out.println("          -->  is :" + is);
-                 System.out.println("          is.hash :" + is.hashCode());
-                 System.out.println();
-                 System.out.println("           e.name :" + e.getName());
-                 System.out.println("           e.hash :" + e.hashCode());
-                 System.out.println("         e.method :" + e.getMethod());
-                 System.out.println("           e.size :" + e.getSize());
-                 System.out.println("          e.csize :" + e.getCompressedSize());
+                try (final InputStream is = zf.getInputStream(e)) {
+                    try {
+                        while (is.read(bytes) >= 0) {
+                        }
+                    } catch (IOException x) {
+                        System.out.println("..................................");
+                        System.out.println("          -->  is :" + is);
+                        System.out.println("          is.hash :" + is.hashCode());
+                        System.out.println();
+                        System.out.println("           e.name :" + e.getName());
+                        System.out.println("           e.hash :" + e.hashCode());
+                        System.out.println("         e.method :" + e.getMethod());
+                        System.out.println("           e.size :" + e.getSize());
+                        System.out.println("          e.csize :" + e.getCompressedSize());
+                        System.out.println("..................................");
 
-                 x.printStackTrace();
-                 System.out.println("..................................");
-                 System.exit(97);
+                        throw new AssertionError("IOException was throwing while read the archive. Test failed.", x);
+                    }
+                }
             }
         }
-        zf.close();
+        System.out.println("Test passed.");
+    }
+
+    private static void createTestJarFile() {
+        ArrayList<String> jarOptions = new ArrayList<>();
+
+        // jar cf foo.jar *
+        System.out.println("Creating jar file..");
+        jarOptions.add("cf");
+        jarOptions.add(JAR_NAME);
+        try {
+            for (int i = 0; i < 100; ++i) {
+                Path temp = Files.createTempFile(CURRENT_DIR, SELF_NAME, ".java");
+                Files.copy(TEST_SOURCE_PATH, temp, StandardCopyOption.REPLACE_EXISTING);
+                jarOptions.add(temp.toString());
+            }
+        } catch (IOException ex) {
+            throw new AssertionError("TESTBUG: Creating temp files failed.", ex);
+        }
+        runJar(jarOptions);
+
+        // jar -uf0 foo.jar Test7068051.java
+        System.out.println("Adding unpacked file...");
+        jarOptions.clear();
+        jarOptions.add("-uf0");
+        jarOptions.add(JAR_NAME);
+        jarOptions.add(TEST_SOURCE_PATH.toString());
+        runJar(jarOptions);
+    }
+
+    private static void runJar(List<String> params) {
+        JDKToolLauncher jar = JDKToolLauncher.create("jar");
+        for (String p : params) {
+            jar.addToolArg(p);
+        }
+        ProcessBuilder pb = new ProcessBuilder(jar.getCommand());
+        try {
+            OutputAnalyzer output = new OutputAnalyzer(pb.start());
+            output.shouldHaveExitValue(0);
+        } catch (IOException ex) {
+            throw new AssertionError("TESTBUG: jar failed.", ex);
+        }
     }
 }
--- a/hotspot/test/compiler/7068051/Test7068051.sh	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-# 
-# Copyright (c) 2011, 2014, 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.
-# 
-# 
-## some tests require path to find test source dir
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
-
-set -x
-
-${COMPILEJAVA}/bin/jar xf ${COMPILEJAVA}/jre/lib/javaws.jar
-${COMPILEJAVA}/bin/jar cf foo.jar *
-cp ${TESTSRC}/Test7068051.java ./
-${COMPILEJAVA}/bin/jar -uf0 foo.jar Test7068051.java
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7068051.java
-
-${TESTJAVA}/bin/java ${TESTOPTS} -showversion -Xbatch Test7068051 foo.jar
-
--- a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,7 @@
 /*
  * @test
  * @library /testlibrary
- * @run main/othervm -Xbatch -XX:+EliminateAutoBox
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
  *                   -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort
  *                   UnsignedLoads
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+import java.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+import java.util.ArrayList;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test AllocationCodeBlobTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build AllocationCodeBlobTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:-SegmentedCodeCache AllocationCodeBlobTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:+SegmentedCodeCache AllocationCodeBlobTest
+ * @summary testing of WB::allocate/freeCodeBlob()
+ */
+public class AllocationCodeBlobTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final long CODE_CACHE_SIZE
+            = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize");
+    private static final int SIZE = 1;
+
+    public static void main(String[] args) {
+        // check that Sweeper handels dummy blobs correctly
+        new ForcedSweeper(500).start();
+        EnumSet<BlobType> blobTypes = BlobType.getAvailable();
+        for (BlobType type : blobTypes) {
+            new AllocationCodeBlobTest(type).test();
+        }
+    }
+
+    private final BlobType type;
+    private final MemoryPoolMXBean bean;
+    private AllocationCodeBlobTest(BlobType type) {
+        this.type = type;
+        bean = type.getMemoryPool();
+    }
+
+    private void test() {
+        System.out.printf("type %s%n", type);
+        long start = getUsage();
+        long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+
+        long firstAllocation = getUsage();
+        Asserts.assertLTE(start + SIZE, firstAllocation,
+                "allocation should increase memory usage: "
+                + start + " + " + SIZE + " <= " + firstAllocation);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        long firstFree = getUsage();
+        Asserts.assertLTE(firstFree, firstAllocation,
+                "free shouldn't increase memory usage: "
+                + firstFree + " <= " + firstAllocation);
+
+        addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+
+        long secondAllocation = getUsage();
+        Asserts.assertEQ(firstAllocation, secondAllocation);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        System.out.println("allocating till possible...");
+        ArrayList<Long> blobs = new ArrayList<>();
+        int size = (int) (CODE_CACHE_SIZE >> 7);
+        while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+            blobs.add(addr);
+        }
+        for (Long blob : blobs) {
+            WHITE_BOX.freeCodeBlob(blob);
+        }
+    }
+
+    private long getUsage() {
+        return bean.getUsage().getUsed();
+    }
+
+    private static class ForcedSweeper extends Thread {
+        private final int millis;
+        public ForcedSweeper(int millis) {
+            super("ForcedSweeper");
+            setDaemon(true);
+            this.millis = millis;
+        }
+        public void run() {
+            try {
+                while (true) {
+                    WHITE_BOX.forceNMethodSweep();
+                    Thread.sleep(millis);
+                }
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                throw new Error(e);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+import java.util.Arrays;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.CodeBlob;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test GetCodeHeapEntriesTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build GetCodeHeapEntriesTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache
+ *                   GetCodeHeapEntriesTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache
+ *                   GetCodeHeapEntriesTest
+ * @summary testing of WB::getCodeHeapEntries()
+ */
+public class GetCodeHeapEntriesTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final int SIZE = 1024;
+    private static final String DUMMY_NAME = "WB::DummyBlob";
+    private static EnumSet<BlobType> SEGMENTED_TYPES
+            = EnumSet.complementOf(EnumSet.of(BlobType.All));
+
+    public static void main(String[] args) {
+        EnumSet<BlobType> blobTypes = BlobType.getAvailable();
+        for (BlobType type : blobTypes) {
+            new GetCodeHeapEntriesTest(type).test();
+        }
+    }
+
+    private final BlobType type;
+    private GetCodeHeapEntriesTest(BlobType type) {
+        this.type = type;
+    }
+
+    private void test() {
+        System.out.printf("type %s%n", type);
+        long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+        CodeBlob[] blobs = CodeBlob.getCodeBlobs(type);
+        Asserts.assertNotNull(blobs);
+        CodeBlob blob = Arrays.stream(blobs)
+                              .filter(GetCodeHeapEntriesTest::filter)
+                              .findAny()
+                              .get();
+        Asserts.assertNotNull(blob);
+        Asserts.assertEQ(blob.code_blob_type, type);
+        Asserts.assertGTE(blob.size, SIZE);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        blobs = CodeBlob.getCodeBlobs(type);
+        long count = Arrays.stream(blobs)
+                           .filter(GetCodeHeapEntriesTest::filter)
+                           .count();
+        Asserts.assertEQ(0L, count);
+    }
+
+    private static boolean filter(CodeBlob blob) {
+        if (blob == null) {
+            return false;
+        }
+        return DUMMY_NAME.equals(blob.name);
+    }
+}
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,7 +22,9 @@
  *
  */
 
+import sun.hotspot.code.BlobType;
 import sun.hotspot.code.NMethod;
+import com.oracle.java.testlibrary.Asserts;
 
 /*
  * @test GetNMethodTest
@@ -52,21 +54,46 @@
 
         compile();
         checkCompiled();
+
         NMethod nmethod = NMethod.get(method, testCase.isOsr());
         if (IS_VERBOSE) {
             System.out.println("nmethod = " + nmethod);
         }
-        if (nmethod == null) {
-            throw new RuntimeException("nmethod of compiled method is null");
+        Asserts.assertNotNull(nmethod,
+                "nmethod of compiled method is null");
+        Asserts.assertNotNull(nmethod.insts,
+                "nmethod.insts of compiled method is null");
+        Asserts.assertGT(nmethod.insts.length, 0,
+                "compiled method's instructions is empty");
+        Asserts.assertNotNull(nmethod.code_blob_type, "blob type is null");
+        if (WHITE_BOX.getBooleanVMFlag("SegmentedCodeCache")) {
+            Asserts.assertNE(nmethod.code_blob_type, BlobType.All);
+            switch (nmethod.comp_level) {
+            case 1:
+            case 4:
+                checkBlockType(nmethod, BlobType.MethodNonProfiled);
+                break;
+            case 2:
+            case 3:
+                checkBlockType(nmethod, BlobType.MethodNonProfiled);
+                break;
+            default:
+                throw new Error("unexpected comp level " + nmethod);
+            }
+        } else {
+            Asserts.assertEQ(nmethod.code_blob_type, BlobType.All);
         }
-        if (nmethod.insts.length == 0) {
-            throw new RuntimeException("compiled method's instructions is empty");
-        }
+
         deoptimize();
         checkNotCompiled();
         nmethod = NMethod.get(method, testCase.isOsr());
-        if (nmethod != null) {
-            throw new RuntimeException("nmethod of non-compiled method isn't null");
-        }
+        Asserts.assertNull(nmethod,
+                "nmethod of non-compiled method isn't null");
+    }
+
+    private void checkBlockType(NMethod nmethod, BlobType expectedType) {
+        Asserts.assertEQ(nmethod.code_blob_type, expectedType,
+                String.format("blob_type[%s] for %d level isn't %s",
+                        nmethod.code_blob_type, nmethod.comp_level, expectedType));
     }
 }
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
  * @summary testing of WB::isMethodCompilable()
  * @author igor.ignatyev@oracle.com
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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 LockCompilationTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build LockCompilationTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* LockCompilationTest
+ * @summary testing of WB::lock/unlockCompilation()
+ */
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class LockCompilationTest extends CompilerWhiteBoxTest {
+    public static void main(String[] args) throws Exception {
+        CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
+    }
+
+    private LockCompilationTest(TestCase testCase) {
+        super(testCase);
+        // to prevent inlining of #method
+        WHITE_BOX.testSetDontInlineMethod(method, true);
+    }
+
+    protected void test() throws Exception {
+        checkNotCompiled();
+
+        System.out.println("locking compilation");
+        WHITE_BOX.lockCompilation();
+
+        try {
+            System.out.println("trying to compile");
+            compile();
+            // to check if it works correctly w/ safepoints
+            System.out.println("going to safepoint");
+            WHITE_BOX.fullGC();
+            waitBackgroundCompilation();
+            Asserts.assertTrue(
+                    WHITE_BOX.isMethodQueuedForCompilation(method),
+                    method + " must be in queue");
+            Asserts.assertFalse(
+                    WHITE_BOX.isMethodCompiled(method, false),
+                    method + " must be not compiled");
+            Asserts.assertEQ(
+                    WHITE_BOX.getMethodCompilationLevel(method, false), 0,
+                    method + " comp_level must be == 0");
+            Asserts.assertFalse(
+                    WHITE_BOX.isMethodCompiled(method, true),
+                    method + " must be not osr_compiled");
+            Asserts.assertEQ(
+                    WHITE_BOX.getMethodCompilationLevel(method, true), 0,
+                    method + " osr_comp_level must be == 0");
+        } finally {
+            System.out.println("unlocking compilation");
+            WHITE_BOX.unlockCompilation();
+        }
+        waitBackgroundCompilation();
+        Asserts.assertFalse(
+                WHITE_BOX.isMethodQueuedForCompilation(method),
+                method + " must not be in queue");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/TestNUMAPageSize.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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 TestNUMAPageSize
+ * @summary Make sure that start up with NUMA support does not cause problems.
+ * @bug 8061467
+ * @key gc
+ * @key regression
+ * @run main/othervm -Xmx8M -XX:+UseNUMA TestNUMAPageSize
+ */
+
+public class TestNUMAPageSize {
+  public static void main(String args[]) throws Exception {
+    // nothing to do
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2014, 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 DisableResizePLAB
+ * @key gc
+ * @bug 8060467
+ * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
+ * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB
+ */
+
+public class DisableResizePLAB {
+    public static void main(String args[]) throws Exception {
+        Object garbage[] = new Object[1_000];
+        for (int i = 0; i < garbage.length; i++) {
+            garbage[i] = new byte[0];
+        }
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < 10_000) {
+            Object o = new byte[1024];
+        }
+    }
+}
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -279,8 +279,7 @@
             "-XX:\\+UseConcMarkSweepGC",
             "-XX:\\+UseParallelOldGC",
             "-XX:\\+UseParNewGC",
-            "-Xconcgc",
-            "-Xincgc"
+            "-Xconcgc"
         };
     }
 }
--- a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-/*
-* Copyright (c) 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 TestCMSIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that the deprecated CMSIncrementalMode print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSIncrementalMode {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:+CMSIncrementalMode", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
--- a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 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 TestCMSNoIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that CMS with incremental mode turned off does not print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSNoIncrementalMode {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:-CMSIncrementalMode", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldNotContain("deprecated");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
--- a/hotspot/test/gc/startup_warnings/TestIncGC.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 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 TestIncGC
-* @key gc
-* @bug 8006398
-* @summary Test that the deprecated -Xincgc print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-
-public class TestIncGC {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xincgc", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Mon Nov 17 09:36:40 2014 +0100
@@ -143,8 +143,14 @@
   }
   public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
   public native void    clearMethodState(Executable method);
+  public native void    lockCompilation();
+  public native void    unlockCompilation();
   public native int     getMethodEntryBci(Executable method);
   public native Object[] getNMethod(Executable method, boolean isOsr);
+  public native long    allocateCodeBlob(int size, int type);
+  public native void    freeCodeBlob(long addr);
+  public native void    forceNMethodSweep();
+  public native Object[] getCodeHeapEntries(int type);
 
   // Intered strings
   public native boolean isInStringTable(String str);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+
+public enum BlobType {
+    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
+    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"),
+    // Execution level 2 and 3 (profiled) nmethods
+    MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
+    // Non-nmethods like Buffers, Adapters and Runtime Stubs
+    NonNMethod(2, "CodeHeap 'non-nmethods'"),
+    // All types (No code cache segmentation)
+    All(3, "CodeCache");
+
+    public final int id;
+    private final String beanName;
+
+    private BlobType(int id, String beanName) {
+        this.id = id;
+        this.beanName = beanName;
+    }
+
+    public MemoryPoolMXBean getMemoryPool() {
+        for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
+            String name = bean.getName();
+            if (beanName.equals(name)) {
+                return bean;
+            }
+        }
+        return null;
+    }
+    public static EnumSet<BlobType> getAvailable() {
+        WhiteBox whiteBox = WhiteBox.getWhiteBox();
+        if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
+            // only All for non segmented world
+            return EnumSet.of(All);
+        }
+        if (System.getProperty("java.vm.info").startsWith("interpreted ")) {
+            // only NonNMethod for -Xint
+            return EnumSet.of(NonNMethod);
+        }
+
+        EnumSet<BlobType> result = EnumSet.complementOf(EnumSet.of(All));
+        if (!whiteBox.getBooleanVMFlag("TieredCompilation")
+                || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) {
+            // there is no MethodProfiled in non tiered world or pure C1
+            result.remove(MethodProfiled);
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import sun.hotspot.WhiteBox;
+
+public class CodeBlob {
+  private static final WhiteBox WB = WhiteBox.getWhiteBox();
+  public static CodeBlob[] getCodeBlobs(BlobType type) {
+    Object[] obj = WB.getCodeHeapEntries(type.id);
+    if (obj == null) {
+      return null;
+    }
+    CodeBlob[] result = new CodeBlob[obj.length];
+    for (int i = 0, n = result.length; i < n; ++i) {
+      result[i] = new CodeBlob((Object[]) obj[i]);
+    }
+    return result;
+  }
+  protected CodeBlob(Object[] obj) {
+    assert obj.length == 3;
+    name = (String) obj[0];
+    size = (Integer) obj[1];
+    code_blob_type = BlobType.values()[(Integer) obj[2]];
+    assert code_blob_type.id == (Integer) obj[2];
+  }
+  public final String name;
+  public final int size;
+  public final BlobType code_blob_type;
+
+  @Override
+  public String toString() {
+    return "CodeBlob{"
+        + "name=" + name
+        + ", size=" + size
+        + ", code_blob_type=" + code_blob_type
+        + '}';
+  }
+}
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,28 +27,30 @@
 import java.lang.reflect.Executable;
 import sun.hotspot.WhiteBox;
 
-public class NMethod {
+public class NMethod extends CodeBlob {
   private static final WhiteBox wb = WhiteBox.getWhiteBox();
   public static NMethod get(Executable method, boolean isOsr) {
     Object[] obj = wb.getNMethod(method, isOsr);
     return obj == null ? null : new NMethod(obj);
   }
   private NMethod(Object[] obj) {
-    assert obj.length == 3;
-    comp_level = (Integer) obj[0];
-    insts = (byte[]) obj[1];
-    compile_id = (Integer) obj[2];
+    super((Object[])obj[0]);
+    assert obj.length == 4;
+    comp_level = (Integer) obj[1];
+    insts = (byte[]) obj[2];
+    compile_id = (Integer) obj[3];
   }
-  public byte[] insts;
-  public int comp_level;
-  public int compile_id;
+  public final byte[] insts;
+  public final int comp_level;
+  public final int compile_id;
 
   @Override
   public String toString() {
-    return "NMethod{" +
-        "insts=" + insts +
-        ", comp_level=" + comp_level +
-        ", compile_id=" + compile_id +
-        '}';
+    return "NMethod{"
+        + super.toString()
+        + ", insts=" + insts
+        + ", comp_level=" + comp_level
+        + ", compile_id=" + compile_id
+        + '}';
   }
 }
--- a/jaxp/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
 61b4c9acaa58e482db6601ec5dc4fc3d2d8dbb55 jdk9-b36
 48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
+6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
+a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java	Mon Nov 17 09:36:40 2014 +0100
@@ -213,6 +213,10 @@
   public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {
     stack.push(obj);
     obj.accept(visitor);
+
+    LocalVariable[] vars = obj.getLocalVariableTypeTable();
+    for(int i=0; i < vars.length; i++)
+      vars[i].accept(this);
     stack.pop();
   }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java	Mon Nov 17 09:36:40 2014 +0100
@@ -87,6 +87,7 @@
   private boolean         strip_attributes;
 
   private ArrayList       variable_vec    = new ArrayList();
+  private ArrayList       type_vec        = new ArrayList();
   private ArrayList       line_number_vec = new ArrayList();
   private ArrayList       exception_vec   = new ArrayList();
   private ArrayList       throws_vec      = new ArrayList();
@@ -260,7 +261,7 @@
             }
           } else if (a instanceof LocalVariableTypeTable) {
              LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable();
-             removeLocalVariables();
+             removeLocalVariableTypes();
              for (int k = 0; k < lv.length; k++) {
                  LocalVariable l = lv[k];
                  InstructionHandle start = il.findHandle(l.getStartPC());
@@ -272,7 +273,7 @@
                  if (null == end) {
                      end = il.getEnd();
                  }
-                 addLocalVariable(l.getName(), Type.getType(l.getSignature()), l
+                 addLocalVariableType(l.getName(), Type.getType(l.getSignature()), l
                          .getIndex(), start, end);
               }
           } else
@@ -406,6 +407,31 @@
     return lg;
   }
 
+  /*
+   * If the range of the variable has not been set yet, it will be set to be
+   * val id from the start to the end of the instruction list.
+   *
+   * @return array of declared local variable types sorted by index
+   */
+  private LocalVariableGen[] getLocalVariableTypes() {
+    int                size = type_vec.size();
+    LocalVariableGen[] lg   = new LocalVariableGen[size];
+    type_vec.toArray(lg);
+
+    for(int i=0; i < size; i++) {
+      if(lg[i].getStart() == null)
+        lg[i].setStart(il.getStart());
+
+      if(lg[i].getEnd() == null)
+        lg[i].setEnd(il.getEnd());
+    }
+
+    if(size > 1)
+      sort(lg, 0, size - 1);
+
+    return lg;
+  }
+
   /**
    * @return `LocalVariableTable' attribute of all the local variables of this method.
    */
@@ -422,6 +448,68 @@
   }
 
   /**
+   * @return `LocalVariableTypeTable' attribute of all the local variable
+   * types of this method.
+   */
+  public LocalVariableTypeTable getLocalVariableTypeTable(ConstantPoolGen cp) {
+    LocalVariableGen[] lg   = getLocalVariableTypes();
+    int                size = lg.length;
+    LocalVariable[]    lv   = new LocalVariable[size];
+
+    for(int i=0; i < size; i++)
+      lv[i] = lg[i].getLocalVariable(cp);
+
+    return new LocalVariableTypeTable(cp.addUtf8("LocalVariableTypeTable"),
+                                  2 + lv.length * 10, lv, cp.getConstantPool());
+  }
+
+  /**
+   * Adds a local variable type to this method.
+   *
+   * @param name variable name
+   * @param type variable type
+   * @param slot the index of the local variable, if type is long or double, the next available
+   * index is slot+2
+   * @param start from where the variable is valid
+   * @param end until where the variable is valid
+   * @return new local variable object
+   * @see LocalVariable
+   */
+  private LocalVariableGen addLocalVariableType(String name, Type type, int slot,
+                                           InstructionHandle start,
+                                           InstructionHandle end) {
+    byte t = type.getType();
+
+    if(t != Constants.T_ADDRESS) {
+      int  add = type.getSize();
+
+      if(slot + add > max_locals)
+        max_locals = slot + add;
+
+      LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end);
+      int i;
+
+      if((i = type_vec.indexOf(l)) >= 0) // Overwrite if necessary
+        type_vec.set(i, l);
+      else
+        type_vec.add(l);
+
+      return l;
+    } else {
+      throw new IllegalArgumentException("Can not use " + type +
+                                         " as type for local variable");
+
+    }
+  }
+
+  /**
+   * Remove all local variable types.
+   */
+  private void removeLocalVariableTypes() {
+    type_vec.clear();
+  }
+
+  /**
    * Give an instruction a line number corresponding to the source code line.
    *
    * @param ih instruction to tag
@@ -637,12 +725,17 @@
 
     LineNumberTable    lnt = null;
     LocalVariableTable lvt = null;
+    LocalVariableTypeTable lvtt = null;
 
-    /* Create LocalVariableTable and LineNumberTable attributes (for debuggers, e.g.)
+    /* Create LocalVariableTable, LocalvariableTypeTable, and LineNumberTable
+     * attributes (for debuggers, e.g.)
      */
     if((variable_vec.size() > 0) && !strip_attributes)
       addCodeAttribute(lvt = getLocalVariableTable(cp));
 
+    if((type_vec.size() > 0) && !strip_attributes)
+      addCodeAttribute(lvtt = getLocalVariableTypeTable(cp));
+
     if((line_number_vec.size() > 0) && !strip_attributes)
       addCodeAttribute(lnt = getLineNumberTable(cp));
 
@@ -691,6 +784,7 @@
 
     // Undo effects of adding attributes
     if(lvt != null)  removeCodeAttribute(lvt);
+    if(lvtt != null) removeCodeAttribute(lvtt);
     if(lnt != null)  removeCodeAttribute(lnt);
     if(code != null) removeAttribute(code);
     if(et != null)   removeAttribute(et);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Mon Nov 17 09:36:40 2014 +0100
@@ -146,8 +146,9 @@
             fCurrentEntity.lineNumber++;
             fCurrentEntity.columnNumber = 1;
             if (fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)c;
-                load(1, false, true);
+                load(1, false, false);
             }
             if (c == '\r' && external) {
                 int cc = fCurrentEntity.ch[fCurrentEntity.position++];
@@ -305,9 +306,10 @@
 
         if (XML11Char.isXML11NameStart(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     return symbol;
@@ -316,9 +318,10 @@
         }
         else if (XML11Char.isXML11NameHighSurrogate(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     --fCurrentEntity.position;
                     --fCurrentEntity.startPosition;
                     return null;
@@ -331,10 +334,11 @@
                 return null;
             }
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(2);
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false, true)) {
+                if (load(2, false, false)) {
                     fCurrentEntity.columnNumber += 2;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     return symbol;
@@ -463,9 +467,10 @@
 
         if (XML11Char.isXML11NCNameStart(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     return symbol;
@@ -474,9 +479,10 @@
         }
         else if (XML11Char.isXML11NameHighSurrogate(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     --fCurrentEntity.position;
                     --fCurrentEntity.startPosition;
                     return null;
@@ -489,10 +495,11 @@
                 return null;
             }
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(2);
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false, true)) {
+                if (load(2, false, false)) {
                     fCurrentEntity.columnNumber += 2;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     return symbol;
@@ -627,9 +634,10 @@
 
         if (XML11Char.isXML11NCNameStart(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     fCurrentEntity.columnNumber++;
                     String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
                     qname.setValues(null, name, name, null);
@@ -639,9 +647,10 @@
         }
         else if (XML11Char.isXML11NameHighSurrogate(ch)) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = ch;
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     --fCurrentEntity.startPosition;
                     --fCurrentEntity.position;
                     return false;
@@ -654,10 +663,11 @@
                 return false;
             }
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(2);
                 fCurrentEntity.ch[0] = ch;
                 fCurrentEntity.ch[1] = ch2;
                 offset = 0;
-                if (load(2, false, true)) {
+                if (load(2, false, false)) {
                     fCurrentEntity.columnNumber += 2;
                     String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
                     qname.setValues(null, name, name, null);
@@ -834,8 +844,9 @@
             load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false, true);
+            load(1, false, false);
             fCurrentEntity.position = 0;
             fCurrentEntity.startPosition = 0;
         }
@@ -975,8 +986,9 @@
             load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false, true);
+            load(1, false, false);
             fCurrentEntity.startPosition = 0;
             fCurrentEntity.position = 0;
         }
@@ -1345,8 +1357,9 @@
         else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
             // handle newlines
             if (fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)cc;
-                load(1, false, true);
+                load(1, false, false);
             }
             int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
             if (ccc == '\n' || ccc == 0x85) {
@@ -1407,8 +1420,9 @@
                         fCurrentEntity.lineNumber++;
                         fCurrentEntity.columnNumber = 1;
                         if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+                            invokeListeners(0);
                             fCurrentEntity.ch[0] = (char)c;
-                            entityChanged = load(1, true, true);
+                            entityChanged = load(1, true, false);
                             if (!entityChanged) {
                                 // the load change the position to be 1,
                                 // need to restore it when entity not changed
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -383,6 +383,8 @@
 
     protected boolean foundBuiltInRefs = false;
 
+    /** Built-in reference character event */
+    protected boolean builtInRefCharacterHandled = false;
 
     //skip element algorithm
     static final short MAX_DEPTH_LIMIT = 5 ;
@@ -1949,7 +1951,10 @@
                 fDocumentHandler.startGeneralEntity(entity, null, null, null);
             }
             fTempString.setValues(fSingleChar, 0, 1);
-            //fDocumentHandler.characters(fTempString, null);
+            if(!fIsCoalesce){
+                fDocumentHandler.characters(fTempString, null);
+                builtInRefCharacterHandled = true;
+            }
 
             if (fNotifyBuiltInRefs) {
                 fDocumentHandler.endGeneralEntity(entity, null);
@@ -3068,7 +3073,12 @@
                             //return CHARACTERS
                             if(fScannerState == SCANNER_STATE_BUILT_IN_REFS && !fIsCoalesce){
                                 setScannerState(SCANNER_STATE_CONTENT);
-                                return XMLEvent.CHARACTERS;
+                                if (builtInRefCharacterHandled) {
+                                    builtInRefCharacterHandled = false;
+                                    return XMLEvent.ENTITY_REFERENCE;
+                                } else {
+                                    return XMLEvent.CHARACTERS;
+                                }
                             }
 
                             //if there was a text declaration, call next() it will be taken care.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Mon Nov 17 09:36:40 2014 +0100
@@ -538,8 +538,9 @@
             fCurrentEntity.lineNumber++;
             fCurrentEntity.columnNumber = 1;
             if (fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)c;
-                load(1, false, true);
+                load(1, false, false);
             }
             if (c == '\r' && isExternal) {
                 if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
@@ -670,9 +671,10 @@
         int offset = fCurrentEntity.position;
         if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
                 offset = 0;
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     fCurrentEntity.columnNumber++;
                     String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
 
@@ -776,10 +778,11 @@
 
         if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
             if (++fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
                 offset = 0;
 
-                if (load(1, false, true)) {
+                if (load(1, false, false)) {
                     fCurrentEntity.columnNumber++;
                     //adding into symbol table.
                     //XXX We are trying to add single character in SymbolTable??????
@@ -906,8 +909,9 @@
         if (fCurrentEntity.position == fCurrentEntity.count) {
             load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false, true);
+            load(1, false, false);
             fCurrentEntity.position = 0;
         }
 
@@ -1054,8 +1058,9 @@
         if (fCurrentEntity.position == fCurrentEntity.count) {
             load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-            load(1, false, true);
+            load(1, false, false);
             fCurrentEntity.position = 0;
         }
 
@@ -1427,8 +1432,9 @@
         } else if (c == '\n' && cc == '\r' && isExternal) {
             // handle newlines
             if (fCurrentEntity.position == fCurrentEntity.count) {
+                invokeListeners(1);
                 fCurrentEntity.ch[0] = (char)cc;
-                load(1, false, true);
+                load(1, false, false);
             }
             fCurrentEntity.position++;
             if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
@@ -1502,8 +1508,9 @@
                     fCurrentEntity.lineNumber++;
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
+                        invokeListeners(0);
                         fCurrentEntity.ch[0] = (char)c;
-                        entityChanged = load(1, true, true);
+                        entityChanged = load(1, true, false);
                         if (!entityChanged){
                             // the load change the position to be 1,
                             // need to restore it when entity not changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,386 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
+import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.nio.file.Paths;
+import java.util.GregorianCalendar;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeConstants;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import static jaxp.library.JAXPTestUtilities.bomStream;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSSerializer;
+import org.xml.sax.SAXException;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
+/**
+ * This is the user controller  class for the Auction portal HiBid.com.
+ */
+public class AuctionController {
+    /**
+     * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927
+     * DOMConfiguration.setParameter("well-formed",true) throws an exception.
+     */
+    @Test
+    public void testCreateNewItem2Sell() {
+        String xmlFile = XML_DIR + "novelsInvalid.xml";
+
+        try {
+            Document document = DocumentBuilderFactory.newInstance()
+                    .newDocumentBuilder().parse(xmlFile);
+
+            document.getDomConfig().setParameter("well-formed", true);
+
+            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+            DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+            MyDOMOutput domOutput = new MyDOMOutput();
+            domOutput.setByteStream(System.out);
+            LSSerializer writer = impl.createLSSerializer();
+            writer.write(document, domOutput);
+        } catch (ParserConfigurationException | SAXException | IOException
+                | ClassNotFoundException | InstantiationException
+                | IllegalAccessException | ClassCastException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132
+     * test throws DOM Level 1 node error.
+     */
+    @Test
+    public void testCreateNewItem2SellRetry() {
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            Document document = dbf.newDocumentBuilder().parse(xmlFile);
+
+            DOMConfiguration domConfig = document.getDomConfig();
+            MyDOMErrorHandler errHandler = new MyDOMErrorHandler();
+            domConfig.setParameter("error-handler", errHandler);
+
+            DOMImplementationLS impl =
+                 (DOMImplementationLS) DOMImplementationRegistry.newInstance()
+                         .getDOMImplementation("LS");
+            LSSerializer writer = impl.createLSSerializer();
+            MyDOMOutput domoutput = new MyDOMOutput();
+
+            domoutput.setByteStream(System.out);
+            writer.write(document, domoutput);
+
+            document.normalizeDocument();
+            writer.write(document, domoutput);
+            assertFalse(errHandler.isError());
+        } catch (ParserConfigurationException | SAXException | IOException
+                | ClassNotFoundException | InstantiationException
+                | IllegalAccessException | ClassCastException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check if setting the attribute to be of type ID works. This will affect
+     * the Attr.isID method according to the spec.
+     */
+    @Test
+    public void testCreateID() {
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+
+            Document document = dbf.newDocumentBuilder().parse(xmlFile);
+            Element account = (Element)document
+                .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+
+            account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true);
+            Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
+            assertTrue(aID.isId());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check the user data on the node.
+     */
+    @Test
+    public void testCheckingUserData() {
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(xmlFile);
+
+            Element account = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+            assertEquals(account.getNodeName(), "acc:Account");
+            Element firstName = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
+            assertEquals(firstName.getNodeName(), "FirstName");
+
+            Document doc1 = docBuilder.newDocument();
+            Element someName = doc1.createElement("newelem");
+
+            someName.setUserData("mykey", "dd",
+                (operation, key,  data, src,  dst) ->  {
+                    System.err.println("In UserDataHandler" + key);
+                    System.out.println("In UserDataHandler");
+                });
+            Element impAccount = (Element)document.importNode(someName, true);
+            assertEquals(impAccount.getNodeName(), "newelem");
+            document.normalizeDocument();
+            String data = (someName.getUserData("mykey")).toString();
+            assertEquals(data, "dd");
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+
+    /**
+     * Check the UTF-16 XMLEncoding xml file.
+     * @see <a href="content/movies.xml">movies.xml</a>
+     */
+    @Test
+    public void testCheckingEncoding() {
+        // Note since movies.xml is UTF-16 encoding. We're not using stanard XML
+        // file suffix.
+        String xmlFile = XML_DIR + "movies.xml.data";
+
+        //try (FileInputStream is = new FileInputStream(xmlFile)) {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            InputStream source = bomStream("UTF-16", xmlFile);
+            Document document = dbf.newDocumentBuilder().parse(source);
+            assertEquals(document.getXmlEncoding(), "UTF-16");
+            assertEquals(document.getXmlStandalone(), true);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check validation API features. A schema which is including in Bug 4909119
+     * used to be testing for the functionalities.
+     * @see <a href="content/userDetails.xsd">userDetails.xsd</a>
+     */
+    @Test
+    public void testGetOwnerInfo() {
+        String schemaFile = XML_DIR + "userDetails.xsd";
+        String xmlFile = XML_DIR + "userDetails.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(Paths.get(schemaFile).toFile());
+
+            Validator validator = schema.newValidator();
+            MyErrorHandler eh = new MyErrorHandler();
+            validator.setErrorHandler(eh);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            docBuilder.setErrorHandler(eh);
+
+            Document document = docBuilder.parse(new FileInputStream(xmlFile));
+            DOMResult dResult = new DOMResult();
+            DOMSource domSource = new DOMSource(document);
+            validator.validate(domSource, dResult);
+            assertFalse(eh.isAnyError());
+        } catch (SAXException | ParserConfigurationException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check grammar caching with imported schemas.
+     * @see <a href="content/coins.xsd">coins.xsd</a>
+     * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
+     */
+    @Test
+    public void testGetOwnerItemList() {
+        String xsdFile = XML_DIR + "coins.xsd";
+        String xmlFile = XML_DIR + "coins.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            dbf.setValidating(false);
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(new File(((xsdFile))));
+
+            MyErrorHandler eh = new MyErrorHandler();
+            Validator validator = schema.newValidator();
+            validator.setErrorHandler(eh);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new FileInputStream(xmlFile));
+            validator.validate(new DOMSource(document), new DOMResult());
+            assertFalse(eh.isAnyError());
+        } catch (SAXException | ParserConfigurationException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+
+    /**
+     * Check for the same imported schemas but will use SAXParserFactory and try
+     * parsing using the SAXParser. SCHEMA_SOURCE attribute is using for this
+     * test.
+     * @see <a href="content/coins.xsd">coins.xsd</a>
+     * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
+     */
+
+    @Test
+    public void testGetOwnerItemList1() {
+        String xsdFile = XML_DIR + "coins.xsd";
+        String xmlFile = XML_DIR + "coins.xml";
+
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+
+            SAXParser sp = spf.newSAXParser();
+            sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            sp.setProperty(JAXP_SCHEMA_SOURCE, xsdFile);
+
+            MyErrorHandler eh = new MyErrorHandler();
+            sp.parse(new File(xmlFile), eh);
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check usage of javax.xml.datatype.Duration class.
+     */
+    @Test
+    public void testGetItemDuration() {
+        String xmlFile = XML_DIR + "itemsDuration.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            Document document = dbf.newDocumentBuilder().parse(xmlFile);
+
+            Element durationElement = (Element) document.getElementsByTagName("sellDuration").item(0);
+
+            NodeList childList = durationElement.getChildNodes();
+
+            for (int i = 0; i < childList.getLength(); i++) {
+                System.out.println("child " + i + childList.item(i));
+            }
+
+            Duration duration = DatatypeFactory.newInstance().newDuration("P365D");
+            Duration sellDuration = DatatypeFactory.newInstance().newDuration(childList.item(0).getNodeValue());
+            assertFalse(sellDuration.isShorterThan(duration));
+            assertFalse(sellDuration.isLongerThan(duration));
+            assertEquals(sellDuration.getField(DatatypeConstants.DAYS), BigInteger.valueOf(365));
+            assertEquals(sellDuration.normalizeWith(new GregorianCalendar(1999, 2, 22)), duration);
+
+            Duration myDuration = sellDuration.add(duration);
+            assertEquals(myDuration.normalizeWith(new GregorianCalendar(2003, 2, 22)),
+                    DatatypeFactory.newInstance().newDuration("P730D"));
+        } catch (ParserConfigurationException | DatatypeConfigurationException
+                | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Check usage of TypeInfo interface introduced in DOM L3.
+     */
+    @Test
+    public void testGetTypeInfo() {
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            docBuilder.setErrorHandler(new MyErrorHandler());
+
+            Document document = docBuilder.parse(xmlFile);
+            Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0);
+            TypeInfo typeInfo = userId.getSchemaTypeInfo();
+            assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger"));
+            assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI));
+
+            Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0);
+            TypeInfo roletypeInfo = role.getSchemaTypeInfo();
+            assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell"));
+            assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,482 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import static com.sun.org.apache.xerces.internal.impl.Constants.SP_ENTITY_EXPANSION_LIMIT;
+import static com.sun.org.apache.xerces.internal.impl.Constants.SP_MAX_OCCUR_LIMIT;
+import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
+import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE;
+import static org.testng.Assert.assertTrue;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import static test.auctionportal.HiBidConstants.CLASS_DIR;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
+/**
+ * This is a test class for the Auction portal HiBid.com.
+ */
+public class AuctionItemRepository {
+    /**
+     * XML file for parsing.
+     */
+    private final static String ENTITY_XML = XML_DIR + "entity.xml";
+
+    /**
+     * Feature name.
+     */
+    private final static String FEATURE_NAME = "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * Setting the EntityExpansion Limit to 128000 and checks if the XML
+     * document that has more than two levels of entity expansion is parsed or
+     * not. Previous system property was changed to jdk.xml.entityExpansionLimit
+     * see http://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html.
+     */
+    @Test
+    public void testEntityExpansionSAXPos() {
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            // Secure processing will limit XML processing to conform to
+            // implementation limits.
+            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+            // Set entityExpansionLimit as 2 should expect fatalError
+            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(128000));
+            SAXParser parser = factory.newSAXParser();
+
+            MyErrorHandler fatalHandler = new MyErrorHandler();
+            parser.parse(new File(ENTITY_XML), fatalHandler);
+            assertFalse(fatalHandler.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+    /**
+     * Setting the EntityExpansion Limit to 2 and checks if the XML
+     * document that has more than two levels of entity expansion is parsed or
+     * not. Previous system property was changed to jdk.xml.entityExpansionLimit
+     * see http://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html.
+     */
+    @Test(expectedExceptions = SAXParseException.class)
+    public void testEntityExpansionSAXNeg() throws SAXParseException {
+        //
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            // Secure processing will limit XML processing to conform to
+            // implementation limits.
+            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+            // Set entityExpansionLimit as 2 should expect SAXParseException
+            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
+            SAXParser parser = factory.newSAXParser();
+
+            MyErrorHandler fatalHandler = new MyErrorHandler();
+            parser.parse(new File(ENTITY_XML), fatalHandler);
+        } catch (SAXParseException e) {
+            throw e;
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testing set MaxOccursLimit to 10000 in the secure processing enabled for
+     * SAXParserFactory.
+     */
+    @Test
+    public void testMaxOccurLimitPos() {
+        String schema_file = XML_DIR + "toys.xsd";
+        String xml_file = XML_DIR + "toys.xml";
+
+        try (InputStream is = new FileInputStream(xml_file)) {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setValidating(true);
+            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+            System.setProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
+            SAXParser parser = factory.newSAXParser();
+            parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
+            MyErrorHandler eh = new MyErrorHandler();
+            parser.parse(is, eh);
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Use a DocumentBuilder to create a DOM object and see if Secure Processing
+     * feature affects the entity expansion.
+     */
+    @Test
+    public void testEntityExpansionDOMPos()  {
+        try {
+            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+            dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
+            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(10000));
+            DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            dBuilder.setErrorHandler(eh);
+            dBuilder.parse(ENTITY_XML);
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Use a DocumentBuilder to create a DOM object and see how does the Secure
+     * Processing feature and entityExpansionLimit value affects output.
+     * Negative test that when entityExpansionLimit is too small.
+     */
+    @Test(expectedExceptions = SAXParseException.class)
+    public void testEntityExpansionDOMNeg() throws SAXParseException {
+        try {
+            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+            dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
+            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
+            DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            dBuilder.setErrorHandler(eh);
+            dBuilder.parse(ENTITY_XML);
+        } catch (SAXParseException e) {
+            throw e;
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test xi:include with a SAXParserFactory.
+     */
+    @Test
+    public void testXIncludeSAXPos() {
+        String resultFile = CLASS_DIR + "doc_xinclude.out";
+        String goldFile = GOLDEN_DIR + "doc_xincludeGold.xml";
+        String xmlFile = XML_DIR + "doc_xinclude.xml";
+
+        try {
+            try(FileOutputStream fos = new FileOutputStream(resultFile)) {
+                XInclHandler xh = new XInclHandler(fos, null);
+                SAXParserFactory spf = SAXParserFactory.newInstance();
+                spf.setNamespaceAware(true);
+                spf.setXIncludeAware(true);
+                spf.setFeature(FEATURE_NAME, true);
+                spf.newSAXParser().parse(new File(xmlFile), xh);
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test the simple case of including a document using xi:include using a
+     * DocumentBuilder.
+     */
+    @Test
+    public void testXIncludeDOMPos() {
+        String resultFile = CLASS_DIR + "doc_xincludeDOM.out";
+        String goldFile = GOLDEN_DIR + "doc_xincludeGold.xml";
+        String xmlFile = XML_DIR + "doc_xinclude.xml";
+        try {
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+
+                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+                doc.setXmlStandalone(true);
+
+                TransformerFactory.newInstance().newTransformer().
+                        transform(new DOMSource(doc), new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test the simple case of including a document using xi:include within a
+     * xi:fallback using a DocumentBuilder.
+     */
+    @Test
+    public void testXIncludeFallbackDOMPos() {
+        String resultFile = CLASS_DIR + "doc_fallbackDOM.out";
+        String goldFile = GOLDEN_DIR + "doc_fallbackGold.xml";
+        String xmlFile = XML_DIR + "doc_fallback.xml";
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+
+                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+                doc.setXmlStandalone(true);
+                TransformerFactory.newInstance().newTransformer()
+                        .transform(new DOMSource(doc), new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test for xi:fallback where the fall back text is parsed as text. This
+     * test uses a nested xi:include for the fallback test.
+     */
+    @Test
+    public void testXIncludeFallbackTextPos() {
+        String resultFile = CLASS_DIR + "doc_fallback_text.out";
+        String goldFile = GOLDEN_DIR + "doc_fallback_textGold.xml";
+        String xmlFile = XML_DIR + "doc_fallback_text.xml";
+
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+
+                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+                doc.setXmlStandalone(true);
+                TransformerFactory.newInstance().newTransformer()
+                        .transform(new DOMSource(doc), new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test the XPointer element() framework with XInclude.
+     */
+    @Test
+    public void testXpointerElementPos() {
+        String resultFile = CLASS_DIR + "doc_xpointer_element.out";
+        String goldFile = GOLDEN_DIR + "doc_xpointerGold.xml";
+        String xmlFile = XML_DIR + "doc_xpointer_element.xml";
+
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+
+                DocumentBuilder db = dbf.newDocumentBuilder();
+
+                TransformerFactory.newInstance().newTransformer()
+                        .transform(new DOMSource(db.parse(new File(xmlFile))),
+                                new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test the XPointer framework with a SAX object.
+     */
+    @Test
+    public void testXPointerPos() {
+        String resultFile = CLASS_DIR + "doc_xpointer.out";
+        String goldFile = GOLDEN_DIR + "doc_xpointerGold.xml";
+        String xmlFile = XML_DIR + "doc_xpointer.xml";
+
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                SAXParserFactory spf = SAXParserFactory.newInstance();
+                spf.setNamespaceAware(true);
+                spf.setXIncludeAware(true);
+                spf.setFeature(FEATURE_NAME, true);
+                // parse the file
+                spf.newSAXParser().parse(new File(xmlFile), new XInclHandler(fos, null));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test if xi:include may reference the doc containing the include if the
+     * parse type is text.
+     */
+    @Test
+    public void testXIncludeLoopPos() {
+        String resultFile = CLASS_DIR + "doc_xinc_loops.out";
+        String goldFile = GOLDEN_DIR + "doc_xinc_loopGold.xml";
+        String xmlFile = XML_DIR + "doc_xinc_loops.xml";
+
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+                DocumentBuilder db = dbf.newDocumentBuilder();
+                Document doc = db.parse(new File(xmlFile));
+                doc.normalizeDocument();
+                doc.setXmlStandalone(true);
+
+                TransformerFactory.newInstance().newTransformer()
+                        .transform(new DOMSource(doc), new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Test if two non nested xi:include elements can include the same document
+     * with an xi:include statement.
+     */
+    @Test
+    public void testXIncludeNestedPos() {
+        String resultFile = CLASS_DIR + "schedule.out";
+        String goldFile = GOLDEN_DIR + "scheduleGold.xml";
+        String xmlFile = XML_DIR + "schedule.xml";
+
+        try{
+            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setXIncludeAware(true);
+                dbf.setNamespaceAware(true);
+
+                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+                doc.setXmlStandalone(true);
+                TransformerFactory.newInstance().newTransformer()
+                        .transform(new DOMSource(doc), new StreamResult(fos));
+            }
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyDOMErrorHandler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMError;
+
+/**
+ * Error handler for recording DOM processing error.
+ */
+public class MyDOMErrorHandler implements DOMErrorHandler {
+    /**
+     * flag shows if there is any error.
+     */
+    private volatile boolean errorOccured = false;
+
+    /**
+     * Set errorOcurred to true when an error occurs.
+     * @param error The error object that describes the error. This object
+     * may be reused by the DOM implementation across multiple calls to
+     * the handleError method.
+     * @return true that processing may continue depending on.
+     */
+    @Override
+    public boolean handleError (DOMError error) {
+        System.err.println( "ERROR" + error.getMessage());
+        System.err.println( "ERROR" + error.getRelatedData());
+        errorOccured = true;
+        return true;
+    }
+
+    /**
+     * Showing if any error was handled.
+     * @return true if there is one or more error.
+     *         false no error occurs.
+     */
+    public boolean isError() {
+        return errorOccured;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyDOMOutput.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import org.w3c.dom.ls.LSOutput;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * A Thread-safe LS output destination for DOM processing. LSOutput objects
+ * belong to the application. The DOM implementation will never modify them
+ * (though it may make copies and modify the copies, if necessary).
+ */
+public class MyDOMOutput implements LSOutput {
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream of bytes.
+     */
+    private OutputStream bytestream;
+
+    /**
+     * character encoding to use for the output.
+     */
+    private String encoding;
+
+    /**
+     * The system identifier.
+     */
+    private String sysId;
+
+    /**
+     * Writable stream to which 16-bit units can be output.
+     */
+    private Writer writer;
+
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream of bytes.
+     *
+     * @return a writable stream.
+     */
+    @Override
+    public OutputStream getByteStream() {
+        return bytestream;
+    }
+
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream to which 16-bit units can be output.
+     *
+     * @return writable stream instance.
+     */
+    @Override
+    public Writer getCharacterStream() {
+        return writer;
+    }
+
+    /**
+     * The character encoding to use for the output.
+     *
+     * @return the character encoding.
+     */
+    @Override
+    public String getEncoding() {
+        return encoding;
+    }
+
+    /**
+     * The system identifier for this output destination.
+     *
+     * @return system identifier.
+     */
+    @Override
+    public String getSystemId() {
+        return sysId;
+    }
+
+    /**
+     * Set writable stream of bytes.
+     *
+     * @param bs OutputStream instance
+     */
+    @Override
+    public void setByteStream(OutputStream bs) {
+        bytestream = bs;
+    }
+
+    /**
+     * Set 16 bits unit writable stream.
+     *
+     * @param bs a Writer instance
+     */
+    @Override
+    public void setCharacterStream(Writer cs) {
+        writer = cs;
+    }
+
+    /**
+     * Set character encoding to use for the output.
+     *
+     * @param encoding encoding set to the output
+     */
+    @Override
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    /**
+     * Set the system identifier for the output.
+     *
+     * @param sysId system identifier string.
+     */
+    @Override
+    public void setSystemId(String sysId) {
+        this.sysId = sysId;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyErrorHandler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * ErrorHandler for error handling. Set state if any method in error, warning
+ * or fatalError was called.
+ */
+public final class MyErrorHandler extends DefaultHandler {
+    /**
+     * Enumeration for ErrorHandler's state.
+     */
+    private enum STATE { ERROR, FATAL, WARNING, NORMAL};
+
+    /**
+     * Set state as normal by default.
+     */
+    private volatile STATE state = STATE.NORMAL;
+
+    /**
+     * Keep exception for further investigation.
+     */
+    private volatile SAXParseException exception;
+
+    /**
+     * Save exception and set state to ERROR.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void error (SAXParseException e) {
+        state = STATE.ERROR;
+        exception = e;
+    }
+
+    /**
+     * Save exception and set state to FATAL.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void fatalError (SAXParseException e) {
+        state = STATE.FATAL;
+        exception = e;
+    }
+
+    /**
+     * Save exception and set state to WARNING.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void warning (SAXParseException e) {
+        state = STATE.WARNING;
+        exception = e;
+    }
+
+    /**
+     * return ErrorHandle's state .
+     * @return true No error, fatalError and warning.
+     *         false there is any error, fatalError or warning in processing.
+     */
+    public boolean isAnyError() {
+        if (state != STATE.NORMAL)
+            System.out.println(exception);
+        return state != STATE.NORMAL;
+    }
+
+    /**
+     * return whether fatalError is the only error.
+     * @return true fatalError is the only error.
+     *         false there is no error, or other error besides fatalError.
+     */
+    public boolean isFatalError() {
+        if (state == STATE.FATAL)
+            System.out.println(exception);
+        return state == STATE.FATAL;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
+import static org.testng.Assert.assertFalse;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+import org.xml.sax.SAXException;
+import static test.auctionportal.HiBidConstants.CLASS_DIR;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
+/**
+ * This is the user controller class for the Auction portal HiBid.com.
+ */
+public class UserController {
+    /**
+     * Checking when creating an XML document using DOM Level 2 validating
+     * it without having a schema source or a schema location It must throw a
+     * sax parse exception.
+     */
+    @Test
+    public void testCreateNewUser() {
+        String resultFile = CLASS_DIR + "accountInfoOut.xml";
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            docBuilder.setErrorHandler(eh);
+
+            Document document = docBuilder.newDocument();
+
+            Element account = document.createElementNS(PORTAL_ACCOUNT_NS, "acc:Account");
+            Attr accountID = document.createAttributeNS(PORTAL_ACCOUNT_NS, "acc:accountID");
+            account.setAttributeNode(accountID);
+
+            account.appendChild(document.createElement("FirstName"));
+            account.appendChild(document.createElementNS(PORTAL_ACCOUNT_NS, "acc:LastName"));
+            account.appendChild(document.createElement("UserID"));
+
+            DOMImplementationLS impl
+                    = (DOMImplementationLS) DOMImplementationRegistry
+                            .newInstance().getDOMImplementation("LS");
+            LSSerializer writer = impl.createLSSerializer();
+            LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+            FileOutputStream output = new FileOutputStream(resultFile);
+            MyDOMOutput domOutput = new MyDOMOutput();
+
+            domOutput.setByteStream(output);
+            writer.write(account, domOutput);
+            docBuilder.parse(resultFile);
+
+            assertTrue(eh.isAnyError());
+        } catch (ParserConfigurationException | ClassNotFoundException |
+                InstantiationException | IllegalAccessException
+                | ClassCastException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Checking conflicting namespaces and use renameNode and normalizeDocument.
+     * @see <a href="content/accountInfo.xml">accountInfo.xml</a>
+     */
+    @Test
+    public void testAddUser() {
+        String resultFile = CLASS_DIR + "accountRole.out";
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            // Copy schema for outputfile
+            Files.copy(Paths.get(XML_DIR, "accountInfo.xsd"),
+                    Paths.get(CLASS_DIR, "accountInfo.xsd"),
+                    StandardCopyOption.REPLACE_EXISTING);
+            MyErrorHandler eh = new MyErrorHandler();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            docBuilder.setErrorHandler(eh);
+
+            Document document = docBuilder.parse(xmlFile);
+            Element sell = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Sell").item(0);
+            Element role = (Element) sell.getParentNode();
+
+            Element buy = (Element) document.renameNode(sell, PORTAL_ACCOUNT_NS, "acc:Buy");
+            role.appendChild(buy);
+
+            DOMImplementationLS impl
+                    = (DOMImplementationLS) DOMImplementationRegistry
+                            .newInstance().getDOMImplementation("LS");
+            LSSerializer writer = impl.createLSSerializer();
+
+
+            try(FileOutputStream output = new FileOutputStream(resultFile)) {
+                MyDOMOutput mydomoutput = new MyDOMOutput();
+                mydomoutput.setByteStream(output);
+                writer.write(document, mydomoutput);
+            }
+
+            docBuilder.parse(resultFile);
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException
+                | ClassNotFoundException | InstantiationException
+                | IllegalAccessException | ClassCastException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Checking Text content in XML file.
+     * @see <a href="content/accountInfo.xml">accountInfo.xml</a>
+     */
+    @Test
+    public void testMoreUserInfo() {
+        String xmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            System.out.println("Checking additional user info");
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            docBuilder.setErrorHandler(eh);
+
+            Document document = docBuilder.parse(xmlFile);
+            Element account = (Element)document
+                    .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+            String textContent = account.getTextContent();
+            assertTrue(textContent.trim().regionMatches(0, "Rachel", 0, 6));
+            assertEquals(textContent, "RachelGreen744");
+
+            Attr accountID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
+            assertTrue(accountID.getTextContent().trim().equals("1"));
+
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This will check if adoptNode works will adoptNode from
+     * @see <a href="content/userInfo.xml">userInfo.xml</a>
+     * @see <a href="content/accountInfo.xml">accountInfo.xml</a>. This is
+     * adopting a node from the XML file which is validated by a DTD and
+     * into an XML file which is validated by the schema This covers Row 5
+     * for the table
+     * http://javaweb.sfbay/~jsuttor/JSR206/jsr-206-html/ch03s05.html. Filed
+     * bug 4893745 because there was a difference in behavior
+     */
+    @Test
+    public void testCreateUserAccount() {
+        System.out.println("Creating user account");
+        String userXmlFile = XML_DIR + "userInfo.xml";
+        String accountXmlFile = XML_DIR + "accountInfo.xml";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            docBuilder.setErrorHandler(eh);
+
+            Document document = docBuilder.parse(userXmlFile);
+            Element user = (Element) document.getElementsByTagName("FirstName").item(0);
+            // Set schema after parsing userInfo.xml. Otherwise it will conflict
+            // with DTD validation.
+            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+            DocumentBuilder docBuilder1 = dbf.newDocumentBuilder();
+            docBuilder1.setErrorHandler(eh);
+            Document accDocument = docBuilder1.parse(accountXmlFile);
+
+            Element firstName = (Element) accDocument
+                    .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
+            Element adoptedAccount = (Element) accDocument.adoptNode(user);
+
+            Element parent = (Element) firstName.getParentNode();
+            parent.replaceChild(adoptedAccount, firstName);
+
+            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+            DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+            LSSerializer writer = impl.createLSSerializer();
+
+            MyDOMOutput mydomoutput = new MyDOMOutput();
+            mydomoutput.setByteStream(System.out);
+
+            writer.write(document, mydomoutput);
+            writer.write(accDocument, mydomoutput);
+
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException
+                | ClassNotFoundException | InstantiationException
+                | IllegalAccessException | ClassCastException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Checking for Row 8 from the schema table when setting the schemaSource
+     * without the schemaLanguage must report an error.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testUserError() throws IllegalArgumentException {
+        System.out.println("Creating an error in user account");
+
+        String xmlFile = XML_DIR + "userInfo.xml";
+        String schema = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+        String schemaValue = "http://dummy.com/dummy.xsd";
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            dbf.setAttribute(schema, schemaValue);
+
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            MyErrorHandler eh = new MyErrorHandler();
+            docBuilder.setErrorHandler(eh);
+            Document document = docBuilder.parse(xmlFile);
+            assertFalse(eh.isAnyError());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Checking for namespace normalization.
+     * @see <a href="content/screenName.xml">screenName.xml</a> has prefix of
+     * userName is bound to "http://hibid.com/user" namespace normalization
+     * will create a namespace of prefix us and attach userEmail.
+     */
+    @Test
+    public void testCheckScreenNameExists() {
+        String resultFile = CLASS_DIR + "screenName.out";
+        String xmlFile = XML_DIR + "screenName.xml";
+        String goldFile = GOLDEN_DIR + "screenNameGold.xml";
+
+        String nsTagName = "http://hibid.com/screenName";
+        String userNs = "http://hibid.com/user";
+
+        try (FileOutputStream output = new FileOutputStream(resultFile)) {
+            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+            DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+            LSSerializer writer = impl.createLSSerializer();
+            LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+            Document document = builder.parseURI(xmlFile);
+            NodeList nl = document.getElementsByTagNameNS(nsTagName, "screen-name");
+            assertEquals(nl.getLength(), 1);
+            Element screenName = (Element)nl.item(0);
+            Element userEmail = document.createElementNS(userNs, "userEmail");
+            assertTrue(userEmail.isDefaultNamespace(userNs));
+
+            Text email = document.createTextNode("myid@hibid.com");
+            userEmail.appendChild(email);
+            screenName.appendChild(userEmail);
+            document.normalizeDocument();
+
+            MyDOMOutput domoutput = new MyDOMOutput();
+            domoutput.setByteStream(output);
+            writer.write(document, domoutput);
+
+            assertTrue(compareDocumentWithGold(goldFile, resultFile));
+        } catch (ClassNotFoundException | InstantiationException
+                | IllegalAccessException | ClassCastException | IOException
+                | ParserConfigurationException | SAXException e) {
+            failUnexpected(e);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if (Files.exists(resultPath)) {
+                    Files.delete(resultPath);
+                }
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/XInclHandler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.stream.Collectors;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A SAX2 event handlers.
+ * This SAX2 ContentHandler receives callback event then print whole document
+ * that is parsed.
+ */
+public class XInclHandler extends DefaultHandler implements LexicalHandler {
+    /**
+     * Print writer.
+     */
+    private final PrintWriter fOut;
+
+    /**
+     * Canonical output.
+     */
+    private volatile boolean fCanonical;
+
+    /**
+     * Element depth.
+     */
+    private volatile int fElementDepth;
+
+    /**
+     * Sets whether output is canonical.
+     */
+    public void setCanonical(boolean canonical) {
+        fCanonical = canonical;
+    }
+
+    /**
+     * Sets the output stream for printing.
+     * @param stream OutputStream for message output.
+     * @param encoding File encoding for message output.
+     */
+    public XInclHandler(OutputStream stream, String encoding)
+            throws UnsupportedEncodingException {
+        // At least set one encoding.
+        if (encoding == null) {
+            encoding = "UTF8";
+        }
+
+        fOut = new PrintWriter(new OutputStreamWriter(stream, encoding), false);
+    }
+
+    /**
+     * Receive notification of the beginning of the document. Write the start
+     * document tag if it's not canonical mode.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        fElementDepth = 0;
+
+        if (!fCanonical) {
+            writeFlush("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        }
+    }
+
+    /**
+     * Receive notification of a processing instruction.
+     * @param target The processing instruction target.
+     * @param data The processing instruction data, or null if
+     *             none is supplied.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void processingInstruction (String target, String data)
+        throws SAXException {
+        if (fElementDepth > 0) {
+            StringBuilder instruction = new StringBuilder("<?").append(target);
+            if (data != null && data.length() > 0) {
+                instruction.append(' ').append(data);
+            }
+            instruction.append("?>");
+            writeFlush(instruction.toString());
+        }
+    }
+
+    /**
+     * Receive notification of the start of an element then write the normalized
+     * output to the file.
+     * @param uri The Namespace URI, or the empty string if the
+     *        element has no Namespace URI or if Namespace
+     *        processing is not being performed.
+     * @param localName The local name (without prefix), or the
+     *        empty string if Namespace processing is not being
+     *        performed.
+     * @param qName The qualified name (with prefix), or the
+     *        empty string if qualified names are not available.
+     * @param attributes The attributes attached to the element.  If
+     *        there are no attributes, it shall be an empty
+     *        Attributes object.
+     */
+    @Override
+    public void startElement(String uri, String local, String raw,
+            Attributes attrs) throws SAXException {
+        fElementDepth++;
+        StringBuilder start = new StringBuilder().append('<').append(raw);
+        if (attrs != null) {
+            for (int i = 0; i < attrs.getLength(); i++) {
+                start.append(' ').append(attrs.getQName(i)).append("=\"").
+                    append(normalizeAndPrint(attrs.getValue(i))).append('"');
+            }
+        }
+        start.append('>');
+        writeFlush(start.toString());
+    }
+
+    /**
+     * Receive notification of character data inside an element and write
+     * normalized characters to file.
+     * @param ch The characters.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void characters(char ch[], int start, int length)
+            throws SAXException {
+        writeFlush(normalizeAndPrint(ch, start, length));
+    }
+
+    /**
+     * Receiving notification of ignorable whitespace in element content and
+     * writing normalized ignorable characters to file.
+     * @param ch The characters.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void ignorableWhitespace(char ch[], int start, int length)
+            throws SAXException {
+        characters(ch, start, length);
+    }
+
+    /**
+     * Receive notification of the end of an element and print end element.
+     *
+     * @param uri The Namespace URI, or the empty string if the
+     *        element has no Namespace URI or if Namespace
+     *        processing is not being performed.
+     * @param localName The local name (without prefix), or the
+     *        empty string if Namespace processing is not being
+     *        performed.
+     * @param qName The qualified name (with prefix), or the
+     *        empty string if qualified names are not available.
+     */
+    @Override
+    public void endElement(String uri, String local, String raw)
+            throws SAXException {
+        fElementDepth--;
+        writeFlush("</" + raw + ">");
+    }
+
+    /**
+     * Receive notification of a parser warning and print it out.
+     * @param e The warning information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void warning(SAXParseException ex) throws SAXException {
+        printError("Warning", ex);
+    }
+
+    /**
+     * Receive notification of a parser error and print it out.
+     * @param e The error information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+
+     */
+    @Override
+    public void error(SAXParseException ex) throws SAXException {
+        printError("Error", ex);
+    }
+
+    /**
+     * Receive notification of a parser fatal error. Throw out fatal error
+     * following print fatal error message.
+     * @param e The fatal error information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+
+     */
+    @Override
+    public void fatalError(SAXParseException ex) throws SAXException {
+        printError("Fatal Error", ex);
+        throw ex;
+    }
+
+    /**
+     * Do nothing on start DTD.
+     * @param name The document type name.
+     * @param publicId The declared public identifier for the
+     *        external DTD subset, or null if none was declared.
+     * @param systemId The declared system identifier for the
+     *        external DTD subset, or null if none was declared.
+     *        (Note that this is not resolved against the document
+     *        base URI.)
+     * @exception SAXException The application may raise an
+     *            exception.
+     */
+    @Override
+    public void startDTD(String name, String publicId, String systemId)
+        throws SAXException {
+    }
+
+    /**
+     * Do nothing on end DTD.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endDTD() throws SAXException {
+    }
+
+    /**
+     * Do nothing on start entity.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%', and if it is the
+     *        external DTD subset, it will be "[dtd]".
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void startEntity(String name) throws SAXException {
+    }
+
+    /**
+     * Do nothing on end entity.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%', and if it is the
+     *        external DTD subset, it will be "[dtd]".
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endEntity(String name) throws SAXException {
+    }
+
+    /**
+     * Do nothing on start CDATA section.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void startCDATA() throws SAXException {
+    }
+
+    /**
+     * Do nothing on end CDATA section.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endCDATA() throws SAXException {
+    }
+
+    /**
+     * Report an normalized XML comment when receive a comment in the document.
+     *
+     * @param ch An array holding the characters in the comment.
+     * @param start The starting position in the array.
+     * @param length The number of characters to use from the array.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void comment(char ch[], int start, int length) throws SAXException {
+        if (!fCanonical && fElementDepth > 0) {
+            writeFlush("<!--" + normalizeAndPrint(ch, start, length) + "-->");
+        }
+    }
+
+    /**
+     * Normalizes and prints the given string.
+     * @param s String to be normalized
+     */
+    private String normalizeAndPrint(String s) {
+        return s.chars().mapToObj(c -> normalizeAndPrint((char)c)).
+                collect(Collectors.joining());
+    }
+
+    /**
+     * Normalizes and prints the given array of characters.
+     * @param ch The characters to be normalized.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     */
+    private String normalizeAndPrint(char[] ch, int offset, int length) {
+        return normalizeAndPrint(new String(ch, offset, length));
+    }
+
+    /**
+     * Normalizes given character.
+     * @param c char to be normalized.
+     */
+    private String normalizeAndPrint(char c) {
+        switch (c) {
+            case '<':
+                return "&lt;";
+            case '>':
+                return "&gt;";
+            case '&':
+                return "&amp;";
+            case '"':
+                return "&quot;";
+            case '\r':
+            case '\n':
+                return fCanonical ? "&#" + Integer.toString(c) + ";" : String.valueOf(c);
+            default:
+                return String.valueOf(c);
+        }
+    }
+
+    /**
+     * Prints the error message.
+     * @param type error type
+     * @param ex exception that need to be printed
+     */
+    private void printError(String type, SAXParseException ex) {
+        System.err.print("[" + type + "] ");
+        String systemId = ex.getSystemId();
+        if (systemId != null) {
+            int index = systemId.lastIndexOf('/');
+            if (index != -1)
+                systemId = systemId.substring(index + 1);
+            System.err.print(systemId);
+        }
+        System.err.print(':' + ex.getLineNumber());
+        System.err.print(':' + ex.getColumnNumber());
+        System.err.println(": " + ex.getMessage());
+        System.err.flush();
+    }
+
+    /**
+     * Write out and flush.
+     * @param out string to be written.
+     */
+    private void writeFlush(String out) {
+        fOut.print(out);
+        fOut.flush();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/accountInfo.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" ?>
+<acc:Account xmlns="http://www.auctionportal.org/Accounts"
+         xmlns:acc="http://www.auctionportal.org/Accounts"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://www.auctionportal.org/Accounts accountInfo.xsd" acc:accountID="1">
+
+   <FirstName>Rachel</FirstName>
+   <LastName>Green</LastName>
+   <UserID>744</UserID>
+   <Role><Sell/></Role>
+</acc:Account>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/accountInfo.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://www.auctionportal.org/Accounts"
+           xmlns:acc="http://www.auctionportal.org/Accounts"
+           xmlns="http://www.auctionportal.org/Accounts" elementFormDefault="qualified">
+
+<xs:element name="Account">
+  <xs:complexType>
+    <xs:sequence>
+       <xs:element name="FirstName" type ="xs:string"/>
+       <xs:element name="MiddleInitial" type ="xs:string" minOccurs="0"/>
+       <xs:element ref="LastName"/>
+
+       <!-- This is to associate the account with the screenName
+            later will work on uniqueness with identity constraints
+            importing/including this schema in another one
+            -->
+       <xs:element name="UserID" type ="xs:nonNegativeInteger" />
+       <xs:element name="Role" type ="BuyOrSell" minOccurs="0" maxOccurs="1" />
+
+       <!-- This  may not make sense but this is to test the date -->
+       <xs:element name="DateOfBirth" type ="DateType" minOccurs="0" maxOccurs="1" />
+       <xs:element name="EmailQname" type ="xs:QName" minOccurs="0" maxOccurs="1" />
+       <xs:element name="AptNo" type ="xs:unsignedShort" minOccurs="0" maxOccurs="1" />
+       <xs:element name="StreetNo" type ="xs:short" minOccurs="0" maxOccurs="1" />
+    </xs:sequence>
+   <xs:attribute ref="accountID"/> 
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="LastName" type ="xs:string"/>
+
+<!-- The accountID is same as UserID This is just to check how
+   global attributes are treated-->
+<xs:attribute name="accountID" type="xs:integer"/>
+
+<xs:complexType name="BuyOrSell">
+  <xs:choice>
+     <xs:element name="Buy" type="PlaceHolder"/>
+     <xs:element name="Sell" type="PlaceHolder"/>
+  </xs:choice>
+</xs:complexType>
+
+<!-- an empty complex type declared globally-->
+<xs:complexType name="PlaceHolder">
+</xs:complexType>
+
+
+<!-- This may all not make too much sense 
+     but just to  check the date features of schema-->
+<xs:complexType name="DateType">
+  <xs:sequence>
+  <!--<xs:all>-->
+     <xs:element name="YearMonth" type="xs:gYearMonth"/>
+     <xs:element name="MonthDay" type="xs:gMonthDay"/>
+     <xs:element name="Date" type="xs:date"/>
+  <!--</xs:all>-->
+  </xs:sequence>
+</xs:complexType>
+
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/activity.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?>
+<activity id="1" >
+ <name>Code</name>
+ <description>Some description</description>
+</activity>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/bookInfo.dtd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,13 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ELEMENT xmlns:pages (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY ws "Walter Sam Communications">
+<!ENTITY af "Alfred publication">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/bookInfo.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,25 @@
+<?xml version="1.0" standalone="no" ?>
+<!DOCTYPE document SYSTEM "bookInfo.dtd">
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	&ws; 
+	15535 Morrison
+	South Oaks CA 91403
+	</publisher>
+
+	<book price="$100" author = "Herold" number = "no_11"> 
+		eXtensible Markup Language 
+	</book>
+
+  	<bookurn xmlns='urn:loc.gov:books'
+        	   xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+	<xmlns:pages />
+
+	Publishers are not noted in report by time.
+
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/coins.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<im:coin 
+     xmlns:im="http://www.hibid.com/items" 
+     xmlns="http://www.hibid.com/items" 
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xmlns:it="http://someimport.com">
+  <im:description> 
+    <im:info> 1950 gold coin
+    </im:info>
+  </im:description>
+  <dates_data xmlns="http://www.hibid.com/items">
+     <it:mint>1950-04-04T00:00:00</it:mint>
+     <it:circulation> 1960
+     </it:circulation>
+  </dates_data>
+</im:coin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/coins.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://www.hibid.com/items"
+           xmlns="http://www.hibid.com/items"
+           xmlns:im="http://someimport.com"
+           elementFormDefault="qualified"
+           xmlns:it="http://www.hibid.com/items" >
+
+        <xs:import schemaLocation="coinsImportMe.xsd" namespace="http://someimport.com"/>
+
+          
+
+        <xs:element name="coin">
+           <xs:complexType>
+              <xs:sequence>
+	         <xs:element name="description" type="it:description" />
+	         <xs:element name="dates_data" type="im:dates_data" />
+              </xs:sequence>
+	   </xs:complexType>
+  	</xs:element>
+
+           <xs:complexType name="description">
+              <xs:sequence>
+	         <xs:element name="info" type="xs:string" />
+              </xs:sequence>
+	   </xs:complexType>
+
+
+          <xs:simpleType name="yearType">
+           <xs:restriction base="xs:int">
+              <xs:enumeration value="1930" />
+              <xs:enumeration value="1949" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:element name="YearInfo">
+           <xs:complexType>
+              <xs:sequence>
+                 <xs:element name="reMintYear" type="yearType" />
+              </xs:sequence>
+           </xs:complexType>
+        </xs:element>
+
+
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/coinsImportMe.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://someimport.com"
+           xmlns="http://someimport.com"
+           elementFormDefault="qualified"
+           xmlns:im="http://someimport.com" >
+
+
+          <xs:complexType name="dates_data">
+           <xs:sequence>
+                 <xs:element name="mint" type="xs:dateTime" />
+                 <xs:element name="circulation" type="xs:string" />
+           </xs:sequence>
+          </xs:complexType>
+
+          <xs:complexType name="designer">
+           <xs:sequence>
+                 <xs:element name="name" type="xs:string" />
+           </xs:sequence>
+          </xs:complexType>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/data.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,18 @@
+<?xml version='1.0'?>
+<data id="employee">
+   <employee id="employee">
+      <name>timepass</name>
+      <sex>M</sex>
+      <age>10</age>
+      <complexion>Fair</complexion>
+      <figure>36-28-36</figure>
+    </employee>
+    <employee>
+      <name>COOOOL</name>
+      <sex>F</sex>
+      <age>20</age>
+      <complexion>Dark</complexion>
+      <figure>26-32-26</figure>
+    </employee>
+</data>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_fallback.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,11 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "task.xml" resource:</p>
+	<example>
+            <xi:include href="task.xml" parse="xml">
+                <xi:fallback >
+                    <xi:include href="fallback.xml" parse="xml" />
+                </xi:fallback>
+            </xi:include>
+        </example>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_fallback_text.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,11 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "tasks.xml" resource:</p>
+	<example>
+            <xi:include href="task.xml" parse="xml">
+                <xi:fallback >
+                    <xi:include href="fallback_text.xml" parse="text" />
+                </xi:fallback>
+            </xi:include>
+        </example>
+</document>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_xinc_loops.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the outer XML file</p>
+	<example>
+            
+                <xi:include href="task.xml" parse="xml">
+                    <xi:fallback>
+                        <xi:include href="doc_xinc_loops.xml" parse="text" />
+                    </xi:fallback>
+                </xi:include>
+        </example>
+</root>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_xinclude.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "data.xml" resource:</p>
+	<example><xi:include href="tasks.xml" parse="xml"/></example>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_xpointer.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "tasks.xml" resource:</p>
+	<example><xi:include href="tasks.xml" xpointer="element(/1/2/1)" parse="xml"/></example>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/doc_xpointer_element.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "tasks.xml" resource:</p>
+	<example><xi:include href="tasks.xml" xpointer="element(/1/2/1)" parse="xml"/></example>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/document_xinclude.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "data.xml" resource:</p>
+	<example><xi:include href="data.xml" parse="xml"/></example>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/entity.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : entity.xml
+    Created on : August 6, 2003, 5:39 PM
+    Author     : Prasad Subramanian
+    Description:
+        To create a base XML document to test the entiity expansion limit
+-->
+<!DOCTYPE status[
+<!ENTITY firstEntity "fe">
+<!ENTITY secondEntity "&firstEntity;&firstEntity;" >
+<!ENTITY thirdEntity "&secondEntity;&secondEntity;" >
+<!ENTITY fourthEntity "&thirdEntity;&thirdEntity;" >
+<!ENTITY fifthEntity "&fourthEntity;&fourthEntity;" >
+<!-- <!ENTITY sixthEntity "&fifthEntity;&fifthEntity;">
+<!ENTITY seventhEntity "&sixthEntity;&sixthEntity;" >
+<!ENTITY eighthEntity "&seventhEntity;&seventhEntity;" >
+<!ENTITY ninthEntity "&eighthEntity;&eighthEntity;" >
+<!ENTITY tenthEntity "&ninthEntity;&ninthEntity;" >
+<!ENTITY eleventhEntity "&tenthEntity;&tenthEntity;"> -->
+]>
+<report>
+    <tests>
+        <test>  
+            <id>Test Id</id>
+            <name>Test Name</name>
+            <description>My Desc</description>
+            <status>&fifthEntity;</status>
+        </test>
+     </tests>
+</report>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/fallback.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fallback> This is the fallback text </fallback>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/fallback_text.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,1 @@
+This is the fallback text as a text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/inclusion.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<activities xmlns:xi="http://www.w3.org/2001/XInclude" >
+    <xi:include href="activity.xml" parse="xml" />
+</activities>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/itemsDuration.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+
+<item xmlns="http://www.hibid.com/items" itemID="i1" name="Warn Bros Pitcher" category="other" country="US">
+   <description> 20th century vase. Really unique . Really antique</description>
+   <ownerID>2</ownerID>
+   <sellStartDateTime> 2002-03-11T15:23:45</sellStartDateTime>
+   <sellStartDate> 2002-03-11</sellStartDate>
+   <sellStartTime> 15:23:45</sellStartTime>
+   <sellDuration>P365D</sellDuration>
+   <bidderID>a2</bidderID>
+   <bidPrice></bidPrice>
+   <elapsedTime></elapsedTime>
+
+</item>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/movies.xml.data	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
+<Collection>
+    <movies>
+        <movie>
+            <name>&#2720;&#2709;&#2724;</name>
+            <director>Vipul Shah</director>
+            <country>Indian</country>
+            <language>Gujarati</language>
+            <releaseDate>1997-03-02-08:00</releaseDate>
+        </movie>
+    </movies>
+</Collection>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/novels.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns="www.novels.com"
+xsi:schemaLocation=""www.novels.com" novels.xsd" >
+
+
+
+<xs:element name="novel" type="novelType" />
+
+<xs:complexType name="novelType">
+  <xs:sequence maxOccurs ="3" minOccurs="1">
+    <xs:element name="mystery" type="xs:string"/>
+    <xs:element name="links" type="linksType"/>
+  </xs:sequence>
+</xs:complexType>
+
+<xs:simpleType name="linksType">
+  <xs:restriction base="xs:anyURI">
+    <xs:enumeration value="http://www.links.com"/>
+    <xs:enumeration value="http://www.mystery.com"/>
+    <xs:enumeration value="http://www.hitchcock.com"/>
+  </xs:restriction>
+</xs:simpleType>
+
+</xs:schema>
+           
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/novelsInvalid.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<novel>
+   <mystery>Mystery of Whispering Mummy</mystery>
+   <links>http://www.links.com </links>
+
+   <mystery>Mystery of Vanishing Treasure</mystery>
+   <links>http://www.alfrdhitchcock.com </links>
+</novel>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/schedule.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schedule xmlns:xi="http://www.w3.org/2001/XInclude" >
+    <task xmlns:xi="http://www.w3.org/2001/XInclude">
+        <xi:include href="inclusion.xml" parse="xml" />
+    </task>
+    <task xmlns:xi="http://www.w3.org/2001/XInclude">
+        <xi:include href="inclusion.xml" parse="xml" />
+    </task>
+</schedule>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/screenName.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+
+<us:screen-names xmlns:us="http://hibid.com/screenName">
+                xmlns="http://hibid.com/screenName">
+  <us:screen-name>
+  <us:userName xmlns:us="http://hibid.com/user"> tom  </us:userName>
+  <userNo>10 </userNo>
+  </us:screen-name>
+</us:screen-names>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/tasks.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<tasks>
+    <task id="task1" >
+        <owner>John doe</owner>
+        <startdate>10/02/2003</startdate>
+        <enddate>11/02/2003</enddate>
+        <description>This is task 1</description>
+    </task>
+    <task id="task2" >
+        <owner>Jane Doe</owner>
+        <startdate>10/02/2003</startdate>
+        <enddate>11/02/2003</enddate>
+        <description>This is task 2</description>
+    </task>    
+</tasks>    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/toys.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : toys.xml
+    Created on : August 11, 2003, 6:42 PM
+    Author     : Prasad Subramanian
+    Description:
+-->
+
+<toys>
+    <toy>
+        <name>Lego-Model01</name>
+        <price>65.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model2</name>
+        <price>69.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model3</name>
+        <price>14.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Pink</name>
+        <price>12.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Blue</name>
+        <price>13.99</price>
+    </toy>        
+    <toy>
+        <name>Barbie-White</name>
+        <price>13.99</price>
+    </toy>   
+    <toy>
+        <name>Barbie-Plain</name>
+        <price>13.99</price>
+    </toy>           
+</toys>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/toys.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="toys">
+     <xs:complexType>
+       <xs:sequence>
+         <xs:element name="toy" maxOccurs="200">
+           <xs:complexType>
+             <xs:sequence>
+               <xs:element name="name" type="xs:string" minOccurs="0"/>
+               <xs:element name="price" type="xs:string" minOccurs="0"/>
+             </xs:sequence>
+          </xs:complexType>  
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>  
+  </xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/userAddress.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://www.hibid.com/useraccount"
+           xmlns="http://www.hibid.com/useraccount"
+           xmlns:user="http://www.hibid.com/useraccount" elementFormDefault="qualified">
+
+
+
+        <xs:complexType name="AddressType">
+           <xs:sequence>
+              <xs:element name="StreetInfo" type="xs:string" />
+           </xs:sequence>
+        </xs:complexType>
+
+
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/userDetails.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<user xmlns="http://www.hibid.com/useraccount"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://www.hibid.com/useraccount userDetails.xsd  http://www.hibid.com/useraccount userAddress.xsd">
+  <Name>Bob </Name>
+  <addresses>
+    <homeAddress>
+      <StreetInfo>555 Beverly Hills Rd
+      </StreetInfo>
+    </homeAddress>
+  </addresses>
+
+</user>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/userDetails.xsd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding = "utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://www.hibid.com/useraccount"
+           xmlns="http://www.hibid.com/useraccount"
+           xmlns:user="http://www.hibid.com/useraccount" elementFormDefault="qualified" >
+
+        <xs:include schemaLocation="userAddress.xsd"/>
+
+        <xs:simpleType name="charType">
+           <xs:restriction base="xs:NCName">
+              <xs:minLength value="1" />
+              <xs:maxLength value="1" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:simpleType name="_2CharsType">
+           <xs:restriction base="xs:string">
+              <xs:length value="2" fixed="true"/>
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:simpleType name="_3digits">
+           <xs:restriction base="xs:string">
+              <xs:pattern value="[0-9]{3}" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:simpleType name="_7digits">
+           <xs:restriction base="xs:string">
+              <xs:pattern value="[0-9]{7}" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:complexType name="EmptyElement" />
+
+
+        <!-- *************************************
+             ***       phone number type      ****
+             *************************************
+        -->
+        <xs:complexType name="international_AreaCode_Type">
+           <xs:sequence>
+              <xs:element name="countryCode" type="_3digits"/>
+              <xs:element name="areaCode" type="_3digits"/>
+           </xs:sequence>
+        </xs:complexType>
+
+        <xs:complexType name="us_AreaCode_Type">
+           <xs:sequence>
+              <xs:element name="areaCode" type="_3digits"/>
+           </xs:sequence>
+        </xs:complexType>
+
+        <xs:complexType name="us_phonenumber_type">
+           <xs:complexContent>
+              <xs:extension base="us_AreaCode_Type">
+                 <xs:sequence>
+                    <xs:element name="localNumber" type="_7digits"/>
+                 </xs:sequence>
+              </xs:extension>
+           </xs:complexContent>
+        </xs:complexType>
+
+        <xs:complexType name="international_phonenumber_type">
+           <xs:complexContent>
+              <xs:extension base="international_AreaCode_Type">
+                 <xs:sequence>
+                    <xs:element name="localNumber" type="_7digits"/>
+                 </xs:sequence>
+              </xs:extension>
+           </xs:complexContent>
+        </xs:complexType>
+
+        <!-- *************************************
+             ***       address type             ****
+             *************************************
+        -->
+        <xs:simpleType name="stateAbrvType">
+           <xs:restriction base="_2CharsType">
+              <xs:pattern value="[A-Z]" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:simpleType name="us_zipCodeType">
+           <xs:restriction base="xs:string">
+              <xs:pattern value="[0-9]{5}(-[0-9]{4})?" />
+           </xs:restriction>
+        </xs:simpleType>
+
+        <xs:simpleType name="state.zip_type">
+           <xs:union memberTypes="stateAbrvType us_zipCodeType"/>
+        </xs:simpleType>
+
+        <xs:simpleType name="CityInfo_type">
+           <xs:restriction base="xs:normalizedString">
+              <xs:whiteSpace value="collapse" />
+           </xs:restriction>
+        </xs:simpleType>
+
+
+        <!-- *************************************
+             ***       user             ****
+             *************************************
+        -->
+        <xs:element name="user">
+           <xs:complexType>
+              <xs:sequence>
+		 <xs:element name="Name" type="xs:string" minOccurs="0" />
+		 
+
+		 <xs:element name="addresses">
+		    <xs:complexType>
+	               <xs:sequence>
+		          <xs:element name="homeAddress" type="AddressType"/>
+	               </xs:sequence>
+	            </xs:complexType>
+	         </xs:element>
+             </xs:sequence>
+
+
+	   </xs:complexType>
+  	</xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/userInfo.dtd	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+<!ELEMENT userInfo (user+)>
+<!ELEMENT user (FirstName,LastName,UserID)>
+<!ELEMENT FirstName (#PCDATA)>
+<!ELEMENT LastName (#PCDATA)>
+<!ELEMENT UserID (#PCDATA)>
+<!ATTLIST user accountID CDATA "100">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/content/userInfo.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,12 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE userInfo SYSTEM "userInfo.dtd">
+<userInfo>
+   <user accountID="a111">
+      <FirstName>King
+      </FirstName>
+      <LastName>Kong
+      </LastName>
+      <UserID>007
+      </UserID>
+   </user>
+</userInfo>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/doc_fallbackGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?><document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "task.xml" resource:</p>
+	<example>
+            
+                    <fallback xml:base="fallback.xml"> This is the fallback text </fallback>
+                
+        </example>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/doc_fallback_textGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "tasks.xml" resource:</p>
+	<example>
+            
+                    This is the fallback text as a text
+
+                
+        </example>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/doc_xinc_loopGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the outer XML file</p>
+	<example>
+            
+                
+                        &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;root xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
+	&lt;p&gt;The following is the outer XML file&lt;/p&gt;
+	&lt;example&gt;
+            
+                &lt;xi:include href="task.xml" parse="xml"&gt;
+                    &lt;xi:fallback&gt;
+                        &lt;xi:include href="doc_xinc_loops.xml" parse="text" /&gt;
+                    &lt;/xi:fallback&gt;
+                &lt;/xi:include&gt;
+        &lt;/example&gt;
+&lt;/root&gt;
+
+
+                    
+        </example>
+</root>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/doc_xincludeGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding="UTF-8"?><document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the &quot;data.xml&quot; resource:</p>
+	<example><tasks xml:base="tasks.xml">
+    <task id="task1" >
+        <owner>John doe</owner>
+        <startdate>10/02/2003</startdate>
+        <enddate>11/02/2003</enddate>
+        <description>This is task 1</description>
+    </task>
+    <task id="task2" >
+        <owner>Jane Doe</owner>
+        <startdate>10/02/2003</startdate>
+        <enddate>11/02/2003</enddate>
+        <description>This is task 2</description>
+    </task>    
+</tasks></example>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/doc_xpointerGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><document xmlns:xi="http://www.w3.org/2001/XInclude">
+	<p>The following is the source of the "tasks.xml" resource:</p>
+	<example><owner xml:base="tasks.xml">Jane Doe</owner></example>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/scheduleGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?><schedule xmlns:xi="http://www.w3.org/2001/XInclude">
+    <task>
+        <activities xml:base="inclusion.xml">
+    <activity id="1" xml:base="activity.xml">
+ <name>Code</name>
+ <description>Some description</description>
+</activity>
+</activities>
+    </task>
+    <task>
+        <activities xml:base="inclusion.xml">
+    <activity id="1" xml:base="activity.xml">
+ <name>Code</name>
+ <description>Some description</description>
+</activity>
+</activities>
+    </task>
+</schedule>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/golden/screenNameGold.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<us:screen-names xmlns:us="http://hibid.com/screenName">
+                xmlns="http://hibid.com/screenName">
+  <us:screen-name>
+  <us:userName xmlns:us="http://hibid.com/user"> tom  </us:userName>
+  <userNo>10 </userNo>
+  <userEmail xmlns="http://hibid.com/user">myid@hibid.com</userEmail></us:screen-name>
+</us:screen-names>
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,11 +22,23 @@
  */
 package jaxp.library;
 
-
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.UnsupportedCharsetException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import static org.testng.Assert.fail;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
 
 /**
  * This is an interface provide basic support for JAXP functional test.
@@ -59,6 +71,22 @@
     public static final String TEMP_DIR = System.getProperty("java.io.tmpdir", ".");
 
     /**
+     * BOM table for storing BOM header.
+     */
+    private final static Map<String, byte[]> bom = new HashMap();
+
+    /**
+     * Initialize all BOM headers.
+     */
+    static {
+        bom.put("UTF-8", new byte[]{(byte)0xEF, (byte) 0xBB, (byte) 0xBF});
+        bom.put("UTF-16BE", new byte[]{(byte)0xFE, (byte)0xFF});
+        bom.put("UTF-16LE", new byte[]{(byte)0xFF, (byte)0xFE});
+        bom.put("UTF-32BE", new byte[]{(byte)0x00, (byte)0x00, (byte)0xFE, (byte)0xFF});
+        bom.put("UTF-32LE", new byte[]{(byte)0xFF, (byte)0xFE, (byte)0x00, (byte)0x00});
+    }
+
+    /**
      * Compare contents of golden file with test output file line by line.
      * return true if they're identical.
      * @param goldfile Golden output file name
@@ -75,6 +103,63 @@
     }
 
     /**
+     * Compare contents of golden file with test output file by their document
+     * representation.
+     * Here we ignore the white space and comments. return true if they're
+     * lexical identical.
+     * @param goldfile Golden output file name.
+     * @param resultFile Test output file name.
+     * @return true if two file's document representation are identical.
+     *         false if two file's document representation are not identical.
+     * @throws javax.xml.parsers.ParserConfigurationException if the
+     *         implementation is not available or cannot be instantiated.
+     * @throws SAXException If any parse errors occur.
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read .
+     */
+    public static boolean compareDocumentWithGold(String goldfile, String resultFile)
+            throws ParserConfigurationException, SAXException, IOException {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setCoalescing(true);
+        factory.setIgnoringElementContentWhitespace(true);
+        factory.setIgnoringComments(true);
+        DocumentBuilder db = factory.newDocumentBuilder();
+
+        Document goldD = db.parse(Paths.get(goldfile).toFile());
+        goldD.normalizeDocument();
+        Document resultD = db.parse(Paths.get(resultFile).toFile());
+        resultD.normalizeDocument();
+        return goldD.isEqualNode(resultD);
+    }
+    /**
+     * Convert stream to ByteArrayInputStream by given character set.
+     * @param charset target character set.
+     * @param file a file that contains no BOM head content.
+     * @return a ByteArrayInputStream contains BOM heads and bytes in original
+     *         stream
+     * @throws IOException I/O operation failed or unsupported character set.
+     */
+    public static InputStream bomStream(String charset, String file)
+            throws IOException {
+        String localCharset = charset;
+        if (charset.equals("UTF-16") || charset.equals("UTF-32")) {
+            localCharset
+                += ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN ? "BE" : "LE";
+        }
+        if (!bom.containsKey(localCharset))
+            throw new UnsupportedCharsetException("Charset:" + localCharset);
+
+        byte[] content = Files.readAllLines(Paths.get(file)).stream().
+                collect(Collectors.joining()).getBytes(localCharset);
+        byte[] head = bom.get(localCharset);
+        ByteBuffer bb = ByteBuffer.allocate(content.length + head.length);
+        bb.put(head);
+        bb.put(content);
+        return new ByteArrayInputStream(bb.array());
+    }
+
+    /**
      * Prints error message if an exception is thrown
      * @param ex The exception is thrown by test.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.auctionportal;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
+/**
+ * This is the Base test class provide basic support for Auction portal test.
+ */
+public class HiBidConstants {
+    /**
+     * Current test directory.
+     */
+    public static final String CLASS_DIR
+            = System.getProperty("test.classes", ".") + FILE_SEP;
+
+    /**
+     * Package name that separates by slash.
+     */
+    public static final String PACKAGE_NAME = FILE_SEP +
+            HiBidConstants.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
+
+
+    /**
+     * Java source directory.
+     */
+    public static final String SRC_DIR = System.getProperty("test.src", USER_DIR)
+            .replaceAll("\\" + System.getProperty("file.separator"), "/")
+                + PACKAGE_NAME + FILE_SEP;
+
+    /**
+     * Source XML file directory.
+     */
+    public static final String XML_DIR = SRC_DIR + "content" + FILE_SEP;
+
+    /**
+     * Golden output file directory.
+     * We pre-define all expected output in golden output file.  Test verifies
+     * whether the standard output is same as content of golden file.
+     */
+    public static final String GOLDEN_DIR = SRC_DIR + "golden" + FILE_SEP;
+
+    /**
+     * Name space for account operation.
+     */
+    public static final String PORTAL_ACCOUNT_NS = "http://www.auctionportal.org/Accounts";
+}
--- a/jaxws/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/jaxws/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -283,3 +283,5 @@
 afe0c89e2edbdfb1a7ceff3d9b3ff46c4186202f jdk9-b35
 84803c3be7f79d29c7dc40749d7743675f64107a jdk9-b36
 90de6ecbff46386a3f9d6f7ca876e7aa6381f50a jdk9-b37
+dd4ba422dba858b1c3c4b38f49a3e514be4e2790 jdk9-b38
+381bad1174c7c27352bee604535332da4ee2c556 jdk9-b39
--- a/jdk/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 e549291a0227031310fa91c574891f892d27f959 jdk9-b35
 cdcf2e599e42935c2d1d19a24bb19e808aeb43b5 jdk9-b36
 27c3345d6dce39a22c262f30bb1f0e0b00c3709e jdk9-b37
+d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
+ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,12 +29,10 @@
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.AccessControlContext;
 import java.security.CodeSource;
-import java.security.Policy;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
@@ -54,7 +52,6 @@
 import sun.misc.CompoundEnumeration;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
-import sun.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
@@ -268,8 +265,8 @@
 
     // The packages defined in this class loader.  Each package name is mapped
     // to its corresponding Package object.
-    // @GuardedBy("itself")
-    private final HashMap<String, Package> packages = new HashMap<>();
+    private final ConcurrentHashMap<String, Package> packages
+            = new ConcurrentHashMap<>();
 
     private static Void checkCreateClassLoader() {
         SecurityManager security = System.getSecurityManager();
@@ -1575,17 +1572,17 @@
                                     String implVendor, URL sealBase)
         throws IllegalArgumentException
     {
-        synchronized (packages) {
-            Package pkg = getPackage(name);
-            if (pkg != null) {
-                throw new IllegalArgumentException(name);
-            }
-            pkg = new Package(name, specTitle, specVersion, specVendor,
-                              implTitle, implVersion, implVendor,
-                              sealBase, this);
-            packages.put(name, pkg);
-            return pkg;
+        Package pkg = getPackage(name);
+        if (pkg != null) {
+            throw new IllegalArgumentException(name);
         }
+        pkg = new Package(name, specTitle, specVersion, specVendor,
+                          implTitle, implVersion, implVendor,
+                          sealBase, this);
+        if (packages.putIfAbsent(name, pkg) != null) {
+            throw new IllegalArgumentException(name);
+        }
+        return pkg;
     }
 
     /**
@@ -1601,26 +1598,13 @@
      * @since  1.2
      */
     protected Package getPackage(String name) {
-        Package pkg;
-        synchronized (packages) {
-            pkg = packages.get(name);
-        }
+        Package pkg = packages.get(name);
         if (pkg == null) {
             if (parent != null) {
                 pkg = parent.getPackage(name);
             } else {
                 pkg = Package.getSystemPackage(name);
             }
-            if (pkg != null) {
-                synchronized (packages) {
-                    Package pkg2 = packages.get(name);
-                    if (pkg2 == null) {
-                        packages.put(name, pkg);
-                    } else {
-                        pkg = pkg2;
-                    }
-                }
-            }
         }
         return pkg;
     }
@@ -1635,22 +1619,18 @@
      * @since  1.2
      */
     protected Package[] getPackages() {
-        Map<String, Package> map;
-        synchronized (packages) {
-            map = new HashMap<>(packages);
-        }
         Package[] pkgs;
         if (parent != null) {
             pkgs = parent.getPackages();
         } else {
             pkgs = Package.getSystemPackages();
         }
+
+        Map<String, Package> map = packages;
         if (pkgs != null) {
+            map = new HashMap<>(packages);
             for (Package pkg : pkgs) {
-                String pkgName = pkg.getName();
-                if (map.get(pkgName) == null) {
-                    map.put(pkgName, pkg);
-                }
+                map.putIfAbsent(pkg.getName(), pkg);
             }
         }
         return map.values().toArray(new Package[map.size()]);
--- a/jdk/src/java.base/share/classes/java/lang/Package.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,27 +26,21 @@
 package java.lang;
 
 import java.lang.reflect.AnnotatedElement;
-import java.io.InputStream;
-import java.util.Enumeration;
 
-import java.util.StringTokenizer;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URL;
 import java.net.MalformedURLException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
-import java.util.jar.JarException;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
 
 import sun.net.www.ParseUtil;
 import sun.reflect.CallerSensitive;
@@ -538,17 +532,15 @@
      * Returns the loaded system package for the specified name.
      */
     static Package getSystemPackage(String name) {
-        synchronized (pkgs) {
-            Package pkg = pkgs.get(name);
-            if (pkg == null) {
-                name = name.replace('.', '/').concat("/");
-                String fn = getSystemPackage0(name);
-                if (fn != null) {
-                    pkg = defineSystemPackage(name, fn);
-                }
+        Package pkg = pkgs.get(name);
+        if (pkg == null) {
+            name = name.replace('.', '/').concat("/");
+            String fn = getSystemPackage0(name);
+            if (fn != null) {
+                pkg = defineSystemPackage(name, fn);
             }
-            return pkg;
         }
+        return pkg;
     }
 
     /*
@@ -557,74 +549,98 @@
     static Package[] getSystemPackages() {
         // First, update the system package map with new package names
         String[] names = getSystemPackages0();
-        synchronized (pkgs) {
-            for (String name : names) {
+        for (String name : names) {
+            if (!pkgs.containsKey(name)) {
                 defineSystemPackage(name, getSystemPackage0(name));
             }
-            return pkgs.values().toArray(new Package[pkgs.size()]);
         }
+        return pkgs.values().toArray(new Package[pkgs.size()]);
     }
 
     private static Package defineSystemPackage(final String iname,
                                                final String fn)
     {
-        return AccessController.doPrivileged(new PrivilegedAction<Package>() {
-            public Package run() {
-                String name = iname;
-                // Get the cached code source url for the file name
-                URL url = urls.get(fn);
-                if (url == null) {
-                    // URL not found, so create one
-                    File file = new File(fn);
-                    try {
-                        url = ParseUtil.fileToEncodedURL(file);
-                    } catch (MalformedURLException e) {
-                    }
-                    if (url != null) {
-                        urls.put(fn, url);
-                        // If loading a JAR file, then also cache the manifest
-                        if (file.isFile()) {
-                            mans.put(fn, loadManifest(fn));
-                        }
-                    }
-                }
-                // Convert to "."-separated package name
-                name = name.substring(0, name.length() - 1).replace('/', '.');
-                Package pkg;
-                Manifest man = mans.get(fn);
-                if (man != null) {
-                    pkg = new Package(name, man, url, null);
-                } else {
-                    pkg = new Package(name, null, null, null,
-                                      null, null, null, null, null);
-                }
-                pkgs.put(name, pkg);
-                return pkg;
-            }
-        });
+        // Convert to "."-separated package name
+        String name = iname.substring(0, iname.length() - 1).replace('/', '.');
+        // Creates a cached manifest for the file name, allowing
+        // only-once, lazy reads of manifest from jar files
+        CachedManifest cachedManifest = createCachedManifest(fn);
+        pkgs.putIfAbsent(name, new Package(name, cachedManifest.getManifest(),
+                                           cachedManifest.getURL(), null));
+        // Ensure we only expose one Package object
+        return pkgs.get(name);
     }
 
-    /*
-     * Returns the Manifest for the specified JAR file name.
-     */
-    private static Manifest loadManifest(String fn) {
-        try (FileInputStream fis = new FileInputStream(fn);
-             JarInputStream jis = new JarInputStream(fis, false))
-        {
-            return jis.getManifest();
-        } catch (IOException e) {
-            return null;
+    private static CachedManifest createCachedManifest(String fn) {
+        if (!manifests.containsKey(fn)) {
+            manifests.putIfAbsent(fn, new CachedManifest(fn));
         }
+        return manifests.get(fn);
     }
 
     // The map of loaded system packages
-    private static Map<String, Package> pkgs = new HashMap<>(31);
+    private static final ConcurrentHashMap<String, Package> pkgs
+            = new ConcurrentHashMap<>();
+
+    // Maps each directory or zip file name to its corresponding manifest, if
+    // it exists
+    private static final ConcurrentHashMap<String, CachedManifest> manifests
+            = new ConcurrentHashMap<>();
+
+    private static class CachedManifest {
+        private static final Manifest EMPTY_MANIFEST = new Manifest();
+        private final String fileName;
+        private final URL url;
+        private volatile Manifest manifest;
+
+        CachedManifest(final String fileName) {
+            this.fileName = fileName;
+            this.url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+                public URL run() {
+                    final File file = new File(fileName);
+                    if (file.isFile()) {
+                        try {
+                            return ParseUtil.fileToEncodedURL(file);
+                        } catch (MalformedURLException e) {
+                        }
+                    }
+                    return null;
+                }
+            });
+        }
 
-    // Maps each directory or zip file name to its corresponding url
-    private static Map<String, URL> urls = new HashMap<>(10);
+        public URL getURL() {
+            return url;
+        }
 
-    // Maps each code source url for a jar file to its manifest
-    private static Map<String, Manifest> mans = new HashMap<>(10);
+        public Manifest getManifest() {
+            if (url == null) {
+                return EMPTY_MANIFEST;
+            }
+            Manifest m = manifest;
+            if (m != null) {
+                return m;
+            }
+            synchronized (this) {
+                m = manifest;
+                if (m != null) {
+                    return m;
+                }
+                m = AccessController.doPrivileged(new PrivilegedAction<Manifest>() {
+                    public Manifest run() {
+                        try (FileInputStream fis = new FileInputStream(fileName);
+                             JarInputStream jis = new JarInputStream(fis, false)) {
+                            return jis.getManifest();
+                        } catch (IOException e) {
+                            return null;
+                        }
+                    }
+                });
+                manifest = m = (m == null ? EMPTY_MANIFEST : m);
+            }
+            return m;
+        }
+    }
 
     private static native String getSystemPackage0(String name);
     private static native String[] getSystemPackages0();
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1388,16 +1388,26 @@
                                   Object a4, Object a5, Object a6, Object a7,
                                   Object a8, Object a9)
                 { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
+
+    private static final int ARRAYS_COUNT = 11;
+
     private static MethodHandle[] makeArrays() {
-        ArrayList<MethodHandle> mhs = new ArrayList<>();
-        for (;;) {
-            MethodHandle mh = findCollector("array", mhs.size(), Object[].class);
-            if (mh == null)  break;
+        MethodHandle[] mhs = new MethodHandle[MAX_ARITY + 1];
+        for (int i = 0; i < ARRAYS_COUNT; i++) {
+            MethodHandle mh = findCollector("array", i, Object[].class);
             mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
-            mhs.add(mh);
+            mhs[i] = mh;
         }
-        assert(mhs.size() == 11);  // current number of methods
-        return mhs.toArray(new MethodHandle[MAX_ARITY+1]);
+        assert(assertArrayMethodCount(mhs));
+        return mhs;
+    }
+
+    private static boolean assertArrayMethodCount(MethodHandle[] mhs) {
+        assert(findCollector("array", ARRAYS_COUNT, Object[].class) == null);
+        for (int i = 0; i < ARRAYS_COUNT; i++) {
+            assert(mhs[i] != null);
+        }
+        return true;
     }
 
     // filling versions of the above:
@@ -1449,15 +1459,22 @@
     private static final int FILL_ARRAYS_COUNT = 11; // current number of fillArray methods
 
     private static MethodHandle[] makeFillArrays() {
-        ArrayList<MethodHandle> mhs = new ArrayList<>();
-        mhs.add(null);  // there is no empty fill; at least a0 is required
-        for (;;) {
-            MethodHandle mh = findCollector("fillArray", mhs.size(), Object[].class, Integer.class, Object[].class);
-            if (mh == null)  break;
-            mhs.add(mh);
+        MethodHandle[] mhs = new MethodHandle[FILL_ARRAYS_COUNT];
+        mhs[0] = null;  // there is no empty fill; at least a0 is required
+        for (int i = 1; i < FILL_ARRAYS_COUNT; i++) {
+            MethodHandle mh = findCollector("fillArray", i, Object[].class, Integer.class, Object[].class);
+            mhs[i] = mh;
         }
-        assert(mhs.size() == FILL_ARRAYS_COUNT);
-        return mhs.toArray(new MethodHandle[0]);
+        assert(assertFillArrayMethodCount(mhs));
+        return mhs;
+    }
+
+    private static boolean assertFillArrayMethodCount(MethodHandle[] mhs) {
+        assert(findCollector("fillArray", FILL_ARRAYS_COUNT, Object[].class, Integer.class, Object[].class) == null);
+        for (int i = 1; i < FILL_ARRAYS_COUNT; i++) {
+            assert(mhs[i] != null);
+        }
+        return true;
     }
 
     private static Object copyAsPrimitiveArray(Wrapper w, Object... boxes) {
@@ -1472,9 +1489,6 @@
     static MethodHandle varargsArray(int nargs) {
         MethodHandle mh = Lazy.ARRAYS[nargs];
         if (mh != null)  return mh;
-        mh = findCollector("array", nargs, Object[].class);
-        if (mh != null)  mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
-        if (mh != null)  return Lazy.ARRAYS[nargs] = mh;
         mh = buildVarargsArray(Lazy.MH_fillNewArray, Lazy.MH_arrayIdentity, nargs);
         assert(assertCorrectArity(mh, nargs));
         mh = makeIntrinsic(mh, Intrinsic.NEW_ARRAY);
--- a/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -122,18 +122,18 @@
         AccessController.doPrivileged(
             new PrivilegedAction<Void>() {
                 public Void run() {
-                ThreadGroup tg = Thread.currentThread().getThreadGroup();
-                for (ThreadGroup tgn = tg;
-                     tgn != null;
-                     tg = tgn, tgn = tg.getParent());
-                Thread sft = new Thread(tg, proc, "Secondary finalizer");
-                sft.start();
-                try {
-                    sft.join();
-                } catch (InterruptedException x) {
-                    /* Ignore */
-                }
-                return null;
+                    ThreadGroup tg = Thread.currentThread().getThreadGroup();
+                    for (ThreadGroup tgn = tg;
+                         tgn != null;
+                         tg = tgn, tgn = tg.getParent());
+                    Thread sft = new Thread(tg, proc, "Secondary finalizer");
+                    sft.start();
+                    try {
+                        sft.join();
+                    } catch (InterruptedException x) {
+                        Thread.currentThread().interrupt();
+                    }
+                    return null;
                 }});
     }
 
@@ -146,6 +146,7 @@
         forkSecondaryFinalizer(new Runnable() {
             private volatile boolean running;
             public void run() {
+                // in case of recursive call to run()
                 if (running)
                     return;
                 final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
@@ -168,6 +169,7 @@
         forkSecondaryFinalizer(new Runnable() {
             private volatile boolean running;
             public void run() {
+                // in case of recursive call to run()
                 if (running)
                     return;
                 final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
@@ -189,6 +191,7 @@
             super(g, "Finalizer");
         }
         public void run() {
+            // in case of recursive call to run()
             if (running)
                 return;
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -286,6 +286,53 @@
     }
 
     /**
+     * Behaves like {@code getGenericParameterTypes}, but returns type
+     * information for all parameters, including synthetic parameters.
+     */
+    Type[] getAllGenericParameterTypes() {
+        final boolean genericInfo = hasGenericInformation();
+
+        // Easy case: we don't have generic parameter information.  In
+        // this case, we just return the result of
+        // getParameterTypes().
+        if (!genericInfo) {
+            return getParameterTypes();
+        } else {
+            final boolean realParamData = hasRealParameterData();
+            final Type[] genericParamTypes = getGenericParameterTypes();
+            final Type[] nonGenericParamTypes = getParameterTypes();
+            final Type[] out = new Type[nonGenericParamTypes.length];
+            final Parameter[] params = getParameters();
+            int fromidx = 0;
+            // If we have real parameter data, then we use the
+            // synthetic and mandate flags to our advantage.
+            if (realParamData) {
+                for (int i = 0; i < out.length; i++) {
+                    final Parameter param = params[i];
+                    if (param.isSynthetic() || param.isImplicit()) {
+                        // If we hit a synthetic or mandated parameter,
+                        // use the non generic parameter info.
+                        out[i] = nonGenericParamTypes[i];
+                    } else {
+                        // Otherwise, use the generic parameter info.
+                        out[i] = genericParamTypes[fromidx];
+                        fromidx++;
+                    }
+                }
+            } else {
+                // Otherwise, use the non-generic parameter data.
+                // Without method parameter reflection data, we have
+                // no way to figure out which parameters are
+                // synthetic/mandated, thus, no way to match up the
+                // indexes.
+                return genericParamTypes.length == nonGenericParamTypes.length ?
+                    genericParamTypes : nonGenericParamTypes;
+            }
+            return out;
+        }
+    }
+
+    /**
      * Returns an array of {@code Parameter} objects that represent
      * all the parameters to the underlying executable represented by
      * this object.  Returns an array of length 0 if the executable
@@ -646,7 +693,7 @@
                         getConstantPool(getDeclaringClass()),
                 this,
                 getDeclaringClass(),
-                getGenericParameterTypes(),
+                getAllGenericParameterTypes(),
                 TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER);
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Parameter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Parameter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -198,7 +198,7 @@
     public Type getParameterizedType() {
         Type tmp = parameterTypeCache;
         if (null == tmp) {
-            tmp = executable.getGenericParameterTypes()[index];
+            tmp = executable.getAllGenericParameterTypes()[index];
             parameterTypeCache = tmp;
         }
 
--- a/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -446,6 +446,7 @@
 
         serverSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
         serverSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
+        serverSocketOptions.add(StandardSocketOptions.IP_TOS);
     };
 
     /**
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java	Mon Nov 17 09:36:40 2014 +0100
@@ -303,7 +303,7 @@
      * is a {@link java.nio.channels.FileChannel}.
      *
      * <p> <b>Usage Examples:</b>
-     * <pre>
+     * <pre>{@code
      *     Path path = ...
      *
      *     // open file for reading
@@ -314,9 +314,10 @@
      *     WritableByteChannel wbc = Files.newByteChannel(path, EnumSet.of(CREATE,APPEND));
      *
      *     // create file with initial permissions, opening it for both reading and writing
-     *     {@code FileAttribute<Set<PosixFilePermission>> perms = ...}
-     *     SeekableByteChannel sbc = Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms);
-     * </pre>
+     *     FileAttribute<Set<PosixFilePermission>> perms = ...
+     *     SeekableByteChannel sbc =
+     *         Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms);
+     * }</pre>
      *
      * @param   path
      *          the path to the file to open or create
@@ -1702,7 +1703,8 @@
      * Alternatively, suppose we want to read file's POSIX attributes without
      * following symbolic links:
      * <pre>
-     *    PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);
+     *    PosixFileAttributes attrs =
+     *        Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);
      * </pre>
      *
      * @param   <A>
@@ -2840,6 +2842,8 @@
      * @return  a new buffered writer, with default buffer size, to write text
      *          to the file
      *
+     * @throws  IllegalArgumentException
+     *          if {@code options} contains an invalid combination of options
      * @throws  IOException
      *          if an I/O error occurs opening or creating the file
      * @throws  UnsupportedOperationException
@@ -2880,6 +2884,8 @@
      * @return  a new buffered writer, with default buffer size, to write text
      *          to the file
      *
+     * @throws  IllegalArgumentException
+     *          if {@code options} contains an invalid combination of options
      * @throws  IOException
      *          if an I/O error occurs opening or creating the file
      * @throws  UnsupportedOperationException
@@ -2891,7 +2897,9 @@
      *
      * @since 1.8
      */
-    public static BufferedWriter newBufferedWriter(Path path, OpenOption... options) throws IOException {
+    public static BufferedWriter newBufferedWriter(Path path, OpenOption... options)
+        throws IOException
+    {
         return newBufferedWriter(path, StandardCharsets.UTF_8, options);
     }
 
@@ -3273,6 +3281,8 @@
      *
      * @return  the path
      *
+     * @throws  IllegalArgumentException
+     *          if {@code options} contains an invalid combination of options
      * @throws  IOException
      *          if an I/O error occurs writing to or creating the file
      * @throws  UnsupportedOperationException
@@ -3330,6 +3340,8 @@
      *
      * @return  the path
      *
+     * @throws  IllegalArgumentException
+     *          if {@code options} contains an invalid combination of options
      * @throws  IOException
      *          if an I/O error occurs writing to or creating the file, or the
      *          text cannot be encoded using the specified charset
@@ -3376,6 +3388,8 @@
      *
      * @return  the path
      *
+     * @throws  IllegalArgumentException
+     *          if {@code options} contains an invalid combination of options
      * @throws  IOException
      *          if an I/O error occurs writing to or creating the file, or the
      *          text cannot be encoded as {@code UTF-8}
@@ -3452,7 +3466,7 @@
             final Iterator<Path> delegate = ds.iterator();
 
             // Re-wrap DirectoryIteratorException to UncheckedIOException
-            Iterator<Path> it = new Iterator<Path>() {
+            Iterator<Path> iterator = new Iterator<Path>() {
                 @Override
                 public boolean hasNext() {
                     try {
@@ -3471,7 +3485,9 @@
                 }
             };
 
-            return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, Spliterator.DISTINCT), false)
+            Spliterator<Path> spliterator =
+                Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT);
+            return StreamSupport.stream(spliterator, false)
                                 .onClose(asUncheckedRunnable(ds));
         } catch (Error|RuntimeException e) {
             try {
@@ -3572,7 +3588,9 @@
     {
         FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
         try {
-            return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false)
+            Spliterator<FileTreeWalker.Event> spliterator =
+                Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT);
+            return StreamSupport.stream(spliterator, false)
                                 .onClose(iterator::close)
                                 .map(entry -> entry.file());
         } catch (Error|RuntimeException e) {
@@ -3685,7 +3703,9 @@
     {
         FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
         try {
-            return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false)
+            Spliterator<FileTreeWalker.Event> spliterator =
+                Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT);
+            return StreamSupport.stream(spliterator, false)
                                 .onClose(iterator::close)
                                 .filter(entry -> matcher.test(entry.file(), entry.attributes()))
                                 .map(entry -> entry.file());
--- a/jdk/src/java.base/share/classes/java/nio/file/package-info.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/file/package-info.java	Mon Nov 17 09:36:40 2014 +0100
@@ -86,8 +86,8 @@
  * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
  * or method of any class or interface in this package will cause a {@link
  * java.lang.NullPointerException NullPointerException} to be thrown. Additionally,
- * invoking a method with a collection containing a {@code null} element will
- * cause a {@code NullPointerException}, unless otherwise specified. </p>
+ * invoking a method with an array or collection containing a {@code null} element
+ * will cause a {@code NullPointerException}, unless otherwise specified. </p>
  *
  * <p> Unless otherwise noted, methods that attempt to access the file system
  * will throw {@link java.nio.file.ClosedFileSystemException} when invoked on
--- a/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Mon Nov 17 09:36:40 2014 +0100
@@ -276,6 +276,7 @@
         set = new HashSet<>();
         set.add(StandardSocketOptions.SO_RCVBUF);
         set.add(StandardSocketOptions.SO_REUSEADDR);
+        set.add(StandardSocketOptions.IP_TOS);
         set = Collections.unmodifiableSet(set);
         options.put(ServerSocket.class, set);
 
--- a/jdk/src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -32,7 +32,7 @@
     bootstrapping. */
 
 class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
-    private Constructor<?> constructor;
+    private final Constructor<?> constructor;
 
     BootstrapConstructorAccessorImpl(Constructor<?> c) {
         this.constructor = c;
--- a/jdk/src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,7 +33,7 @@
 
 class InstantiationExceptionConstructorAccessorImpl
     extends ConstructorAccessorImpl {
-    private String message;
+    private final String message;
 
     InstantiationExceptionConstructorAccessorImpl(String message) {
         this.message = message;
--- a/jdk/src/java.base/share/classes/sun/reflect/Label.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/Label.java	Mon Nov 17 09:36:40 2014 +0100
@@ -47,10 +47,10 @@
         }
         // This won't work for more than one assembler anyway, so this is
         // unnecessary
-        ClassFileAssembler asm;
-        short instrBCI;
-        short patchBCI;
-        int   stackDepth;
+        final ClassFileAssembler asm;
+        final short instrBCI;
+        final short patchBCI;
+        final int   stackDepth;
     }
     private List<PatchInfo> patches = new ArrayList<>();
 
--- a/jdk/src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -32,7 +32,7 @@
     afterward, switches to bytecode-based implementation */
 
 class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
-    private Constructor<?> c;
+    private final Constructor<?> c;
     private DelegatingConstructorAccessorImpl parent;
     private int numInvocations;
 
--- a/jdk/src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -32,7 +32,7 @@
     switches to bytecode-based implementation */
 
 class NativeMethodAccessorImpl extends MethodAccessorImpl {
-    private Method method;
+    private final Method method;
     private DelegatingMethodAccessorImpl parent;
     private int numInvocations;
 
--- a/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -50,9 +50,9 @@
 public class ReflectionFactory {
 
     private static boolean initted = false;
-    private static Permission reflectionFactoryAccessPerm
+    private static final Permission reflectionFactoryAccessPerm
         = new RuntimePermission("reflectionFactoryAccess");
-    private static ReflectionFactory soleInstance = new ReflectionFactory();
+    private static final ReflectionFactory soleInstance = new ReflectionFactory();
     // Provides access to package-private mechanisms in java.lang.reflect
     private static volatile LangReflectAccess langReflectAccess;
 
--- a/jdk/src/java.base/share/classes/sun/reflect/SignatureIterator.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/SignatureIterator.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,7 @@
 /** Assists in iterating down a method's signature */
 
 public class SignatureIterator {
-    private String sig;
+    private final String sig;
     private int idx;
 
     public SignatureIterator(String sig) {
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -45,8 +45,8 @@
  * core reflection (java.lang.reflect).
  */
 public class CoreReflectionFactory implements GenericsFactory {
-    private GenericDeclaration decl;
-    private Scope scope;
+    private final GenericDeclaration decl;
+    private final Scope scope;
 
     private CoreReflectionFactory(GenericDeclaration d, Scope s) {
         decl = d;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,7 +34,7 @@
  */
 public class GenericArrayTypeImpl
     implements GenericArrayType {
-    private Type genericComponentType;
+    private final Type genericComponentType;
 
     // private constructor enforces use of static factory
     private GenericArrayTypeImpl(Type ct) {
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java	Mon Nov 17 09:36:40 2014 +0100
@@ -40,7 +40,7 @@
  *
 */
 public abstract class LazyReflectiveObjectGenerator {
-    private GenericsFactory factory; // cached factory
+    private final GenericsFactory factory; // cached factory
 
     protected LazyReflectiveObjectGenerator(GenericsFactory f) {
         factory = f;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -38,9 +38,9 @@
 /** Implementing class for ParameterizedType interface. */
 
 public class ParameterizedTypeImpl implements ParameterizedType {
-    private Type[] actualTypeArguments;
-    private Class<?>  rawType;
-    private Type   ownerType;
+    private final Type[] actualTypeArguments;
+    private final Class<?>  rawType;
+    private final Type   ownerType;
 
     private ParameterizedTypeImpl(Class<?> rawType,
                                   Type[] actualTypeArguments,
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/AbstractRepository.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/AbstractRepository.java	Mon Nov 17 09:36:40 2014 +0100
@@ -40,9 +40,9 @@
 
     // A factory used to produce reflective objects. Provided when the
     //repository is created. Will vary across implementations.
-    private GenericsFactory factory;
+    private final GenericsFactory factory;
 
-    private T tree; // the AST for the generic type info
+    private final T tree; // the AST for the generic type info
 
     //accessors
     private GenericsFactory getFactory() { return factory;}
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java	Mon Nov 17 09:36:40 2014 +0100
@@ -41,7 +41,7 @@
 public abstract class AbstractScope<D extends GenericDeclaration>
     implements Scope {
 
-    private D recvr; // the declaration whose scope this instance represents
+    private final D recvr; // the declaration whose scope this instance represents
     private Scope enclosingScope; // the enclosing scope of this scope
 
     /**
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/DummyScope.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/DummyScope.java	Mon Nov 17 09:36:40 2014 +0100
@@ -38,7 +38,7 @@
 public class DummyScope implements Scope {
     // Caches the unique instance of this class; instances contain no data
     // so we can use the singleton pattern
-    private static DummyScope singleton = new DummyScope();
+    private static final DummyScope singleton = new DummyScope();
 
     // constructor is private to enforce use of factory method
     private DummyScope(){}
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ArrayTypeSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ArrayTypeSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,7 @@
 import sun.reflect.generics.visitor.TypeTreeVisitor;
 
 public class ArrayTypeSignature implements FieldTypeSignature {
-    private TypeSignature componentType;
+    private final TypeSignature componentType;
 
     private ArrayTypeSignature(TypeSignature ct) {componentType = ct;}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/BooleanSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/BooleanSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type boolean. */
 public class BooleanSignature implements BaseType {
-    private static BooleanSignature singleton = new BooleanSignature();
+    private static final BooleanSignature singleton = new BooleanSignature();
 
     private BooleanSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/BottomSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/BottomSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,7 @@
 import sun.reflect.generics.visitor.TypeTreeVisitor;
 
 public class BottomSignature implements FieldTypeSignature {
-    private static BottomSignature singleton = new BottomSignature();
+    private static final BottomSignature singleton = new BottomSignature();
 
     private BottomSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ByteSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ByteSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type byte. */
 public class ByteSignature implements BaseType {
-    private static ByteSignature singleton = new ByteSignature();
+    private static final ByteSignature singleton = new ByteSignature();
 
     private ByteSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/CharSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/CharSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type char. */
 public class CharSignature implements BaseType {
-    private static CharSignature singleton = new CharSignature();
+    private static final CharSignature singleton = new CharSignature();
 
     private CharSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ClassSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ClassSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,9 +28,9 @@
 import sun.reflect.generics.visitor.Visitor;
 
 public class ClassSignature implements Signature {
-    private FormalTypeParameter[] formalTypeParams;
-    private ClassTypeSignature superclass;
-    private ClassTypeSignature[] superInterfaces;
+    private final FormalTypeParameter[] formalTypeParams;
+    private final ClassTypeSignature superclass;
+    private final ClassTypeSignature[] superInterfaces;
 
     private ClassSignature(FormalTypeParameter[] ftps,
                                       ClassTypeSignature sc,
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ClassTypeSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ClassTypeSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,7 +33,7 @@
  * AST representing class types.
  */
 public class ClassTypeSignature implements FieldTypeSignature {
-    private List<SimpleClassTypeSignature> path;
+    private final List<SimpleClassTypeSignature> path;
 
 
     private ClassTypeSignature(List<SimpleClassTypeSignature> p) {
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/DoubleSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/DoubleSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type double. */
 public class DoubleSignature implements BaseType {
-    private static DoubleSignature singleton = new DoubleSignature();
+    private static final DoubleSignature singleton = new DoubleSignature();
 
     private DoubleSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/FloatSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/FloatSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type float. */
 public class FloatSignature implements BaseType {
-    private static FloatSignature singleton = new FloatSignature();
+    private static final FloatSignature singleton = new FloatSignature();
 
     private FloatSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/FormalTypeParameter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/FormalTypeParameter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,8 +29,8 @@
 
 /** AST that represents a formal type parameter. */
 public class FormalTypeParameter implements TypeTree {
-    private String name;
-    private FieldTypeSignature[] bounds;
+    private final String name;
+    private final FieldTypeSignature[] bounds;
 
     private FormalTypeParameter(String n, FieldTypeSignature[] bs) {
         name = n;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/IntSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/IntSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type int. */
 public class IntSignature implements BaseType {
-    private static IntSignature singleton = new IntSignature();
+    private static final IntSignature singleton = new IntSignature();
 
     private IntSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/LongSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/LongSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type long. */
 public class LongSignature implements BaseType {
-    private static LongSignature singleton = new LongSignature();
+    private static final LongSignature singleton = new LongSignature();
 
     private LongSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,10 +28,10 @@
 import sun.reflect.generics.visitor.Visitor;
 
 public class MethodTypeSignature implements Signature {
-    private FormalTypeParameter[] formalTypeParams;
-    private TypeSignature[] parameterTypes;
-    private ReturnType returnType;
-    private FieldTypeSignature[] exceptionTypes;
+    private final FormalTypeParameter[] formalTypeParams;
+    private final TypeSignature[] parameterTypes;
+    private final ReturnType returnType;
+    private final FieldTypeSignature[] exceptionTypes;
 
     private MethodTypeSignature(FormalTypeParameter[] ftps,
                                 TypeSignature[] pts,
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ShortSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/ShortSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,7 @@
 
 /** AST that represents the type short. */
 public class ShortSignature implements BaseType {
-    private static ShortSignature singleton = new ShortSignature();
+    private static final ShortSignature singleton = new ShortSignature();
 
     private ShortSignature(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/SimpleClassTypeSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/SimpleClassTypeSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,9 +28,9 @@
 import sun.reflect.generics.visitor.TypeTreeVisitor;
 
 public class SimpleClassTypeSignature implements FieldTypeSignature {
-    private boolean dollar;
-    private String name;
-    private TypeArgument[] typeArgs;
+    private final boolean dollar;
+    private final String name;
+    private final TypeArgument[] typeArgs;
 
     private SimpleClassTypeSignature(String n, boolean dollar, TypeArgument[] tas) {
         name = n;
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/TypeVariableSignature.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/TypeVariableSignature.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,7 @@
 import sun.reflect.generics.visitor.TypeTreeVisitor;
 
 public class TypeVariableSignature implements FieldTypeSignature {
-    private String identifier;
+    private final String identifier;
 
     private TypeVariableSignature(String id) {identifier = id;}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/tree/VoidDescriptor.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/tree/VoidDescriptor.java	Mon Nov 17 09:36:40 2014 +0100
@@ -30,7 +30,7 @@
 
 /** AST that represents the pseudo-type void. */
 public class VoidDescriptor implements ReturnType {
-    private static VoidDescriptor singleton = new VoidDescriptor();
+    private static final VoidDescriptor singleton = new VoidDescriptor();
 
     private VoidDescriptor(){}
 
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java	Mon Nov 17 09:36:40 2014 +0100
@@ -76,9 +76,9 @@
  * Create a trampoline class.
  */
 public final class MethodUtil extends SecureClassLoader {
-    private static String MISC_PKG = "sun.reflect.misc.";
-    private static String TRAMPOLINE = MISC_PKG + "Trampoline";
-    private static Method bounce = getTrampoline();
+    private static final String MISC_PKG = "sun.reflect.misc.";
+    private static final String TRAMPOLINE = MISC_PKG + "Trampoline";
+    private static final Method bounce = getTrampoline();
 
     private MethodUtil() {
         super();
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1608,7 +1608,7 @@
     private static String getCompatibleSigAlgName(String keyAlgName)
             throws Exception {
         if ("DSA".equalsIgnoreCase(keyAlgName)) {
-            return "SHA1WithDSA";
+            return "SHA256WithDSA";
         } else if ("RSA".equalsIgnoreCase(keyAlgName)) {
             return "SHA256WithRSA";
         } else if ("EC".equalsIgnoreCase(keyAlgName)) {
@@ -1628,10 +1628,8 @@
         if (keysize == -1) {
             if ("EC".equalsIgnoreCase(keyAlgName)) {
                 keysize = 256;
-            } else if ("RSA".equalsIgnoreCase(keyAlgName)) {
-                keysize = 2048;
             } else {
-                keysize = 1024;
+                keysize = 2048;     // RSA and DSA
             }
         }
 
--- a/jdk/src/java.base/windows/native/libnio/MappedByteBuffer.c	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.base/windows/native/libnio/MappedByteBuffer.c	Mon Nov 17 09:36:40 2014 +0100
@@ -83,9 +83,9 @@
         HANDLE h;
         if (handle_fdID == NULL) {
             jclass clazz = (*env)->FindClass(env, "java/io/FileDescriptor");
-            if (clazz == NULL)
-                return; // exception thrown
+            CHECK_NULL(clazz); //exception thrown
             handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J");
+            CHECK_NULL(handle_fdID);
         }
         h = jlong_to_ptr((*env)->GetLongField(env, fdo, handle_fdID));
         result = FlushFileBuffers(h);
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Mon Nov 17 09:36:40 2014 +0100
@@ -678,7 +678,7 @@
         final long nsWindowPtr = getNSWindowPtr();
         LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
         Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
-        if( w != null
+        if( w != null && w.getPeer() != null
                 && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
                 && !lwcToolkit.isApplicationActive()) {
             lwcToolkit.activateApplicationIgnoringOtherApps();
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Mon Nov 17 09:36:40 2014 +0100
@@ -72,7 +72,9 @@
             }
             [pool drain];
             free(ctxinfo);
+            oglc->ctxInfo = NULL;
         }
+        cglinfo->context = NULL;
     }
 
     free(cglinfo);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m	Mon Nov 17 09:36:40 2014 +0100
@@ -187,6 +187,11 @@
     }
 
     OGLContext *oglc = cglInfo->context;
+    if (oglc == NULL) {
+        J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_SetScratchContext: ogl context is null");
+        return NULL;
+    }
+
     CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
 
 JNF_COCOA_ENTER(env);
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java	Mon Nov 17 09:36:40 2014 +0100
@@ -8607,7 +8607,7 @@
      * @param propertyName the programmatic name of the property
      *          that was changed
      * @param oldValue the old value of the property (as a short)
-     * @param newValue the old value of the property (as a short)
+     * @param newValue the new value of the property (as a short)
      * @see #firePropertyChange(java.lang.String, java.lang.Object,
      *          java.lang.Object)
      * @since 1.5
--- a/jdk/src/java.desktop/share/classes/java/awt/Robot.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Robot.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,9 +34,12 @@
 import java.awt.image.WritableRaster;
 import java.awt.peer.RobotPeer;
 import java.lang.reflect.InvocationTargetException;
+import java.security.AccessController;
+
 import sun.awt.AWTPermissions;
 import sun.awt.ComponentFactory;
 import sun.awt.SunToolkit;
+import sun.awt.OSInfo;
 import sun.awt.image.SunWritableRaster;
 
 /**
@@ -555,15 +558,21 @@
      */
     public synchronized void waitForIdle() {
         checkNotDispatchThread();
-        // post a dummy event to the queue so we know when
-        // all the events before it have been processed
+
         try {
             SunToolkit.flushPendingEvents();
-            EventQueue.invokeAndWait( new Runnable() {
-                                            public void run() {
-                                                // dummy implementation
-                                            }
-                                        } );
+            // 7185258: realSync() call blocks all DnD tests on OS X
+            if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
+                // post a dummy event to the queue so we know when
+                // all the events before it have been processed
+                EventQueue.invokeAndWait( new Runnable() {
+                                                public void run() {
+                                                    // dummy implementation
+                                                }
+                                            } );
+            } else {
+                ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            }
         } catch(InterruptedException ite) {
             System.err.println("Robot.waitForIdle, non-fatal exception caught:");
             ite.printStackTrace();
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1320,7 +1320,8 @@
      */
     public void actionPerformed(ActionEvent e) {
         ComboBoxEditor editor = getEditor();
-        if ((editor != null) && (e != null) && (editor == e.getSource())) {
+        if ((editor != null) && (e != null)
+                && (editor.getEditorComponent() == e.getSource())) {
             setPopupVisible(false);
             getModel().setSelectedItem(editor.getItem());
             String oldCommand = getActionCommand();
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java	Mon Nov 17 09:36:40 2014 +0100
@@ -278,18 +278,34 @@
                                      Color bgColor, int interpType,
                                      double coords[])
     {
-        double dx = coords[0];
-        double dy = coords[1];
-        double dw = coords[2] - dx;
-        double dh = coords[3] - dy;
+        double dx1 = coords[0];
+        double dy1 = coords[1];
+        double dx2 = coords[2];
+        double dy2 = coords[3];
+        double dw = dx2 - dx1;
+        double dh = dy2 - dy1;
+
+        /* If any of the destination coordinates exceed the integer range,
+         * then the calculations performed in calls made here cannot be
+         * guaranteed to be correct, or to converge (terminate).
+         * So return out of here, deferring to code that can handle this.
+         */
+        if (dx1 < Integer.MIN_VALUE || dx1 > Integer.MAX_VALUE ||
+            dy1 < Integer.MIN_VALUE || dy1 > Integer.MAX_VALUE ||
+            dx2 < Integer.MIN_VALUE || dx2 > Integer.MAX_VALUE ||
+            dy2 < Integer.MIN_VALUE || dy2 > Integer.MAX_VALUE)
+        {
+            return false;
+        }
+
         // First check if width and height are very close to img w&h.
         if (closeToInteger(sx2-sx1, dw) && closeToInteger(sy2-sy1, dh)) {
             // Round location to nearest pixel and then test
             // if it will cause interpolation anomalies.
-            int idx = (int) Math.floor(dx + 0.5);
-            int idy = (int) Math.floor(dy + 0.5);
+            int idx = (int) Math.floor(dx1 + 0.5);
+            int idy = (int) Math.floor(dy1 + 0.5);
             if (interpType == AffineTransformOp.TYPE_NEAREST_NEIGHBOR ||
-                (closeToInteger(idx, dx) && closeToInteger(idy, dy)))
+                (closeToInteger(idx, dx1) && closeToInteger(idy, dy1)))
             {
                 renderImageCopy(sg, img, bgColor,
                                 idx, idy,
@@ -302,7 +318,7 @@
         if (dw > 0 && dh > 0) {
             if (renderImageScale(sg, img, bgColor, interpType,
                                  sx1, sy1, sx2, sy2,
-                                 coords[0], coords[1], coords[2], coords[3]))
+                                 dx1, dy1, dx2, dy2))
             {
                 return true;
             }
@@ -494,7 +510,7 @@
         // We need to transform to a temp image and then copy
         // just the pieces that are valid data to the dest.
         BufferedImage tmpimg = new BufferedImage(dx2-dx1, dy2-dy1,
-                                                 BufferedImage.TYPE_INT_ARGB);
+                                                 BufferedImage.TYPE_INT_ARGB_PRE);
         SurfaceData tmpData = SurfaceData.getPrimarySurfaceData(tmpimg);
         SurfaceType tmpType = tmpData.getSurfaceType();
         MaskBlit tmpmaskblit =
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -48,7 +48,7 @@
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import sun.java2d.windows.GDIWindowSurfaceData;
 
-class D3DBlitLoops {
+final class D3DBlitLoops {
 
     static void register() {
         Blit blitIntArgbPreToSurface =
@@ -57,7 +57,9 @@
         Blit blitIntArgbPreToTexture =
             new D3DSwToTextureBlit(SurfaceType.IntArgbPre,
                                    D3DSurfaceData.ST_INT_ARGB_PRE);
-
+        TransformBlit transformBlitIntArgbPreToSurface =
+            new D3DSwToSurfaceTransform(SurfaceType.IntArgbPre,
+                                        D3DSurfaceData.ST_INT_ARGB_PRE);
         GraphicsPrimitive[] primitives = {
             // prevent D3DSurface -> Screen blits
             new D3DSurfaceToGDIWindowSurfaceBlit(),
@@ -123,8 +125,6 @@
 
             new D3DSwToSurfaceTransform(SurfaceType.IntArgb,
                                         D3DSurfaceData.ST_INT_ARGB),
-            new D3DSwToSurfaceTransform(SurfaceType.IntArgbPre,
-                                        D3DSurfaceData.ST_INT_ARGB_PRE),
             new D3DSwToSurfaceTransform(SurfaceType.IntRgb,
                                         D3DSurfaceData.ST_INT_RGB),
             new D3DSwToSurfaceTransform(SurfaceType.IntBgr,
@@ -140,6 +140,9 @@
             // REMIND: we don't have a native sw loop to back this loop up
 //            new D3DSwToSurfaceTransform(SurfaceType.ByteIndexedBm,
 //                                        D3DSurfaceData.ST_BYTE_INDEXED_BM),
+            transformBlitIntArgbPreToSurface,
+
+            new D3DGeneralTransformedBlit(transformBlitIntArgbPreToSurface),
 
             // texture->surface ops
             new D3DTextureToSurfaceBlit(),
@@ -712,11 +715,11 @@
  * This general Blit implementation converts any source surface to an
  * intermediate IntArgbPre surface, and then uses the more specific
  * IntArgbPre->D3DSurface/Texture loop to get the intermediate
- * (premultiplied) surface down to D3D.
+ * (premultiplied) surface down to D3D using simple blit.
  */
 class D3DGeneralBlit extends Blit {
 
-    private Blit performop;
+    private final Blit performop;
     private WeakReference<SurfaceData> srcTmp;
 
     D3DGeneralBlit(SurfaceType dstType,
@@ -757,6 +760,49 @@
     }
 }
 
+/**
+ * This general TransformedBlit implementation converts any source surface to an
+ * intermediate IntArgbPre surface, and then uses the more specific
+ * IntArgbPre->D3DSurface/Texture loop to get the intermediate
+ * (premultiplied) surface down to D3D using simple transformBlit.
+ */
+final class D3DGeneralTransformedBlit extends TransformBlit {
+
+    private final TransformBlit performop;
+    private WeakReference<SurfaceData> srcTmp;
+
+    D3DGeneralTransformedBlit(final TransformBlit performop) {
+        super(SurfaceType.Any, CompositeType.AnyAlpha,
+                D3DSurfaceData.D3DSurface);
+        this.performop = performop;
+    }
+
+    @Override
+    public synchronized void Transform(SurfaceData src, SurfaceData dst,
+                                       Composite comp, Region clip,
+                                       AffineTransform at, int hint, int srcx,
+                                       int srcy, int dstx, int dsty, int width,
+                                       int height){
+        Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
+                                            CompositeType.SrcNoEa,
+                                            SurfaceType.IntArgbPre);
+        // use cached intermediate surface, if available
+        final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null;
+        // convert source to IntArgbPre
+        src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc,
+                          BufferedImage.TYPE_INT_ARGB_PRE);
+
+        // transform IntArgbPre intermediate surface to D3D surface
+        performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty,
+                            width, height);
+
+        if (src != cachedSrc) {
+            // cache the intermediate surface
+            srcTmp = new WeakReference<>(src);
+        }
+    }
+}
+
 /*
  * The following classes prohibit copying D3DSurfaces to the screen
  * (the D3D->sysmem->GDI path is known to be very very slow).
--- a/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java	Mon Nov 17 09:36:40 2014 +0100
@@ -205,28 +205,4 @@
      */
     public static final Logger MISC_LOGGER =
             Logger.getLogger(MISC_LOGGER_NAME);
-
-    /**
-     * Logger name for SNMP.
-     */
-    public static final String SNMP_LOGGER_NAME =
-            "javax.management.snmp";
-
-    /**
-     * Logger for SNMP.
-     */
-    public static final Logger SNMP_LOGGER =
-            Logger.getLogger(SNMP_LOGGER_NAME);
-
-    /**
-     * Logger name for SNMP Adaptor.
-     */
-    public static final String SNMP_ADAPTOR_LOGGER_NAME =
-            "javax.management.snmp.daemon";
-
-    /**
-     * Logger for SNMP Adaptor.
-     */
-    public static final Logger SNMP_ADAPTOR_LOGGER =
-            Logger.getLogger(SNMP_ADAPTOR_LOGGER_NAME);
 }
--- a/jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -25,7 +25,6 @@
 
 package com.sun.management;
 
-import java.util.List;
 import java.lang.management.PlatformManagedObject;
 
 /**
@@ -109,7 +108,7 @@
      * @throws IllegalArgumentException if the VM option of the given name
      *                                     does not exist.
      * @throws IllegalArgumentException if the new value is invalid.
-     * @throws IllegalArgumentException if the VM option is not writeable.
+     * @throws IllegalArgumentException if the VM option is not writable.
      * @throws NullPointerException if name or value is <tt>null</tt>.
      *
      * @throws  java.lang.SecurityException
--- a/jdk/src/java.management/share/classes/sun/management/Flag.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/classes/sun/management/Flag.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -110,6 +110,7 @@
     // These set* methods are synchronized on the class object
     // to avoid multiple threads updating the same flag at the same time.
     static synchronized native void setLongValue(String name, long value);
+    static synchronized native void setDoubleValue(String name, double value);
     static synchronized native void setBooleanValue(String name, boolean value);
     static synchronized native void setStringValue(String name, String value);
 
--- a/jdk/src/java.management/share/classes/sun/management/HotSpotDiagnostic.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/classes/sun/management/HotSpotDiagnostic.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -40,6 +40,7 @@
     public HotSpotDiagnostic() {
     }
 
+    @Override
     public void dumpHeap(String outputFile, boolean live) throws IOException {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
@@ -52,6 +53,7 @@
 
     private native void dumpHeap0(String outputFile, boolean live) throws IOException;
 
+    @Override
     public List<VMOption> getDiagnosticOptions() {
         List<Flag> allFlags = Flag.getAllFlags();
         List<VMOption> result = new ArrayList<>();
@@ -63,6 +65,7 @@
         return result;
     }
 
+    @Override
     public VMOption getVMOption(String name) {
         if (name == null) {
             throw new NullPointerException("name cannot be null");
@@ -76,6 +79,7 @@
         return f.getVMOption();
     }
 
+    @Override
     public void setVMOption(String name, String value) {
         if (name == null) {
             throw new NullPointerException("name cannot be null");
@@ -102,12 +106,18 @@
                 long l = Long.parseLong(value);
                 Flag.setLongValue(name, l);
             } catch (NumberFormatException e) {
-                IllegalArgumentException iae =
-                    new IllegalArgumentException("Invalid value:" +
+                throw new IllegalArgumentException("Invalid value:" +
                         " VM Option \"" + name + "\"" +
-                        " expects numeric value");
-                iae.initCause(e);
-                throw iae;
+                        " expects numeric value", e);
+            }
+        } else if (v instanceof Double) {
+            try {
+                double d = Double.parseDouble(value);
+                Flag.setDoubleValue(name, d);
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("Invalid value:" +
+                        " VM Option \"" + name + "\"" +
+                        " expects numeric value", e);
             }
         } else if (v instanceof Boolean) {
             if (!value.equalsIgnoreCase("true") &&
@@ -126,6 +136,7 @@
         }
     }
 
+    @Override
     public ObjectName getObjectName() {
         return Util.newObjectName("com.sun.management:type=HotSpotDiagnostic");
     }
--- a/jdk/src/java.management/share/native/include/jmm.h	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/native/include/jmm.h	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -143,7 +143,8 @@
   JMM_VMGLOBAL_TYPE_UNKNOWN  = 0,
   JMM_VMGLOBAL_TYPE_JBOOLEAN = 1,
   JMM_VMGLOBAL_TYPE_JSTRING  = 2,
-  JMM_VMGLOBAL_TYPE_JLONG    = 3
+  JMM_VMGLOBAL_TYPE_JLONG    = 3,
+  JMM_VMGLOBAL_TYPE_JDOUBLE  = 4
 } jmmVMGlobalType;
 
 typedef enum {
--- a/jdk/src/java.management/share/native/libmanagement/Flag.c	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/share/native/libmanagement/Flag.c	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -133,6 +133,10 @@
             valueObj = JNU_NewObjectByName(env, "java/lang/Long", "(J)V",
                                            globals[i].value.j);
             break;
+        case JMM_VMGLOBAL_TYPE_JDOUBLE:
+            valueObj = JNU_NewObjectByName(env, "java/lang/Double", "(D)V",
+                                           globals[i].value.d);
+            break;
         default:
             // ignore unsupported type
             continue;
@@ -202,6 +206,16 @@
 }
 
 JNIEXPORT void JNICALL
+Java_sun_management_Flag_setDoubleValue
+  (JNIEnv *env, jclass cls, jstring name, jdouble value)
+{
+   jvalue v;
+   v.d = value;
+
+   jmm_interface->SetVMGlobal(env, name, v);
+}
+
+JNIEXPORT void JNICALL
 Java_sun_management_Flag_setBooleanValue
   (JNIEnv *env, jclass cls, jstring name, jboolean value)
 {
--- a/jdk/src/java.management/windows/native/libmanagement/OperatingSystemImpl.c	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/java.management/windows/native/libmanagement/OperatingSystemImpl.c	Mon Nov 17 09:36:40 2014 +0100
@@ -53,8 +53,6 @@
 typedef unsigned __int32 juint;
 typedef unsigned __int64 julong;
 
-typedef enum boolean_values { false=0, true=1};
-
 static void set_low(jlong* value, jint low) {
     *value &= (jlong)0xffffffff << 32;
     *value |= (jlong)(julong)(juint)low;
@@ -66,22 +64,22 @@
 }
 
 static jlong jlong_from(jint h, jint l) {
-  jlong result = 0; // initialization to avoid warning
-  set_high(&result, h);
-  set_low(&result,  l);
-  return result;
+    jlong result = 0; // initialization to avoid warning
+    set_high(&result, h);
+    set_low(&result,  l);
+    return result;
 }
 
 static HANDLE main_process;
 
-int perfiInit(void);
+static void perfInit(void);
 
 JNIEXPORT void JNICALL
 Java_sun_management_OperatingSystemImpl_initialize0
   (JNIEnv *env, jclass cls)
 {
     main_process = GetCurrentProcess();
-     perfiInit();
+    perfInit();
 }
 
 JNIEXPORT jlong JNICALL
@@ -155,26 +153,7 @@
     return (jlong) ms.ullTotalPhys;
 }
 
-// Seems WinXP PDH returns PDH_MORE_DATA whenever we send in a NULL buffer.
-// Let's just ignore it, since we make sure we have enough buffer anyway.
-static int
-pdh_fail(PDH_STATUS pdhStat) {
-    return pdhStat != ERROR_SUCCESS && pdhStat != PDH_MORE_DATA;
-}
-
-// INFO: Using PDH APIs Correctly in a Localized Language (Q287159)
-//       http://support.microsoft.com/default.aspx?scid=kb;EN-US;q287159
-// The index value for the base system counters and objects like processor,
-// process, thread, memory, and so forth are always the same irrespective
-// of the localized version of the operating system or service pack installed.
-#define PDH_PROCESSOR_IDX        ((DWORD) 238)
-#define PDH_PROCESSOR_TIME_IDX        ((DWORD)   6)
-#define PDH_PRIV_PROCESSOR_TIME_IDX ((DWORD) 144)
-#define PDH_PROCESS_IDX            ((DWORD) 230)
-#define PDH_ID_PROCESS_IDX        ((DWORD) 784)
-#define PDH_CONTEXT_SWITCH_RATE_IDX ((DWORD) 146)
-#define PDH_SYSTEM_IDX            ((DWORD)   2)
-#define PDH_VIRTUAL_BYTES_IDX        ((DWORD) 174)
+/* Performance Data Helper API (PDH) support */
 
 typedef PDH_STATUS (WINAPI *PdhAddCounterFunc)(
                            HQUERY      hQuery,
@@ -183,48 +162,44 @@
                            HCOUNTER    *phCounter
                            );
 typedef PDH_STATUS (WINAPI *PdhOpenQueryFunc)(
-                          LPCWSTR     szDataSource,
-                          DWORD       dwUserData,
-                          HQUERY      *phQuery
-                          );
+                           LPCWSTR     szDataSource,
+                           DWORD       dwUserData,
+                           HQUERY      *phQuery
+                           );
+typedef PDH_STATUS (WINAPI *PdhCollectQueryDataFunc)(
+                           HQUERY      hQuery
+                           );
+
+typedef PDH_STATUS (WINAPI *PdhEnumObjectItemsFunc)(
+                           LPCTSTR     szDataSource,
+                           LPCTSTR     szMachineName,
+                           LPCTSTR     szObjectName,
+                           LPTSTR      mszCounterList,
+                           LPDWORD     pcchCounterListLength,
+                           LPTSTR      mszInstanceList,
+                           LPDWORD     pcchInstanceListLength,
+                           DWORD       dwDetailLevel,
+                           DWORD       dwFlags
+                           );
+typedef PDH_STATUS (WINAPI *PdhRemoveCounterFunc)(
+                           HCOUNTER   hCounter
+                           );
+typedef PDH_STATUS (WINAPI *PdhLookupPerfNameByIndexFunc)(
+                           LPCSTR     szMachineName,
+                           DWORD      dwNameIndex,
+                           LPSTR      szNameBuffer,
+                           LPDWORD    pcchNameBufferSize
+                           );
 typedef DWORD (WINAPI *PdhCloseQueryFunc)(
                       HQUERY      hQuery
                       );
-typedef PDH_STATUS (WINAPI *PdhCollectQueryDataFunc)(
-                             HQUERY      hQuery
-                             );
+
 typedef DWORD (WINAPI *PdhGetFormattedCounterValueFunc)(
-                            HCOUNTER                hCounter,
-                            DWORD                   dwFormat,
-                            LPDWORD                 lpdwType,
-                            PPDH_FMT_COUNTERVALUE   pValue
-                            );
-typedef PDH_STATUS (WINAPI *PdhEnumObjectItemsFunc)(
-                            LPCTSTR    szDataSource,
-                            LPCTSTR    szMachineName,
-                            LPCTSTR    szObjectName,
-                            LPTSTR     mszCounterList,
-                            LPDWORD    pcchCounterListLength,
-                            LPTSTR     mszInstanceList,
-                            LPDWORD    pcchInstanceListLength,
-                            DWORD      dwDetailLevel,
-                            DWORD      dwFlags
-                            );
-typedef PDH_STATUS (WINAPI *PdhRemoveCounterFunc)(
-                          HCOUNTER  hCounter
-                          );
-typedef PDH_STATUS (WINAPI *PdhLookupPerfNameByIndexFunc)(
-                              LPCSTR  szMachineName,
-                              DWORD   dwNameIndex,
-                              LPSTR   szNameBuffer,
-                              LPDWORD pcchNameBufferSize
-                              );
-typedef PDH_STATUS (WINAPI *PdhMakeCounterPathFunc)(
-                            PDH_COUNTER_PATH_ELEMENTS *pCounterPathElements,
-                            LPTSTR szFullPathBuffer,
-                            LPDWORD pcchBufferSize,
-                            DWORD dwFlags
-                            );
+                      HCOUNTER                hCounter,
+                      DWORD                   dwFormat,
+                      LPDWORD                 lpdwType,
+                      PPDH_FMT_COUNTERVALUE   pValue
+                      );
 
 static PdhAddCounterFunc PdhAddCounter_i;
 static PdhOpenQueryFunc PdhOpenQuery_i;
@@ -234,76 +209,757 @@
 static PdhEnumObjectItemsFunc PdhEnumObjectItems_i;
 static PdhRemoveCounterFunc PdhRemoveCounter_i;
 static PdhLookupPerfNameByIndexFunc PdhLookupPerfNameByIndex_i;
-static PdhMakeCounterPathFunc PdhMakeCounterPath_i;
 
-static HANDLE thisProcess;
-static double cpuFactor;
-static DWORD  num_cpus;
-
-#define FT2JLONG(X)  ((((jlong)X.dwHighDateTime) << 32) | ((jlong)X.dwLowDateTime))
-#define COUNTER_BUF_SIZE 256
-// Min time between query updates.
-#define MIN_UPDATE_INTERVAL 500
-#define CONFIG_SUCCESSFUL 0
-
-/**
+/*
  * Struct for PDH queries.
  */
 typedef struct {
     HQUERY      query;
-    uint64_t      lastUpdate; // Last time query was updated (current millis).
+    uint64_t    lastUpdate; // Last time query was updated (ticks)
 } UpdateQueryS, *UpdateQueryP;
 
-/**
- * Struct for the processor load counters.
+// Min time between query updates (ticks)
+static const int MIN_UPDATE_INTERVAL = 500;
+
+/*
+ * Struct for a PDH query with multiple counters.
  */
 typedef struct {
-    UpdateQueryS      query;
-    HCOUNTER*      counters;
-    int          noOfCounters;
+    UpdateQueryS  query;
+    HCOUNTER*     counters;
+    int           noOfCounters;
 } MultipleCounterQueryS, *MultipleCounterQueryP;
 
-/**
- * Struct for the jvm process load counter.
+/*
+ * Struct for a PDH query with a single counter.
  */
 typedef struct {
-    UpdateQueryS      query;
+    UpdateQueryS  query;
     HCOUNTER      counter;
 } SingleCounterQueryS, *SingleCounterQueryP;
 
-static char* getProcessPDHHeader(void);
+
+typedef struct {
+    CRITICAL_SECTION cs;
+    DWORD owningThread;
+    DWORD recursionCount;
+} PdhCriticalSectionS, *PdhCriticalSectionP;
+
+static PdhCriticalSectionS initializationLock;
+
+static void InitializePdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+
+    InitializeCriticalSection(&criticalSection->cs);
+    criticalSection->owningThread = 0;
+    criticalSection->recursionCount = 0;
+}
+
+static void EnterPdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+
+    EnterCriticalSection(&criticalSection->cs);
+    criticalSection->recursionCount++;
+    if (!criticalSection->owningThread) {
+        criticalSection->owningThread = GetCurrentThreadId();
+    }
+}
+
+static void LeavePdhCriticalSection(PdhCriticalSectionP criticalSection) {
+    assert(criticalSection);
+    assert(GetCurrentThreadId() == criticalSection->owningThread);
+    assert(criticalSection->recursionCount >= 1);
+
+    criticalSection->recursionCount--;
+    if (!criticalSection->recursionCount) {
+        criticalSection->owningThread = 0;
+    }
+    LeaveCriticalSection(&criticalSection->cs);
+}
 
-/**
- * Currently available counters.
+/*
+ * INFO: Using PDH APIs Correctly in a Localized Language (Q287159)
+ *   http://support.microsoft.com/default.aspx?scid=kb;EN-US;q287159
+ * The index value for the base system counters and objects like processor,
+ * process, thread, memory, and so forth are always the same irrespective
+ * of the localized version of the operating system or service pack installed.
+ * To find the correct index for an object or counter, inspect the registry key/value:
+ * [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter]
+ */
+static const DWORD PDH_PROCESSOR_IDX = 238;
+static const DWORD PDH_PROCESSOR_TIME_IDX = 6;
+static const DWORD PDH_PROCESS_IDX = 230;
+static const DWORD PDH_ID_PROCESS_IDX = 784;
+
+/* useful pdh fmt's */
+static const char* const OBJECT_COUNTER_FMT = "\\%s\\%s";
+static const size_t OBJECT_COUNTER_FMT_LEN = 2;
+static const char* const OBJECT_WITH_INSTANCES_COUNTER_FMT = "\\%s(%s)\\%s";
+static const size_t OBJECT_WITH_INSTANCES_COUNTER_FMT_LEN = 4;
+static const char* const PROCESS_OBJECT_INSTANCE_COUNTER_FMT = "\\%s(%s#%s)\\%s";
+static const size_t PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN = 5;
+
+static const char* pdhProcessImageName = NULL; /* "java" */
+static char* pdhIDProcessCounterFmt = NULL;    /* "\Process(java#%d)\ID Process" */
+
+static int numberOfJavaProcessesAtInitialization = 0;
+
+/*
+ * Currently used CPU queries/counters and variables
+ */
+static SingleCounterQueryP processTotalCPULoad = NULL;
+static MultipleCounterQueryP multiCounterCPULoad = NULL;
+static double cpuFactor = .0;
+static DWORD  numCpus = 0;
+
+/*
+ * Seems WinXP PDH returns PDH_MORE_DATA whenever we send in a NULL buffer.
+ * Let's just ignore it, since we make sure we have enough buffer anyway.
  */
-static SingleCounterQueryS cntCtxtSwitchRate;
-static SingleCounterQueryS cntVirtualSize;
-static SingleCounterQueryS cntProcLoad;
-static SingleCounterQueryS cntProcSystemLoad;
-static MultipleCounterQueryS multiCounterCPULoad;
+static int
+pdhFail(PDH_STATUS pdhStat) {
+    return pdhStat != ERROR_SUCCESS && pdhStat != PDH_MORE_DATA;
+}
+
+static const char*
+allocateAndCopy(const char* const originalString) {
+    size_t len;
+    char* allocatedString;
+
+    assert(originalString);
+
+    len = strlen(originalString);
+
+    allocatedString = malloc(len + 1);
+
+    if (!allocatedString) {
+        return NULL;
+    }
+
+    strncpy(allocatedString, originalString, len);
+    allocatedString[len] = '\0';
+
+    return allocatedString;
+}
+
+/*
+ * Allocates memory into the supplied pointer and
+ * fills it with the localized PDH artifact description, if indexed correctly.
+ * Caller owns the memory from the point of returning from this function.
+ *
+ * @param index    the PDH counter index as specified in the registry
+ * @param ppBuffer pointer to a char*.
+ * @return         0 if successful, negative on failure.
+ */
+static int
+lookupNameByIndex(DWORD index, char** ppBuffer) {
+    DWORD size;
+
+    assert(ppBuffer);
+
+    /* determine size needed */
+    if (PdhLookupPerfNameByIndex_i(NULL, index, NULL, &size) != PDH_MORE_DATA) {
+      /* invalid index? */
+      return -1;
+    }
+
+    *ppBuffer = malloc((size_t)size);
+
+    if (!*ppBuffer) {
+        return -1;
+    }
+
+    if (PdhLookupPerfNameByIndex_i(NULL, index, *ppBuffer, &size) != ERROR_SUCCESS) {
+        free(*ppBuffer);
+        *ppBuffer = NULL;
+        return -1;
+    }
+
+    /* windows vista does not null-terminate the string
+     * (although the docs says it will) */
+    (*ppBuffer)[size - 1] = '\0';
+
+    return 0;
+}
+
+/*
+* Construct a fully qualified PDH path
+*
+* @param objectName   a PDH Object string representation (required)
+* @param counterName  a PDH Counter string representation (required)
+* @param imageName    a process image name string, ex. "java" (opt)
+* @param instance     an instance string, ex. "0", "1", ... (opt)
+* @return             the fully qualified PDH path.
+*
+* Caller will own the returned malloc:ed string
+*/
+static const char*
+makeFullCounterPath(const char* const objectName,
+                    const char* const counterName,
+                    const char* const imageName,
+                    const char* const instance) {
+
+    size_t fullCounterPathLen;
+    char* fullCounterPath;
+
+    assert(objectName);
+    assert(counterName);
 
-static CRITICAL_SECTION processHeaderLock;
-static CRITICAL_SECTION initializationLock;
+    fullCounterPathLen = strlen(objectName);
+    fullCounterPathLen += strlen(counterName);
+
+    if (imageName) {
+        /*
+         * For paths using the "Process" Object.
+         *
+         * Examples:
+         * abstract: "\Process(imageName#instance)\Counter"
+         * actual:   "\Process(java#2)\ID Process"
+         */
+        fullCounterPathLen += PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN;
+        fullCounterPathLen += strlen(imageName);
+
+        /*
+         * imageName must be passed together with an associated
+         * instance "number" ("0", "1", "2", ...).
+         * This is required in order to create valid "Process" Object paths.
+         *
+         * Examples: "\Process(java#0)", \Process(java#1"), ...
+         */
+        assert(instance);
+
+        fullCounterPathLen += strlen(instance);
+
+        fullCounterPath = malloc(fullCounterPathLen + 1);
+
+        if (!fullCounterPath) {
+            return NULL;
+        }
 
-/**
- * Initialize the perf module at startup.
+        _snprintf(fullCounterPath,
+                  fullCounterPathLen,
+                  PROCESS_OBJECT_INSTANCE_COUNTER_FMT,
+                  objectName,
+                  imageName,
+                  instance,
+                  counterName);
+    } else {
+        if (instance) {
+            /*
+             * For paths where the Object has multiple instances.
+             *
+             * Examples:
+             * abstract: "\Object(instance)\Counter"
+             * actual:   "\Processor(0)\% Privileged Time"
+             */
+            fullCounterPathLen += strlen(instance);
+            fullCounterPathLen += OBJECT_WITH_INSTANCES_COUNTER_FMT_LEN;
+        } else {
+            /*
+             * For "normal" paths.
+             *
+             * Examples:
+             * abstract: "\Object\Counter"
+             * actual:   "\Memory\Available Mbytes"
+             */
+            fullCounterPathLen += OBJECT_COUNTER_FMT_LEN;
+        }
+
+        fullCounterPath = malloc(fullCounterPathLen + 1);
+
+        if (!fullCounterPath) {
+            return NULL;
+        }
+
+        if (instance) {
+            _snprintf(fullCounterPath,
+                      fullCounterPathLen,
+                      OBJECT_WITH_INSTANCES_COUNTER_FMT,
+                      objectName,
+                      instance,
+                      counterName);
+        } else {
+            _snprintf(fullCounterPath,
+                      fullCounterPathLen,
+                      OBJECT_COUNTER_FMT,
+                      objectName,
+                      counterName);
+        }
+    }
+
+    fullCounterPath[fullCounterPathLen] = '\0';
+
+    return fullCounterPath;
+}
+
+/*
+ * Resolves an index for a PDH artifact to
+ * a localized, malloc:ed string representation.
+ * Caller will own the returned malloc:ed string.
+ *
+ * @param pdhArtifactIndex  PDH index
+ * @return                  malloc:ed string representation
+ *                          of the requested pdh artifact (localized).
+ *                          NULL on failure.
  */
-int
-perfiInit(void)
-{
-    InitializeCriticalSection(&processHeaderLock);
-    InitializeCriticalSection(&initializationLock);
+static const char*
+getPdhLocalizedArtifact(DWORD pdhArtifactIndex) {
+    char* pdhLocalizedArtifactString;
+
+    if (lookupNameByIndex(pdhArtifactIndex,
+                          &pdhLocalizedArtifactString) != 0) {
+        return NULL;
+    }
+
+    return pdhLocalizedArtifactString;
+}
+
+static void
+pdhCleanup(HQUERY* const query, HCOUNTER* const counter) {
+    if (counter && *counter) {
+        PdhRemoveCounter_i(*counter);
+        *counter = NULL;
+    }
+    if (query && *query) {
+        PdhCloseQuery_i(*query);
+        *query = NULL;
+    }
+}
+
+static void
+destroySingleCounter(SingleCounterQueryP counterQuery) {
+    if (counterQuery) {
+        pdhCleanup(&counterQuery->query.query, &counterQuery->counter);
+    }
+}
+
+static void
+destroyMultiCounter(MultipleCounterQueryP multiCounterQuery) {
+    int i;
+    if (multiCounterQuery) {
+        if (multiCounterQuery->counters) {
+            for (i = 0; i < multiCounterQuery->noOfCounters; i++) {
+                pdhCleanup(NULL, &multiCounterQuery->counters[i]);
+            }
+            free(multiCounterQuery->counters);
+            multiCounterQuery->counters = NULL;
+        }
+        pdhCleanup(&multiCounterQuery->query.query, NULL);
+    }
+}
+
+static int
+openQuery(HQUERY* const query) {
+    assert(query);
+
+    if (PdhOpenQuery_i(NULL, 0, query) != ERROR_SUCCESS) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static int
+addCounter(HQUERY query,
+           const char* const fullCounterPath,
+           HCOUNTER* const counter) {
+
+    assert(fullCounterPath);
+    assert(counter);
+
+    if (PdhAddCounter_i(query,
+                        fullCounterPath,
+                        0,
+                        counter) != ERROR_SUCCESS) {
+        return -1;
+    }
+
     return 0;
 }
 
-/**
+/*
+ * Sets up the supplied SingleCounterQuery to listen for the specified counter.
+ *
+ * @param counterQuery       the counter query to set up.
+ * @param fullCounterPath    the string specifying the full path to the counter.
+ * @returns                  0 if successful, negative on failure.
+ */
+static int
+initializeSingleCounterQuery(SingleCounterQueryP counterQuery,
+                             const char* const fullCounterPath) {
+    assert(counterQuery);
+    assert(fullCounterPath);
+
+    if (openQuery(&counterQuery->query.query) == 0) {
+        if (addCounter(counterQuery->query.query,
+                       fullCounterPath,
+                       &counterQuery->counter) == 0) {
+            return 0;
+        }
+    }
+
+    return -1;
+}
+
+/*
+ * Sets up a SingleCounterQuery
+ *
+ * param counter             the counter query to set up.
+ * param localizedObject     string representing the PDH object to query
+ * param localizedCounter    string representing the PDH counter to query
+ * param processImageName    if the counter query needs the process image name ("java")
+ * param instance            if the counter has instances, this is the instance ("\Processor(0)\")
+                                 where 0 is the instance
+ * param firstSampleOnInit   for counters that need two queries to yield their values,
+                                 the first query can be issued just after initialization
+ *
+ * @returns                   0 if successful, negative on failure.
+ */
+static int
+initializeSingleCounter(SingleCounterQueryP const counter,
+                        const char* const localizedObject,
+                        const char* const localizedCounter,
+                        const char* const processImageName,
+                        const char* const instance,
+                        BOOL firstSampleOnInit) {
+    int retValue = -1;
+
+    const char* fullCounterPath = makeFullCounterPath(localizedObject,
+                                                      localizedCounter,
+                                                      processImageName,
+                                                      instance);
+
+    if (fullCounterPath) {
+
+        assert(counter);
+
+        if (initializeSingleCounterQuery(counter, fullCounterPath) == 0) {
+            /*
+             * According to the MSDN documentation, rate counters must be read twice:
+             *
+             * "Obtaining the value of rate counters such as Page faults/sec requires that
+             *  PdhCollectQueryData be called twice, with a specific time interval between
+             *  the two calls, before calling PdhGetFormattedCounterValue. Call Sleep to
+             *  implement the waiting period between the two calls to PdhCollectQueryData."
+             *
+             *  Take the first sample here already to allow for the next (first) "real" sample
+             *  to succeed.
+             */
+            if (firstSampleOnInit) {
+                PdhCollectQueryData_i(counter->query.query);
+            }
+
+            retValue = 0;
+        }
+        free((char*)fullCounterPath);
+    }
+
+    return retValue;
+}
+
+static void
+perfInit(void) {
+    InitializePdhCriticalSection(&initializationLock);
+}
+
+static int
+getProcessID() {
+    static int myPid = 0;
+    if (0 == myPid) {
+        myPid = _getpid();
+    }
+    return myPid;
+}
+
+/*
+ * Working against the Process object and it's related counters is inherently problematic
+ * when using the PDH API:
+ *
+ * For PDH, a process is not primarily identified by it's process id,
+ * but with a sequential number, for example \Process(java#0), \Process(java#1), ....
+ * The really bad part is that this list is reset as soon as one process exits:
+ * If \Process(java#1) exits, \Process(java#3) now becomes \Process(java#2) etc.
+ *
+ * The PDH query api requires a process identifier to be submitted when registering
+ * a query, but as soon as the list resets, the query is invalidated (since the name
+ * changed).
+ *
+ * Solution:
+ * The #number identifier for a Process query can only decrease after process creation.
+ *
+ * Therefore we create an array of counter queries for all process object instances
+ * up to and including ourselves:
+ *
+ * Ex. we come in as third process instance (java#2), we then create and register
+ * queries for the following Process object instances:
+ * java#0, java#1, java#2
+ *
+ * currentQueryIndexForProcess() keeps track of the current "correct" query
+ * (in order to keep this index valid when the list resets from underneath,
+ * ensure to call getCurrentQueryIndexForProcess() before every query involving
+ * Process object instance data).
+ */
+static int
+currentQueryIndexForProcess(void) {
+    HQUERY tmpQuery = NULL;
+    HCOUNTER handleCounter = NULL;
+    int retValue = -1;
+
+    assert(pdhProcessImageName);
+    assert(pdhIDProcessCounterFmt);
+
+    if (openQuery(&tmpQuery) == 0) {
+        int index;
+
+        /* iterate over all instance indexes and try to find our own pid */
+        for (index = 0; index < INT_MAX; ++index) {
+            char fullIDProcessCounterPath[MAX_PATH];
+            PDH_FMT_COUNTERVALUE counterValue;
+            PDH_STATUS res;
+
+            _snprintf(fullIDProcessCounterPath,
+                      MAX_PATH,
+                      pdhIDProcessCounterFmt,
+                      index);
+
+            if (addCounter(tmpQuery, fullIDProcessCounterPath, &handleCounter) != 0) {
+                break;
+            }
+
+            res = PdhCollectQueryData_i(tmpQuery);
+
+            if (PDH_INVALID_HANDLE == res || PDH_NO_DATA == res) {
+                break;
+            }
+
+            PdhGetFormattedCounterValue_i(handleCounter,
+                                          PDH_FMT_LONG,
+                                          NULL,
+                                          &counterValue);
+            /*
+             * This check seems to be needed for Win2k SMP boxes, since
+             * they for some reason don't return PDH_NO_DATA for non existing
+             * counters.
+             */
+            if (counterValue.CStatus != PDH_CSTATUS_VALID_DATA) {
+                break;
+            }
+
+            if ((LONG)getProcessID() == counterValue.longValue) {
+                retValue = index;
+                break;
+            }
+        }
+    }
+
+    pdhCleanup(&tmpQuery, &handleCounter);
+
+    return retValue;
+}
+
+/*
+ * If successful, returns the #index corresponding to our PID
+ * as resolved by the pdh query:
+ * "\Process(java#index)\ID Process" (or localized equivalent)
+ *
+ * This function should be called before attempting to read
+ * from any Process related counter(s), and the return value
+ * is the index to be used for indexing an array of Process object query's:
+ *
+ * Example:
+ * processTotalCPULoad[currentQueryIndex].query
+ *
+ * Returns -1 on failure.
+ */
+static int
+getCurrentQueryIndexForProcess() {
+    int currentQueryIndex = currentQueryIndexForProcess();
+
+    assert(currentQueryIndex >= 0 &&
+           currentQueryIndex < numberOfJavaProcessesAtInitialization);
+
+    return currentQueryIndex;
+}
+
+/*
+ * Returns the PDH string identifying the current process image name.
+ * Use this name as a qualifier when getting counters from the PDH Process Object
+ * representing your process.
+
+ * Example:
+ * "\Process(java#0)\Virtual Bytes" - where "java" is the PDH process
+ * image name.
+ *
+ * Please note that the process image name is not necessarily "java",
+ * hence the use of GetModuleFileName() to detect the process image name.
+ *
+ * @return   the process image name to be used when retrieving
+ *           PDH counters from the current process. The caller will
+             own the returned malloc:ed string. NULL if failure.
+ */
+static const char*
+getPdhProcessImageName() {
+    char moduleName[MAX_PATH];
+    char* processImageName;
+    char* dotPos;
+
+    // Find our module name and use it to extract the image name used by PDH
+    DWORD getmfnReturn = GetModuleFileName(NULL, moduleName, sizeof(moduleName));
+
+    if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+        return NULL;
+    }
+
+    if (getmfnReturn >= MAX_PATH || 0 == getmfnReturn) {
+        return NULL;
+    }
+
+    processImageName = strrchr(moduleName, '\\'); //drop path
+    processImageName++;                           //skip slash
+    dotPos = strrchr(processImageName, '.');      //drop .exe
+    dotPos[0] = '\0';
+
+    return allocateAndCopy(processImageName);
+}
+
+/*
+ * Sets up the supplied MultipleCounterQuery to check on the processors via PDH CPU counters.
+ * TODO: Refactor and prettify as with the the SingleCounter queries
+ * if more MultipleCounterQueries are discovered/needed.
+ *
+ * @param multiCounterCPULoad  a pointer to a MultipleCounterQueryS, will be filled in with
+ *                             the necessary info to check the PDH processor counters.
+ * @return                     0 if successful, negative on failure.
+ */
+static int
+initializeMultipleCounterForCPUs(MultipleCounterQueryP multiCounterCPULoad) {
+    DWORD cSize = 0;
+    DWORD iSize = 0;
+    DWORD pCount;
+    DWORD index;
+    char* processor = NULL; //'Processor' == PDH_PROCESSOR_IDX
+    char* time = NULL;      //'Time' == PDH_PROCESSOR_TIME_IDX
+    char* instances = NULL;
+    char* tmp;
+    int   retValue = -1;
+    PDH_STATUS pdhStat;
+
+    if (lookupNameByIndex(PDH_PROCESSOR_IDX, &processor) != 0) {
+        goto end;
+    }
+
+    if (lookupNameByIndex(PDH_PROCESSOR_TIME_IDX, &time) != 0) {
+        goto end;
+    }
+
+    //ok, now we have enough to enumerate all processors.
+    pdhStat = PdhEnumObjectItems_i(
+                                   NULL, // reserved
+                                   NULL, // local machine
+                                   processor, // object to enumerate
+                                   NULL, // pass in NULL buffers
+                                   &cSize, // and 0 length to get
+                                   NULL, // required size
+                                   &iSize, // of the buffers in chars
+                                   PERF_DETAIL_WIZARD, // counter detail level
+                                   0);
+
+    if (pdhFail(pdhStat)) {
+        goto end;
+    }
+
+    instances = calloc(iSize, 1);
+
+    if (!instances) {
+        goto end;
+    }
+
+    cSize = 0;
+
+    pdhStat = PdhEnumObjectItems_i(
+                                   NULL, // reserved
+                                   NULL, // local machine
+                                   processor, // object to enumerate
+                                   NULL, // pass in NULL buffers
+                                   &cSize,
+                                   instances, // now allocated to be filled in
+                                   &iSize, // and size is known
+                                   PERF_DETAIL_WIZARD, // counter detail level
+                                   0);
+
+    if (pdhFail(pdhStat)) {
+        goto end;
+    }
+
+    // enumerate the Processor instances ("\Processor(0)", "\Processor(1)", ..., "\Processor(_Total)")
+    for (pCount = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[strlen(tmp)+1], pCount++);
+
+    assert(pCount == numCpus+1);
+
+    //ok, we now have the number of Processor instances - allocate an HCOUNTER for each
+    multiCounterCPULoad->counters = (HCOUNTER*)malloc(pCount * sizeof(HCOUNTER));
+
+    if (!multiCounterCPULoad->counters) {
+        goto end;
+    }
+
+    multiCounterCPULoad->noOfCounters = pCount;
+
+    if (openQuery(&multiCounterCPULoad->query.query) != 0) {
+        goto end;
+    }
+
+    // fetch instance and register its corresponding HCOUNTER with the query
+    for (index = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[strlen(tmp)+1], ++index) {
+        const char* const fullCounterPath = makeFullCounterPath(processor, time, NULL, tmp);
+
+        if (!fullCounterPath) {
+            goto end;
+        }
+
+        retValue = addCounter(multiCounterCPULoad->query.query,
+                              fullCounterPath,
+                              &multiCounterCPULoad->counters[index]);
+
+        free((char*)fullCounterPath);
+
+        if (retValue != 0) {
+            goto end;
+        }
+    }
+
+    // Query once to initialize the counters which require at least two samples
+    // (like the % CPU usage) to calculate correctly.
+    PdhCollectQueryData_i(multiCounterCPULoad->query.query);
+
+  end:
+    if (processor) {
+        free(processor);
+    }
+
+    if (time) {
+        free(time);
+    }
+
+    if (instances) {
+        free(instances);
+    }
+
+    return retValue;
+}
+
+/*
  * Dynamically sets up function pointers to the PDH library.
  *
- * @return CONFIG_SUCCESSFUL on success, negative on failure.
+ * @param h  HMODULE for the PDH library
+ * @return   0 on success, negative on failure.
  */
 static int
-get_functions(HMODULE h, char *ebuf, size_t elen) {
-    // The 'A' at the end means the ANSI (not the UNICODE) vesions of the methods
+bindPdhFunctionPointers(HMODULE h) {
+    assert(h);
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    /* The 'A' at the end means the ANSI (not the UNICODE) vesions of the methods */
     PdhAddCounter_i         = (PdhAddCounterFunc)GetProcAddress(h, "PdhAddCounterA");
     PdhOpenQuery_i         = (PdhOpenQueryFunc)GetProcAddress(h, "PdhOpenQueryA");
     PdhCloseQuery_i         = (PdhCloseQueryFunc)GetProcAddress(h, "PdhCloseQuery");
@@ -312,42 +968,41 @@
     PdhEnumObjectItems_i         = (PdhEnumObjectItemsFunc)GetProcAddress(h, "PdhEnumObjectItemsA");
     PdhRemoveCounter_i         = (PdhRemoveCounterFunc)GetProcAddress(h, "PdhRemoveCounter");
     PdhLookupPerfNameByIndex_i     = (PdhLookupPerfNameByIndexFunc)GetProcAddress(h, "PdhLookupPerfNameByIndexA");
-    PdhMakeCounterPath_i         = (PdhMakeCounterPathFunc)GetProcAddress(h, "PdhMakeCounterPathA");
 
-    if (PdhAddCounter_i == NULL || PdhOpenQuery_i == NULL ||
-    PdhCloseQuery_i == NULL || PdhCollectQueryData_i == NULL ||
-    PdhGetFormattedCounterValue_i == NULL || PdhEnumObjectItems_i == NULL ||
-    PdhRemoveCounter_i == NULL || PdhLookupPerfNameByIndex_i == NULL || PdhMakeCounterPath_i == NULL)
+    if (!PdhAddCounter_i || !PdhOpenQuery_i ||
+        !PdhCloseQuery_i || !PdhCollectQueryData_i ||
+        !PdhGetFormattedCounterValue_i || !PdhEnumObjectItems_i ||
+        !PdhRemoveCounter_i || !PdhLookupPerfNameByIndex_i)
     {
-        _snprintf(ebuf, elen, "Required method could not be found.");
         return -1;
     }
-    return CONFIG_SUCCESSFUL;
+    return 0;
 }
 
-/**
+/*
  * Returns the counter value as a double for the specified query.
  * Will collect the query data and update the counter values as necessary.
  *
  * @param query       the query to update (if needed).
- * @param c          the counter to read.
+ * @param c           the counter to read.
  * @param value       where to store the formatted value.
  * @param format      the format to use (i.e. PDH_FMT_DOUBLE, PDH_FMT_LONG etc)
- * @return            CONFIG_SUCCESSFUL if no error
+ * @return            0 if no error
  *                    -1 if PdhCollectQueryData fails
  *                    -2 if PdhGetFormattedCounterValue fails
  */
 static int
 getPerformanceData(UpdateQueryP query, HCOUNTER c, PDH_FMT_COUNTERVALUE* value, DWORD format) {
-    clock_t now;
-    now = clock();
+    clock_t now = clock();
 
-    // Need to limit how often we update the query
-    // to mimise the heisenberg effect.
-    // (PDH behaves erratically if the counters are
-    // queried too often, especially counters that
-    // store and use values from two consecutive updates,
-    // like cpu load.)
+    /*
+     * Need to limit how often we update the query
+     * to minimize the Heisenberg effect.
+     * (PDH behaves erratically if the counters are
+     * queried too often, especially counters that
+     * store and use values from two consecutive updates,
+     * like cpu load.)
+     */
     if (now - query->lastUpdate > MIN_UPDATE_INTERVAL) {
         if (PdhCollectQueryData_i(query->query) != ERROR_SUCCESS) {
             return -1;
@@ -358,500 +1013,308 @@
     if (PdhGetFormattedCounterValue_i(c, format, NULL, value) != ERROR_SUCCESS) {
         return -2;
     }
-    return CONFIG_SUCCESSFUL;
-}
 
-/**
- * Places the resolved counter name of the counter at the specified index in the
- * supplied buffer. There must be enough space in the buffer to hold the counter name.
- *
- * @param index   the counter index as specified in the registry.
- * @param buf     the buffer in which to place the counter name.
- * @param size      the size of the counter name buffer.
- * @param ebuf    the error message buffer.
- * @param elen    the length of the error buffer.
- * @return        CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-find_name(DWORD index, char *buf, DWORD size) {
-    PDH_STATUS res;
-
-    if ((res = PdhLookupPerfNameByIndex_i(NULL, index, buf, &size)) != ERROR_SUCCESS) {
-
-        /* printf("Could not open counter %d: error=0x%08x", index, res); */
-        /* if (res == PDH_CSTATUS_NO_MACHINE) { */
-        /*      printf("User probably does not have sufficient privileges to use"); */
-        /*      printf("performance counters. If you are running on Windows 2003"); */
-        /*      printf("or Windows Vista, make sure the user is in the"); */
-        /*      printf("Performance Logs user group."); */
-        /* } */
-        return -1;
-    }
-
-    if (size == 0) {
-        /* printf("Failed to get counter name for %d: empty string", index); */
-        return -1;
-    }
-
-    // windows vista does not null-terminate the string (allthough the docs says it will)
-    buf[size - 1] = '\0';
-    return CONFIG_SUCCESSFUL;
-}
-
-/**
- * Sets up the supplied SingleCounterQuery to listen for the specified counter.
- * initPDH() must have been run prior to calling this function!
- *
- * @param counterQuery   the counter query to set up.
- * @param counterString  the string specifying the path to the counter.
- * @param ebuf           the error buffer.
- * @param elen           the length of the error buffer.
- * @returns              CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initSingleCounterQuery(SingleCounterQueryP counterQuery, char *counterString) {
-    if (PdhOpenQuery_i(NULL, 0, &counterQuery->query.query) != ERROR_SUCCESS) {
-        /* printf("Could not open query for %s", counterString); */
-        return -1;
-    }
-    if (PdhAddCounter_i(counterQuery->query.query, counterString, 0, &counterQuery->counter) != ERROR_SUCCESS) {
-        /* printf("Could not add counter %s for query", counterString); */
-        if (counterQuery->counter != NULL) {
-            PdhRemoveCounter_i(counterQuery->counter);
-        }
-        if (counterQuery->query.query != NULL) {
-            PdhCloseQuery_i(counterQuery->query.query);
-        }
-        memset(counterQuery, 0, sizeof(SingleCounterQueryS));
-        return -1;
-    }
-    return CONFIG_SUCCESSFUL;
-}
-
-/**
- * Sets up the supplied SingleCounterQuery to listen for the time spent
- * by the HotSpot process.
- *
- * @param counterQuery   the counter query to set up as a process counter.
- * @param ebuf           the error buffer.
- * @param elen           the length of the error buffer.
- * @returns              CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initProcLoadCounter(void) {
-    char time[COUNTER_BUF_SIZE];
-    char counter[COUNTER_BUF_SIZE*2];
-
-    if (find_name(PDH_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    _snprintf(counter, sizeof(counter)-1, "%s\\%s", getProcessPDHHeader(), time);
-    return initSingleCounterQuery(&cntProcLoad, counter);
+    return 0;
 }
 
 static int
-initProcSystemLoadCounter(void) {
-    char time[COUNTER_BUF_SIZE];
-    char counter[COUNTER_BUF_SIZE*2];
-
-    if (find_name(PDH_PRIV_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    _snprintf(counter, sizeof(counter)-1, "%s\\%s", getProcessPDHHeader(), time);
-    return initSingleCounterQuery(&cntProcSystemLoad, counter);
-}
+allocateAndInitializePdhConstants() {
+    const char* pdhLocalizedProcessObject = NULL;
+    const char* pdhLocalizedIDProcessCounter = NULL;
+    size_t pdhIDProcessCounterFmtLen;
+    int currentQueryIndex;
+    int retValue = -1;
 
-/**
- * Sets up the supplied MultipleCounterQuery to check on the processors.
- * (Comment: Refactor and prettify as with the the SingleCounter queries
- * if more MultipleCounterQueries are discovered.)
- *
- * initPDH() must have been run prior to calling this function.
- *
- * @param multiQuery  a pointer to a MultipleCounterQueryS, will be filled in with
- *                    the necessary info to check the PDH processor counters.
- * @return            CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-static int
-initProcessorCounters(void) {
-    char          processor[COUNTER_BUF_SIZE]; //'Processor' == #238
-    char          time[COUNTER_BUF_SIZE];      //'Time' == 6
-    DWORD      c_size, i_size;
-    HQUERY     tmpQuery;
-    DWORD      i, p_count;
-    BOOL          error;
-    char         *instances, *tmp;
-    PDH_STATUS pdhStat;
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
 
-    c_size   = i_size = 0;
-    tmpQuery = NULL;
-    error    = false;
-
-    // This __try / __except stuff is there since Windows 2000 beta (or so) sometimes triggered
-    // an access violation when the user had insufficient privileges to use the performance
-    // counters. This was previously guarded by a very ugly piece of code which disabled the
-    // global trap handling in JRockit. Don't know if this really is needed anymore, but otoh,
-    // if we keep it we don't crash on Win2k beta. /Ihse, 2005-05-30
-    __try {
-        if (find_name(PDH_PROCESSOR_IDX, processor, sizeof(processor)-1) < 0) {
-            return -1;
-        }
-    } __except (EXCEPTION_EXECUTE_HANDLER) { // We'll catch all exceptions here.
-        /* printf("User does not have sufficient privileges to use performance counters"); */
-        return -1;
+    assert(!pdhProcessImageName);
+    pdhProcessImageName = getPdhProcessImageName();
+    if (!pdhProcessImageName) {
+        goto end;
     }
 
-    if (find_name(PDH_PROCESSOR_TIME_IDX, time, sizeof(time)-1) < 0) {
-        return -1;
-    }
-    //ok, now we have enough to enumerate all processors.
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processor,          // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    NULL,              // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-    if (pdh_fail(pdhStat)) {
-        /* printf("could not enumerate processors (1) error=%d", pdhStat); */
-        return -1;
+    pdhLocalizedProcessObject = getPdhLocalizedArtifact(PDH_PROCESS_IDX);
+    if (!pdhLocalizedProcessObject) {
+        goto end;
     }
 
-    // use calloc because windows vista does not null terminate the instance names (allthough the docs says it will)
-    instances = calloc(i_size, 1);
-    if (instances == NULL) {
-        /* printf("could not allocate memory (1) %d bytes", i_size); */
-        error = true;
+    pdhLocalizedIDProcessCounter = getPdhLocalizedArtifact(PDH_ID_PROCESS_IDX);
+    if (!pdhLocalizedIDProcessCounter) {
         goto end;
     }
 
-    c_size  = 0;
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processor,              // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    instances,          // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
+    assert(!pdhIDProcessCounterFmt);
 
-    if (pdh_fail(pdhStat)) {
-        /* printf("could not enumerate processors (2) error=%d", pdhStat); */
-        error = true;
+    pdhIDProcessCounterFmtLen = strlen(pdhProcessImageName);
+    pdhIDProcessCounterFmtLen += strlen(pdhLocalizedProcessObject);
+    pdhIDProcessCounterFmtLen += strlen(pdhLocalizedIDProcessCounter);
+    pdhIDProcessCounterFmtLen += PROCESS_OBJECT_INSTANCE_COUNTER_FMT_LEN;
+    pdhIDProcessCounterFmtLen += 2; // "%d"
+
+    assert(pdhIDProcessCounterFmtLen < MAX_PATH);
+    pdhIDProcessCounterFmt = malloc(pdhIDProcessCounterFmtLen + 1);
+    if (!pdhIDProcessCounterFmt) {
         goto end;
     }
-    //count perf count instances.
-    for (p_count = 0, tmp = instances; *tmp != 0; tmp = &tmp[lstrlen(tmp)+1], p_count++);
-
-    //is this correct for HT?
-    assert(p_count == num_cpus+1);
 
-    //ok, have number of perf counters.
-    multiCounterCPULoad.counters = calloc(p_count, sizeof(HCOUNTER));
-    if (multiCounterCPULoad.counters == NULL) {
-        /* printf("could not allocate memory (2) count=%d", p_count); */
-        error = true;
+    /* "\Process(java#%d)\ID Process" */
+    _snprintf(pdhIDProcessCounterFmt,
+              pdhIDProcessCounterFmtLen,
+              PROCESS_OBJECT_INSTANCE_COUNTER_FMT,
+              pdhLocalizedProcessObject,
+              pdhProcessImageName,
+              "%d",
+              pdhLocalizedIDProcessCounter);
+
+    pdhIDProcessCounterFmt[pdhIDProcessCounterFmtLen] = '\0';
+
+    assert(0 == numberOfJavaProcessesAtInitialization);
+    currentQueryIndex = currentQueryIndexForProcess();
+    if (-1 == currentQueryIndex) {
         goto end;
     }
 
-    multiCounterCPULoad.noOfCounters = p_count;
+    numberOfJavaProcessesAtInitialization = currentQueryIndex + 1;
+    assert(numberOfJavaProcessesAtInitialization >= 1);
+
+    retValue = 0;
 
-    if (PdhOpenQuery_i(NULL, 0, &multiCounterCPULoad.query.query) != ERROR_SUCCESS) {
-        /* printf("could not create query"); */
-        error = true;
-        goto end;
+  end:
+
+    if (pdhLocalizedProcessObject) {
+        free((char*)pdhLocalizedProcessObject);
     }
-    //now, fetch the counters.
-    for (i = 0, tmp = instances; *tmp != '\0'; tmp = &tmp[lstrlen(tmp)+1], i++) {
-    char counter[2*COUNTER_BUF_SIZE];
 
-    _snprintf(counter, sizeof(counter)-1, "\\%s(%s)\\%s", processor, tmp, time);
-
-    if (PdhAddCounter_i(multiCounterCPULoad.query.query, counter, 0, &multiCounterCPULoad.counters[i]) != ERROR_SUCCESS) {
-            /* printf("error adding processor counter %s", counter); */
-            error = true;
-            goto end;
-        }
+    if (pdhLocalizedIDProcessCounter) {
+        free((char*)pdhLocalizedIDProcessCounter);
     }
 
-    free(instances);
-    instances = NULL;
+    return retValue;
+}
 
-    // Query once to initialize the counters needing at least two queries
-    // (like the % CPU usage) to calculate correctly.
-    if (PdhCollectQueryData_i(multiCounterCPULoad.query.query) != ERROR_SUCCESS)
-        error = true;
+static void
+deallocatePdhConstants() {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
 
- end:
-    if (instances != NULL) {
-        free(instances);
-    }
-    if (tmpQuery != NULL) {
-        PdhCloseQuery_i(tmpQuery);
+    if (pdhProcessImageName) {
+        free((char*)pdhProcessImageName);
+        pdhProcessImageName = NULL;
     }
-    if (error) {
-        int i;
 
-        if (multiCounterCPULoad.counters != NULL) {
-            for (i = 0; i < multiCounterCPULoad.noOfCounters; i++) {
-                if (multiCounterCPULoad.counters[i] != NULL) {
-                    PdhRemoveCounter_i(multiCounterCPULoad.counters[i]);
-                }
-            }
-            free(multiCounterCPULoad.counters[i]);
-        }
-        if (multiCounterCPULoad.query.query != NULL) {
-            PdhCloseQuery_i(multiCounterCPULoad.query.query);
-        }
-        memset(&multiCounterCPULoad, 0, sizeof(MultipleCounterQueryS));
-        return -1;
+    if (pdhIDProcessCounterFmt) {
+      free(pdhIDProcessCounterFmt);
+      pdhIDProcessCounterFmt = NULL;
     }
-    return CONFIG_SUCCESSFUL;
+
+    numberOfJavaProcessesAtInitialization = 0;
 }
 
-/**
- * Help function that initializes the PDH process header for the JRockit process.
- * (You should probably use getProcessPDHHeader() instead!)
- *
- * initPDH() must have been run prior to calling this function.
- *
- * @param ebuf the error buffer.
- * @param elen the length of the error buffer.
- *
- * @return the PDH instance description corresponding to the JVM process.
- */
-static char*
-initProcessPDHHeader(void) {
-    static char hotspotheader[2*COUNTER_BUF_SIZE];
+static int
+initializeCPUCounters() {
+    SYSTEM_INFO si;
+    char* localizedProcessObject;
+    char* localizedProcessorTimeCounter;
+    int i;
+    int retValue = -1;
+
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    assert(0 == numCpus);
+    GetSystemInfo(&si);
+    numCpus = si.dwNumberOfProcessors;
+    assert(numCpus >= 1);
+
+    /* Initialize the denominator for the jvm load calculations */
+    assert(.0 == cpuFactor);
+    cpuFactor = numCpus * 100;
+
+    if (lookupNameByIndex(PDH_PROCESS_IDX,
+                          &localizedProcessObject) == 0) {
 
-    char           counter[2*COUNTER_BUF_SIZE];
-    char           processes[COUNTER_BUF_SIZE];   //'Process' == #230
-    char           pid[COUNTER_BUF_SIZE];           //'ID Process' == 784
-    char           module_name[MAX_PATH];
-    PDH_STATUS  pdhStat;
-    DWORD       c_size = 0, i_size = 0;
-    HQUERY      tmpQuery = NULL;
-    int           i, myPid = _getpid();
-    BOOL           error = false;
-    char          *instances, *tmp, *instance_name, *dot_pos;
+        if (lookupNameByIndex(PDH_PROCESSOR_TIME_IDX,
+                              &localizedProcessorTimeCounter) == 0) {
+
+            assert(processTotalCPULoad);
+            assert(pdhProcessImageName);
 
-    tmpQuery = NULL;
-    myPid    = _getpid();
-    error    = false;
-
-    if (find_name(PDH_PROCESS_IDX, processes, sizeof(processes) - 1) < 0) {
-        return NULL;
+            for (i = 0; i < numberOfJavaProcessesAtInitialization; ++i) {
+                char instanceIndexBuffer[32];
+                retValue = initializeSingleCounter(&processTotalCPULoad[i],
+                                                   localizedProcessObject,
+                                                   localizedProcessorTimeCounter,
+                                                   pdhProcessImageName,
+                                                   itoa(i, instanceIndexBuffer, 10),
+                                                   TRUE);
+                if (retValue != 0) {
+                    break;
+                }
+            }
+            free(localizedProcessorTimeCounter);
+        }
+        free(localizedProcessObject);
     }
 
-    if (find_name(PDH_ID_PROCESS_IDX, pid, sizeof(pid) - 1) < 0) {
-        return NULL;
-    }
-    //time is same.
-
-    c_size = 0;
-    i_size = 0;
-
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processes,              // object to enumerate
-                    NULL,                   // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    NULL,              // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
-
-    //ok, now we have enough to enumerate all processes
-    if (pdh_fail(pdhStat)) {
-        /* printf("Could not enumerate processes (1) error=%d", pdhStat); */
-        return NULL;
+    if (retValue != 0) {
+        return -1;
     }
 
-    // use calloc because windows vista does not null terminate the instance names (allthough the docs says it will)
-    if ((instances = calloc(i_size, 1)) == NULL) {
-        /* printf("Could not allocate memory %d bytes", i_size); */
-        error = true;
-        goto end;
+    assert(multiCounterCPULoad);
+    return initializeMultipleCounterForCPUs(multiCounterCPULoad);
+}
+
+static void
+deallocateCPUCounters() {
+    int i;
+
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    if (processTotalCPULoad) {
+        for (i = 0; i < numberOfJavaProcessesAtInitialization; ++i) {
+            destroySingleCounter(&processTotalCPULoad[i]);
+        }
+        free(processTotalCPULoad);
+        processTotalCPULoad = NULL;
+    }
+
+    if (multiCounterCPULoad) {
+        destroyMultiCounter(multiCounterCPULoad);
+        free(multiCounterCPULoad);
+        multiCounterCPULoad = NULL;
     }
 
-    c_size = 0;
+    cpuFactor = .0;
+    numCpus = 0;
+}
+
+static void
+pdhInitErrorHandler(HMODULE h) {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+
+    deallocatePdhConstants();
 
-    pdhStat = PdhEnumObjectItems_i (
-                    NULL,                   // reserved
-                    NULL,                   // local machine
-                    processes,              // object to enumerate
-                    NULL,              // pass in NULL buffers
-                    &c_size,              // and 0 length to get
-                    instances,          // required size
-                    &i_size,              // of the buffers in chars
-                    PERF_DETAIL_WIZARD,     // counter detail level
-                    0);
+    if (h) {
+        FreeLibrary(h);
+    }
+}
 
-    // ok, now we have enough to enumerate all processes
-    if (pdh_fail(pdhStat)) {
-        /* printf("Could not enumerate processes (2) error=%d", pdhStat); */
-        error = true;
-        goto end;
-    }
+/*
+ * Helper to initialize the PDH library, function pointers and constants.
+ *
+ * @return  0 if successful, negative on failure.
+ */
+static int
+pdhInit() {
+    static BOOL initialized = FALSE;
+    int retValue;
 
-    if (PdhOpenQuery_i(NULL, 0, &tmpQuery) != ERROR_SUCCESS) {
-        /* printf("Could not create temporary query"); */
-        error = true;
-        goto end;
+    if (initialized) {
+        return 0;
     }
 
-    // Find our module name and use it to extract the instance name used by PDH
-    if (GetModuleFileName(NULL, module_name, MAX_PATH) >= MAX_PATH-1) {
-        /* printf("Module name truncated"); */
-        error = true;
-        goto end;
-    }
-    instance_name = strrchr(module_name, '\\'); //drop path
-    instance_name++;                            //skip slash
-    dot_pos = strchr(instance_name, '.');       //drop .exe
-    dot_pos[0] = '\0';
+    retValue = 0;
 
-    //now, fetch the counters.
-    for (tmp = instances; *tmp != 0 && !error; tmp = &tmp[lstrlen(tmp)+1]) {
-        HCOUNTER  hc = NULL;
-        BOOL done = false;
-
-        // Skip until we find our own process name
-        if (strcmp(tmp, instance_name) != 0) {
-            continue;
-        }
-
-        // iterate over all instance indexes and try to find our own pid
-        for (i = 0; !done && !error; i++){
-            PDH_STATUS res;
-            _snprintf(counter, sizeof(counter)-1, "\\%s(%s#%d)\\%s", processes, tmp, i, pid);
-
-            if (PdhAddCounter_i(tmpQuery, counter, 0, &hc) != ERROR_SUCCESS) {
-                /* printf("Failed to create process id query"); */
-                error = true;
-                goto end;
+    EnterPdhCriticalSection(&initializationLock); {
+        if (!initialized) {
+            HMODULE h = NULL;
+            if ((h = LoadLibrary("pdh.dll")) == NULL) {
+                retValue = -1;
+            } else if (bindPdhFunctionPointers(h) < 0) {
+                retValue = -1;
+            } else if (allocateAndInitializePdhConstants() < 0) {
+                retValue = -1;
             }
 
-            res = PdhCollectQueryData_i(tmpQuery);
+            if (0 == retValue) {
+                initialized = TRUE;
+            } else {
+                pdhInitErrorHandler(h);
+            }
+        }
+    } LeavePdhCriticalSection(&initializationLock);
 
-            if (res == PDH_INVALID_HANDLE) {
-                /* printf("Failed to query process id"); */
-                res = -1;
-                done = true;
-            } else if (res == PDH_NO_DATA) {
-                done = true;
-            } else {
-                PDH_FMT_COUNTERVALUE cv;
+    return retValue;
+}
+
+static int
+allocateCPUCounters() {
+    assert(GetCurrentThreadId() == initializationLock.owningThread);
+    assert(numberOfJavaProcessesAtInitialization >= 1);
+    assert(!processTotalCPULoad);
+    assert(!multiCounterCPULoad);
 
-                PdhGetFormattedCounterValue_i(hc, PDH_FMT_LONG, NULL, &cv);
-               /*
-                 * This check seems to be needed for Win2k SMP boxes, since
-                 * they for some reason don't return PDH_NO_DATA for non existing
-                 * counters.
-                 */
-                if (cv.CStatus != PDH_CSTATUS_VALID_DATA) {
-                    done = true;
-                } else if (cv.longValue == myPid) {
-                    _snprintf(hotspotheader, sizeof(hotspotheader)-1, "\\%s(%s#%d)\0", processes, tmp, i);
-                    PdhRemoveCounter_i(hc);
-                    goto end;
-                }
-            }
-            PdhRemoveCounter_i(hc);
-        }
+    /*
+     * Create an array of Process object queries, for each instance
+     * up to and including our own (java#0, java#1, java#2, ...).
+     */
+    processTotalCPULoad = calloc(numberOfJavaProcessesAtInitialization,
+                                 sizeof(SingleCounterQueryS));
+
+    if (!processTotalCPULoad) {
+        return -1;
     }
- end:
-    if (instances != NULL) {
-        free(instances);
+
+    multiCounterCPULoad = calloc(1, sizeof(MultipleCounterQueryS));
+
+    if (!multiCounterCPULoad) {
+        return -1;
     }
-    if (tmpQuery != NULL) {
-        PdhCloseQuery_i(tmpQuery);
-    }
-    if (error) {
-        return NULL;
-    }
-    return hotspotheader;
+
+    return 0;
 }
 
-/**
- * Returns the PDH string prefix identifying the HotSpot process. Use this prefix when getting
- * counters from the PDH process object representing HotSpot.
- *
- * Note: this call may take some time to complete.
- *
- * @param ebuf error buffer.
- * @param elen error buffer length.
- *
- * @return the header to be used when retrieving PDH counters from the HotSpot process.
- * Will return NULL if the call failed.
- */
-static char *
-getProcessPDHHeader(void) {
-    static char *processHeader = NULL;
+static int
+initializePdhCPUCounters() {
+    static BOOL initialized = FALSE;
+    int retValue;
+
+    if (initialized) {
+        return 0;
+    }
+
+    retValue = 0;
 
-    EnterCriticalSection(&processHeaderLock); {
-        if (processHeader == NULL) {
-            processHeader = initProcessPDHHeader();
+    EnterPdhCriticalSection(&initializationLock); {
+        if (!initialized) {
+            if (pdhInit() < 0) {
+                retValue = -1;
+            }  else if (allocateCPUCounters() < 0) {
+                retValue = -1;
+            } else if (initializeCPUCounters() < 0) {
+                retValue = -1;
+            }
+
+            if (0 == retValue) {
+                initialized = TRUE;
+            } else {
+              deallocateCPUCounters();
+            }
         }
-    } LeaveCriticalSection(&processHeaderLock);
-    return processHeader;
+    } LeavePdhCriticalSection(&initializationLock);
+
+    return retValue;
 }
 
-int perfInit(void);
+static int
+perfCPUInit() {
+    return initializePdhCPUCounters();
+}
 
-double
-perfGetCPULoad(int which)
-{
+static double
+perfGetProcessCPULoad() {
     PDH_FMT_COUNTERVALUE cv;
-    HCOUNTER            c;
+    int currentQueryIndex;
 
-    if (perfInit() < 0) {
+    if (perfCPUInit() < 0) {
         // warn?
         return -1.0;
     }
 
-    if (multiCounterCPULoad.query.query == NULL) {
-        // warn?
-        return -1.0;
-    }
+    currentQueryIndex = getCurrentQueryIndexForProcess();
 
-    if (which == -1) {
-        c = multiCounterCPULoad.counters[multiCounterCPULoad.noOfCounters - 1];
-    } else {
-        if (which < multiCounterCPULoad.noOfCounters) {
-            c = multiCounterCPULoad.counters[which];
-        } else {
-            return -1.0;
-        }
-    }
-    if (getPerformanceData(&multiCounterCPULoad.query, c, &cv, PDH_FMT_DOUBLE ) == CONFIG_SUCCESSFUL) {
-        return cv.doubleValue / 100;
-    }
-    return -1.0;
-}
-
-double
-perfGetProcessLoad(void)
-{
-    PDH_FMT_COUNTERVALUE cv;
-
-    if (perfInit() < 0) {
-        // warn?
-        return -1.0;
-    }
-
-    if (cntProcLoad.query.query == NULL) {
-        // warn?
-        return -1.0;
-    }
-
-    if (getPerformanceData(&cntProcLoad.query, cntProcLoad.counter, &cv, PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == CONFIG_SUCCESSFUL) {
+    if (getPerformanceData(&processTotalCPULoad[currentQueryIndex].query,
+                           processTotalCPULoad[currentQueryIndex].counter,
+                           &cv,
+                           PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == 0) {
         double d = cv.doubleValue / cpuFactor;
         d = min(1, d);
         d = max(0, d);
@@ -860,70 +1323,29 @@
     return -1.0;
 }
 
-/**
- * Helper to initialize the PDH library. Loads the library and sets up the functions.
- * Note that once loaded, we will never unload the PDH library.
- *
- * @return  CONFIG_SUCCESSFUL if successful, negative on failure.
- */
-int
-perfInit(void) {
-    static HMODULE    h;
-    static BOOL        running, inited;
+static double
+perfGetCPULoad(int which) {
+    PDH_FMT_COUNTERVALUE cv;
+    HCOUNTER c;
 
-    int error;
-
-    if (running) {
-        return CONFIG_SUCCESSFUL;
+    if (perfCPUInit() < 0) {
+        // warn?
+        return -1.0;
     }
 
-    error = CONFIG_SUCCESSFUL;
-
-    // this is double checked locking again, but we try to bypass the worst by
-    // implicit membar at end of lock.
-    EnterCriticalSection(&initializationLock); {
-        if (!inited) {
-            char         buf[64] = "";
-            SYSTEM_INFO si;
-
-            // CMH. But windows will not care about our affinity when giving
-            // us measurements. Need the real, raw num cpus.
-
-            GetSystemInfo(&si);
-            num_cpus  = si.dwNumberOfProcessors;
-            // Initialize the denominator for the jvm load calculations
-            cpuFactor = num_cpus * 100;
-
-            /**
-             * Do this dynamically, so we don't fail to start on systems without pdh.
-             */
-            if ((h = LoadLibrary("pdh.dll")) == NULL) {
-                /* printf("Could not load pdh.dll (%d)", GetLastError()); */
-                error = -2;
-            } else if (get_functions(h, buf, sizeof(buf)) < 0) {
-                FreeLibrary(h);
-                h = NULL;
-                error = -2;
-               /* printf("Failed to init pdh functions: %s.\n", buf); */
-            } else {
-                if (initProcessorCounters() != 0) {
-                    /* printf("Failed to init system load counters.\n"); */
-                } else if (initProcLoadCounter() != 0) {
-                    /* printf("Failed to init process load counter.\n"); */
-                } else if (initProcSystemLoadCounter() != 0) {
-                    /* printf("Failed to init process system load counter.\n"); */
-                } else {
-                    inited = true;
-                }
-            }
+    if (-1 == which) {
+        c = multiCounterCPULoad->counters[multiCounterCPULoad->noOfCounters - 1];
+    } else {
+        if (which < multiCounterCPULoad->noOfCounters) {
+            c = multiCounterCPULoad->counters[which];
+        } else {
+            return -1.0;
         }
-    } LeaveCriticalSection(&initializationLock);
-
-    if (inited && error == CONFIG_SUCCESSFUL) {
-        running = true;
     }
-
-    return error;
+    if (getPerformanceData(&multiCounterCPULoad->query, c, &cv, PDH_FMT_DOUBLE ) == 0) {
+        return cv.doubleValue / 100;
+    }
+    return -1.0;
 }
 
 JNIEXPORT jdouble JNICALL
@@ -937,5 +1359,5 @@
 Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
-    return perfGetProcessLoad();
+    return perfGetProcessCPULoad();
 }
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_crypt.c	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_crypt.c	Mon Nov 17 09:36:40 2014 +0100
@@ -141,8 +141,8 @@
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckEncryptedPartLen);
 
-    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
     (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     ckAssertReturnValueOK(env, rv);
     return ckEncryptedPartLen;
@@ -214,7 +214,7 @@
     }
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -266,7 +266,7 @@
     //printf("EF: ckLastEncryptedPartLen=%i", ckLastEncryptedPartLen);
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -361,8 +361,8 @@
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckPartLen);
 
-    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
     (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     ckAssertReturnValueOK(env, rv);
 
@@ -429,7 +429,7 @@
     }
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
     }
 
     ckAssertReturnValueOK(env, rv);
@@ -478,7 +478,7 @@
                                          &ckLastPartLen);
 
     if (directOut == 0) {
-        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);
 
     }
 
--- a/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java	Mon Nov 17 09:36:40 2014 +0100
@@ -294,11 +294,11 @@
             if (entry instanceof TrustedCertEntry) {
                 return ((TrustedCertEntry)entry).cert;
             } else {
-                if (((KeyEntry)entry).chain == null) {
+                KeyEntry ke = (KeyEntry)entry;
+                if (ke.chain == null || ke.chain.length == 0) {
                     return null;
-                } else {
-                    return ((KeyEntry)entry).chain[0];
                 }
+                return ke.chain[0];
             }
         } else {
             return null;
@@ -618,10 +618,12 @@
             Object entry = entries.get(alias);
             if (entry instanceof TrustedCertEntry) {
                 certElem = ((TrustedCertEntry)entry).cert;
-            } else if (((KeyEntry)entry).chain != null) {
-                certElem = ((KeyEntry)entry).chain[0];
             } else {
-                continue;
+                KeyEntry ke = (KeyEntry)entry;
+                if (ke.chain == null || ke.chain.length == 0) {
+                    continue;
+                }
+                certElem = ke.chain[0];
             }
             if (certElem.equals(cert)) {
                 return alias;
--- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -279,7 +279,8 @@
     // Search the user keychain list for all identities. Identities are a certificate/private key association that
     // can be chosen for a purpose such as signing or an SSL connection.
     SecIdentitySearchRef identitySearch = NULL;
-    OSStatus err = SecIdentitySearchCreate(NULL, CSSM_KEYUSE_ANY, &identitySearch);
+    // Pass 0 if you want all identities returned by this search
+    OSStatus err = SecIdentitySearchCreate(NULL, 0, &identitySearch);
     SecIdentityRef theIdentity = NULL;
     OSErr searchResult = noErr;
 
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Mon Nov 17 09:36:40 2014 +0100
@@ -2358,7 +2358,7 @@
             if (sigalg == null) {
 
                 if (keyAlgorithm.equalsIgnoreCase("DSA"))
-                    signatureAlgorithm = "SHA1withDSA";
+                    signatureAlgorithm = "SHA256withDSA";
                 else if (keyAlgorithm.equalsIgnoreCase("RSA"))
                     signatureAlgorithm = "SHA256withRSA";
                 else if (keyAlgorithm.equalsIgnoreCase("EC"))
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1400,7 +1400,13 @@
         if (t instanceof NoDisplayException) {
             return;
         }
-        displayErrorDialog(w, t.toString());
+        if (t.getClass() == Exception.class) {
+            // Exception is usually thrown inside policytool for user
+            // interaction error. There is no need to show the type.
+            displayErrorDialog(w, t.getLocalizedMessage());
+        } else {
+            displayErrorDialog(w, t.toString());
+        }
     }
 
     /**
--- a/jdk/test/ProblemList.txt	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/ProblemList.txt	Mon Nov 17 09:36:40 2014 +0100
@@ -138,9 +138,6 @@
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
-# 8058506
-java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java                              generic-all
-
 ############################################################################
 
 # jdk_jmx
@@ -285,6 +282,9 @@
 # 8058616
 com/sun/jdi/RedefinePop.sh                                      generic-all
 
+# 8061114
+com/sun/jdi/Redefine-g.sh                                       generic-all
+
 ############################################################################
 
 # jdk_util
@@ -318,4 +318,7 @@
 # 8057732
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    generic-all
 
+# 8060736
+sun/jvmstat/monitor/MonitoredVm/CR6672135.java                  generic-all
+
 ############################################################################
--- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -46,8 +46,7 @@
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 public class LdapTimeoutTest {
-    private static final ScheduledExecutorService pool =
-        Executors.newScheduledThreadPool(1);
+
     static volatile int passed = 0, failed = 0;
     static void pass() {passed++;}
     static void fail() {failed++; Thread.dumpStack();}
@@ -80,7 +79,6 @@
             new LdapTimeoutTest().simpleAuthConnectTest(env);
         } finally {
             s.interrupt();
-            LdapTimeoutTest.pool.shutdown();
         }
 
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
@@ -90,7 +88,6 @@
     void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
         InitialContext ctx = null;
         if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        ScheduledFuture killer = killSwitch(5_000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -112,13 +109,12 @@
                 pass();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
     void simpleAuthConnectTest(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(5_000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -141,13 +137,12 @@
                 fail();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
     void deadServerNoTimeout(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(30_000);
         long start = System.currentTimeMillis();
         try {
             ctx = new InitialDirContext(env);
@@ -169,12 +164,11 @@
                 pass();
             }
         } finally {
-            if (!shutItDown(killer, ctx)) fail();
+            if (!shutItDown(ctx)) fail();
         }
     }
 
-    boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
-        killer.cancel(true);
+    boolean shutItDown(InitialContext ctx) {
         try {
             if (ctx != null) ctx.close();
             return true;
@@ -183,17 +177,6 @@
         }
     }
 
-    ScheduledFuture killSwitch(int ms) {
-        final Thread current = Thread.currentThread();
-        return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
-            public Void call() throws Exception {
-                System.err.println("Fail: killSwitch()");
-                System.exit(0);
-                return null;
-            }
-        }, ms, MILLISECONDS);
-    }
-
     static class Server extends Thread {
         final ServerSocket serverSock;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetDoubleVMOption.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug     8061616
+ * @summary Basic Test for HotSpotDiagnosticMXBean.getVMOption() and double values
+ * @author  Jaroslav Bachorik
+ *
+ * @run main/othervm -XX:CompileThresholdScaling=0.14 GetDoubleVMOption
+ */
+
+import com.sun.management.HotSpotDiagnosticMXBean;
+import com.sun.management.VMOption;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import javax.management.MBeanServer;
+
+public class GetDoubleVMOption {
+    private static final String COMPILE_THRESHOLD_SCALING = "CompileThresholdScaling";
+    private static final String EXPECTED_VALUE = "0.14";
+    private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
+        "com.sun.management:type=HotSpotDiagnostic";
+
+    public static void main(String[] args) throws Exception {
+        List<HotSpotDiagnosticMXBean> list =
+            ManagementFactory.getPlatformMXBeans(HotSpotDiagnosticMXBean.class);
+        HotSpotDiagnosticMXBean mbean = list.get(0);
+        checkVMOption(mbean);
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        mbean = ManagementFactory.newPlatformMXBeanProxy(mbs,
+                    HOTSPOT_DIAGNOSTIC_MXBEAN_NAME,
+                    HotSpotDiagnosticMXBean.class);
+        checkVMOption(mbean);
+    }
+
+    private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
+        VMOption option = mbean.getVMOption(COMPILE_THRESHOLD_SCALING);
+        if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
+            throw new RuntimeException("Unexpected value: " +
+                option.getValue() + " expected: " + EXPECTED_VALUE);
+        }
+    }
+}
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -32,16 +32,15 @@
 
 import com.sun.management.HotSpotDiagnosticMXBean;
 import com.sun.management.VMOption;
-import com.sun.management.VMOption.Origin;
 import java.lang.management.ManagementFactory;
 import java.util.List;
 import javax.management.MBeanServer;
 
 public class GetVMOption {
-    private static String PRINT_GC_DETAILS = "PrintGCDetails";
-    private static String EXPECTED_VALUE = "true";
-    private static String BAD_OPTION = "BadOption";
-    private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
+    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String EXPECTED_VALUE = "true";
+    private static final String BAD_OPTION = "BadOption";
+    private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
         "com.sun.management:type=HotSpotDiagnostic";
 
     public static void main(String[] args) throws Exception {
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -39,11 +39,11 @@
 import com.sun.management.VMOption.Origin;
 
 public class SetVMOption {
-    private static String PRINT_GC_DETAILS = "PrintGCDetails";
-    private static String EXPECTED_VALUE = "true";
-    private static String BAD_VALUE = "yes";
-    private static String NEW_VALUE = "false";
-    private static String MANAGEMENT_SERVER = "ManagementServer";
+    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String EXPECTED_VALUE = "true";
+    private static final String BAD_VALUE = "yes";
+    private static final String NEW_VALUE = "false";
+    private static final String MANAGEMENT_SERVER = "ManagementServer";
     private static HotSpotDiagnosticMXBean mbean;
 
     public static void main(String[] args) throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,21 @@
+<html>
+<!--  
+  @test
+  @bug 4051487 4145670
+  @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
+           while it is being created does not crash the VM.
+  @author dpm area=Threads
+  @run applet/timeout=7200 DisposeStressTest.html
+  -->
+<head>
+<title>DisposeStressTest</title>
+</head>
+<body>
+
+<h1>DisposeStressTest<br>Bug ID: 4051487, 4145670</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="DisposeStressTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2014, 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
+  @bug 4051487 4145670 8062021
+  @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
+           while it is being created does not crash the VM.
+  @author dpm area=Threads
+  @run applet/timeout=7200 DisposeStressTest.html
+*/
+
+// Note there is no @ in front of test above.  This is so that the
+//  harness will not mistake this file as a test file.  It should
+//  only see the html file as a test file. (the harness runs all
+//  valid test files, so it would run this test twice if this file
+//  were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag.  Here, you
+//  should put which functional area the test falls in.  See the
+//  AWT-core home page -> test areas and/or -> AWT team  for a list of
+//  areas.
+// Note also the 'DisposeStressTest.html' in the run tag.  This should
+//  be changed to the name of the test.
+
+
+/**
+ * DisposeStressTest.java
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors.  (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems).  Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class DisposeStressTest extends Applet
+ {
+   //Declare things used in the test, like buttons and labels here
+
+   public void init()
+    {
+      //Create instructions for the user here, as well as set up
+      // the environment -- set the layout manager, add buttons,
+      // etc.
+
+      this.setLayout (new BorderLayout ());
+
+      String[] instructions =
+       {
+         "This is an AUTOMATIC test",
+         "simply wait until it is done"
+       };
+      Sysout.createDialog( );
+      Sysout.printInstructions( instructions );
+
+    }//End  init()
+
+   public void start ()
+    {
+        for (int i = 0; i < 1000; i++) {
+            Frame f = new Frame();
+            f.setBounds(10, 10, 10, 10);
+            f.show();
+            f.dispose();
+
+            Frame f2 = new Frame();
+            f2.setBounds(10, 10, 100, 100);
+            MenuBar bar = new MenuBar();
+            Menu menu = new Menu();
+            menu.add(new MenuItem("foo"));
+            bar.add(menu);
+            f2.setMenuBar(bar);
+            f2.show();
+            f2.dispose();
+        }
+    }// start()
+
+ }// class DisposeStressTest
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+ {
+   private static TestDialog dialog;
+
+   public static void createDialogWithInstructions( String[] instructions )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      dialog.printInstructions( instructions );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+   public static void createDialog( )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      String[] defInstr = { "Instructions will appear here. ", "" } ;
+      dialog.printInstructions( defInstr );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+
+   public static void printInstructions( String[] instructions )
+    {
+      dialog.printInstructions( instructions );
+    }
+
+
+   public static void println( String messageIn )
+    {
+      dialog.displayMessage( messageIn );
+    }
+
+ }// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+ {
+
+   TextArea instructionsText;
+   TextArea messageText;
+   int maxStringLength = 80;
+
+   //DO NOT call this directly, go through Sysout
+   public TestDialog( Frame frame, String name )
+    {
+      super( frame, name );
+      int scrollBoth = TextArea.SCROLLBARS_BOTH;
+      instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+      add( "North", instructionsText );
+
+      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+      add("South", messageText);
+
+      pack();
+
+      show();
+    }// TestDialog()
+
+   //DO NOT call this directly, go through Sysout
+   public void printInstructions( String[] instructions )
+    {
+      //Clear out any current instructions
+      instructionsText.setText( "" );
+
+      //Go down array of instruction strings
+
+      String printStr, remainingStr;
+      for( int i=0; i < instructions.length; i++ )
+       {
+         //chop up each into pieces maxSringLength long
+         remainingStr = instructions[ i ];
+         while( remainingStr.length() > 0 )
+          {
+            //if longer than max then chop off first max chars to print
+            if( remainingStr.length() >= maxStringLength )
+             {
+               //Try to chop on a word boundary
+               int posOfSpace = remainingStr.
+                  lastIndexOf( ' ', maxStringLength - 1 );
+
+               if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+               printStr = remainingStr.substring( 0, posOfSpace + 1 );
+               remainingStr = remainingStr.substring( posOfSpace + 1 );
+             }
+            //else just print
+            else
+             {
+               printStr = remainingStr;
+               remainingStr = "";
+             }
+
+            instructionsText.append( printStr + "\n" );
+
+          }// while
+
+       }// for
+
+    }//printInstructions()
+
+   //DO NOT call this directly, go through Sysout
+   public void displayMessage( String messageIn )
+    {
+      messageText.append( messageIn + "\n" );
+    }
+
+ }// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/tray.policy	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,3 @@
+//NoPermission Test
+grant{
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/geom/AffineTransform/GetTypeOptimization.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2002, 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
+ * @bug 4418285
+ * @summary Tests that transforms modified with degenerate operations
+ *          continue to return their more optimal type from getType().
+ *          This test also confirms that isIdentity() returns the
+ *          optimal value under all histories of modification.
+ * @run main GetTypeOptimization
+ */
+
+import java.awt.geom.AffineTransform;
+import java.util.Random;
+
+public class GetTypeOptimization {
+    static int TYPE_IDENTITY          = AffineTransform.TYPE_IDENTITY;
+    static int TYPE_TRANSLATION       = AffineTransform.TYPE_TRANSLATION;
+    static int TYPE_UNIFORM_SCALE     = AffineTransform.TYPE_UNIFORM_SCALE;
+    static int TYPE_GENERAL_SCALE     = AffineTransform.TYPE_GENERAL_SCALE;
+    static int TYPE_FLIP              = AffineTransform.TYPE_FLIP;
+    static int TYPE_QUADRANT_ROTATION = AffineTransform.TYPE_QUADRANT_ROTATION;
+    static int TYPE_GENERAL_ROTATION  = AffineTransform.TYPE_GENERAL_ROTATION;
+    static int TYPE_GENERAL_TRANSFORM = AffineTransform.TYPE_GENERAL_TRANSFORM;
+
+    public static Random rand = new Random();
+
+    public static boolean verbose;
+    public static int numerrors;
+
+    public static void main(String argv[]) {
+        verbose = (argv.length != 0);
+
+        checkBug4418285();
+
+        checkAtType(new AffineTransform());
+        checkAtType(AffineTransform.getTranslateInstance(0, 0));
+        checkAtType(AffineTransform.getScaleInstance(1, 1));
+        checkAtType(AffineTransform.getShearInstance(0, 0));
+        checkAtType(AffineTransform.getRotateInstance(0));
+        checkAtType(AffineTransform.getRotateInstance(0, 0, 0));
+        for (int i = 90; i <= 360; i += 90) {
+            double angle = Math.toRadians(i);
+            checkAtType(AffineTransform.getRotateInstance(angle));
+            checkAtType(AffineTransform.getRotateInstance(angle, 0, 0));
+        }
+
+        AffineTransform at = new AffineTransform();
+        checkAtType(at);
+
+        at.setToIdentity(); checkAtType(at);
+        at.setToTranslation(0.0, 0.0); checkAtType(at);
+        at.setToScale(1.0, 1.0); checkAtType(at);
+        at.setToShear(0.0, 0.0); checkAtType(at);
+        at.setToRotation(0); checkAtType(at);
+        at.setToRotation(0, 0, 0); checkAtType(at);
+        for (int i = 90; i <= 360; i += 90) {
+            double angle = Math.toRadians(i);
+            at.setToRotation(angle); checkAtType(at);
+            at.setToRotation(angle, 0, 0); checkAtType(at);
+        }
+
+        at.setToIdentity(); at.scale(1, 1); checkAtType(at);
+        at.setToIdentity(); at.translate(0, 0); checkAtType(at);
+        at.setToIdentity(); at.shear(0, 0); checkAtType(at);
+        at.setToIdentity(); at.rotate(0); checkAtType(at);
+        for (int i = 90; i <= 360; i += 90) {
+            double angle = Math.toRadians(i);
+            at.setToIdentity(); at.rotate(angle); checkAtType(at);
+            at.setToIdentity(); at.rotate(angle, 0, 0); checkAtType(at);
+        }
+
+        at.setToIdentity();
+        for (int i = 0; i < 4; i++) {
+            at.rotate(Math.toRadians(90)); checkAtType(at);
+        }
+
+        at.setToIdentity();
+        at.scale(2, 2); checkAtType(at);
+        at.scale(.5, .5); checkAtType(at);
+
+        for (int n = 1; n <= 3; n++) {
+            for (int i = 0; i < 500; i++) {
+                checkAtType(makeRandomTransform(n));
+            }
+        }
+        if (numerrors != 0) {
+            if (!verbose) {
+                System.err.println("Rerun test with an argument for details");
+            }
+            throw new RuntimeException(numerrors+" tests failed!");
+        }
+    }
+
+    public static void checkBug4418285() {
+        AffineTransform id =
+            new AffineTransform ();
+        AffineTransform translate0 =
+            AffineTransform.getTranslateInstance (0, 0);
+        if (id.isIdentity() != translate0.isIdentity() ||
+            id.getType() != translate0.getType())
+        {
+            numerrors++;
+            if (verbose) {
+                System.err.println("id=        " + id         +
+                                   ", isIdentity()=" +
+                                   id.isIdentity());
+                System.err.println("translate0=" + translate0 +
+                                   ", isIdentity()=" +
+                                   translate0.isIdentity());
+                System.err.println("equals="     + id.equals (translate0));
+                System.err.println();
+            }
+        }
+    }
+
+    public static AffineTransform makeRandomTransform(int numops) {
+        AffineTransform at = new AffineTransform();
+        while (--numops >= 0) {
+            switch (rand.nextInt(4)) {
+            case 0:
+                at.scale(rand.nextDouble() * 5 - 2.5,
+                         rand.nextDouble() * 5 - 2.5);
+                break;
+            case 1:
+                at.shear(rand.nextDouble() * 5 - 2.5,
+                         rand.nextDouble() * 5 - 2.5);
+                break;
+            case 2:
+                at.rotate(rand.nextDouble() * Math.PI * 2);
+                break;
+            case 3:
+                at.translate(rand.nextDouble() * 50 - 25,
+                             rand.nextDouble() * 50 - 25);
+                break;
+            default:
+                throw new InternalError("bad case!");
+            }
+        }
+        return at;
+    }
+
+    public static void checkAtType(AffineTransform at) {
+        int reftype = getRefType(at);
+        boolean isident = isIdentity(at);
+        for (int i = 0; i < 5; i++) {
+            boolean atisident = at.isIdentity();
+            int attype = at.getType();
+            if (isident != atisident || reftype != attype) {
+                numerrors++;
+                if (verbose) {
+                    System.err.println(at+".isIdentity() == "+atisident);
+                    System.err.println(at+".getType() == "+attype);
+                    System.err.println("should be "+isident+", "+reftype);
+                    new Throwable().printStackTrace();
+                    System.err.println();
+                }
+                break;
+            }
+        }
+    }
+
+    public static boolean isIdentity(AffineTransform at) {
+        return (at.getScaleX() == 1 &&
+                at.getScaleY() == 1 &&
+                at.getShearX() == 0 &&
+                at.getShearY() == 0 &&
+                at.getTranslateX() == 0 &&
+                at.getTranslateY() == 0);
+
+    }
+
+    public static int getRefType(AffineTransform at) {
+        double m00 = at.getScaleX();
+        double m11 = at.getScaleY();
+        double m01 = at.getShearX();
+        double m10 = at.getShearY();
+        if (m00 * m01 + m10 * m11 != 0) {
+            // Transformed unit vectors are not perpendicular...
+            return TYPE_GENERAL_TRANSFORM;
+        }
+        int type = ((at.getTranslateX() != 0 || at.getTranslateY() != 0)
+                    ? TYPE_TRANSLATION : TYPE_IDENTITY);
+        boolean sgn0, sgn1;
+        if (m01 == 0 && m10 == 0) {
+            sgn0 = (m00 >= 0.0);
+            sgn1 = (m11 >= 0.0);
+            if (sgn0 == sgn1) {
+                if (sgn0) {
+                    // Both scaling factors non-negative - simple scale
+                    if (m00 != m11) {
+                        type |= TYPE_GENERAL_SCALE;
+                    } else if (m00 != 1.0) {
+                        type |= TYPE_UNIFORM_SCALE;
+                    }
+                } else {
+                    // Both scaling factors negative - 180 degree rotation
+                    type |= TYPE_QUADRANT_ROTATION;
+                    if (m00 != m11) {
+                        type |= TYPE_GENERAL_SCALE;
+                    } else if (m00 != -1.0) {
+                        type |= TYPE_UNIFORM_SCALE;
+                    }
+                }
+            } else {
+                // Scaling factor signs different - flip about some axis
+                type |= TYPE_FLIP;
+                if (m00 != -m11) {
+                    type |= TYPE_GENERAL_SCALE;
+                } else if (m00 != 1.0 && m00 != -1.0) {
+                    type |= TYPE_UNIFORM_SCALE;
+                }
+            }
+        } else if (m00 == 0 && m11 == 0) {
+            sgn0 = (m01 >= 0.0);
+            sgn1 = (m10 >= 0.0);
+            if (sgn0 != sgn1) {
+                // Different signs - simple 90 degree rotation
+                if (m01 != -m10) {
+                    type |= (TYPE_QUADRANT_ROTATION | TYPE_GENERAL_SCALE);
+                } else if (m01 != 1.0 && m01 != -1.0) {
+                    type |= (TYPE_QUADRANT_ROTATION | TYPE_UNIFORM_SCALE);
+                } else {
+                    type |= TYPE_QUADRANT_ROTATION;
+                }
+            } else {
+                // Same signs - 90 degree rotation plus an axis flip too
+                if (m01 == m10) {
+                    if (m01 == 0) {
+                        // All four m[01][01] elements are 0
+                        type |= TYPE_UNIFORM_SCALE;
+                    } else {
+                        // Note - shouldn't (1,1) be no scale at all?
+                        type |= (TYPE_QUADRANT_ROTATION |
+                                 TYPE_FLIP |
+                                 TYPE_UNIFORM_SCALE);
+                    }
+                } else {
+                    type |= (TYPE_QUADRANT_ROTATION |
+                             TYPE_FLIP |
+                             TYPE_GENERAL_SCALE);
+                }
+            }
+        } else {
+            if (m00 * m11 >= 0.0) {
+                // sgn(m00) == sgn(m11) therefore sgn(m01) == -sgn(m10)
+                // This is the "unflipped" (right-handed) state
+                if (m00 != m11 || m01 != -m10) {
+                    type |= (TYPE_GENERAL_ROTATION | TYPE_GENERAL_SCALE);
+                } else if (m00 == 0) {
+                    // then m11 == 0 also
+                    if (m01 == -m10) {
+                        type |= (TYPE_QUADRANT_ROTATION | TYPE_UNIFORM_SCALE);
+                    } else {
+                        type |= (TYPE_QUADRANT_ROTATION | TYPE_GENERAL_SCALE);
+                    }
+                } else if (m00 * m11 - m01 * m10 != 1.0) {
+                    type |= (TYPE_GENERAL_ROTATION | TYPE_UNIFORM_SCALE);
+                } else {
+                    type |= TYPE_GENERAL_ROTATION;
+                }
+            } else {
+                // sgn(m00) == -sgn(m11) therefore sgn(m01) == sgn(m10)
+                // This is the "flipped" (left-handed) state
+                if (m00 != -m11 || m01 != m10) {
+                    type |= (TYPE_GENERAL_ROTATION |
+                             TYPE_FLIP |
+                             TYPE_GENERAL_SCALE);
+                } else if (m01 == 0) {
+                    if (m00 == 1.0 || m00 == -1.0) {
+                        type |= TYPE_FLIP;
+                    } else {
+                        type |= (TYPE_FLIP | TYPE_UNIFORM_SCALE);
+                    }
+                } else if (m00 * m11 - m01 * m10 != 1.0) {
+                    type |= (TYPE_GENERAL_ROTATION |
+                             TYPE_FLIP |
+                             TYPE_UNIFORM_SCALE);
+                } else {
+                    type |= (TYPE_GENERAL_ROTATION | TYPE_FLIP);
+                }
+            }
+        }
+        return type;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/geom/AffineTransform/TestInvertMethods.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,483 @@
+/*
+ * Copyright (c) 2005, 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
+ * @bug 4987374
+ * @summary Unit test for inversion methods:
+ *
+ *          AffineTransform.createInverse();
+ *          AffineTransform.invert();
+ *
+ * @author flar
+ * @run main TestInvertMethods
+ */
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+
+/*
+ * Instances of the inner class Tester are "nodes" which take an input
+ * AffineTransform (AT), modify it in some way and pass the modified
+ * AT onto another Tester node.
+ *
+ * There is one particular Tester node of note called theVerifier.
+ * This is a leaf node which takes the input AT and tests the various
+ * inversion methods on that matrix.
+ *
+ * Most of the other Tester nodes will perform a single affine operation
+ * on their input, such as a rotate by various angles, or a scale by
+ * various predefined scale  values, and then pass the modified AT on
+ * to the next node in the chain which may be a verifier or another
+ * modifier.
+ *
+ * The Tester instances can also be chained together using the chain
+ * method so that we can test not only matrices modified by some single
+ * affine operation (scale, rotate, etc.) but also composite matrices
+ * that represent multiple operations concatenated together.
+ */
+public class TestInvertMethods {
+    public static boolean verbose;
+
+    public static final double MAX_ULPS = 2.0;
+    public static double MAX_TX_ULPS = MAX_ULPS;
+    public static double maxulps = 0.0;
+    public static double maxtxulps = 0.0;
+    public static int numtests = 0;
+
+    public static void main(String argv[]) {
+        Tester rotate = new Tester.Rotate();
+        Tester scale = new Tester.Scale();
+        Tester shear = new Tester.Shear();
+        Tester translate = new Tester.Translate();
+
+        if (argv.length > 1) {
+            // This next line verifies that chaining works correctly...
+            scale.chain(translate.chain(new Tester.Debug())).test(false);
+            return;
+        }
+
+        verbose = (argv.length > 0);
+
+        new Tester.Identity().test(true);
+        translate.test(true);
+        scale.test(true);
+        rotate.test(true);
+        shear.test(true);
+        scale.chain(translate).test(true);
+        rotate.chain(translate).test(true);
+        shear.chain(translate).test(true);
+        translate.chain(scale).test(true);
+        translate.chain(rotate).test(true);
+        translate.chain(shear).test(true);
+        translate.chain(scale.chain(rotate.chain(shear))).test(false);
+        shear.chain(rotate.chain(scale.chain(translate))).test(false);
+
+        System.out.println(numtests+" tests performed");
+        System.out.println("Max scale and shear difference: "+maxulps+" ulps");
+        System.out.println("Max translate difference: "+maxtxulps+" ulps");
+    }
+
+    public abstract static class Tester {
+        public static AffineTransform IdentityTx = new AffineTransform();
+
+        /*
+         * This is the leaf node that performs inversion testing
+         * on the incoming AffineTransform.
+         */
+        public static final Tester theVerifier = new Tester() {
+            public void test(AffineTransform at, boolean full) {
+                numtests++;
+                AffineTransform inv1, inv2;
+                boolean isinvertible =
+                    (Math.abs(at.getDeterminant()) >= Double.MIN_VALUE);
+                try {
+                    inv1 = at.createInverse();
+                    if (!isinvertible) missingNTE("createInverse", at);
+                } catch (NoninvertibleTransformException e) {
+                    inv1 = null;
+                    if (isinvertible) extraNTE("createInverse", at);
+                }
+                inv2 = new AffineTransform(at);
+                try {
+                    inv2.invert();
+                    if (!isinvertible) missingNTE("invert", at);
+                } catch (NoninvertibleTransformException e) {
+                    if (isinvertible) extraNTE("invert", at);
+                }
+                if (verbose) System.out.println("at = "+at);
+                if (isinvertible) {
+                    if (verbose) System.out.println(" inv1 = "+inv1);
+                    if (verbose) System.out.println(" inv2 = "+inv2);
+                    if (!inv1.equals(inv2)) {
+                        report(at, inv1, inv2,
+                               "invert methods do not agree");
+                    }
+                    inv1.concatenate(at);
+                    inv2.concatenate(at);
+                    // "Fix" some values that don't always behave
+                    // well with all the math that we've done up
+                    // to this point.
+                    // See the note on the concatfix method below.
+                    concatfix(inv1);
+                    concatfix(inv2);
+                    if (verbose) System.out.println("  at*inv1 = "+inv1);
+                    if (verbose) System.out.println("  at*inv2 = "+inv2);
+                    if (!compare(inv1, IdentityTx)) {
+                        report(at, inv1, IdentityTx,
+                               "createInverse() check failed");
+                    }
+                    if (!compare(inv2, IdentityTx)) {
+                        report(at, inv2, IdentityTx,
+                               "invert() check failed");
+                    }
+                } else {
+                    if (verbose) System.out.println(" is not invertible");
+                }
+                if (verbose) System.out.println();
+            }
+
+            void missingNTE(String methodname, AffineTransform at) {
+                throw new RuntimeException("Noninvertible was not "+
+                                           "thrown from "+methodname+
+                                           " for: "+at);
+            }
+
+            void extraNTE(String methodname, AffineTransform at) {
+                throw new RuntimeException("Unexpected Noninvertible "+
+                                           "thrown from "+methodname+
+                                           " for: "+at);
+            }
+        };
+
+        /*
+         * The inversion math may work out fairly exactly, but when
+         * we concatenate the inversions back with the original matrix
+         * in an attempt to restore them to the identity matrix,
+         * then we can end up compounding errors to a fairly high
+         * level, particularly if the component values had mantissas
+         * that were repeating fractions.  This function therefore
+         * "fixes" the results of concatenating the inversions back
+         * with their original matrices to get rid of small variations
+         * in the values that should have ended up being 0.0.
+         */
+        public void concatfix(AffineTransform at) {
+            double m00 = at.getScaleX();
+            double m10 = at.getShearY();
+            double m01 = at.getShearX();
+            double m11 = at.getScaleY();
+            double m02 = at.getTranslateX();
+            double m12 = at.getTranslateY();
+            if (Math.abs(m02) < 1E-10) m02 = 0.0;
+            if (Math.abs(m12) < 1E-10) m12 = 0.0;
+            if (Math.abs(m01) < 1E-15) m01 = 0.0;
+            if (Math.abs(m10) < 1E-15) m10 = 0.0;
+            at.setTransform(m00, m10,
+                            m01, m11,
+                            m02, m12);
+        }
+
+        public void test(boolean full) {
+            test(IdentityTx, full);
+        }
+
+        public void test(AffineTransform init, boolean full) {
+            test(init, theVerifier, full);
+        }
+
+        public void test(AffineTransform init, Tester next, boolean full) {
+            next.test(init, full);
+        }
+
+        public Tester chain(Tester next) {
+            return new Chain(this, next);
+        }
+
+        /*
+         * Utility node used to chain together two other nodes for
+         * implementing the "chain" method.
+         */
+        public static class Chain extends Tester {
+            Tester prev;
+            Tester next;
+
+            public Chain(Tester prev, Tester next) {
+                this.prev = prev;
+                this.next = next;
+            }
+
+            public void test(AffineTransform init, boolean full) {
+                prev.test(init, next, full);
+            }
+
+            public Tester chain(Tester next) {
+                this.next = this.next.chain(next);
+                return this;
+            }
+        }
+
+        /*
+         * Utility node for testing.
+         */
+        public static class Fail extends Tester {
+            public void test(AffineTransform init, Tester next, boolean full) {
+                throw new RuntimeException("Debug: Forcing failure");
+            }
+        }
+
+        /*
+         * Utility node for testing that chaining works.
+         */
+        public static class Debug extends Tester {
+            public void test(AffineTransform init, Tester next, boolean full) {
+                new Throwable().printStackTrace();
+                next.test(init, full);
+            }
+        }
+
+        /*
+         * NOP node.
+         */
+        public static class Identity extends Tester {
+            public void test(AffineTransform init, Tester next, boolean full) {
+                if (verbose) System.out.println("*Identity = "+init);
+                next.test(init, full);
+            }
+        }
+
+        /*
+         * Affine rotation node.
+         */
+        public static class Rotate extends Tester {
+            public void test(AffineTransform init, Tester next, boolean full) {
+                int inc = full ? 10 : 45;
+                for (int i = -720; i <= 720; i += inc) {
+                    AffineTransform at2 = new AffineTransform(init);
+                    at2.rotate(Math.toRadians(i));
+                    if (verbose) System.out.println("*Rotate("+i+") = "+at2);
+                    next.test(at2, full);
+                }
+            }
+        }
+
+        public static final double SMALL_VALUE = .0001;
+        public static final double LARGE_VALUE = 10000;
+
+        /*
+         * Affine scale node.
+         */
+        public static class Scale extends Tester {
+            public double fullvals[] = {
+                // Noninvertibles
+                0.0, 0.0,
+                0.0, 1.0,
+                1.0, 0.0,
+
+                // Invertibles
+                SMALL_VALUE, SMALL_VALUE,
+                SMALL_VALUE, 1.0,
+                1.0, SMALL_VALUE,
+
+                SMALL_VALUE, LARGE_VALUE,
+                LARGE_VALUE, SMALL_VALUE,
+
+                LARGE_VALUE, LARGE_VALUE,
+                LARGE_VALUE, 1.0,
+                1.0, LARGE_VALUE,
+
+                0.5, 0.5,
+                1.0, 1.0,
+                2.0, 2.0,
+                Math.PI, Math.E,
+            };
+            public double abbrevvals[] = {
+                0.0, 0.0,
+                1.0, 1.0,
+                2.0, 3.0,
+            };
+
+            public void test(AffineTransform init, Tester next, boolean full) {
+                double scales[] = (full ? fullvals : abbrevvals);
+                for (int i = 0; i < scales.length; i += 2) {
+                    AffineTransform at2 = new AffineTransform(init);
+                    at2.scale(scales[i], scales[i+1]);
+                    if (verbose) System.out.println("*Scale("+scales[i]+", "+
+                                                    scales[i+1]+") = "+at2);
+                    next.test(at2, full);
+                }
+            }
+        }
+
+        /*
+         * Affine shear node.
+         */
+        public static class Shear extends Tester {
+            public double fullvals[] = {
+                0.0, 0.0,
+                0.0, 1.0,
+                1.0, 0.0,
+
+                // Noninvertible
+                1.0, 1.0,
+
+                SMALL_VALUE, SMALL_VALUE,
+                SMALL_VALUE, LARGE_VALUE,
+                LARGE_VALUE, SMALL_VALUE,
+                LARGE_VALUE, LARGE_VALUE,
+
+                Math.PI, Math.E,
+            };
+            public double abbrevvals[] = {
+                0.0, 0.0,
+                0.0, 1.0,
+                1.0, 0.0,
+
+                // Noninvertible
+                1.0, 1.0,
+            };
+
+            public void test(AffineTransform init, Tester next, boolean full) {
+                double shears[] = (full ? fullvals : abbrevvals);
+                for (int i = 0; i < shears.length; i += 2) {
+                    AffineTransform at2 = new AffineTransform(init);
+                    at2.shear(shears[i], shears[i+1]);
+                    if (verbose) System.out.println("*Shear("+shears[i]+", "+
+                                                    shears[i+1]+") = "+at2);
+                    next.test(at2, full);
+                }
+            }
+        }
+
+        /*
+         * Affine translate node.
+         */
+        public static class Translate extends Tester {
+            public double fullvals[] = {
+                0.0, 0.0,
+                0.0, 1.0,
+                1.0, 0.0,
+
+                SMALL_VALUE, SMALL_VALUE,
+                SMALL_VALUE, LARGE_VALUE,
+                LARGE_VALUE, SMALL_VALUE,
+                LARGE_VALUE, LARGE_VALUE,
+
+                Math.PI, Math.E,
+            };
+            public double abbrevvals[] = {
+                0.0, 0.0,
+                0.0, 1.0,
+                1.0, 0.0,
+                Math.PI, Math.E,
+            };
+
+            public void test(AffineTransform init, Tester next, boolean full) {
+                double translates[] = (full ? fullvals : abbrevvals);
+                for (int i = 0; i < translates.length; i += 2) {
+                    AffineTransform at2 = new AffineTransform(init);
+                    at2.translate(translates[i], translates[i+1]);
+                    if (verbose) System.out.println("*Translate("+
+                                                    translates[i]+", "+
+                                                    translates[i+1]+") = "+at2);
+                    next.test(at2, full);
+                }
+            }
+        }
+    }
+
+    public static void report(AffineTransform orig,
+                              AffineTransform at1, AffineTransform at2,
+                              String message)
+    {
+        System.out.println(orig+", type = "+orig.getType());
+        System.out.println(at1+", type = "+at1.getType());
+        System.out.println(at2+", type = "+at2.getType());
+        System.out.println("ScaleX values differ by "+
+                           ulps(at1.getScaleX(),
+                                at2.getScaleX())+" ulps");
+        System.out.println("ScaleY values differ by "+
+                           ulps(at1.getScaleY(),
+                                at2.getScaleY())+" ulps");
+        System.out.println("ShearX values differ by "+
+                           ulps(at1.getShearX(),
+                                at2.getShearX())+" ulps");
+        System.out.println("ShearY values differ by "+
+                           ulps(at1.getShearY(),
+                                at2.getShearY())+" ulps");
+        System.out.println("TranslateX values differ by "+
+                           ulps(at1.getTranslateX(),
+                                at2.getTranslateX())+" ulps");
+        System.out.println("TranslateY values differ by "+
+                           ulps(at1.getTranslateY(),
+                                at2.getTranslateY())+" ulps");
+        throw new RuntimeException(message);
+    }
+
+    public static boolean compare(AffineTransform at1, AffineTransform at2) {
+        maxulps = Math.max(maxulps, ulps(at1.getScaleX(), at2.getScaleX()));
+        maxulps = Math.max(maxulps, ulps(at1.getScaleY(), at2.getScaleY()));
+        maxulps = Math.max(maxulps, ulps(at1.getShearX(), at2.getShearX()));
+        maxulps = Math.max(maxulps, ulps(at1.getShearY(), at2.getShearY()));
+        maxtxulps = Math.max(maxtxulps,
+                             ulps(at1.getTranslateX(), at2.getTranslateX()));
+        maxtxulps = Math.max(maxtxulps,
+                             ulps(at1.getTranslateY(), at2.getTranslateY()));
+        return (getModifiedType(at1) == getModifiedType(at2) &&
+                (compare(at1.getScaleX(), at2.getScaleX(), MAX_ULPS)) &&
+                (compare(at1.getScaleY(), at2.getScaleY(), MAX_ULPS)) &&
+                (compare(at1.getShearX(), at2.getShearX(), MAX_ULPS)) &&
+                (compare(at1.getShearY(), at2.getShearY(), MAX_ULPS)) &&
+                (compare(at1.getTranslateX(),
+                         at2.getTranslateX(), MAX_TX_ULPS)) &&
+                (compare(at1.getTranslateY(),
+                         at2.getTranslateY(), MAX_TX_ULPS)));
+    }
+
+    public static final int ANY_SCALE_MASK =
+        (AffineTransform.TYPE_UNIFORM_SCALE |
+         AffineTransform.TYPE_GENERAL_SCALE);
+    public static int getModifiedType(AffineTransform at) {
+        int type = at.getType();
+        // Some of the vector methods can introduce a tiny uniform scale
+        // at some angles...
+        if ((type & ANY_SCALE_MASK) != 0) {
+            maxulps = Math.max(maxulps, ulps(at.getDeterminant(), 1.0));
+            if (ulps(at.getDeterminant(), 1.0) <= MAX_ULPS) {
+                // Really tiny - we will ignore it
+                type &= ~ ANY_SCALE_MASK;
+            }
+        }
+        return type;
+    }
+
+    public static boolean compare(double val1, double val2, double maxulps) {
+        if (Math.abs(val1 - val2) < 1E-15) return true;
+        return (ulps(val1, val2) <= maxulps);
+    }
+
+    public static double ulps(double val1, double val2) {
+        double diff = Math.abs(val1 - val2);
+        double ulpmax = Math.min(Math.ulp(val1), Math.ulp(val2));
+        return (diff / ulpmax);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/geom/AffineTransform/TestRotateMethods.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2004, 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
+ * @bug 4980035
+ * @summary Unit test for new methods:
+ *
+ *          AffineTransform.getRotateInstance(double x, double y);
+ *          AffineTransform.setToRotation(double x, double y);
+ *          AffineTransform.rotate(double x, double y);
+ *
+ *          AffineTransform.getQuadrantRotateInstance(int numquads);
+ *          AffineTransform.setToQuadrantRotation(int numquads);
+ *          AffineTransform.quadrantRotate(int numquads);
+ *
+ * @author flar
+ * @run main TestRotateMethods
+ */
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+
+public class TestRotateMethods {
+    /* The maximum errors allowed, measured in double precision "ulps"
+     * Note that for most fields, the tests are extremely accurate - to
+     * within 3 ulps of the smaller value in the comparison
+     * For the translation components, the tests are still very accurate,
+     * but the absolute number of ulps can be noticeably higher when we
+     * use one of the rotate methods that takes an anchor point.
+     * Since a double precision value has 56 bits of precision, even
+     * 1024 ulps is extremely small as a ratio of the value.
+     */
+    public static final double MAX_ULPS = 3.0;
+    public static final double MAX_ANCHOR_TX_ULPS = 1024.0;
+    public static double MAX_TX_ULPS = MAX_ULPS;
+
+    // Vectors for quadrant rotations
+    public static final double quadxvec[] = {  1.0,  0.0, -1.0,  0.0 };
+    public static final double quadyvec[] = {  0.0,  1.0,  0.0, -1.0 };
+
+    // Run tests once for each type of method:
+    //     tx = AffineTransform.get<Rotate>Instance()
+    //     tx.set<Rotate>()
+    //     tx.<rotate>()
+    public static enum Mode { GET, SET, MOD };
+
+    // Used to accumulate and report largest differences encountered by tests
+    public static double maxulps = 0.0;
+    public static double maxtxulps = 0.0;
+
+    // Sample anchor points for testing.
+    public static Point2D zeropt = new Point2D.Double(0, 0);
+    public static Point2D testtxpts[] = {
+        new Point2D.Double(       5,      5),
+        new Point2D.Double(      20,    -10),
+        new Point2D.Double(-Math.PI, Math.E),
+    };
+
+    public static void main(String argv[]) {
+        test(Mode.GET);
+        test(Mode.SET);
+        test(Mode.MOD);
+
+        System.out.println("Max scale and shear difference: "+maxulps+" ulps");
+        System.out.println("Max translate difference: "+maxtxulps+" ulps");
+    }
+
+    public static void test(Mode mode) {
+        MAX_TX_ULPS = MAX_ULPS; // Stricter tx testing with no anchor point
+        test(mode, 0.5, null);
+        test(mode, 1.0, null);
+        test(mode, 3.0, null);
+
+        // Anchor points make the tx values less reliable
+        MAX_TX_ULPS = MAX_ANCHOR_TX_ULPS;
+        for (int i = 0; i < testtxpts.length; i++) {
+            test(mode, 1.0, testtxpts[i]);
+        }
+        MAX_TX_ULPS = MAX_ULPS; // Restore to default
+    }
+
+    public static void verify(AffineTransform at1, AffineTransform at2,
+                              Mode mode, double vectorscale, Point2D txpt,
+                              String message, double num, String units)
+    {
+        if (!compare(at1, at2)) {
+            System.out.println("mode == "+mode);
+            System.out.println("vectorscale == "+vectorscale);
+            System.out.println("txpt == "+txpt);
+            System.out.println(at1+", type = "+at1.getType());
+            System.out.println(at2+", type = "+at2.getType());
+            System.out.println("ScaleX values differ by "+
+                               ulps(at1.getScaleX(), at2.getScaleX())+" ulps");
+            System.out.println("ScaleY values differ by "+
+                               ulps(at1.getScaleY(), at2.getScaleY())+" ulps");
+            System.out.println("ShearX values differ by "+
+                               ulps(at1.getShearX(), at2.getShearX())+" ulps");
+            System.out.println("ShearY values differ by "+
+                               ulps(at1.getShearY(), at2.getShearY())+" ulps");
+            System.out.println("TranslateX values differ by "+
+                               ulps(at1.getTranslateX(),
+                                    at2.getTranslateX())+" ulps");
+            System.out.println("TranslateY values differ by "+
+                               ulps(at1.getTranslateY(),
+                                    at2.getTranslateY())+" ulps");
+            throw new RuntimeException(message + num + units);
+        }
+    }
+
+    public static void test(Mode mode, double vectorscale, Point2D txpt) {
+        AffineTransform at1, at2, at3;
+
+        for (int deg = -720; deg <= 720; deg++) {
+            if ((deg % 90) == 0) continue;
+            double radians = Math.toRadians(deg);
+            double vecy = Math.sin(radians) * vectorscale;
+            double vecx = Math.cos(radians) * vectorscale;
+
+            at1 = makeAT(mode, txpt, radians);
+            at2 = makeAT(mode, txpt, vecx, vecy);
+            verify(at1, at2, mode, vectorscale, txpt,
+                   "vector and radians do not match for ", deg, " degrees");
+
+            if (txpt == null) {
+                // Make sure output was same as a with a 0,0 anchor point
+                if (vectorscale == 1.0) {
+                    // Only need to test radians method for one scale factor
+                    at3 = makeAT(mode, zeropt, radians);
+                    verify(at1, at3, mode, vectorscale, zeropt,
+                           "radians not invariant with 0,0 translate at ",
+                           deg, " degrees");
+                }
+                // But test vector methods with all scale factors
+                at3 = makeAT(mode, zeropt, vecx, vecy);
+                verify(at2, at3, mode, vectorscale, zeropt,
+                       "vector not invariant with 0,0 translate at ",
+                       deg, " degrees");
+            }
+        }
+
+        for (int quad = -8; quad <= 8; quad++) {
+            double degrees = quad * 90.0;
+            double radians = Math.toRadians(degrees);
+            double vecx = quadxvec[quad & 3] * vectorscale;
+            double vecy = quadyvec[quad & 3] * vectorscale;
+
+            at1 = makeAT(mode, txpt, radians);
+            at2 = makeAT(mode, txpt, vecx, vecy);
+            verify(at1, at2, mode, vectorscale, txpt,
+                   "quadrant vector and radians do not match for ",
+                   degrees, " degrees");
+            at2 = makeQuadAT(mode, txpt, quad);
+            verify(at1, at2, mode, vectorscale, txpt,
+                   "quadrant and radians do not match for ",
+                   quad, " quadrants");
+            if (txpt == null) {
+                at3 = makeQuadAT(mode, zeropt, quad);
+                verify(at2, at3, mode, vectorscale, zeropt,
+                       "quadrant not invariant with 0,0 translate at ",
+                       quad, " quadrants");
+            }
+        }
+    }
+
+    public static AffineTransform makeRandomAT() {
+        AffineTransform at = new AffineTransform();
+        at.scale(Math.random() * -10.0, Math.random() * 100.0);
+        at.rotate(Math.random() * Math.PI);
+        at.shear(Math.random(), Math.random());
+        at.translate(Math.random() * 300.0, Math.random() * -20.0);
+        return at;
+    }
+
+    public static AffineTransform makeAT(Mode mode, Point2D txpt,
+                                         double radians)
+    {
+        AffineTransform at;
+        double tx = (txpt == null) ? 0.0 : txpt.getX();
+        double ty = (txpt == null) ? 0.0 : txpt.getY();
+        switch (mode) {
+        case GET:
+            if (txpt != null) {
+                at = AffineTransform.getRotateInstance(radians, tx, ty);
+            } else {
+                at = AffineTransform.getRotateInstance(radians);
+            }
+            break;
+        case SET:
+            at = makeRandomAT();
+            if (txpt != null) {
+                at.setToRotation(radians, tx, ty);
+            } else {
+                at.setToRotation(radians);
+            }
+            break;
+        case MOD:
+            at = makeRandomAT();
+            at.setToIdentity();
+            if (txpt != null) {
+                at.rotate(radians, tx, ty);
+            } else {
+                at.rotate(radians);
+            }
+            break;
+        default:
+            throw new InternalError("unrecognized mode: "+mode);
+        }
+
+        return at;
+    }
+
+    public static AffineTransform makeAT(Mode mode, Point2D txpt,
+                                         double vx, double vy)
+    {
+        AffineTransform at;
+        double tx = (txpt == null) ? 0.0 : txpt.getX();
+        double ty = (txpt == null) ? 0.0 : txpt.getY();
+        switch (mode) {
+        case GET:
+            if (txpt != null) {
+                at = AffineTransform.getRotateInstance(vx, vy, tx, ty);
+            } else {
+                at = AffineTransform.getRotateInstance(vx, vy);
+            }
+            break;
+        case SET:
+            at = makeRandomAT();
+            if (txpt != null) {
+                at.setToRotation(vx, vy, tx, ty);
+            } else {
+                at.setToRotation(vx, vy);
+            }
+            break;
+        case MOD:
+            at = makeRandomAT();
+            at.setToIdentity();
+            if (txpt != null) {
+                at.rotate(vx, vy, tx, ty);
+            } else {
+                at.rotate(vx, vy);
+            }
+            break;
+        default:
+            throw new InternalError("unrecognized mode: "+mode);
+        }
+
+        return at;
+    }
+
+    public static AffineTransform makeQuadAT(Mode mode, Point2D txpt,
+                                             int quads)
+    {
+        AffineTransform at;
+        double tx = (txpt == null) ? 0.0 : txpt.getX();
+        double ty = (txpt == null) ? 0.0 : txpt.getY();
+        switch (mode) {
+        case GET:
+            if (txpt != null) {
+                at = AffineTransform.getQuadrantRotateInstance(quads, tx, ty);
+            } else {
+                at = AffineTransform.getQuadrantRotateInstance(quads);
+            }
+            break;
+        case SET:
+            at = makeRandomAT();
+            if (txpt != null) {
+                at.setToQuadrantRotation(quads, tx, ty);
+            } else {
+                at.setToQuadrantRotation(quads);
+            }
+            break;
+        case MOD:
+            at = makeRandomAT();
+            at.setToIdentity();
+            if (txpt != null) {
+                at.quadrantRotate(quads, tx, ty);
+            } else {
+                at.quadrantRotate(quads);
+            }
+            break;
+        default:
+            throw new InternalError("unrecognized mode: "+mode);
+        }
+
+        return at;
+    }
+
+    public static boolean compare(AffineTransform at1, AffineTransform at2) {
+        maxulps = Math.max(maxulps, ulps(at1.getScaleX(), at2.getScaleX()));
+        maxulps = Math.max(maxulps, ulps(at1.getScaleY(), at2.getScaleY()));
+        maxulps = Math.max(maxulps, ulps(at1.getShearX(), at2.getShearX()));
+        maxulps = Math.max(maxulps, ulps(at1.getShearY(), at2.getShearY()));
+        maxtxulps = Math.max(maxtxulps,
+                             ulps(at1.getTranslateX(), at2.getTranslateX()));
+        maxtxulps = Math.max(maxtxulps,
+                             ulps(at1.getTranslateY(), at2.getTranslateY()));
+        return (getModifiedType(at1) == getModifiedType(at2) &&
+                (compare(at1.getScaleX(), at2.getScaleX(), MAX_ULPS)) &&
+                (compare(at1.getScaleY(), at2.getScaleY(), MAX_ULPS)) &&
+                (compare(at1.getShearX(), at2.getShearX(), MAX_ULPS)) &&
+                (compare(at1.getShearY(), at2.getShearY(), MAX_ULPS)) &&
+                (compare(at1.getTranslateX(),
+                         at2.getTranslateX(), MAX_TX_ULPS)) &&
+                (compare(at1.getTranslateY(),
+                         at2.getTranslateY(), MAX_TX_ULPS)));
+    }
+
+    public static int getModifiedType(AffineTransform at) {
+        int type = at.getType();
+        // Some of the vector methods can introduce a tiny uniform scale
+        // at some angles...
+        if ((type & AffineTransform.TYPE_UNIFORM_SCALE) != 0) {
+            maxulps = Math.max(maxulps, ulps(at.getDeterminant(), 1.0));
+            if (ulps(at.getDeterminant(), 1.0) <= MAX_ULPS) {
+                // Really tiny - we will ignore it
+                type &= (~AffineTransform.TYPE_UNIFORM_SCALE);
+            }
+        }
+        return type;
+    }
+
+    public static boolean compare(double val1, double val2, double maxulps) {
+        return (ulps(val1, val2) <= maxulps);
+    }
+
+    public static double ulps(double val1, double val2) {
+        double diff = Math.abs(val1 - val2);
+        double ulpmax = Math.min(Math.ulp(val1), Math.ulp(val2));
+        return (diff / ulpmax);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/geom/AffineTransform/TestSerialization.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2005, 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
+ * @bug 6213608
+ * @summary Test that AffineTransform can deserialize appropriate versions.
+ * @author flar
+ * @run main TestSerialization
+ */
+
+import java.io.FileInputStream;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InvalidClassException;
+import java.awt.geom.AffineTransform;
+
+public class TestSerialization {
+    public static void main(String argv[]) {
+        if (argv.length > 0) {
+            System.out.println("Saving from: "+
+                               System.getProperty("java.version"));
+            writeSer(argv[0]);
+            return;
+        }
+        System.out.println("Testing on: "+System.getProperty("java.version"));
+        testReadWrite();
+        readSer("serial.1.2", true);
+    }
+
+    public static AffineTransform testATs[] = {
+        new AffineTransform(),
+        AffineTransform.getScaleInstance(2.5, -3.0),
+        AffineTransform.getRotateInstance(Math.PI / 4.0),
+        AffineTransform.getShearInstance(1.0, -3.0),
+        AffineTransform.getTranslateInstance(25.0, 12.5),
+        makeComplexAT(),
+    };
+
+    public static AffineTransform makeComplexAT() {
+        AffineTransform at = new AffineTransform();
+        at.scale(2.5, -3.0);
+        at.rotate(Math.PI / 4.0);
+        at.shear(1.0, -3.0);
+        at.translate(25.0, 12.5);
+        return at;
+    };
+
+    public static void testReadWrite() {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            testWrite(oos);
+            oos.flush();
+            oos.close();
+            byte buf[] = baos.toByteArray();
+            ByteArrayInputStream bais = new ByteArrayInputStream(buf);
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            testRead(ois, true);
+        } catch (InvalidClassException ice) {
+            throw new RuntimeException("Object read failed from loopback");
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException("IOException testing loopback");
+        }
+    }
+
+    public static String resolve(String relfilename) {
+        String dir = System.getProperty("test.src");
+        if (dir == null) {
+            return relfilename;
+        } else {
+            return dir+"/"+relfilename;
+        }
+    }
+
+    public static void readSer(String filename, boolean shouldsucceed) {
+        try {
+            FileInputStream fis = new FileInputStream(resolve(filename));
+            ObjectInputStream ois = new ObjectInputStream(fis);
+            testRead(ois, shouldsucceed);
+        } catch (InvalidClassException ice) {
+            throw new RuntimeException("Object read failed from: "+filename);
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException("IOException reading: "+filename);
+        }
+    }
+
+    public static void testRead(ObjectInputStream ois, boolean shouldsucceed)
+        throws IOException
+    {
+        for (int i = 0; i < testATs.length; i++) {
+            AffineTransform at;
+            try {
+                at = (AffineTransform) ois.readObject();
+                if (!shouldsucceed) {
+                    throw new RuntimeException("readObj did not fail");
+                }
+            } catch (ClassNotFoundException e) {
+                // Should never happen, but must catch declared exceptions...
+                throw new RuntimeException("AffineTransform not found!");
+            } catch (InvalidClassException e) {
+                if (shouldsucceed) {
+                    throw e;
+                }
+                continue;
+            }
+            if (!testATs[i].equals(at)) {
+                throw new RuntimeException("wrong AT read from stream");
+            }
+        }
+    }
+
+    public static void writeSer(String filename) {
+        try {
+            FileOutputStream fos = new FileOutputStream(filename);
+            ObjectOutputStream oos = new ObjectOutputStream(fos);
+            testWrite(oos);
+            oos.flush();
+            oos.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException("IOException writing: "+filename);
+        }
+    }
+
+    public static void testWrite(ObjectOutputStream oos)
+        throws IOException
+    {
+        for (int i = 0; i < testATs.length; i++) {
+            oos.writeObject(testATs[i]);
+        }
+    }
+}
Binary file jdk/test/java/awt/geom/AffineTransform/serial.1.2 has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/DrawImage/DrawImageCoordsTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8028539
+ * @summary Test that drawing a scaled image terminates.
+ * @run main/othervm/timeout=60 DrawImageCoordsTest
+*/
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+
+public class DrawImageCoordsTest {
+
+    public static void main(String[] args) {
+
+        /* Create an image to draw, filled in solid red. */
+        BufferedImage srcImg =
+             new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+        Graphics srcG = srcImg.createGraphics();
+        srcG.setColor(Color.red);
+        int w = srcImg.getWidth(null);
+        int h = srcImg.getHeight(null);
+        srcG.fillRect(0, 0, w, h);
+
+        /* Create a destination image */
+        BufferedImage dstImage =
+           new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+        Graphics2D dstG = dstImage.createGraphics();
+        /* draw image under a scaling transform that overflows int */
+        AffineTransform tx = new AffineTransform(0.5, 0, 0, 0.5,
+                                                  0, 5.8658460197478485E9);
+        dstG.setTransform(tx);
+        dstG.drawImage(srcImg, 0, 0, null );
+        /* draw image under the same overflowing transform, cancelling
+         * out the 0.5 scale on the graphics
+         */
+        dstG.drawImage(srcImg, 0, 0, 2*w, 2*h, null);
+        if (Color.red.getRGB() == dstImage.getRGB(w/2, h/2)) {
+             throw new RuntimeException("Unexpected color: clipping failed.");
+        }
+        System.out.println("Test Thread Completed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectAlphaConversionBicubic.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DataBufferShort;
+import java.awt.image.VolatileImage;
+
+import static java.awt.Transparency.TRANSLUCENT;
+
+/**
+ * @test
+ * @bug 8062164
+ * @summary We should get correct alpha, when we draw to/from VolatileImage and
+ *          bicubic interpolation is enabled
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectAlphaConversionBicubic {
+
+    private static final Color RGB = new Color(200, 255, 7, 123);
+    private static final int SIZE = 100;
+
+    public static void main(final String[] args) {
+        final GraphicsEnvironment ge =
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        final GraphicsDevice gd = ge.getDefaultScreenDevice();
+        final GraphicsConfiguration gc = gd.getDefaultConfiguration();
+        final VolatileImage vi =
+                gc.createCompatibleVolatileImage(SIZE, SIZE, TRANSLUCENT);
+        final BufferedImage bi = makeUnmanagedBI(gc, TRANSLUCENT);
+        final int expected = bi.getRGB(2, 2);
+
+        int attempt = 0;
+        BufferedImage snapshot;
+        while (true) {
+            if (++attempt > 10) {
+                throw new RuntimeException("Too many attempts: " + attempt);
+            }
+            vi.validate(gc);
+            final Graphics2D g2d = vi.createGraphics();
+            g2d.setComposite(AlphaComposite.Src);
+            g2d.scale(2, 2);
+            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+                                 RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+            g2d.drawImage(bi, 0, 0, null);
+            g2d.dispose();
+
+            snapshot = vi.getSnapshot();
+            if (vi.contentsLost()) {
+                continue;
+            }
+            break;
+        }
+        final int actual = snapshot.getRGB(2, 2);
+        if (actual != expected) {
+            System.err.println("Actual: " + Integer.toHexString(actual));
+            System.err.println("Expected: " + Integer.toHexString(expected));
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc,
+                                                 int type) {
+        BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type);
+        Graphics2D g2d = img.createGraphics();
+        g2d.setColor(RGB);
+        g2d.fillRect(0, 0, SIZE, SIZE);
+        g2d.dispose();
+        final DataBuffer db = img.getRaster().getDataBuffer();
+        if (db instanceof DataBufferInt) {
+            ((DataBufferInt) db).getData();
+        } else if (db instanceof DataBufferShort) {
+            ((DataBufferShort) db).getData();
+        } else if (db instanceof DataBufferByte) {
+            ((DataBufferByte) db).getData();
+        } else {
+            try {
+                img.setAccelerationPriority(0.0f);
+            } catch (final Throwable ignored) {
+            }
+        }
+        return img;
+    }
+}
--- a/jdk/test/java/awt/image/DrawImage/UnmanagedDrawImagePerformance.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/awt/image/DrawImage/UnmanagedDrawImagePerformance.java	Mon Nov 17 09:36:40 2014 +0100
@@ -41,7 +41,7 @@
 
 /*
  * @test
- * @bug 8029253
+ * @bug 8029253 8059941
  * @summary Unmanaged images should be drawn fast.
  * @author Sergey Bylokhov
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/GetSystemPackage.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2014 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
+ * @bug 8060130
+ * @library /lib/testlibrary
+ * @build package2.Class2 GetSystemPackage jdk.testlibrary.*
+ * @summary Test if getSystemPackage() return consistent values for cases
+ *          where a manifest is provided or not and ensure only jars on
+ *          bootclasspath gets resolved via Package.getSystemPackage
+ * @run main GetSystemPackage
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import jdk.testlibrary.ProcessTools;
+
+public class GetSystemPackage {
+
+    static final String testClassesDir = System.getProperty("test.classes", ".");
+    static final File tmpFolder = new File(testClassesDir);
+    static final String manifestTitle = "Special JAR";
+
+    public static void main(String ... args) throws Exception {
+        if (args.length == 0) {
+            buildJarsAndInitiateSystemPackageTest();
+            return;
+        }
+        switch (args[0]) {
+            case "system-manifest":
+                verifyPackage(true, true);
+                break;
+            case "system-no-manifest":
+                verifyPackage(false, true);
+                break;
+            case "non-system-manifest":
+                verifyPackage(true, false);
+                break;
+            case "non-system-no-manifest":
+            default:
+                verifyPackage(false, false);
+                break;
+        }
+    }
+
+    private static void buildJarsAndInitiateSystemPackageTest()
+            throws Exception
+    {
+        Manifest m = new Manifest();
+        // not setting MANIFEST_VERSION prevents META-INF/MANIFEST.MF from
+        // getting written
+        m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+        m.getMainAttributes().put(Attributes.Name.SPECIFICATION_TITLE,
+                                  manifestTitle);
+
+        buildJar("manifest.jar", m);
+        buildJar("no-manifest.jar", null);
+
+        runSubProcess("System package with manifest improperly resolved.",
+                "-Xbootclasspath/p:" + testClassesDir + "/manifest.jar",
+                "GetSystemPackage", "system-manifest");
+
+        runSubProcess("System package from directory improperly resolved.",
+                "-Xbootclasspath/p:" + testClassesDir, "GetSystemPackage",
+                "system-no-manifest");
+
+        runSubProcess("System package with no manifest improperly resolved",
+                "-Xbootclasspath/p:" + testClassesDir + "/no-manifest.jar",
+                "GetSystemPackage", "system-no-manifest");
+
+        runSubProcess("Classpath package with manifest improperly resolved",
+                "-cp", testClassesDir + "/manifest.jar", "GetSystemPackage",
+                "non-system-manifest");
+
+        runSubProcess("Classpath package with no manifest improperly resolved",
+                "-cp", testClassesDir + "/no-manifest.jar", "GetSystemPackage",
+                "non-system-no-manifest");
+
+    }
+
+    private static void buildJar(String name, Manifest man) throws Exception {
+        JarBuilder jar = new JarBuilder(tmpFolder, name, man);
+        jar.addClassFile("package2/Class2.class",
+                testClassesDir + "/package2/Class2.class");
+        jar.addClassFile("GetSystemPackage.class",
+                testClassesDir + "/GetSystemPackage.class");
+        jar.addClassFile("GetSystemPackageClassLoader.class",
+                testClassesDir + "/GetSystemPackageClassLoader.class");
+        jar.build();
+    }
+
+    private static void runSubProcess(String messageOnError, String ... args)
+            throws Exception
+    {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
+        int res = pb.directory(tmpFolder).inheritIO().start().waitFor();
+        if (res != 0) {
+            throw new RuntimeException(messageOnError);
+        }
+    }
+
+    private static void verifyPackage(boolean hasManifest,
+            boolean isSystemPackage) throws Exception
+    {
+        Class c = Class.forName("package2.Class2");
+        Package pkg = c.getPackage();
+        if (pkg == null || pkg != Package.getPackage("package2") ||
+                !"package2".equals(pkg.getName())) {
+            fail("package2 not found via Package.getPackage()");
+        }
+
+        String specificationTitle = pkg.getSpecificationTitle();
+        if (!"package2".equals(pkg.getName())) {
+            fail("Invalid package for Class2");
+        }
+
+        if (hasManifest && (specificationTitle == null
+                || !manifestTitle.equals(specificationTitle))) {
+            fail("Invalid manifest for package " + pkg.getName());
+        }
+        if (!hasManifest && specificationTitle != null) {
+            fail("Invalid manifest for package " + pkg.getName() + ": was " +
+                 specificationTitle + " expected: null");
+        }
+
+        // force the use of a classloader with no parent, then retrieve the
+        // package in a way that bypasses the classloader pkg maps
+        GetSystemPackageClassLoader classLoader =
+                new GetSystemPackageClassLoader();
+        Package systemPkg = classLoader.getSystemPackage("package2");
+
+        if (findPackage("java.lang") == null) {
+            fail("java.lang not found via Package.getPackages()");
+        }
+        Package foundPackage = findPackage("package2");
+        if (isSystemPackage) {
+            if (systemPkg == null) {
+                fail("System package could not be found via getSystemPackage");
+            }
+            if (foundPackage != systemPkg || systemPkg != pkg) {
+                fail("Inconsistent package found via Package.getPackages()");
+            }
+        } else {
+            if (systemPkg != null) {
+                fail("Non-system package could be found via getSystemPackage");
+            }
+            if (foundPackage == null) {
+                fail("Non-system package not found via Package.getPackages()");
+            }
+        }
+    }
+
+    private static Package findPackage(String name) {
+        Package[] packages = Package.getPackages();
+        for (Package p : packages) {
+            System.out.println(p);
+            if (p.getName().equals(name)) {
+                return p;
+            }
+        }
+        return null;
+    }
+
+    private static void fail(String message) {
+        throw new RuntimeException(message);
+    }
+}
+
+/*
+ * This classloader bypasses the system classloader to give as direct access
+ * to Package.getSystemPackage() as possible
+ */
+class GetSystemPackageClassLoader extends ClassLoader {
+
+    public GetSystemPackageClassLoader() {
+        super(null);
+    }
+
+    public Package getSystemPackage(String name) {
+        return super.getPackage(name);
+    }
+}
+
+/*
+ * Helper class for building jar files
+ */
+class JarBuilder {
+
+    private JarOutputStream os;
+
+    public JarBuilder(File tmpFolder, String jarName, Manifest manifest)
+            throws FileNotFoundException, IOException
+    {
+        File jarFile = new File(tmpFolder, jarName);
+        if (manifest != null) {
+            this.os = new JarOutputStream(new FileOutputStream(jarFile),
+                                          manifest);
+        } else {
+            this.os = new JarOutputStream(new FileOutputStream(jarFile));
+        }
+    }
+
+    public void addClassFile(String pathFromRoot, String file)
+            throws IOException
+    {
+        byte[] buf = new byte[1024];
+        try (FileInputStream in = new FileInputStream(file)) {
+            JarEntry entry = new JarEntry(pathFromRoot);
+            os.putNextEntry(entry);
+            int len;
+            while ((len = in.read(buf)) > 0) {
+                os.write(buf, 0, len);
+            }
+            os.closeEntry();
+        }
+    }
+
+    public void build() throws IOException {
+        os.close();
+    }
+}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Mon Nov 17 09:36:40 2014 +0100
@@ -2269,9 +2269,10 @@
                 fail("Test failed: Process exited prematurely");
             }
             long end = System.nanoTime();
-            // give waitFor(timeout) a wide berth (200ms)
-            // Old AIX machines my need a little longer.
-            if ((end - start) > 200000000L * (AIX.is() ? 2 : 1))
+            // give waitFor(timeout) a wide berth (2s)
+            System.out.printf(" waitFor process: delta: %d%n",(end - start) );
+
+            if ((end - start) > TimeUnit.SECONDS.toNanos(2))
                 fail("Test failed: waitFor took too long (" + (end - start) + "ns)");
 
             p.destroy();
@@ -2295,19 +2296,23 @@
             final Process p = new ProcessBuilder(childArgs).start();
             long start = System.nanoTime();
 
-            p.waitFor(1000, TimeUnit.MILLISECONDS);
+            p.waitFor(10, TimeUnit.MILLISECONDS);
 
             long end = System.nanoTime();
-            if ((end - start) < 500000000)
+            if ((end - start) < TimeUnit.MILLISECONDS.toNanos(10))
                 fail("Test failed: waitFor didn't take long enough (" + (end - start) + "ns)");
 
             p.destroy();
 
             start = System.nanoTime();
-            p.waitFor(1000, TimeUnit.MILLISECONDS);
+            p.waitFor(8, TimeUnit.SECONDS);
             end = System.nanoTime();
-            if ((end - start) > 900000000)
-                fail("Test failed: waitFor took too long on a dead process. (" + (end - start) + "ns)");
+
+            int exitValue = p.exitValue();
+
+            if ((end - start) > TimeUnit.SECONDS.toNanos(7))
+                fail("Test failed: waitFor took too long on a dead process. (" + (end - start) + "ns)"
+                + ", exitValue: " + exitValue);
         } catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/finalization/FinInterrupt.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 4354680
+ * @summary runFinalization() should not clear or ignore interrupt bit
+ * @run main FinInterrupt
+ */
+
+public class FinInterrupt {
+    public static void main(String[] args) throws Exception {
+        Thread.currentThread().interrupt();
+        System.runFinalization();
+        if (Thread.interrupted()) {
+            System.out.println("Passed: interrupt bit was still set.");
+        } else {
+            throw new AssertionError("interrupt bit was cleared");
+        }
+    }
+}
--- a/jdk/test/java/lang/Thread/ThreadStateController.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/lang/Thread/ThreadStateController.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014 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
@@ -27,6 +27,8 @@
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.LockSupport;
 
+import jdk.testlibrary.LockFreeLogManager;
+
 /**
  * ThreadStateController allows a thread to request this thread to transition
  * to a specific thread state.  The {@linkplain #transitionTo request} is
@@ -94,8 +96,12 @@
     private static final int S_TERMINATE = 8;
 
     // for debugging
-    private AtomicInteger iterations = new AtomicInteger();
-    private AtomicInteger interrupted = new AtomicInteger();
+    private final AtomicInteger iterations = new AtomicInteger();
+    private final AtomicInteger interrupted = new AtomicInteger();
+
+    private final LockFreeLogManager logManager = new LockFreeLogManager();
+
+    @Override
     public void run() {
         // this thread has started
         while (!done) {
@@ -119,13 +125,13 @@
                     break;
                 }
                 case S_BLOCKED: {
-                    System.out.format("%d: %s is going to block (interations %d)%n",
-                                      getId(), getName(), iterations.get());
+                    log("%d: %s is going to block (iterations %d)%n",
+                        getId(), getName(), iterations.get());
                     stateChange(nextState);
                     // going to block on lock
                     synchronized (lock) {
-                        System.out.format("%d:   %s acquired the lock (interations %d)%n",
-                                          getId(), getName(), iterations.get());
+                        log("%d:   %s acquired the lock (iterations %d)%n",
+                            getId(), getName(), iterations.get());
                         try {
                             // this thread has escaped the BLOCKED state
                             // release the lock and a short wait before continue
@@ -139,13 +145,13 @@
                 }
                 case S_WAITING: {
                     synchronized (lock) {
-                        System.out.format("%d: %s is going to waiting (interations %d interrupted %d)%n",
-                                          getId(), getName(), iterations.get(), interrupted.get());
+                        log("%d: %s is going to waiting (iterations %d interrupted %d)%n",
+                            getId(), getName(), iterations.get(), interrupted.get());
                         try {
                             stateChange(nextState);
                             lock.wait();
-                            System.out.format("%d:   %s wakes up from waiting (interations %d interrupted %d)%n",
-                                              getId(), getName(), iterations.get(), interrupted.get());
+                            log("%d:   %s wakes up from waiting (iterations %d interrupted %d)%n",
+                                getId(), getName(), iterations.get(), interrupted.get());
                         } catch (InterruptedException e) {
                             // ignore
                             interrupted.incrementAndGet();
@@ -155,13 +161,13 @@
                 }
                 case S_TIMED_WAITING: {
                     synchronized (lock) {
-                        System.out.format("%d: %s is going to timed waiting (interations %d interrupted %d)%n",
-                                          getId(), getName(), iterations.get(), interrupted.get());
+                        log("%d: %s is going to timed waiting (iterations %d interrupted %d)%n",
+                            getId(), getName(), iterations.get(), interrupted.get());
                         try {
                             stateChange(nextState);
                             lock.wait(10000);
-                            System.out.format("%d:   %s wakes up from timed waiting (interations %d interrupted %d)%n",
-                                              getId(), getName(), iterations.get(), interrupted.get());
+                            log("%d:   %s wakes up from timed waiting (iterations %d interrupted %d)%n",
+                                getId(), getName(), iterations.get(), interrupted.get());
                         } catch (InterruptedException e) {
                             // ignore
                             interrupted.incrementAndGet();
@@ -170,23 +176,23 @@
                     break;
                 }
                 case S_PARKED: {
-                    System.out.format("%d: %s is going to park (interations %d)%n",
-                                      getId(), getName(), iterations.get());
+                    log("%d: %s is going to park (iterations %d)%n",
+                        getId(), getName(), iterations.get());
                     stateChange(nextState);
                     LockSupport.park();
                     break;
                 }
                 case S_TIMED_PARKED: {
-                    System.out.format("%d: %s is going to timed park (interations %d)%n",
-                                      getId(), getName(), iterations.get());
+                    log("%d: %s is going to timed park (iterations %d)%n",
+                        getId(), getName(), iterations.get());
                     long deadline = System.currentTimeMillis() + 10000*1000;
                     stateChange(nextState);
                     LockSupport.parkUntil(deadline);
                     break;
                 }
                 case S_SLEEPING: {
-                    System.out.format("%d: %s is going to sleep (interations %d interrupted %d)%n",
-                                      getId(), getName(), iterations.get(), interrupted.get());
+                    log("%d: %s is going to sleep (iterations %d interrupted %d)%n",
+                        getId(), getName(), iterations.get(), interrupted.get());
                     try {
                         stateChange(nextState);
                         Thread.sleep(1000000);
@@ -219,8 +225,8 @@
         if (newState == nextState) {
             state = nextState;
             phaser.arrive();
-            System.out.format("%d:   state change: %s %s%n",
-                              getId(), toStateName(nextState), phaserToString(phaser));
+            log("%d:   state change: %s %s%n",
+                getId(), toStateName(nextState), phaserToString(phaser));
             return;
         }
 
@@ -270,12 +276,12 @@
 
     private void nextState(int s) throws InterruptedException {
         final long id = Thread.currentThread().getId();
-        System.out.format("%d: wait until the thread transitions to %s %s%n",
-                          id, toStateName(s), phaserToString(phaser));
+        log("%d: wait until the thread transitions to %s %s%n",
+            id, toStateName(s), phaserToString(phaser));
         this.newState = s;
         int phase = phaser.arrive();
-        System.out.format("%d:   awaiting party arrive %s %s%n",
-                           id, toStateName(s), phaserToString(phaser));
+        log("%d:   awaiting party arrive %s %s%n",
+            id, toStateName(s), phaserToString(phaser));
         for (;;) {
             // when this thread has changed its state before it waits or parks
             // on a lock, a potential race might happen if it misses the notify
@@ -301,20 +307,22 @@
             }
             try {
                 phaser.awaitAdvanceInterruptibly(phase, 100, TimeUnit.MILLISECONDS);
-                System.out.format("%d:   arrived at %s %s%n",
-                                  id, toStateName(s), phaserToString(phaser));
+                log("%d:   arrived at %s %s%n",
+                    id, toStateName(s), phaserToString(phaser));
                 return;
             } catch (TimeoutException ex) {
                 // this thread hasn't arrived at this phase
-                System.out.format("%d: Timeout: %s%n", id, phaser);
+                log("%d: Timeout: %s%n", id, phaser);
             }
         }
     }
+
     private String phaserToString(Phaser p) {
         return "[phase = " + p.getPhase() +
                " parties = " + p.getRegisteredParties() +
                " arrived = " + p.getArrivedParties() + "]";
     }
+
     private String toStateName(int state) {
         switch (state) {
             case S_RUNNABLE:
@@ -337,4 +345,20 @@
                 return "unknown " + state;
         }
     }
+
+    private void log(String msg, Object ... params) {
+        logManager.log(msg, params);
+    }
+
+    /**
+     * Waits for the controller to complete the test run and returns the
+     * generated log
+     * @return The controller log
+     * @throws InterruptedException
+     */
+    public String getLog() throws InterruptedException {
+        this.join();
+
+        return logManager.toString();
+    }
 }
--- a/jdk/test/java/lang/Thread/ThreadStateTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/lang/Thread/ThreadStateTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -30,6 +30,8 @@
  *          Thread.getState().
  *
  * @author  Mandy Chung
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
  * @build ThreadStateTest ThreadStateController
  * @run main/othervm -Xmixed ThreadStateTest
  */
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -31,6 +31,8 @@
  * @author  Mandy Chung
  *
  * @library ../../Thread
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
  * @build ThreadMXBeanStateTest ThreadStateController
  * @run main ThreadMXBeanStateTest
  */
@@ -44,15 +46,17 @@
     private static final ThreadMXBean tm = ManagementFactory.getThreadMXBean();
 
     static class Lock {
-        private String name;
+        private final String name;
         Lock(String name) {
             this.name = name;
         }
+        @Override
         public String toString() {
             return name;
         }
     }
-    private static Lock globalLock = new Lock("my lock");
+
+    private static final Lock globalLock = new Lock("my lock");
 
     public static void main(String[] argv) throws Exception {
         // Force thread state initialization now before the test
@@ -109,7 +113,7 @@
         thread.checkThreadState(TERMINATED);
 
         try {
-            thread.join();
+            System.out.println(thread.getLog());
         } catch (InterruptedException e) {
             e.printStackTrace();
             System.out.println("TEST FAILED: Unexpected exception.");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Generics/ThreadSafety.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2014 Google Inc.  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
+ * @bug 8062771 8016236
+ * @summary Test publication of Class objects via a data race
+ * @run testng ThreadSafety
+ */
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Collections;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * A test resulting from an attempt to repro this failure (in guice):
+ *
+ * java.lang.NullPointerException
+ *   at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
+ *   at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
+ *   at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:84)
+ *   at java.lang.Class.getGenericSuperclass(Class.java:692)
+ *   at com.google.inject.TypeLiteral.getSuperclassTypeParameter(TypeLiteral.java:99)
+ *   at com.google.inject.TypeLiteral.<init>(TypeLiteral.java:79)
+ *
+ * However, as one would expect with thread safety problems in reflection, these
+ * are very hard to reproduce.  This very test has never been observed to fail,
+ * but a similar test has been observed to fail about once in 2000 executions
+ * (about once every 6 CPU-hours), in jdk7 only.  It appears to be fixed in jdk8+ by:
+ *
+ * 8016236: Class.getGenericInterfaces performance improvement.
+ * (by making Class.genericInfo volatile)
+ */
+public class ThreadSafety {
+    public static class EmptyClass {
+        public static class EmptyGenericSuperclass<T> {}
+        public static class EmptyGenericSubclass<T> extends EmptyGenericSuperclass<T> {}
+    }
+
+    /** published via data race */
+    private Class<?> racyClass = Object.class;
+
+    private URL[] urls = ((URLClassLoader) ThreadSafety.class.getClassLoader()).getURLs();
+
+    private Class<?> createNewEmptyGenericSubclassClass() throws Exception {
+        URLClassLoader ucl = new URLClassLoader(urls, null);
+        return Class.forName("ThreadSafety$EmptyClass$EmptyGenericSubclass", true, ucl);
+    }
+
+    @Test
+    public void testRacy_getGenericSuperclass() throws Exception {
+        final int nThreads = 10;
+        final int iterations = 30;
+        final int timeout = 10;
+        final CyclicBarrier newCycle = new CyclicBarrier(nThreads);
+        final Callable<Void> task = new Callable<Void>() {
+            public Void call() throws Exception {
+                for (int i = 0; i < iterations; i++) {
+                    final int threadId;
+                    try {
+                        threadId = newCycle.await(timeout, SECONDS);
+                    } catch (BrokenBarrierException e) {
+                        return null;
+                    }
+                    for (int j = 0; j < iterations; j++) {
+                        // one thread publishes the class object via a data
+                        // race, for the other threads to consume.
+                        if (threadId == 0) {
+                            racyClass = createNewEmptyGenericSubclassClass();
+                        } else {
+                            racyClass.getGenericSuperclass();
+                        }
+                    }
+                }
+                return null;
+            }};
+
+        final ExecutorService pool = Executors.newFixedThreadPool(nThreads);
+        try {
+            for (Future<Void> future :
+                     pool.invokeAll(Collections.nCopies(nThreads, task))) {
+                try {
+                    future.get(iterations * timeout, SECONDS);
+                } catch (ExecutionException e) {
+                    // ignore "collateral damage"
+                    if (!(e.getCause() instanceof BrokenBarrierException)
+                        &&
+                        !(e.getCause() instanceof TimeoutException)) {
+                        throw e;
+                    }
+                }
+            }
+        } finally {
+            pool.shutdownNow();
+            assertTrue(pool.awaitTermination(2 * timeout, SECONDS));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Parameter/InnerClassToString.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8055063
+ * @summary javac should generate method parameters correctly.
+ * @clean InnerClassToString
+ * @compile -parameters InnerClassToString.java
+ * @run main InnerClassToString
+ * @clean InnerClassToString
+ * @compile InnerClassToString.java
+ * @run main InnerClassToString
+ */
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Parameter;
+import java.util.Set;
+
+// Test copied and expanded from webbug group report.
+public class InnerClassToString {
+    private static final Class<?>[] genericParamClasses = new Class<?>[] {
+        InnerClassToString.class, Set.class
+    };
+
+    private static final Class<?>[] nongenericParamClasses = new Class<?>[] {
+        InnerClassToString.class, String.class
+    };
+
+    private int errors = 0;
+
+    private void test(Constructor<MyEntity> constructor,
+                     Class<?>[] paramClasses) {
+        final Parameter[] params = constructor.getParameters();
+
+        for (int i = 0; i < params.length; i++) {
+            final Parameter parameter = params[i];
+            System.out.println(parameter.toString());
+
+            if (!parameter.getType().equals(paramClasses[i])) {
+                errors++;
+                System.err.println("Expected type " + paramClasses[i] +
+                                   " but got " + parameter.getType());
+            }
+
+            System.out.println(parameter.getParameterizedType());
+            System.out.println(parameter.getAnnotatedType());
+        }
+
+    }
+
+    private void run() throws Exception {
+        final Constructor<MyEntity> genericConstructor =
+            MyEntity.class.getConstructor(InnerClassToString.class, Set.class);
+
+        test(genericConstructor, genericParamClasses);
+
+        final Constructor<MyEntity> nongenericConstructor =
+            MyEntity.class.getConstructor(InnerClassToString.class, String.class);
+
+        test(nongenericConstructor, nongenericParamClasses);
+
+        if (errors != 0)
+            throw new RuntimeException(errors + " errors in test");
+    }
+
+    public static void main(String[] args) throws Exception {
+        new InnerClassToString().run();
+    }
+
+    public class MyEntity {
+        public MyEntity(Set<?> names) {}
+        public MyEntity(String names) {}
+    }
+}
--- a/jdk/test/java/sql/testng/util/TestPolicy.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/java/sql/testng/util/TestPolicy.java	Mon Nov 17 09:36:40 2014 +0100
@@ -35,6 +35,7 @@
 import java.util.Enumeration;
 import java.util.PropertyPermission;
 import java.util.StringJoiner;
+import java.util.logging.LoggingPermission;
 
 /*
  * Simple Policy class that supports the required Permissions to validate the
@@ -57,7 +58,8 @@
      * Policy used by the JDBC tests Possible values are: all (ALLPermissions),
      * setLog (SQLPemission("setLog"), deregisterDriver
      * (SQLPermission("deregisterDriver") (SQLPermission("deregisterDriver"),
-     * and setSyncFactory(SQLPermission(setSyncFactory),
+     * setSyncFactory(SQLPermission(setSyncFactory), and also
+     * LoggerPermission("control", null) when setting a Level
      *
      * @param policy Permissions to set
      */
@@ -79,6 +81,11 @@
                 setMinimalPermissions();
                 permissions.add(new SQLPermission("setSyncFactory"));
                 break;
+            case "setSyncFactoryLogger":
+                setMinimalPermissions();
+                permissions.add(new SQLPermission("setSyncFactory"));
+                permissions.add(new LoggingPermission("control", null));
+                break;
             default:
                 setMinimalPermissions();
         }
--- a/jdk/test/javax/naming/spi/providers/InitialContextTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/javax/naming/spi/providers/InitialContextTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -68,10 +68,9 @@
         Path dst = tmp.resolve("Test.java");
         Files.copy(src, dst);
 
-        javac(tmp, dst);
+        Path build = Files.createDirectory(tmp.resolve("build"));
 
-        Path build = Files.createDirectory(tmp.resolve("build"));
-        Files.copy(tmp.resolve("Test.class"), build.resolve("Test.class"));
+        javac(build, dst);
 
         Map<String, String> props
                 = singletonMap(Context.INITIAL_CONTEXT_FACTORY, factoryClassFqn);
@@ -107,13 +106,13 @@
         Path dst1 = createFactoryFrom(templatesHome().resolve("factory.template"),
                 factoryClassFqn, tmp);
 
-        javac(tmp, dst);
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        javac(build, dst);
         Path explodedJar = Files.createDirectory(tmp.resolve("exploded-jar"));
         javac(explodedJar, dst1);
         jar(tmp.resolve("test.jar"), explodedJar);
 
-        Path build = Files.createDirectory(tmp.resolve("build"));
-        Files.copy(tmp.resolve("Test.class"), build.resolve("Test.class"));
         Files.copy(tmp.resolve("test.jar"), build.resolve("test.jar"));
 
         Map<String, String> props
@@ -191,7 +190,9 @@
         Path dst1 = createFactoryFrom(templatesHome().resolve("broken_factory.template"),
                 factoryClassFqn, tmp);
 
-        javac(tmp, dst);
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        javac(build, dst);
 
         Path explodedJar = Files.createDirectory(tmp.resolve("exploded-jar"));
         Path services = Files.createDirectories(explodedJar.resolve("META-INF")
@@ -208,15 +209,12 @@
         javac(explodedJar, dst1);
         jar(tmp.resolve("test.jar"), explodedJar);
 
-        Path build = Files.createDirectory(tmp.resolve("build"));
-        Files.copy(tmp.resolve("Test.class"), build.resolve("Test.class"));
         Files.copy(tmp.resolve("test.jar"), build.resolve("test.jar"));
 
-        Map<String, String> props = new HashMap<>();
-        props.put("java.ext.dirs", build.toString());
-        props.put(Context.INITIAL_CONTEXT_FACTORY, factoryClassFqn);
+        Map<String, String> props
+                = singletonMap(Context.INITIAL_CONTEXT_FACTORY, factoryClassFqn);
 
-        Result r = java(props, singleton(build), "Test");
+        Result r = java(props, asList(build.resolve("test.jar"), build), "Test");
 
         if (r.exitValue == 0 || !verifyOutput(r.output, factoryClassFqn))
             throw new RuntimeException(r.output);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,1318 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringBufferInputStream;
+import java.io.StringReader;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.RowId;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.sql.rowset.serial.SerialArray;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialRef;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubArray;
+import util.StubBaseRowSet;
+import util.StubBlob;
+import util.StubClob;
+import util.StubNClob;
+import util.StubRef;
+import util.StubRowId;
+import util.StubSQLXML;
+import util.TestRowSetListener;
+
+public class BaseRowSetTests extends BaseTest {
+
+    private StubBaseRowSet brs;
+    private StubBaseRowSet brs1;
+    private final String query = "SELECT * FROM SUPERHEROS";
+    private final String url = "jdbc:derby://localhost:1527/myDB";
+    private final String dsName = "jdbc/myDB";
+    private final String user = "Bruce Wayne";
+    private final String password = "The Dark Knight";
+    private final Date aDate = Date.valueOf(LocalDate.now());
+    private final Time aTime = Time.valueOf(LocalTime.now());
+    private final Timestamp ts = Timestamp.valueOf(LocalDateTime.now());
+    private final Calendar cal = Calendar.getInstance();
+    private final byte[] bytes = new byte[10];
+    private RowId aRowid;
+    private Ref aRef;
+    private Blob aBlob;
+    private Clob aClob;
+    private Array aArray;
+    private InputStream is;
+    private Reader rdr;
+    private Map<String, Class<?>> map = new HashMap<>();
+
+    public BaseRowSetTests() {
+        brs1 = new StubBaseRowSet();
+        is = new StringBufferInputStream(query);
+        rdr = new StringReader(query);
+        aRowid = new StubRowId();
+        try {
+            aBlob = new SerialBlob(new StubBlob());
+            aClob = new SerialClob(new StubClob());
+            aRef = new SerialRef(new StubRef("INTEGER", query));
+            aArray = new SerialArray(new StubArray("INTEGER", new Object[1]));
+            map.put("SUPERHERO", Class.forName("util.SuperHero"));
+        } catch (SQLException | ClassNotFoundException ex) {
+            Logger.getLogger(BaseRowSetTests.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+
+    @BeforeMethod
+    @Override
+    public void setUpMethod() throws Exception {
+        brs = new StubBaseRowSet();
+    }
+
+    /*
+     * Validate that getCommand() returns null by default
+     */
+    @Test
+    public void test() {
+        assertTrue(brs.getCommand() == null);
+    }
+
+    /*
+     * Validate that getCommand() returns command specified to setCommand
+     */
+    @Test
+    public void test01() throws Exception {
+        brs.setCommand(query);
+        assertTrue(brs.getCommand().equals(query));
+    }
+
+    /*
+     * Validate that getCurrency() returns the correct default value
+     */
+    @Test
+    public void test02() throws Exception {
+        assertTrue(brs.getConcurrency() == ResultSet.CONCUR_UPDATABLE);
+    }
+
+    /*
+     * Validate that getCurrency() returns the correct value
+     * after a call to setConcurrency())
+     */
+    @Test(dataProvider = "concurTypes")
+    public void test03(int concurType) throws Exception {
+        brs.setConcurrency(concurType);
+        assertTrue(brs.getConcurrency() == concurType);
+    }
+
+    /*
+     * Validate that getCurrency() throws a SQLException for an invalid value
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test04() throws Exception {
+        brs.setConcurrency(ResultSet.CLOSE_CURSORS_AT_COMMIT);
+    }
+
+    /*
+     * Validate that getDataSourceName() returns null by default
+     */
+    @Test
+    public void test05() throws Exception {
+        assertTrue(brs.getDataSourceName() == null);
+    }
+
+    /*
+     * Validate that getDataSourceName() returns the value specified
+     * by setDataSourceName() and getUrl() returns null
+     */
+    @Test
+    public void test06() throws Exception {
+        brs.setUrl(url);
+        brs.setDataSourceName(dsName);
+        assertTrue(brs.getDataSourceName().equals(dsName));
+        assertTrue(brs.getUrl() == null);
+    }
+
+    /*
+     * Validate that setDataSourceName() throws a SQLException for an empty
+     * String specified for the data source name
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test07() throws Exception {
+        String dsname = "";
+        brs.setDataSourceName(dsname);
+    }
+
+    /*
+     * Validate that getEscapeProcessing() returns false by default
+     */
+    @Test
+    public void test08() throws Exception {
+        assertFalse(brs.getEscapeProcessing());
+    }
+
+    /*
+     * Validate that getEscapeProcessing() returns value set by
+     * setEscapeProcessing()
+     */
+    @Test(dataProvider = "trueFalse")
+    public void test09(boolean val) throws Exception {
+        brs.setEscapeProcessing(val);
+        assertTrue(brs.getEscapeProcessing() == val);
+    }
+
+    /*
+     * Validate that getFetchDirection() returns the correct default value
+     */
+    @Test
+    public void test10() throws Exception {
+        assertTrue(brs.getFetchDirection() == ResultSet.FETCH_FORWARD);
+    }
+
+    /*
+     * Validate that getFetchDirection() returns the value set by
+     * setFetchDirection()
+     */
+    @Test(dataProvider = "fetchDirection")
+    public void test11(int direction) throws Exception {
+        brs.setFetchDirection(direction);
+        assertTrue(brs.getFetchDirection() == direction);
+    }
+
+    /*
+     * Validate that setConcurrency() throws a SQLException for an invalid value
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test12() throws Exception {
+        brs.setConcurrency(ResultSet.CLOSE_CURSORS_AT_COMMIT);
+    }
+
+    /*
+     * Validate that setFetchSize() throws a SQLException for an invalid value
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test13() throws Exception {
+        brs.setFetchSize(-1);
+    }
+
+    /*
+     * Validate that setFetchSize() throws a SQLException for a
+     * value greater than getMaxRows()
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test14() throws Exception {
+        brs.setMaxRows(5);
+        brs.setFetchSize(brs.getMaxRows() + 1);
+    }
+
+    /*
+     * Validate that getFetchSize() returns the correct value after
+     * setFetchSize() has been called
+     */
+    @Test
+    public void test15() throws Exception {
+        int maxRows = 150;
+        brs.setFetchSize(0);
+        assertTrue(brs.getFetchSize() == 0);
+        brs.setFetchSize(100);
+        assertTrue(brs.getFetchSize() == 100);
+        brs.setMaxRows(maxRows);
+        brs.setFetchSize(maxRows);
+        assertTrue(brs.getFetchSize() == maxRows);
+    }
+
+    /*
+     * Validate that setMaxFieldSize() throws a SQLException for an invalid value
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test16() throws Exception {
+        brs.setMaxFieldSize(-1);
+    }
+
+    /*
+     * Validate that getMaxFieldSize() returns the value set by
+     * setMaxFieldSize()
+     */
+    @Test
+    public void test17() throws Exception {
+        brs.setMaxFieldSize(0);
+        assertTrue(brs.getMaxFieldSize() == 0);
+        brs.setMaxFieldSize(100);
+        assertTrue(brs.getMaxFieldSize() == 100);
+        brs.setMaxFieldSize(50);
+        assertTrue(brs.getMaxFieldSize() == 50);
+    }
+
+    /*
+     * Validate that isReadOnly() returns value set by
+     * setReadOnly()
+     */
+    @Test(dataProvider = "trueFalse")
+    public void test18(boolean val) throws Exception {
+        brs.setReadOnly(val);
+        assertTrue(brs.isReadOnly() == val);
+    }
+
+    /*
+     * Validate that getTransactionIsolation() returns value set by
+     * setTransactionIsolation()
+     */
+    @Test(dataProvider = "isolationTypes")
+    public void test19(int val) throws Exception {
+        brs.setTransactionIsolation(val);
+        assertTrue(brs.getTransactionIsolation() == val);
+    }
+
+    /*
+     * Validate that getType() returns value set by setType()
+     */
+    @Test(dataProvider = "scrollTypes")
+    public void test20(int val) throws Exception {
+        brs.setType(val);
+        assertTrue(brs.getType() == val);
+    }
+
+    /*
+     * Validate that getEscapeProcessing() returns value set by
+     * setEscapeProcessing()
+     */
+    @Test(dataProvider = "trueFalse")
+    public void test21(boolean val) throws Exception {
+        brs.setShowDeleted(val);
+        assertTrue(brs.getShowDeleted() == val);
+    }
+
+    /*
+     * Validate that getTypeMap() returns same value set by
+     * setTypeMap()
+     */
+    @Test()
+    public void test22() throws Exception {
+        brs.setTypeMap(map);
+        assertTrue(brs.getTypeMap().equals(map));
+    }
+
+    /*
+     * Validate that getUsername() returns same value set by
+     * setUsername()
+     */
+    @Test()
+    public void test23() throws Exception {
+        brs.setUsername(user);
+        assertTrue(brs.getUsername().equals(user));
+    }
+
+    /*
+     * Validate that getPassword() returns same password set by
+     * setPassword()
+     */
+    @Test()
+    public void test24() throws Exception {
+        brs.setPassword(password);
+        assertTrue(brs.getPassword().equals(password));
+    }
+
+    /*
+     * Validate that getQueryTimeout() returns same value set by
+     * setQueryTimeout() and that 0 is a valid timeout value
+     */
+    @Test()
+    public void test25() throws Exception {
+        int timeout = 0;
+        brs.setQueryTimeout(timeout);
+        assertTrue(brs.getQueryTimeout() == timeout);
+    }
+
+    /*
+     * Validate that getQueryTimeout() returns same value set by
+     * setQueryTimeout() and that 0 is a valid timeout value
+     */
+    @Test()
+    public void test26() throws Exception {
+        int timeout = 10000;
+        brs.setQueryTimeout(timeout);
+        assertTrue(brs.getQueryTimeout() == timeout);
+    }
+
+    /*
+     * Validate that setQueryTimeout() throws a SQLException for a timeout
+     * value < 0
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test27() throws Exception {
+        brs.setQueryTimeout(-1);
+    }
+
+    /*
+     * Create a RowSetListener and validate that notifyRowSetChanged is called
+     */
+    @Test()
+    public void test28() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.notifyRowSetChanged();
+        assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
+    }
+
+    /*
+     * Create a RowSetListener and validate that notifyRowChanged is called
+     */
+    @Test()
+    public void test29() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.notifyRowChanged();
+        assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED));
+    }
+
+    /*
+     * Create a RowSetListener and validate that notifyCursorMoved is called
+     */
+    @Test()
+    public void test30() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.notifyCursorMoved();
+        assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED));
+    }
+
+    /*
+     * Create a RowSetListener and validate that notifyRowSetChanged,
+     * notifyRowChanged() and notifyCursorMoved are called
+     */
+    @Test()
+    public void test31() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.notifyRowSetChanged();
+        brs.notifyRowChanged();
+        brs.notifyCursorMoved();
+        assertTrue(rsl.isNotified(
+                TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED
+                | TestRowSetListener.ROW_CHANGED));
+    }
+
+    /*
+     * Create multiple RowSetListeners and validate that notifyRowSetChanged
+     * is called on all listeners
+     */
+    @Test()
+    public void test32() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        TestRowSetListener rsl2 = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.addRowSetListener(rsl2);
+        brs.notifyRowSetChanged();
+        assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
+        assertTrue(rsl2.isNotified(TestRowSetListener.ROWSET_CHANGED));
+    }
+
+    /*
+     * Create multiple RowSetListeners and validate that notifyRowChanged
+     * is called on all listeners
+     */
+    @Test()
+    public void test33() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        TestRowSetListener rsl2 = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.addRowSetListener(rsl2);
+        brs.notifyRowChanged();
+        assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED));
+        assertTrue(rsl2.isNotified(TestRowSetListener.ROW_CHANGED));
+    }
+
+    /*
+     * Create multiple RowSetListeners and validate that notifyCursorMoved
+     * is called on all listeners
+     */
+    @Test()
+    public void test34() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        TestRowSetListener rsl2 = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.addRowSetListener(rsl2);
+        brs.notifyCursorMoved();
+        assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED));
+        assertTrue(rsl2.isNotified(TestRowSetListener.CURSOR_MOVED));
+    }
+
+    /*
+     * Create multiple RowSetListeners and validate that notifyRowSetChanged,
+     * notifyRowChanged() and notifyCursorMoved are called on all listeners
+     */
+    @Test()
+    public void test35() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        TestRowSetListener rsl2 = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.addRowSetListener(rsl2);
+        brs.notifyRowSetChanged();
+        brs.notifyRowChanged();
+        brs.notifyCursorMoved();
+        assertTrue(rsl.isNotified(
+                TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED
+                | TestRowSetListener.ROW_CHANGED));
+        assertTrue(rsl2.isNotified(
+                TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROWSET_CHANGED
+                | TestRowSetListener.ROW_CHANGED));
+    }
+
+    /*
+     * Create a RowSetListener and validate that notifyRowSetChanged is called,
+     * remove the listener, invoke notifyRowSetChanged again and verify the
+     * listner is not called
+     */
+    @Test()
+    public void test36() throws Exception {
+        TestRowSetListener rsl = new TestRowSetListener();
+        brs.addRowSetListener(rsl);
+        brs.notifyRowSetChanged();
+        assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
+        // Clear the flag indicating the listener has been called
+        rsl.resetFlag();
+        brs.removeRowSetListener(rsl);
+        brs.notifyRowSetChanged();
+        assertFalse(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
+    }
+
+    /*
+     * Validate addRowSetListener does not throw an Exception when null is
+     * passed as the parameter
+     */
+    @Test()
+    public void test37() throws Exception {
+        brs.addRowSetListener(null);
+    }
+
+    /*
+     * Validate removeRowSetListener does not throw an Exception when null is
+     * passed as the parameter
+     */
+    @Test()
+    public void test38() throws Exception {
+        brs.removeRowSetListener(null);
+    }
+
+    /*
+     * Set two parameters and then validate clearParameters() will clear them
+     */
+    @Test()
+    public void test39() throws Exception {
+        brs.setInt(1, 1);
+        brs.setString(2, query);
+        assertTrue(brs.getParams().length == 2);
+        brs.clearParameters();
+        assertTrue(brs.getParams().length == 0);
+    }
+
+    /*
+     * Set the base parameters and validate that the value set is
+     * the correct type and value
+     */
+    @Test(dataProvider = "testBaseParameters")
+    public void test40(int pos, Object o) throws Exception {
+        assertTrue(getParam(pos, o).getClass().isInstance(o));
+        assertTrue(o.equals(getParam(pos, o)));
+    }
+
+    /*
+     * Set the complex parameters and validate that the value set is
+     * the correct type
+     */
+    @Test(dataProvider = "testAdvancedParameters")
+    public void test41(int pos, Object o) throws Exception {
+        assertTrue(getParam(pos, o).getClass().isInstance(o));
+    }
+
+    /*
+     * Validate setNull specifying the supported type values
+     */
+    @Test(dataProvider = "jdbcTypes")
+    public void test42(Integer type) throws Exception {
+        brs.setNull(1, type);
+        assertTrue(checkNullParam(1, type, null));
+    }
+
+    /*
+     * Validate setNull specifying the supported type values and that
+     * typeName is set internally
+     */
+    @Test(dataProvider = "jdbcTypes")
+    public void test43(Integer type) throws Exception {
+        brs.setNull(1, type, "SUPERHERO");
+        assertTrue(checkNullParam(1, type, "SUPERHERO"));
+    }
+
+    /*
+     *  Validate that setDate sets the specified Calendar internally
+     */
+    @Test()
+    public void test44() throws Exception {
+        brs.setDate(1, aDate, cal);
+        assertTrue(checkCalendarParam(1, cal));
+    }
+
+    /*
+     *  Validate that setTime sets the specified Calendar internally
+     */
+    @Test()
+    public void test45() throws Exception {
+        brs.setTime(1, aTime, cal);
+        assertTrue(checkCalendarParam(1, cal));
+    }
+
+    /*
+     *  Validate that setTimestamp sets the specified Calendar internally
+     */
+    @Test()
+    public void test46() throws Exception {
+        brs.setTimestamp(1, ts, cal);
+        assertTrue(checkCalendarParam(1, cal));
+    }
+
+    /*
+     * Validate that getURL() returns same value set by
+     * setURL()
+     */
+    @Test()
+    public void test47() throws Exception {
+        brs.setUrl(url);
+        assertTrue(brs.getUrl().equals(url));
+    }
+
+    /*
+     * Validate that initParams() initializes the parameters
+     */
+    @Test()
+    public void test48() throws Exception {
+        brs.setInt(1, 1);
+        brs.initParams();
+        assertTrue(brs.getParams().length == 0);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test100() throws Exception {
+        brs1.setAsciiStream(1, is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test101() throws Exception {
+        brs1.setAsciiStream("one", is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test102() throws Exception {
+        brs1.setAsciiStream("one", is, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test103() throws Exception {
+        brs1.setBinaryStream(1, is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test104() throws Exception {
+        brs1.setBinaryStream("one", is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test105() throws Exception {
+        brs1.setBinaryStream("one", is, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test106() throws Exception {
+        brs1.setBigDecimal("one", BigDecimal.ONE);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test107() throws Exception {
+        brs1.setBlob(1, is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test108() throws Exception {
+        brs1.setBlob("one", is);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test109() throws Exception {
+        brs1.setBlob("one", is, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test110() throws Exception {
+        brs1.setBlob("one", aBlob);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test111() throws Exception {
+        brs1.setBoolean("one", true);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test112() throws Exception {
+        byte b = 1;
+        brs1.setByte("one", b);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test113() throws Exception {
+        byte b = 1;
+        brs1.setBytes("one", bytes);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test114() throws Exception {
+        brs1.setCharacterStream("one", rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test115() throws Exception {
+        brs1.setCharacterStream("one", rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test116() throws Exception {
+        brs1.setCharacterStream(1, rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test117() throws Exception {
+        brs1.setClob(1, rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test118() throws Exception {
+        brs1.setClob("one", rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test119() throws Exception {
+        brs1.setClob("one", rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test120() throws Exception {
+        brs1.setClob("one", aClob);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test121() throws Exception {
+        brs1.setDate("one", aDate);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test122() throws Exception {
+        brs1.setDate("one", aDate, cal);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test123() throws Exception {
+        brs1.setTime("one", aTime);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test124() throws Exception {
+        brs1.setTime("one", aTime, cal);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test125() throws Exception {
+        brs1.setTimestamp("one", ts);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test126() throws Exception {
+        brs1.setTimestamp("one", ts, cal);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test127() throws Exception {
+        brs1.setDouble("one", 2.0d);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test128() throws Exception {
+        brs1.setFloat("one", 2.0f);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test129() throws Exception {
+        brs1.setInt("one", 21);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test130() throws Exception {
+        brs1.setLong("one", 21l);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test131() throws Exception {
+        brs1.setNCharacterStream("one", rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test132() throws Exception {
+        brs1.setNCharacterStream("one", rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test133() throws Exception {
+        brs1.setNCharacterStream(1, rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test134() throws Exception {
+        brs1.setNCharacterStream(1, rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test135() throws Exception {
+        brs1.setClob("one", rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test136() throws Exception {
+        brs1.setClob("one", rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test137() throws Exception {
+        brs1.setNClob("one", new StubNClob());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test138() throws Exception {
+        brs1.setNClob(1, rdr);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test139() throws Exception {
+        brs1.setNClob(1, rdr, query.length());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test140() throws Exception {
+        brs1.setNClob(1, new StubNClob());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test141() throws Exception {
+        brs1.setNString(1, query);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test142() throws Exception {
+        brs1.setNull("one", Types.INTEGER);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test143() throws Exception {
+        brs1.setNull("one", Types.INTEGER, "my.type");
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test144() throws Exception {
+        brs1.setObject("one", query, Types.VARCHAR);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test145() throws Exception {
+        brs1.setObject("one", query, Types.VARCHAR, 0);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test146() throws Exception {
+        brs1.setObject("one", query);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test147() throws Exception {
+        brs1.setRowId("one", aRowid);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test148() throws Exception {
+        brs1.setSQLXML("one", new StubSQLXML());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test149() throws Exception {
+        brs1.setSQLXML(1, new StubSQLXML());
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test150() throws Exception {
+        brs1.setNString(1, query);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test151() throws Exception {
+        brs1.setNString("one", query);
+    }
+
+    /*
+     * This method is currently not implemented in BaseRowSet and will
+     * throw a SQLFeatureNotSupportedException
+     */
+    @Test(expectedExceptions = SQLFeatureNotSupportedException.class)
+    public void test152() throws Exception {
+        short val = 21;
+        brs1.setShort("one", val);
+    }
+
+    /*
+     * DataProvider used to specify the value to set and check for
+     * methods using transaction isolation types
+     */
+    @DataProvider(name = "isolationTypes")
+    private Object[][] isolationTypes() {
+        return new Object[][]{
+            {Connection.TRANSACTION_NONE},
+            {Connection.TRANSACTION_READ_COMMITTED},
+            {Connection.TRANSACTION_READ_UNCOMMITTED},
+            {Connection.TRANSACTION_REPEATABLE_READ},
+            {Connection.TRANSACTION_SERIALIZABLE}
+        };
+    }
+
+    /*
+     * DataProvider used to specify the value to set and check for the
+     * methods for fetch direction
+     */
+    @DataProvider(name = "fetchDirection")
+    private Object[][] fetchDirection() {
+        return new Object[][]{
+            {ResultSet.FETCH_FORWARD},
+            {ResultSet.FETCH_REVERSE},
+            {ResultSet.FETCH_UNKNOWN}
+        };
+    }
+
+    /*
+     * DataProvider used to specify the value to set and check for the
+     * methods for Concurrency
+     */
+    @DataProvider(name = "concurTypes")
+    private Object[][] concurTypes() {
+        return new Object[][]{
+            {ResultSet.CONCUR_READ_ONLY},
+            {ResultSet.CONCUR_UPDATABLE}
+        };
+    }
+
+    /*
+     * DataProvider used to specify the value to set and check for the
+     * methods for Cursor Scroll Type
+     */
+    @DataProvider(name = "scrollTypes")
+    private Object[][] scrollTypes() {
+        return new Object[][]{
+            {ResultSet.TYPE_FORWARD_ONLY},
+            {ResultSet.TYPE_SCROLL_INSENSITIVE},
+            {ResultSet.TYPE_SCROLL_SENSITIVE}
+        };
+    }
+
+    /*
+     * DataProvider used to set parameters for basic types that are supported
+     */
+    @DataProvider(name = "testBaseParameters")
+    private Object[][] testBaseParameters() throws SQLException {
+        Integer aInt = 1;
+        Long aLong = Long.MAX_VALUE;
+        Short aShort = Short.MIN_VALUE;
+        BigDecimal bd = BigDecimal.ONE;
+        Double aDouble = Double.MAX_VALUE;
+        Boolean aBoolean = true;
+        Float aFloat = 1.5f;
+        Byte aByte = 1;
+
+        brs1.clearParameters();
+        brs1.setInt(1, aInt);
+        brs1.setString(2, query);
+        brs1.setLong(3, aLong);
+        brs1.setBoolean(4, aBoolean);
+        brs1.setShort(5, aShort);
+        brs1.setDouble(6, aDouble);
+        brs1.setBigDecimal(7, bd);
+        brs1.setFloat(8, aFloat);
+        brs1.setByte(9, aByte);
+        brs1.setDate(10, aDate);
+        brs1.setTime(11, aTime);
+        brs1.setTimestamp(12, ts);
+        brs1.setDate(13, aDate, cal);
+        brs1.setTime(14, aTime, cal);
+        brs1.setTimestamp(15, ts);
+        brs1.setObject(16, query);
+        brs1.setObject(17, query, Types.CHAR);
+        brs1.setObject(18, query, Types.CHAR, 0);
+
+        return new Object[][]{
+            {1, aInt},
+            {2, query},
+            {3, aLong},
+            {4, aBoolean},
+            {5, aShort},
+            {6, aDouble},
+            {7, bd},
+            {8, aFloat},
+            {9, aByte},
+            {10, aDate},
+            {11, aTime},
+            {12, ts},
+            {13, aDate},
+            {14, aTime},
+            {15, ts},
+            {16, query},
+            {17, query},
+            {18, query}
+
+        };
+    }
+
+    /*
+     * DataProvider used to set advanced parameters for types that are supported
+     */
+    @DataProvider(name = "testAdvancedParameters")
+    private Object[][] testAdvancedParameters() throws SQLException {
+
+        brs1.clearParameters();
+        brs1.setBytes(1, bytes);
+        brs1.setAsciiStream(2, is, query.length());
+        brs1.setRef(3, aRef);
+        brs1.setArray(4, aArray);
+        brs1.setBlob(5, aBlob);
+        brs1.setClob(6, aClob);
+        brs1.setBinaryStream(7, is, query.length());
+        brs1.setUnicodeStream(8, is, query.length());
+        brs1.setCharacterStream(9, rdr, query.length());
+
+        return new Object[][]{
+            {1, bytes},
+            {2, is},
+            {3, aRef},
+            {4, aArray},
+            {5, aBlob},
+            {6, aClob},
+            {7, is},
+            {8, is},
+            {9, rdr}
+        };
+    }
+
+    /*
+     *  Method that returns the specified parameter instance that was set via setXXX
+     *  Note non-basic types are stored as an Object[] where the 1st element
+     *  is the object instnace
+     */
+    @SuppressWarnings("unchecked")
+    private <T> T getParam(int pos, T o) throws SQLException {
+        Object[] params = brs1.getParams();
+        if (params[pos - 1] instanceof Object[]) {
+            Object[] param = (Object[]) params[pos - 1];
+            return (T) param[0];
+        } else {
+            return (T) params[pos - 1];
+        }
+    }
+
+    /*
+     * Utility method to validate parameters when the param is an Object[]
+     */
+    private boolean checkParam(int pos, int type, Object val) throws SQLException {
+        boolean result = false;
+        Object[] params = brs.getParams();
+        if (params[pos - 1] instanceof Object[]) {
+            Object[] param = (Object[]) params[pos - 1];
+
+            if (param[0] == null) {
+                // setNull was used
+                if (param.length == 2 && (Integer) param[1] == type) {
+                    result = true;
+                } else {
+                    if (param.length == 3 && (Integer) param[1] == type
+                            && val.equals(param[2])) {
+                        result = true;
+                    }
+                }
+
+            } else if (param[0] instanceof java.util.Date) {
+                // setDate/Time/Timestamp with a Calendar object
+                if (param[1] instanceof Calendar && val.equals(param[1])) {
+                    result = true;
+                }
+            }
+        }
+        return result;
+    }
+
+    /*
+     * Wrapper method for validating that a null was set and the appropriate
+     * type and typeName if applicable
+     */
+    private boolean checkNullParam(int pos, int type, String typeName) throws SQLException {
+        return checkParam(pos, type, typeName);
+    }
+
+    /*
+     *  Wrapper method for validating that a Calander was set
+     */
+    private boolean checkCalendarParam(int pos, Calendar cal) throws SQLException {
+        // 2nd param is ignored when instanceof java.util.Date
+        return checkParam(pos, Types.DATE, cal);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SQLInputImplTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset.serial;
+
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SQLInputImpl;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubArray;
+import util.StubBlob;
+import util.StubClob;
+import util.StubRef;
+import util.StubStruct;
+import util.SuperHero;
+import util.TestSQLDataImpl;
+
+public class SQLInputImplTests extends BaseTest {
+
+    // Copy of the array of data type values
+    private Object[] typeValues;
+    private TestSQLDataImpl impl;
+    private Map<String, Class<?>> map ;
+    private SuperHero hero;
+    private final String sqlType = "SUPERHERO";
+
+    @BeforeMethod
+    @Override
+    public void setUpMethod() throws Exception {
+        map = new HashMap<>();
+        impl = new TestSQLDataImpl("TestSQLData");
+        typeValues = Arrays.copyOf(TestSQLDataImpl.attributes,
+                TestSQLDataImpl.attributes.length);
+        hero = new SuperHero(sqlType, "Bruce", "Wayne",
+                1939, "Batman");
+    }
+
+    /*
+     * Validate that a SQLException is thrown if the attribute value is
+     * null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test() throws Exception {
+        SQLInputImpl x = new SQLInputImpl(null, map);
+    }
+
+    /*
+     * Validate that a SQLException is thrown if the map value is
+     * null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test02() throws Exception {
+        SQLInputImpl x = new SQLInputImpl(typeValues, null);
+    }
+
+    /*
+     * Read in the various datatypes via readSQL (which will exercise the
+     * various readXXX methods and validate that results are as expected
+     */
+    @Test()
+    public void test03() throws Exception {
+        impl.readSQL(new SQLInputImpl(typeValues, map), "misc");
+        assertTrue(Arrays.equals(impl.toArray(), typeValues));
+        // Null out a field and make sure the arrays do not match
+        typeValues[2] = null;
+        assertFalse(Arrays.equals(impl.toArray(), typeValues));
+    }
+
+    /*
+     * Validate that wasNull indicates if a null was read in
+     */
+    @Test()
+    public void test04() throws Exception {
+        Object[] values = {"Hello", null, 1};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        String s = sqli.readString();
+        assertFalse(sqli.wasNull());
+        s = sqli.readString();
+        assertTrue(sqli.wasNull());
+        int i = sqli.readInt();
+        assertFalse(sqli.wasNull());
+    }
+
+    /*
+     * Validate that readObject returns the correct value
+     */
+    @Test()
+    public void test05() throws Exception {
+        Object[] values = {hero};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Object o = sqli.readObject();
+        assertTrue(hero.equals(o));
+
+    }
+
+    /*
+     * Validate a Array can be read
+     */
+    @Test(enabled = true)
+    public void test06() throws Exception {
+        Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
+            "Cappuccino"};
+        Array a = new StubArray("VARCHAR", coffees);
+        Object[] values = {a};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Array a2 = sqli.readArray();
+        assertTrue(Arrays.equals((Object[]) a2.getArray(), (Object[]) a.getArray()));
+        assertTrue(a.getBaseTypeName().equals(a2.getBaseTypeName()));
+    }
+
+    /*
+     * Validate a Blob can be read
+     */
+    @Test(enabled = true)
+    public void test07() throws Exception {
+        Blob b = new StubBlob();
+        Object[] values = {b};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Blob b2 = sqli.readBlob();
+        assertTrue(Arrays.equals(
+                b.getBytes(1, (int) b.length()),
+                b2.getBytes(1, (int) b2.length())));
+    }
+
+    /*
+     * Validate a Clob can be read
+     */
+    @Test(enabled = true)
+    public void test08() throws Exception {
+        Clob c = new StubClob();
+        Object[] values = {c};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Clob c2 = sqli.readClob();
+        assertTrue(c.getSubString(1,
+                (int) c.length()).equals(c2.getSubString(1, (int) c2.length())));
+    }
+
+    /*
+     * Validate a Ref can be read
+     */
+    @Test(enabled = true)
+    public void test09() throws Exception {
+        Ref ref = new StubRef(sqlType, hero);
+        Object[] values = {ref};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Ref ref2 = sqli.readRef();
+        assertTrue(ref.getObject().equals(ref2.getObject()));
+        assertTrue(ref.getBaseTypeName().equals(ref2.getBaseTypeName()));
+    }
+
+    /*
+     * Validate a URL can be read
+     */
+    @Test(enabled = true)
+    public void test10() throws Exception {
+        URL u = new URL("http://www.oracle.com/");;
+        Object[] values = {u};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        URL u2 = sqli.readURL();
+        assertTrue(u2.equals(u));
+        assertTrue(u2.sameFile(u));
+    }
+
+    /*
+     * Validate that readObject returns the correct value when a Struct is
+     * next on the stream
+     */
+    @Test()
+    public void test11() throws Exception {
+        Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
+            "Batman"};
+        map.put(sqlType, Class.forName("util.SuperHero"));
+        Struct struct = new StubStruct(sqlType, attributes);
+        Object[] values = {struct};
+        SQLInputImpl sqli = new SQLInputImpl(values, map);
+        Object o = sqli.readObject();
+
+        assertTrue(hero.equals(o));
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SQLOutputImplTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset.serial;
+
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+import javax.sql.rowset.serial.SQLInputImpl;
+import javax.sql.rowset.serial.SQLOutputImpl;
+import javax.sql.rowset.serial.SerialArray;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialDatalink;
+import javax.sql.rowset.serial.SerialRef;
+import javax.sql.rowset.serial.SerialStruct;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubArray;
+import util.StubBlob;
+import util.StubClob;
+import util.StubRef;
+import util.StubStruct;
+import util.SuperHero;
+import util.TestSQLDataImpl;
+
+public class SQLOutputImplTests extends BaseTest {
+
+    // Copy of the array of data type values
+    private Object[] typeValues;
+    private TestSQLDataImpl impl;
+    private Map<String, Class<?>> map = new HashMap<>();
+    private Vector results;
+    private final String sqlType = "SUPERHERO";
+    private SuperHero hero;
+    private SQLOutputImpl outImpl;
+
+    @BeforeMethod
+    @Override
+    public void setUpMethod() throws Exception {
+        results = new Vector();
+        impl = new TestSQLDataImpl("TestSQLData");
+        typeValues = Arrays.copyOf(TestSQLDataImpl.attributes,
+                TestSQLDataImpl.attributes.length);
+        hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
+        outImpl = new SQLOutputImpl(results, map);
+    }
+
+    /*
+     * Validate that a SQLException is thrown if the attribute value is
+     * null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test() throws Exception {
+        SQLOutputImpl x = new SQLOutputImpl(null, map);
+    }
+
+    /*
+     * Validate that a SQLException is thrown if the map value is
+     * null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test02() throws Exception {
+        SQLOutputImpl x = new SQLOutputImpl(results, null);
+    }
+
+    /*
+     * Read in the various datatypes via readSQL (which will exercise the
+     * various readXXX methods and validate that results are as expected
+     */
+    @Test()
+    public void test03() throws Exception {
+        impl.readSQL(new SQLInputImpl(typeValues, map), "misc");
+        impl.writeSQL(outImpl);
+        assertTrue(Arrays.equals(results.toArray(), typeValues));
+        // Null out a field and make sure the arrays do not match
+        typeValues[2] = null;
+        assertFalse(Arrays.equals(results.toArray(), typeValues));
+    }
+
+    /*
+     * Validate a Array can be written and returned
+     */
+    @Test(enabled = true)
+    public void test04() throws Exception {
+        Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
+            "Cappuccino"};
+        Array a = new StubArray("VARCHAR", coffees);
+        outImpl.writeArray(a);
+        SerialArray sa = (SerialArray) results.get(0);
+        assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray()));
+        assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName()));
+    }
+
+    /*
+     * Validate a Blob can be written and returned
+     */
+    @Test(enabled = true)
+    public void test05() throws Exception {
+        Blob b = new StubBlob();
+        outImpl.writeBlob(b);
+        SerialBlob sb = (SerialBlob) results.get(0);
+        assertTrue(Arrays.equals(
+                b.getBytes(1, (int) b.length()),
+                sb.getBytes(1, (int) sb.length())));
+    }
+
+    /*
+     * Validate a Clob can be written and returned
+     */
+    @Test(enabled = true)
+    public void test06() throws Exception {
+        Clob c = new StubClob();
+        outImpl.writeClob(c);
+        SerialClob sc = (SerialClob) results.get(0);
+        assertTrue(c.getSubString(1,
+                (int) c.length()).equals(sc.getSubString(1, (int) sc.length())));
+    }
+
+    /*
+     * Validate a Ref can be written and returned
+     */
+    @Test(enabled = true)
+    public void test07() throws Exception {
+        Ref ref = new StubRef(sqlType, hero);
+        outImpl.writeRef(ref);
+        SerialRef sr = (SerialRef) results.get(0);
+        assertTrue(hero.equals(sr.getObject()));
+    }
+
+    /*
+     * Validate a Struct can be written and returned
+     */
+    @Test(enabled = true)
+    public void test08() throws Exception {
+        Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
+            "Batman"};
+        Struct s = new StubStruct(sqlType, attributes);
+        outImpl.writeStruct(s);
+        SerialStruct ss = (SerialStruct) results.get(0);
+        assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
+        assertTrue(sqlType.equals(ss.getSQLTypeName()));
+    }
+
+    /*
+     * Validate a DataLink can be written and returned
+     */
+    @Test(enabled = true)
+    public void test09() throws Exception {
+        URL u = new URL("http://www.oracle.com/");
+        outImpl.writeURL(u);
+        SerialDatalink sdl = (SerialDatalink) results.get(0);
+        URL u2 = sdl.getDatalink();
+        assertTrue(u2.equals(u));
+        assertTrue(u2.sameFile(u));
+    }
+
+    /*
+     * Validate an Object implementing SQLData can be written and returned
+     */
+    @Test(enabled = true)
+    public void test10() throws Exception {
+        Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
+            "Batman"};
+        outImpl.writeObject(hero);
+        SerialStruct ss = (SerialStruct) results.get(0);
+        assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
+        assertTrue(sqlType.equals(ss.getSQLTypeName()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/spi/SyncFactoryExceptionTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset.spi;
+
+import java.sql.SQLException;
+import javax.sql.rowset.spi.SyncFactoryException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SyncFactoryExceptionTests extends BaseTest {
+
+    /*
+     * Create SyncFactoryException with no-arg constructor
+     */
+    @Test
+    public void test01() {
+        SyncFactoryException ex = new SyncFactoryException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /*
+     * Create SyncFactoryException with message
+     */
+    @Test
+    public void test02() {
+        SyncFactoryException ex = new SyncFactoryException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test03() {
+        SyncFactoryException ex = new SyncFactoryException("Exception 1");
+        ex.initCause(t1);
+        SyncFactoryException ex1 = new SyncFactoryException("Exception 2");
+        SyncFactoryException ex2 = new SyncFactoryException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test04() {
+        SQLException ex = new SyncFactoryException("Exception 1");
+        ex.initCause(t1);
+        SyncFactoryException ex1 = new SyncFactoryException("Exception 2");
+        SyncFactoryException ex2 = new SyncFactoryException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        while (ex != null) {
+            assertTrue(msgs[num++].equals(ex.getMessage()));
+            Throwable c = ex.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            ex = ex.getNextException();
+        }
+    }
+
+    /*
+     * Serialize a SyncFactoryException and make sure you can read it back properly
+     */
+    @Test
+    public void test05() throws Exception {
+        SyncFactoryException e = new SyncFactoryException(reason);
+        SyncFactoryException ex1 = createSerializedException(e);
+        assertTrue(ex1.getMessage().equals(reason)
+                && ex1.getSQLState() == null
+                && ex1.getCause() == null
+                && ex1.getErrorCode() == 0);
+    }
+}
--- a/jdk/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,13 +27,13 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.sql.rowset.spi.SyncFactory;
+import javax.sql.rowset.spi.SyncFactoryException;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 import util.BaseTest;
+import util.StubContext;
 import util.TestPolicy;
 
 public class SyncFactoryPermissionsTests extends BaseTest {
@@ -41,6 +41,7 @@
     Context ctx;
     private static Policy policy;
     private static SecurityManager sm;
+    private final Logger alogger = Logger.getLogger(this.getClass().getName());
 
     /*
      * Install a SeeurityManager along with a base Policy to allow testNG to run
@@ -67,13 +68,7 @@
     public SyncFactoryPermissionsTests() {
         policy = Policy.getPolicy();
         sm = System.getSecurityManager();
-
-        try {
-            ctx = new InitialContext();
-        } catch (NamingException ex) {
-            Logger.getLogger(SyncFactoryPermissionsTests.class.getName()).
-                    log(Level.SEVERE, null, ex);
-        }
+        ctx = new StubContext();
     }
 
     /*
@@ -87,12 +82,20 @@
     }
 
     /*
+     * Validate that a SyncFactoryException is thrown if the Logger is null
+     */
+    @Test(expectedExceptions = SyncFactoryException.class)
+    public void test00() throws SyncFactoryException {
+        Logger l = SyncFactory.getLogger();
+    }
+
+    /*
      * Validate that setJNDIContext succeeds if SQLPermission("setSyncFactory")
      * has been granted
      */
     @Test
-    public void test1() throws Exception {
-        Policy.setPolicy(new TestPolicy("setSyncFactory"));
+    public void test01() throws Exception {
+        setPolicy(new TestPolicy("setSyncFactory"));
         SyncFactory.setJNDIContext(ctx);
     }
 
@@ -100,8 +103,77 @@
      * Validate that setJNDIContext succeeds if AllPermissions has been granted
      */
     @Test
-    public void test2() throws Exception {
+    public void test02() throws Exception {
         setPolicy(new TestPolicy("all"));
         SyncFactory.setJNDIContext(ctx);
     }
+
+    /*
+     * Validate that AccessControlException is thrown if
+     * SQLPermission("setSyncFactory") has not been granted
+     */
+    @Test(expectedExceptions = AccessControlException.class)
+    public void test03() throws Exception {
+        setPolicy(new TestPolicy());
+        SyncFactory.setLogger(alogger);
+    }
+
+    /*
+     * Validate that setLogger succeeds if SQLPermission("setSyncFactory")
+     * has been granted
+     */
+    @Test
+    public void test04() throws Exception {
+        setPolicy(new TestPolicy("setSyncFactory"));
+        SyncFactory.setLogger(alogger);
+    }
+
+    /*
+     * Validate that setLogger succeeds if AllPermissions has been granted
+     */
+    @Test
+    public void test05() throws Exception {
+        setPolicy(new TestPolicy("all"));
+        SyncFactory.setLogger(alogger);
+    }
+
+    /*
+     * Validate that AccessControlException is thrown if
+     * SQLPermission("setSyncFactory") has not been granted
+     */
+    @Test(expectedExceptions = AccessControlException.class)
+    public void test06() throws Exception {
+        setPolicy(new TestPolicy());
+        SyncFactory.setLogger(alogger, Level.INFO);
+    }
+
+    /*
+     * Validate that AccessControlException is thrown if
+     * SQLPermission("setSyncFactory")  and LoggingPermission("control", null)
+     * have not been granted
+     */
+    @Test(expectedExceptions = AccessControlException.class)
+    public void test07() throws Exception {
+        setPolicy(new TestPolicy("setSyncFactory"));
+        SyncFactory.setLogger(alogger, Level.INFO);
+    }
+
+    /*
+     * Validate that setLogger succeeds if SQLPermission("setSyncFactory")
+     * has been granted
+     */
+    @Test
+    public void test08() throws Exception {
+        setPolicy(new TestPolicy("setSyncFactoryLogger"));
+        SyncFactory.setLogger(alogger, Level.INFO);
+    }
+
+    /*
+     * Validate that setLogger succeeds if AllPermissions has been granted
+     */
+    @Test
+    public void test09() throws Exception {
+        setPolicy(new TestPolicy("all"));
+        SyncFactory.setLogger(alogger, Level.INFO);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/spi/SyncFactoryTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset.spi;
+
+import com.sun.rowset.providers.RIOptimisticProvider;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.naming.Context;
+import javax.sql.rowset.spi.SyncFactory;
+import javax.sql.rowset.spi.SyncFactoryException;
+import javax.sql.rowset.spi.SyncProvider;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.PropertyStubProvider;
+import util.StubSyncProvider;
+import util.StubContext;
+
+//com.sun.jndi.ldap.LdapCtxFactory
+public class SyncFactoryTests {
+    private static String origFactory;
+
+    private final String stubProvider = "util.StubSyncProvider";
+    private final String propertyStubProvider = "util.PropertyStubProvider";
+    private final Logger alogger = Logger.getLogger(this.getClass().getName());
+    // Initial providers including those set via a property
+    List<String> initialProviders;
+    // All providers including those specifically registered
+    List<String> allProviders;
+    private  Context ctx= null;
+
+    public SyncFactoryTests() {
+
+        // Add a provider via a property
+        System.setProperty("rowset.provider.classname", propertyStubProvider);
+        initialProviders = Arrays.asList(
+                "com.sun.rowset.providers.RIOptimisticProvider",
+                "com.sun.rowset.providers.RIXMLProvider",
+                propertyStubProvider);
+        allProviders = new ArrayList<>();
+        allProviders.addAll(initialProviders);
+        allProviders.add(stubProvider);
+        ctx = new StubContext();
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        // Make sure the provider provider that is registered is removed
+        // before each run
+        SyncFactory.unregisterProvider(stubProvider);
+    }
+
+    /*
+     * Validate a non-null factory is returned
+     */
+    @Test
+    public void test() throws SyncFactoryException {
+        SyncFactory syncFactory = SyncFactory.getSyncFactory();
+        assertTrue(syncFactory != null);
+    }
+
+    /*
+     * Check that the correct SyncProvider is returned for the specified
+     * providerID for the provider registered via a property
+     */
+    @Test
+    public void test00() throws SyncFactoryException {
+        SyncProvider p = SyncFactory.getInstance(propertyStubProvider);
+        assertTrue(p instanceof PropertyStubProvider);
+    }
+
+    /*
+     * Check that the correct SyncProvider is returned for the specified
+     * providerID
+     */
+    @Test
+    public void test01() throws SyncFactoryException {
+        SyncFactory.registerProvider(stubProvider);
+        SyncProvider p = SyncFactory.getInstance(stubProvider);
+        assertTrue(p instanceof StubSyncProvider);
+    }
+
+    /*
+     * Check that the Default SyncProvider is returned if an empty String is
+     * passed or if an invalid providerID is specified
+     */
+    @Test
+    public void test02() throws SyncFactoryException {
+        SyncProvider p = SyncFactory.getInstance("");
+        assertTrue(p instanceof RIOptimisticProvider);
+        // Attempt to get an invalid provider and get the default provider
+        p = SyncFactory.getInstance("util.InvalidSyncProvider");
+        assertTrue(p instanceof RIOptimisticProvider);
+    }
+
+    /*
+     * Validate that a SyncFactoryException is thrown if the ProviderID is null
+     */
+    @Test(expectedExceptions = SyncFactoryException.class)
+    public void test03() throws SyncFactoryException {
+        SyncProvider p = SyncFactory.getInstance(null);
+    }
+
+    /*
+     * Validate that a SyncFactoryException is thrown if the Logger is null
+     */
+    @Test(expectedExceptions = SyncFactoryException.class,enabled=true)
+    public void test04() throws SyncFactoryException {
+        Logger l = SyncFactory.getLogger();
+    }
+
+    /*
+     * Validate that the correct logger is returned by getLogger
+     */
+    @Test
+    public void test05() throws SyncFactoryException {
+        SyncFactory.setLogger(alogger);
+        Logger l = SyncFactory.getLogger();
+        assertTrue(l.equals(alogger));
+    }
+
+    /*
+     * Validate that the correct logger is returned by getLogger
+     */
+    @Test
+    public void test06() throws SyncFactoryException {
+        SyncFactory.setLogger(alogger, Level.INFO);
+        Logger l = SyncFactory.getLogger();
+        assertTrue(l.equals(alogger));
+    }
+
+    /*
+     *  Validate that a driver that is registered is returned by
+     * getRegisteredProviders and  if it is unregistered, that it is
+     * not returned by getRegisteredProviders
+     */
+    @Test
+    public void test07() throws SyncFactoryException {
+
+        // Validate that only the default providers and any specified via
+        // a System property are available
+        validateProviders(initialProviders);
+
+        // Register a provider and make sure it is avaiable
+        SyncFactory.registerProvider(stubProvider);
+        validateProviders(allProviders);
+
+        // Check that if a provider is unregistered, it does not show as
+        // registered
+        SyncFactory.unregisterProvider(stubProvider);
+        validateProviders(initialProviders);
+    }
+
+    /*
+     * Validate that setJNDIContext throws a SyncFactoryException if the
+     * context is null
+     */
+    @Test(expectedExceptions = SyncFactoryException.class, enabled=true)
+    public void test08() throws Exception {
+        SyncFactory.setJNDIContext(null);
+    }
+
+    /*
+     * Validate that setJNDIContext succeeds
+     */
+    @Test(enabled=true)
+    public void test09() throws Exception {
+        SyncFactory.setJNDIContext(ctx);
+    }
+
+    /*
+     * Utility method to validate the expected providers are regsitered
+     */
+    private void validateProviders(List<String> expectedProviders)
+            throws SyncFactoryException {
+        List<String> results = new ArrayList<>();
+        Enumeration<SyncProvider> providers = SyncFactory.getRegisteredProviders();
+
+        while (providers.hasMoreElements()) {
+            SyncProvider p = providers.nextElement();
+            results.add(p.getProviderID());
+        }
+        assertTrue(expectedProviders.containsAll(results)
+                && results.size() == expectedProviders.size());
+    }
+
+    /*
+     * Utility method to dump out SyncProvider info for a registered provider
+     */
+    private void showImpl(SyncProvider impl) {
+        System.out.println("Provider implementation:"
+                + "\nVendor: " + impl.getVendor()
+                + "\nVersion: " + impl.getVersion()
+                + "\nProviderID: " + impl.getProviderID());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/spi/SyncProviderExceptionTests.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package test.rowset.spi;
+
+import com.sun.rowset.internal.SyncResolverImpl;
+import java.sql.SQLException;
+import javax.sql.rowset.spi.SyncProviderException;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubSyncResolver;
+
+public class SyncProviderExceptionTests extends BaseTest {
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        System.out.println(System.getProperty("java.naming.factory.initial"));
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+    /*
+     * Create SyncProviderException with no-arg constructor
+     */
+    @Test
+    public void test() {
+        SyncProviderException ex = new SyncProviderException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getSyncResolver() instanceof SyncResolverImpl);
+    }
+
+    /*
+     * Create SyncProviderException with no-arg constructor and
+     * call setSyncResolver to indicate the SyncResolver to use
+     */
+    @Test
+    public void test01() {
+        SyncProviderException ex = new SyncProviderException();
+        ex.setSyncResolver(new StubSyncResolver());
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getSyncResolver() instanceof StubSyncResolver);
+    }
+
+    /*
+     * Create SyncProviderException with message
+     */
+    @Test
+    public void test02() {
+        SyncProviderException ex = new SyncProviderException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getSyncResolver() instanceof SyncResolverImpl);
+    }
+
+    /*
+     * Create SyncProviderException with message and
+     * call setSyncResolver to indicate the SyncResolver to use
+     */
+    @Test
+    public void test03() {
+        SyncProviderException ex = new SyncProviderException(reason);
+        ex.setSyncResolver(new StubSyncResolver());
+
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getSyncResolver() instanceof StubSyncResolver);
+    }
+
+    /*
+     * Create SyncProviderException with and specify the SyncResolver to use
+     */
+    @Test
+    public void test04() {
+        SyncProviderException ex = new SyncProviderException(new StubSyncResolver());
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getSyncResolver() instanceof StubSyncResolver);
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test05() {
+        SyncProviderException ex = new SyncProviderException("Exception 1");
+        ex.initCause(t1);
+        SyncProviderException ex1 = new SyncProviderException("Exception 2");
+        SyncProviderException ex2 = new SyncProviderException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test06() {
+        SQLException ex = new SyncProviderException("Exception 1");
+        ex.initCause(t1);
+        SyncProviderException ex1 = new SyncProviderException("Exception 2");
+        SyncProviderException ex2 = new SyncProviderException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        while (ex != null) {
+            assertTrue(msgs[num++].equals(ex.getMessage()));
+            Throwable c = ex.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            ex = ex.getNextException();
+        }
+    }
+
+    /*
+     * Serialize a SyncProviderException and make sure you can read it back properly
+     */
+    @Test
+    public void test07() throws Exception {
+        SyncProviderException e = new SyncProviderException(reason);
+        SyncProviderException ex1 = createSerializedException(e);
+        assertTrue(ex1.getMessage().equals(reason)
+                && ex1.getSQLState() == null
+                && ex1.getCause() == null
+                && ex1.getErrorCode() == 0
+                && ex1.getSyncResolver() instanceof SyncResolverImpl, ex1.getSyncResolver().getClass().getName());
+    }
+
+    /*
+     * Serialize a SyncProviderException and make sure you can read it back properly
+     */
+    @Test
+    public void test08() throws Exception {
+        SyncProviderException e = new SyncProviderException(reason);
+        e.setSyncResolver(new StubSyncResolver());
+
+        SyncProviderException ex1 = createSerializedException(e);
+        assertTrue(ex1.getMessage().equals(reason)
+                && ex1.getSQLState() == null
+                && ex1.getCause() == null
+                && ex1.getErrorCode() == 0
+                && ex1.getSyncResolver() instanceof StubSyncResolver);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/PropertyStubProvider.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+public class PropertyStubProvider extends StubSyncProvider {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubBaseRowSet.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,1001 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+import javax.sql.RowSet;
+import javax.sql.rowset.BaseRowSet;
+
+public class StubBaseRowSet extends BaseRowSet implements RowSet {
+
+    public StubBaseRowSet() {
+        super();
+        // Must call initParams() as part of initialization
+        super.initParams();
+    }
+
+    public void notifyCursorMoved() throws SQLException {
+        super.notifyCursorMoved();
+    }
+
+    public void notifyRowChanged() throws SQLException {
+        super.notifyRowChanged();
+    }
+
+    public void notifyRowSetChanged() throws SQLException {
+        super.notifyRowSetChanged();
+    }
+
+    public void initParams() {
+        super.initParams();
+    }
+
+    // Methods required by RowSet interace, not used
+    @Override
+    public void execute() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean next() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void close() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean wasNull() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getString(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getBoolean(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte getByte(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public short getShort(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getInt(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public long getLong(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public float getFloat(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public double getDouble(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte[] getBytes(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getAsciiStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getBinaryStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getCursorName() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ResultSetMetaData getMetaData() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int findColumn(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getCharacterStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void beforeFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void afterLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean first() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean last() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean relative(int rows) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean previous() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowInserted() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNull(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBoolean(String columnLabel, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateByte(String columnLabel, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateShort(String columnLabel, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateInt(String columnLabel, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateLong(String columnLabel, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateFloat(String columnLabel, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDouble(String columnLabel, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateString(String columnLabel, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDate(String columnLabel, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTime(String columnLabel, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void insertRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void refreshRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement getStatement() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Ref getRef(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob getBlob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob getClob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array getArray(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Ref getRef(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob getBlob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob getClob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array getArray(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public java.net.URL getURL(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public java.net.URL getURL(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRef(String columnLabel, Ref x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateArray(String columnLabel, Array x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public RowId getRowId(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public RowId getRowId(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRowId(int columnIndex, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRowId(String columnLabel, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNString(int columnIndex, String nString) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNString(String columnLabel, String nString) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob getNClob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob getNClob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML getSQLXML(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML getSQLXML(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getNString(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getNString(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getNCharacterStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getNCharacterStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubContext.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.util.Hashtable;
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+@SuppressWarnings("unchecked")
+public class StubContext implements Context {
+
+    @Override
+    public Object lookup(Name name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Object lookup(String name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public void bind(Name name, Object obj) throws NamingException {
+
+    }
+
+    @Override
+    public void bind(String name, Object obj) throws NamingException {
+
+    }
+
+    @Override
+    public void rebind(Name name, Object obj) throws NamingException {
+
+    }
+
+    @Override
+    public void rebind(String name, Object obj) throws NamingException {
+
+    }
+
+    @Override
+    public void unbind(Name name) throws NamingException {
+
+    }
+
+    @Override
+    public void unbind(String name) throws NamingException {
+
+    }
+
+    @Override
+    public void rename(Name oldName, Name newName) throws NamingException {
+
+    }
+
+    @Override
+    public void rename(String oldName, String newName) throws NamingException {
+
+    }
+
+    @Override
+    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
+        return new NamingEnumerationStub();
+    }
+
+    @Override
+    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
+        return new NamingEnumerationStub();
+    }
+
+    @Override
+    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
+        return new NamingEnumerationStub();
+    }
+
+    @Override
+    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
+        return new NamingEnumerationStub();
+    }
+
+    @Override
+    public void destroySubcontext(Name name) throws NamingException {
+
+    }
+
+    @Override
+    public void destroySubcontext(String name) throws NamingException {
+
+    }
+
+    @Override
+    public Context createSubcontext(Name name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Context createSubcontext(String name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Object lookupLink(Name name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Object lookupLink(String name) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public NameParser getNameParser(Name name) throws NamingException {
+        return new NameParserStub();
+    }
+
+    @Override
+    public NameParser getNameParser(String name) throws NamingException {
+        return new NameParserStub();
+    }
+
+    @Override
+    public Name composeName(Name name, Name prefix) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public String composeName(String name, String prefix) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Object removeFromEnvironment(String propName) throws NamingException {
+        return null;
+    }
+
+    @Override
+    public Hashtable<?, ?> getEnvironment() throws NamingException {
+        return new Hashtable();
+    }
+
+    @Override
+    public void close() throws NamingException {
+
+    }
+
+    @Override
+    public String getNameInNamespace() throws NamingException {
+        return null;
+    }
+
+    class NamingEnumerationStub implements NamingEnumeration {
+
+        @Override
+        public Object next() throws NamingException {
+            return null;
+        }
+
+        @Override
+        public boolean hasMore() throws NamingException {
+            return false;
+        }
+
+        @Override
+        public void close() throws NamingException {
+
+        }
+
+        @Override
+        public boolean hasMoreElements() {
+            return false;
+        }
+
+        @Override
+        public Object nextElement() {
+            return null;
+        }
+
+    }
+
+    class NameParserStub implements NameParser {
+
+        @Override
+        public Name parse(String name) throws NamingException {
+            return null;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubNClob.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.sql.NClob;
+
+public class StubNClob extends StubClob  implements NClob {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubRowId.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.sql.RowId;
+
+public class StubRowId implements RowId {
+
+    @Override
+    public byte[] getBytes() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubSQLXML.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+public class StubSQLXML implements SQLXML{
+
+    @Override
+    public void free() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getBinaryStream() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public OutputStream setBinaryStream() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getCharacterStream() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Writer setCharacterStream() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getString() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setString(String value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T extends Result> T setResult(Class<T> resultClass) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubSyncProvider.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import javax.sql.RowSetReader;
+import javax.sql.RowSetWriter;
+import javax.sql.rowset.spi.SyncProvider;
+import javax.sql.rowset.spi.SyncProviderException;
+
+public class StubSyncProvider extends SyncProvider {
+
+    /**
+     * The unique provider identifier.
+     */
+    private String providerID = "util.StubSyncProvider";
+
+    /**
+     * The vendor name of this SyncProvider implementation
+     */
+    private String vendorName = "Oracle Corporation";
+
+    /**
+     * The version number of this SyncProvider implementation
+     */
+    private String versionNumber = "1.0";
+
+    @Override
+    public String getProviderID() {
+        return providerID;
+    }
+
+    @Override
+    public RowSetReader getRowSetReader() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public RowSetWriter getRowSetWriter() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getProviderGrade() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDataSourceLock(int datasource_lock) throws SyncProviderException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getDataSourceLock() throws SyncProviderException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int supportsUpdatableView() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getVersion() {
+        return versionNumber;
+    }
+
+    @Override
+    public String getVendor() {
+        return vendorName;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubSyncResolver.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,1616 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+import javax.sql.RowSetListener;
+import javax.sql.rowset.spi.SyncResolver;
+
+public class StubSyncResolver  implements SyncResolver, Serializable {
+
+    @Override
+    public int getStatus() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getConflictValue(int index) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getConflictValue(String columnName) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setResolvedValue(int index, Object obj) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setResolvedValue(String columnName, Object obj) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean nextConflict() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean previousConflict() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getUrl() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setUrl(String url) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getDataSourceName() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDataSourceName(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getUsername() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setUsername(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getPassword() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setPassword(String password) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getTransactionIsolation() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTransactionIsolation(int level) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Map<String, Class<?>> getTypeMap() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getCommand() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCommand(String cmd) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setReadOnly(boolean value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getMaxFieldSize() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setMaxFieldSize(int max) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getMaxRows() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setMaxRows(int max) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getEscapeProcessing() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getQueryTimeout() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setQueryTimeout(int seconds) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setType(int type) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setConcurrency(int concurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNull(int parameterIndex, int sqlType) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNull(String parameterName, int sqlType) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNull(String parameterName, int sqlType, String typeName) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBoolean(int parameterIndex, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBoolean(String parameterName, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setByte(int parameterIndex, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setByte(String parameterName, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setShort(int parameterIndex, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setShort(String parameterName, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setInt(int parameterIndex, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setInt(String parameterName, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setLong(int parameterIndex, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setLong(String parameterName, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setFloat(int parameterIndex, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setFloat(String parameterName, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDouble(int parameterIndex, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDouble(String parameterName, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setString(int parameterIndex, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setString(String parameterName, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBytes(int parameterIndex, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBytes(String parameterName, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDate(int parameterIndex, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTime(int parameterIndex, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTimestamp(String parameterName, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAsciiStream(String parameterName, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBinaryStream(String parameterName, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCharacterStream(String parameterName, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(String parameterName, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setObject(int parameterIndex, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setRef(int i, Ref x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(int i, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(String parameterName, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setBlob(String parameterName, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(int i, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(int parameterIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(String parameterName, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(String parameterName, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClob(String parameterName, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setArray(int i, Array x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDate(String parameterName, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setDate(String parameterName, Date x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTime(String parameterName, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTime(String parameterName, Time x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void clearParameters() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void execute() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void addRowSetListener(RowSetListener listener) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void removeRowSetListener(RowSetListener listener) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setRowId(int parameterIndex, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setRowId(String parameterName, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNString(int parameterIndex, String value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNString(String parameterName, String value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNCharacterStream(String parameterName, Reader value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(String parameterName, NClob value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(String parameterName, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(String parameterName, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(int parameterIndex, NClob value) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNClob(int parameterIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setURL(int parameterIndex, URL x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean next() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void close() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean wasNull() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getString(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getBoolean(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte getByte(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public short getShort(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getInt(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public long getLong(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public float getFloat(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public double getDouble(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public byte[] getBytes(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getAsciiStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public InputStream getBinaryStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getCursorName() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ResultSetMetaData getMetaData() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int findColumn(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getCharacterStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void beforeFirst() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void afterLast() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean first() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean last() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean relative(int rows) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean previous() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setFetchDirection(int direction) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getFetchDirection() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getType() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getConcurrency() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowInserted() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNull(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBoolean(String columnLabel, boolean x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateByte(String columnLabel, byte x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateShort(String columnLabel, short x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateInt(String columnLabel, int x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateLong(String columnLabel, long x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateFloat(String columnLabel, float x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDouble(String columnLabel, double x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateString(String columnLabel, String x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateDate(String columnLabel, Date x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTime(String columnLabel, Time x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void insertRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void deleteRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void refreshRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement getStatement() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Ref getRef(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob getBlob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob getClob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array getArray(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Ref getRef(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob getBlob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob getClob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array getArray(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public URL getURL(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public URL getURL(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRef(String columnLabel, Ref x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, Blob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Clob x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateArray(String columnLabel, Array x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public RowId getRowId(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public RowId getRowId(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRowId(int columnIndex, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateRowId(String columnLabel, RowId x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNString(int columnIndex, String nString) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNString(String columnLabel, String nString) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob getNClob(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob getNClob(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML getSQLXML(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML getSQLXML(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getNString(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getNString(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getNCharacterStream(int columnIndex) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Reader getNCharacterStream(String columnLabel) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+}
--- a/jdk/test/javax/sql/testng/util/SuperHero.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/javax/sql/testng/util/SuperHero.java	Mon Nov 17 09:36:40 2014 +0100
@@ -32,10 +32,14 @@
 
     private String first;
     private String last;
-    private final String type;
+    private String type = "SUPERHERO";
     private Integer firstYear;
     private String secretIdentity;
 
+    public SuperHero() {
+
+    }
+
     public SuperHero(String sqlType, String fname, String lname, Integer year,
             String identity) {
         first = fname;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/TestRowSetListener.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import javax.sql.RowSetEvent;
+import javax.sql.RowSetListener;
+
+public class TestRowSetListener implements RowSetListener {
+
+    // Flags to indicate which listener events should have been notified
+    public final static int ROWSET_CHANGED = 1;
+    public final static int ROW_CHANGED = 2;
+    public final static int CURSOR_MOVED = 4;
+    private int flag;
+
+    @Override
+    public void rowSetChanged(RowSetEvent event) {
+        flag |= ROWSET_CHANGED;
+    }
+
+    @Override
+    public void rowChanged(RowSetEvent event) {
+        flag |= ROW_CHANGED;
+    }
+
+    @Override
+    public void cursorMoved(RowSetEvent event) {
+        flag |= CURSOR_MOVED;
+    }
+
+    /*
+     * Clear the flag indicating which events we were notified for
+     */
+    public void resetFlag() {
+        flag = 0;
+    }
+
+    /*
+     *  Method used to validate that the correct event was notified
+     */
+    public boolean isNotified( int val) {
+        return flag == val;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/TestSQLDataImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.SQLData;
+import java.sql.SQLException;
+import java.sql.SQLInput;
+import java.sql.SQLOutput;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.Arrays;
+
+public class TestSQLDataImpl implements SQLData {
+
+    private final int stringPos = 0;
+    private final int datePos = 1;
+    private final int timePos = 2;
+    private final int timestampPos = 3;
+    private final int intPos = 4;
+    private final int longPos = 5;
+    private final int shortPos = 6;
+    private final int bigDecimalPos = 7;
+    private final int doublePos = 8;
+    private final int booleanPos = 9;
+    private final int floatPos = 10;
+    private final int bytePos = 11;
+    private final int bytesPos = 12;
+    private final int MAX_TYPES = bytesPos + 1;
+    private final Object[] types = new Object[MAX_TYPES];
+
+    private final static byte[] b = {1, 2, 3};
+
+    // attributes entries must line up with the ordering of the reading and
+    // writing of the fields in readSQL and writeSQL
+    public final static Object[] attributes = {"The Dark Knight",
+        Date.valueOf(LocalDate.now()), Time.valueOf(LocalTime.now()),
+        Timestamp.valueOf(LocalDateTime.now()), Integer.MAX_VALUE,
+        Long.MAX_VALUE, Short.MIN_VALUE, BigDecimal.ONE,
+        Double.MAX_VALUE, true, 1.5f, Byte.MAX_VALUE, b};
+
+    private String sqlType;
+
+    public TestSQLDataImpl(String type) {
+        sqlType = type;
+    }
+
+    @Override
+    public String getSQLTypeName() throws SQLException {
+        return sqlType;
+    }
+
+    @Override
+    public void readSQL(SQLInput stream, String typeName) throws SQLException {
+
+        sqlType = typeName;
+        types[stringPos] = stream.readString();
+        types[datePos] = stream.readDate();
+        types[timePos] = stream.readTime();
+        types[timestampPos] = stream.readTimestamp();
+        types[intPos] = stream.readInt();
+        types[longPos] = stream.readLong();
+        types[shortPos] = stream.readShort();
+        types[bigDecimalPos] = stream.readBigDecimal();
+        types[doublePos] = stream.readDouble();
+        types[booleanPos] = stream.readBoolean();
+        types[floatPos] = stream.readFloat();
+        types[bytePos] = stream.readByte();
+        types[bytesPos] = stream.readBytes();
+    }
+
+    @Override
+    public void writeSQL(SQLOutput stream) throws SQLException {
+
+        stream.writeString((String) types[stringPos]);
+        stream.writeDate((Date) types[datePos]);
+        stream.writeTime((Time) types[timePos]);
+        stream.writeTimestamp((Timestamp) types[timestampPos]);
+        stream.writeInt((Integer) types[intPos]);
+        stream.writeLong((Long) types[longPos]);
+        stream.writeShort((Short) types[shortPos]);
+        stream.writeBigDecimal((BigDecimal) types[bigDecimalPos]);
+        stream.writeDouble((Double) types[doublePos]);
+        stream.writeBoolean((Boolean) types[booleanPos]);
+        stream.writeFloat((Float) types[floatPos]);
+        stream.writeByte((Byte) types[bytePos]);
+        stream.writeBytes((byte[]) types[bytesPos]);
+    }
+
+    public Object[] toArray() {
+
+        Object[] result = Arrays.copyOf(types, types.length);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "[" + sqlType + " " + types + "]";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/8057893/bug8057893.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.WindowConstants;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8057893
+ * @author Alexander Scherbatiy
+ * @summary JComboBox actionListener never receives "comboBoxEdited"
+ *   from getActionCommand
+ * @run main bug8057893
+ */
+public class bug8057893 {
+
+    private static volatile boolean isComboBoxEdited = false;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        EventQueue.invokeAndWait(() -> {
+            JFrame frame = new JFrame();
+            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+            JComboBox<String> comboBox = new JComboBox<>(new String[]{"one", "two"});
+            comboBox.setEditable(true);
+            comboBox.addActionListener(new ActionListener() {
+
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    if ("comboBoxEdited".equals(e.getActionCommand())) {
+                        isComboBoxEdited = true;
+                    }
+                }
+            });
+            frame.add(comboBox);
+            frame.pack();
+            frame.setVisible(true);
+            comboBox.requestFocusInWindow();
+        });
+
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        if(!isComboBoxEdited){
+            throw new RuntimeException("ComboBoxEdited event is not fired!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/4222153/bug4222153.html	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,31 @@
+<!--
+ Copyright (c) 1999, 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.
+-->
+
+<html>
+<body>
+Click in the upper-left cell and then press TAB two times.
+If table cell selection is not on the left cell of the second row
+then test fails.
+<applet  code="bug4222153.class" width=200 height=200></applet>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/4222153/bug4222153.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, 2014, 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.
+ */
+
+import javax.swing.JApplet;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+/**
+ * @test
+ * @bug 4222153
+ * @author Konstantin Eremin
+ * @run applet/manual=yesno bug4222153.html
+ */
+public class bug4222153 extends JApplet {
+
+    public void init() {
+        SwingUtilities.invokeLater(() -> {
+            try {
+                UIManager.setLookAndFeel(
+                        "javax.swing.plaf.metal.MetalLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            getContentPane().add(new JTable(2, 2));
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/KeyBoardNavigation/KeyBoardNavigation.html	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 1999, 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.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>Keyboard Navigation in JTable</title>
+  </head>
+
+  <body>
+    <h1>Keyboard Navigation in JTable</h1>
+    <applet code=KeyBoardNavigation width=500 height=200>
+    </applet>
+
+    <p>
+      Refer to bug report 4112270 for spec of keyboard navigation. Check all combinations of navigational keys in all four modes shift and control verifying each change to the selection against the spec.
+       If it does, press "pass", otherwise press "fail".
+    <hr>
+    <address><a href="mailto:milne@taller">Philip Milne</a></address>
+
+  </body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/KeyBoardNavigation/KeyBoardNavigation.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 1999, 2014, 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.
+ */
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+
+import javax.swing.DefaultCellEditor;
+import javax.swing.JApplet;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.BevelBorder;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+
+
+/**
+ * @test
+ * @bug 4112270
+ * @summary
+ *     Keyboard Navigation in JTable
+ * @author milne
+ * @run applet/manual=yesno KeyBoardNavigation.html
+ */
+public class KeyBoardNavigation extends JApplet
+{
+    static void initTest(Container contentPane)
+    {
+        // Take the dummy data from SwingSet.
+        final String[] names = {"First Name", "Last Name", "Favorite Color",
+                "Favorite Number", "Vegetarian"};
+        final Object[][] data = {
+                {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
+                {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
+                {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
+                {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
+                {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
+                {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
+                {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
+                {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
+                {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
+                {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
+                {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
+                {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
+                {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
+                {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
+                {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
+                {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
+                {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
+                {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
+                {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
+                {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
+                {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
+        };
+
+        // Create a model of the data.
+        TableModel dataModel = new AbstractTableModel() {
+            // These methods always need to be implemented.
+            public int getColumnCount() { return names.length; }
+            public int getRowCount() { return data.length;}
+            public Object getValueAt(int row, int col) {return data[row][col];}
+
+            // The default implementations of these methods in
+            // AbstractTableModel would work, but we can refine them.
+            public String getColumnName(int column) {return names[column];}
+            public Class getColumnClass(int c) {return getValueAt(0, c).getClass();}
+            public boolean isCellEditable(int row, int col) {return true;}
+            public void setValueAt(Object aValue, int row, int column) {
+                System.out.println("Setting value to: " + aValue);
+                data[row][column] = aValue;
+            }
+        };
+
+        // Create the table
+        JTable tableView = new JTable(dataModel);
+        // Turn off auto-resizing so that we can set column sizes programmatically.
+        // In this mode, all columns will get their preferred widths, as set blow.
+        tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+
+        // Create a combo box to show that you can use one in a table.
+        JComboBox comboBox = new JComboBox();
+        comboBox.addItem("Red");
+        comboBox.addItem("Orange");
+        comboBox.addItem("Yellow");
+        comboBox.addItem("Green");
+        comboBox.addItem("Blue");
+        comboBox.addItem("Indigo");
+        comboBox.addItem("Violet");
+
+        TableColumn colorColumn = tableView.getColumn("Favorite Color");
+        // Use the combo box as the editor in the "Favorite Color" column.
+        colorColumn.setCellEditor(new DefaultCellEditor(comboBox));
+
+        // Set a pink background and tooltip for the Color column renderer.
+        DefaultTableCellRenderer colorColumnRenderer = new DefaultTableCellRenderer();
+        colorColumnRenderer.setBackground(Color.pink);
+        colorColumnRenderer.setToolTipText("Click for combo box");
+        colorColumn.setCellRenderer(colorColumnRenderer);
+
+        // Set a tooltip for the header of the colors column.
+        TableCellRenderer headerRenderer = colorColumn.getHeaderRenderer();
+        if (headerRenderer instanceof DefaultTableCellRenderer)
+            ((DefaultTableCellRenderer)headerRenderer).setToolTipText("Hi Mom!");
+
+        // Set the width of the "Vegetarian" column.
+        TableColumn vegetarianColumn = tableView.getColumn("Vegetarian");
+        vegetarianColumn.setPreferredWidth(100);
+
+        // Show the values in the "Favorite Number" column in different colors.
+        TableColumn numbersColumn = tableView.getColumn("Favorite Number");
+        DefaultTableCellRenderer numberColumnRenderer = new DefaultTableCellRenderer() {
+            public void setValue(Object value) {
+                int cellValue = (value instanceof Number) ? ((Number)value).intValue() : 0;
+                setForeground((cellValue > 30) ? Color.black : Color.red);
+                setText((value == null) ? "" : value.toString());
+            }
+        };
+        numberColumnRenderer.setHorizontalAlignment(JLabel.RIGHT);
+        numbersColumn.setCellRenderer(numberColumnRenderer);
+        numbersColumn.setPreferredWidth(110);
+
+        // Finish setting up the table.
+        JScrollPane scrollpane = new JScrollPane(tableView);
+        scrollpane.setBorder(new BevelBorder(BevelBorder.LOWERED));
+        scrollpane.setPreferredSize(new Dimension(430, 200));
+
+        contentPane.add(scrollpane);
+    }
+
+
+    public void init() {
+        SwingUtilities.invokeLater(() -> {
+            try {
+                UIManager.setLookAndFeel(
+                        "javax.swing.plaf.metal.MetalLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            initTest(getContentPane());
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/TAB/TAB.html	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 1999, 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.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>Tabbing test</title>
+  </head>
+
+  <body>
+    <h1>Tabbing test</h1>
+    <applet code=TAB width=500 height=200>
+    </applet>
+
+    <p>
+      Select a cell by double clicking it, press tab. Check that the focus moves to the next cell. 
+       If it does, press "pass", otherwise press "fail".
+    <hr>
+    <address><a href="mailto:milne@taller">Philip Milne</a></address>
+
+  </body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/TAB/TAB.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 1999, 2014, 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.
+ */
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+
+import javax.swing.DefaultCellEditor;
+import javax.swing.JApplet;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.BevelBorder;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+
+/**
+ * @test
+ * @bug 4128521
+ * @summary
+ *     Tabbing test
+ * @author milne
+ * @run applet/manual=yesno TAB.html
+ */
+public class TAB extends JApplet
+{
+    static void initTest(Container contentPane)
+    {
+        // Take the dummy data from SwingSet.
+        final String[] names = {"First Name", "Last Name", "Favorite Color",
+                "Favorite Number", "Vegetarian"};
+        final Object[][] data = {
+                {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
+                {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
+                {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
+                {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
+                {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
+                {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
+                {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
+                {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
+                {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
+                {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
+                {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
+                {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
+                {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
+                {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
+                {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
+                {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
+                {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
+                {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
+                {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
+                {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
+                {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
+        };
+
+        // Create a model of the data.
+        TableModel dataModel = new AbstractTableModel() {
+            // These methods always need to be implemented.
+            public int getColumnCount() { return names.length; }
+            public int getRowCount() { return data.length;}
+            public Object getValueAt(int row, int col) {return data[row][col];}
+
+            // The default implementations of these methods in
+            // AbstractTableModel would work, but we can refine them.
+            public String getColumnName(int column) {return names[column];}
+            public Class getColumnClass(int c) {return getValueAt(0, c).getClass();}
+            public boolean isCellEditable(int row, int col) {return true;}
+            public void setValueAt(Object aValue, int row, int column) {
+                System.out.println("Setting value to: " + aValue);
+                data[row][column] = aValue;
+            }
+        };
+
+        // Create the table
+        JTable tableView = new JTable(dataModel);
+        // Turn off auto-resizing so that we can set column sizes programmatically.
+        // In this mode, all columns will get their preferred widths, as set blow.
+        tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+
+        // Create a combo box to show that you can use one in a table.
+        JComboBox comboBox = new JComboBox();
+        comboBox.addItem("Red");
+        comboBox.addItem("Orange");
+        comboBox.addItem("Yellow");
+        comboBox.addItem("Green");
+        comboBox.addItem("Blue");
+        comboBox.addItem("Indigo");
+        comboBox.addItem("Violet");
+
+        TableColumn colorColumn = tableView.getColumn("Favorite Color");
+        // Use the combo box as the editor in the "Favorite Color" column.
+        colorColumn.setCellEditor(new DefaultCellEditor(comboBox));
+
+        // Set a pink background and tooltip for the Color column renderer.
+        DefaultTableCellRenderer colorColumnRenderer = new DefaultTableCellRenderer();
+        colorColumnRenderer.setBackground(Color.pink);
+        colorColumnRenderer.setToolTipText("Click for combo box");
+        colorColumn.setCellRenderer(colorColumnRenderer);
+
+        // Set a tooltip for the header of the colors column.
+        TableCellRenderer headerRenderer = colorColumn.getHeaderRenderer();
+        if (headerRenderer instanceof DefaultTableCellRenderer)
+            ((DefaultTableCellRenderer)headerRenderer).setToolTipText("Hi Mom!");
+
+        // Set the width of the "Vegetarian" column.
+        TableColumn vegetarianColumn = tableView.getColumn("Vegetarian");
+        vegetarianColumn.setPreferredWidth(100);
+
+        // Show the values in the "Favorite Number" column in different colors.
+        TableColumn numbersColumn = tableView.getColumn("Favorite Number");
+        DefaultTableCellRenderer numberColumnRenderer = new DefaultTableCellRenderer() {
+            public void setValue(Object value) {
+                int cellValue = (value instanceof Number) ? ((Number)value).intValue() : 0;
+                setForeground((cellValue > 30) ? Color.black : Color.red);
+                setText((value == null) ? "" : value.toString());
+            }
+        };
+        numberColumnRenderer.setHorizontalAlignment(JLabel.RIGHT);
+        numbersColumn.setCellRenderer(numberColumnRenderer);
+        numbersColumn.setPreferredWidth(110);
+
+        // Finish setting up the table.
+        JScrollPane scrollpane = new JScrollPane(tableView);
+        scrollpane.setBorder(new BevelBorder(BevelBorder.LOWERED));
+        scrollpane.setPreferredSize(new Dimension(430, 200));
+
+        contentPane.add(scrollpane);
+    }
+
+
+    public void init() {
+        SwingUtilities.invokeLater(() -> {
+            try {
+                UIManager.setLookAndFeel(
+                        "javax.swing.plaf.metal.MetalLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            initTest(getContentPane());
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/parse/EntityCharacterEventOrder.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,116 @@
+package parse;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * JDK-6770436: Entity callback order differs between Java1.5 and Java1.6
+ * https://bugs.openjdk.java.net/browse/JDK-6770436
+ *
+ */
+
+public class EntityCharacterEventOrder {
+
+    protected final static String xmlEncoding = "ISO-8859-15";
+    protected static Charset xmlEncodingCharset = null;
+
+    String _xml;
+    static {
+        xmlEncodingCharset = Charset.forName(xmlEncoding);
+    }
+    /**
+    public static void main(String[] args) {
+        TestRunner.run(JDK6770436Test.class);
+    }
+*/
+    @Test
+    public void entityCallbackOrderJava() throws SAXException, IOException {
+        final String input = "<element> &amp; some more text</element>";
+
+        final MockContentHandler handler = new MockContentHandler();
+        final XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+
+        xmlReader.setContentHandler(handler);
+        xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+
+        xmlReader.parse(new InputSource(new StringReader(input)));
+
+        final List<String> events = handler.getEvents();
+        printEvents(events);
+        assertCallbackOrder(events); //regression from JDK5
+    }
+
+    private void assertCallbackOrder(final List<String> events) {
+        assertEquals("startDocument", events.get(0));
+        assertEquals("startElement 'element'", events.get(1));
+        assertEquals("characters ' '", events.get(2));
+        assertEquals("startEntity 'amp'", events.get(3));
+        assertEquals("characters '&'", events.get(4));
+        assertEquals("endEntity 'amp'", events.get(5));
+        assertEquals("characters ' some more text'", events.get(6));
+        assertEquals("endElement 'element'", events.get(7));
+        assertEquals("endDocument", events.get(8));
+    }
+
+    private void printEvents(final List<String> events) {
+        events.stream().forEach((e) -> {
+            System.out.println(e);
+        });
+    }
+
+    private class MockContentHandler extends DefaultHandler2 {
+
+        private List<String> events;
+
+        public List<String> getEvents() {
+            return events;
+        }
+
+        @Override
+        public void startDocument() throws SAXException {
+            events = new ArrayList<String>();
+            events.add("startDocument");
+        }
+
+        @Override
+        public void characters(char[] ch, int start, int length) throws SAXException {
+            events.add("characters '" + new String(ch, start, length) + "'");
+        }
+
+        @Override
+        public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
+            events.add("startElement '" + name + "'");
+        }
+
+        @Override
+        public void endElement(String uri, String localName, String name) throws SAXException {
+            events.add("endElement '" + name + "'");
+        }
+
+        @Override
+        public void endDocument() throws SAXException {
+            events.add("endDocument");
+        }
+
+        @Override
+        public void startEntity(String name) throws SAXException {
+            events.add("startEntity '" + name + "'");
+        }
+
+        @Override
+        public void endEntity(String name) throws SAXException {
+            events.add("endEntity '" + name + "'");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/parse/XMLEntityScannerLoad.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,52 @@
+package parse;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * JDK-8059327: XML parser returns corrupt attribute value
+ * https://bugs.openjdk.java.net/browse/JDK-8059327
+ *
+ * Also:
+ * JDK-8061550: XMLEntityScanner can corrupt corrupt content during parsing
+ * https://bugs.openjdk.java.net/browse/JDK-8061550
+ *
+ * @Summary: verify that the character cache in XMLEntityScanner is reset properly
+ */
+
+public class XMLEntityScannerLoad {
+
+    @Test(dataProvider = "xmls")
+    public void test(String xml) throws SAXException, IOException, ParserConfigurationException {
+        Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ChunkInputStream(xml));
+        String value = d.getDocumentElement().getAttribute("a1");
+        assertEquals(value, "w");
+    }
+
+    static class ChunkInputStream extends ByteArrayInputStream {
+        ChunkInputStream(String xml) {
+            super(xml.getBytes());
+        }
+
+        @Override
+        public synchronized int read(byte[] b, int off, int len) {
+            return super.read(b, off, 7);
+        }
+    }
+
+    @DataProvider(name = "xmls")
+    private Object[][] xmls() {
+        return new Object[][] {
+            {"<?xml version=\"1.0\"?><element a1=\"w\" a2=\"&quot;&quot;\"/>"},
+            {"<?xml version=\"1.1\"?><element a1=\"w\" a2=\"&quot;&quot;\"/>"}
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/net/Sockets/SupportedOptions.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8062744
+ * @run main SupportedOptions
+ */
+
+import java.net.*;
+import java.io.IOException;
+import jdk.net.*;
+
+public class SupportedOptions {
+
+    public static void main(String[] args) throws Exception {
+        if (!Sockets.supportedOptions(ServerSocket.class)
+              .contains(StandardSocketOptions.IP_TOS)) {
+            throw new RuntimeException("Test failed");
+        }
+        // Now set the option
+        ServerSocket ss = new ServerSocket();
+        if (!ss.supportedOptions().contains(StandardSocketOptions.IP_TOS)) {
+            throw new RuntimeException("Test failed");
+        }
+        Sockets.setOption(ss, java.net.StandardSocketOptions.IP_TOS, 128);
+    }
+}
--- a/jdk/test/lib/testlibrary/ExtendedRobot.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/lib/testlibrary/ExtendedRobot.java	Mon Nov 17 09:36:40 2014 +0100
@@ -23,9 +23,6 @@
  * questions.
  */
 
-import sun.awt.ExtendedKeyCodes;
-import sun.awt.SunToolkit;
-
 import java.awt.AWTException;
 import java.awt.Robot;
 import java.awt.GraphicsDevice;
@@ -33,6 +30,7 @@
 import java.awt.Point;
 import java.awt.MouseInfo;
 import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
 
 /**
  * ExtendedRobot is a subclass of {@link java.awt.Robot}. It provides some convenience methods that are
@@ -178,8 +176,7 @@
      *          dispatching thread
      */
     public synchronized void waitForIdle(int delayValue) {
-        SunToolkit.flushPendingEvents();
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        super.waitForIdle();
         delay(delayValue);
     }
 
@@ -382,7 +379,7 @@
      * @see     java.awt.event.KeyEvent
      */
     public void type(char c) {
-        type(ExtendedKeyCodes.getExtendedKeyCodeForChar(c));
+        type(KeyEvent.getExtendedKeyCodeForChar(c));
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package jdk.testlibrary;
+
+import java.util.Collection;
+import java.util.Formatter;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+/**
+ * A log manager designed specifically to allow collecting ordered log messages
+ * in a multi-threaded environment without involving any kind of locking.
+ * <p>
+ * It is particularly useful in situations when one needs to assert various
+ * details about the tested thread state or the locks it hold while also wanting
+ * to produce diagnostic log messages.
+ * <p>
+ * The log manager does not provide any guarantees about the completness of the
+ * logs written from different threads - it is up to the caller to make sure
+ * {@code toString()} method is called only when all the activity has ceased
+ * and the per-thread logs contain all the necessary data.
+ *
+ * @author Jaroslav Bachorik
+ **/
+public class LockFreeLogManager {
+    private final AtomicInteger logCntr = new AtomicInteger(0);
+    private final Collection<Map<Integer, String>> allRecords = new ConcurrentLinkedQueue<>();
+    private final ThreadLocal<Map<Integer, String>> records = new ThreadLocal<Map<Integer, String>>() {
+        @Override
+        protected Map<Integer, String> initialValue() {
+            Map<Integer, String> m = new ConcurrentHashMap<>();
+            allRecords.add(m);
+            return m;
+        }
+
+    };
+
+    /**
+     * Log a message
+     * @param format Message format
+     * @param params Message parameters
+     */
+    public void log(String format, Object ... params) {
+        int id = logCntr.getAndIncrement();
+        try (Formatter formatter = new Formatter()) {
+            records.get().put(id, formatter.format(format, params).toString());
+        }
+    }
+
+    /**
+     * Will generate an aggregated log of chronologically ordered messages.
+     * <p>
+     * Make sure that you call this method only when all the related threads
+     * have finished; otherwise you might get incomplete data.
+     *
+     * @return An aggregated log of chronologically ordered messages
+     */
+    @Override
+    public String toString() {
+        return allRecords.stream()
+            .flatMap(m->m.entrySet().stream())
+            .sorted((l, r)->l.getKey().compareTo(r.getKey()))
+            .map(e->e.getValue())
+            .collect(Collectors.joining());
+    }
+}
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,6 +34,7 @@
  * @bug 6672135
  * @summary setInterval() for local MonitoredHost and local MonitoredVm
  * @author Tomas Hurka
+ * @run main/othervm -XX:+UsePerfData CR6672135
  */
 public class CR6672135 {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Cipher/JNICheck.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8063700
+ * @run main/othervm -Xcheck:jni JNICheck
+ */
+
+import javax.crypto.Cipher;
+import javax.crypto.SealedObject;
+import javax.crypto.SecretKey;
+import javax.crypto.KeyGenerator;
+import java.security.NoSuchProviderException;
+
+public class JNICheck {
+
+    /* This test is similar to the JCK test that found 8063700. */
+    static class SealedObjectTest {
+        Cipher c;
+
+        SealedObjectTest() throws Exception {
+            try {
+                c = Cipher.getInstance("AES", "SunPKCS11-Solaris");
+            } catch (NoSuchProviderException nspe) {
+                System.out.println("No SunPKCS11-Solaris provider.  Test skipped");
+                return;
+            }
+
+            String s = "Test string";
+            SealedObject so;
+            SecretKey key = KeyGenerator.getInstance("AES").generateKey();
+
+            c.init(Cipher.ENCRYPT_MODE, key);
+            so = new SealedObject(s, c);
+
+            so.getObject(key, "SunPKCS11-Solaris");
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        new SealedObjectTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8057810
+ * @summary New defaults for DSA keys in jarsigner and keytool
+ */
+
+import sun.security.pkcs.PKCS7;
+import sun.security.util.KeyUtil;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+import java.util.jar.JarFile;
+
+public class DefaultSigalg {
+
+    public static void main(String[] args) throws Exception {
+
+        // Three test cases
+        String[] keyalgs = {"DSA", "RSA", "EC"};
+        // Expected default keytool sigalg
+        String[] sigalgs = {"SHA256withDSA", "SHA256withRSA", "SHA256withECDSA"};
+        // Expected keysizes
+        int[] keysizes = {2048, 2048, 256};
+        // Expected jarsigner digest alg used in signature
+        String[] digestalgs = {"SHA-256", "SHA-256", "SHA-256"};
+
+        // Create a jar file
+        sun.tools.jar.Main m =
+                new sun.tools.jar.Main(System.out, System.err, "jar");
+        Files.write(Paths.get("x"), new byte[10]);
+        if (!m.run("cvf a.jar x".split(" "))) {
+            throw new Exception("jar creation failed");
+        }
+
+        // Generate keypairs and sign the jar
+        Files.deleteIfExists(Paths.get("jks"));
+        for (String keyalg: keyalgs) {
+            sun.security.tools.keytool.Main.main(
+                    ("-keystore jks -storepass changeit -keypass changeit " +
+                            "-dname CN=A -alias " + keyalg + " -genkeypair " +
+                            "-keyalg " + keyalg).split(" "));
+            sun.security.tools.jarsigner.Main.main(
+                    ("-keystore jks -storepass changeit a.jar " + keyalg).split(" "));
+        }
+
+        // Check result
+        KeyStore ks = KeyStore.getInstance("JKS");
+        try (FileInputStream jks = new FileInputStream("jks");
+                JarFile jf = new JarFile("a.jar")) {
+            ks.load(jks, null);
+            for (int i = 0; i<keyalgs.length; i++) {
+                String keyalg = keyalgs[i];
+                // keytool
+                X509Certificate c = (X509Certificate) ks.getCertificate(keyalg);
+                String sigalg = c.getSigAlgName();
+                if (!sigalg.equals(sigalgs[i])) {
+                    throw new Exception(
+                            "keytool sigalg for " + keyalg + " is " + sigalg);
+                }
+                int keysize = KeyUtil.getKeySize(c.getPublicKey());
+                if (keysize != keysizes[i]) {
+                    throw new Exception(
+                            "keytool keysize for " + keyalg + " is " + keysize);
+                }
+                // jarsigner
+                String bk = "META-INF/" + keyalg + "." + keyalg;
+                try (InputStream is = jf.getInputStream(jf.getEntry(bk))) {
+                    String digestalg = new PKCS7(is).getSignerInfos()[0]
+                            .getDigestAlgorithmId().toString();
+                    if (!digestalg.equals(digestalgs[i])) {
+                        throw new Exception(
+                                "jarsigner digest of sig for " + keyalg
+                                        + " is " + digestalg);
+                    }
+                }
+            }
+        }
+    }
+}
--- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -170,6 +170,13 @@
      */
     void testOK(String input, String cmd) throws Exception {
         try {
+            // Workaround for "8057810: Make SHA256withDSA the default
+            // jarsigner and keytool algorithm for DSA keys". Unfortunately
+            // SunPKCS11-NSS does not support SHA256withDSA yet.
+            if (cmd.contains("p11-nss.txt") && cmd.contains("-genkey")
+                    && !cmd.contains("-keyalg")) {
+                cmd += " -sigalg SHA1withDSA -keysize 1024";
+            }
             test(input, cmd);
         } catch(Exception e) {
             afterFail(input, cmd, "OK");
@@ -245,6 +252,9 @@
      * Helper method, print some output after a test does not do as expected
      */
     void afterFail(String input, String cmd, String should) {
+        if (cmd.contains("p11-nss.txt")) {
+            cmd = "-J-Dnss.lib=" + System.getProperty("nss.lib") + " " + cmd;
+        }
         System.err.println("\nTest fails for the command ---\n" +
                 "keytool " + cmd + "\nOr its debug version ---\n" +
                 "keytool -debug " + cmd);
@@ -799,7 +809,7 @@
         remove("x.jks.p1.cert");
         remove("csr1");
         // PrivateKeyEntry can do certreq
-        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala");
+        testOK("", "-keystore x.jks -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024");
         testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -alias mykey");
         testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1");
         testOK("", "-keystore x.jks -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA");
--- a/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Mon Nov 17 09:36:40 2014 +0100
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 7133495 8041740 8062264
+# @bug 7133495 8041740 8062264 8046777
 # @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry
 
 if [ "${TESTJAVA}" = "" ] ; then
@@ -117,6 +117,26 @@
 fi
 echo "Imported keypairs from PKCS12 keystore into the keychain"
 
+# Generate a 2048-bit RSA keypair and import into the temporary keychain
+# (its private key is configured with non-default key usage settings)
+
+certtool c k=$TEMPORARY_KC <<EOF
+test
+r
+2048
+y
+b
+s
+y
+A
+US
+A
+A
+
+
+y
+EOF
+
 # Adjust the keychain search order
 
 echo "\"$TEMPORARY_KC\"" > $TEMPORARY_LIST
@@ -127,10 +147,11 @@
 security list-keychains
 
 # Recount the number of private key entries in the Keychain keystores
+# (3 private keys imported from PKCS12, 1 private key generated by 'certtool')
 
 RECOUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l`
 echo "Found $RECOUNT private key entries in the Keychain keystore"
-if [ $RECOUNT -lt `expr $COUNT + 3` ]; then
+if [ $RECOUNT -lt `expr $COUNT + 4` ]; then
     echo "Error: expected >$COUNT private key entries in the Keychain keystores"
     RESULT=`$CLEANUP_P12`
     RESULT=`$CLEANUP_KC`
@@ -141,7 +162,7 @@
 # Access controls have already been lowered (see 'security import ... -A' above)
 
 ${TESTJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/ExportPrivateKeyNoPwd.java || exit 6
-echo | ${TESTJAVA}/bin/java ${TESTVMOPTS} ExportPrivateKeyNoPwd x
+${TESTJAVA}/bin/java ${TESTVMOPTS} ExportPrivateKeyNoPwd x
 if [ $? -ne 0 ]; then
     echo "Error exporting private key from the temporary keychain"
     RESULT=`$CLEANUP_P12`
--- a/jdk/test/sun/security/tools/keytool/autotest.sh	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/sun/security/tools/keytool/autotest.sh	Mon Nov 17 09:36:40 2014 +0100
@@ -118,13 +118,4 @@
    KeyToolTest
 status=$?
 
-rm -f p11-nss.txt
-rm -f cert8.db
-rm -f key3.db
-rm -f secmod.db
-
-rm HumanInputStream*.class
-rm KeyToolTest*.class
-rm TestException.class
-
 exit $status
--- a/jdk/test/sun/security/tools/keytool/standard.sh	Sat Nov 15 02:51:48 2014 +0000
+++ b/jdk/test/sun/security/tools/keytool/standard.sh	Mon Nov 17 09:36:40 2014 +0100
@@ -62,9 +62,5 @@
 echo | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dfile KeyToolTest
 status=$?
 
-rm HumanInputStream*.class
-rm KeyToolTest*.class
-rm TestException.class
-
 exit $status
 
--- a/langtools/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -280,3 +280,5 @@
 b8e7bbdd806465a916e64413c283075ceb0a782c jdk9-b35
 c536541235e566701ff772700c15de14b75e2979 jdk9-b36
 478972d90f7bf5002615c5b2fb1ec3e0338fcadd jdk9-b37
+5ad591bc3ef6d1b30b215cb9c228bf94aac6dc7c jdk9-b38
+5ff1cd07bd9297e82cfea5ec01249d162260fe4e jdk9-b39
--- a/langtools/make/build.properties	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/build.properties	Mon Nov 17 09:36:40 2014 +0100
@@ -23,25 +23,46 @@
 # questions.
 #
 
-# This is the JDK used to build and run the bootstrap version of javac.
-# The bootstrap javac is used to compile both boostrap versions of the
-# other tools, and product versions of all the tools.
-# Override this path as needed, either on the command line or in
-# one of the standard user build.properties files (see build.xml)
+#javac configuration for "normal build" (these will be passed to the bootstrap compiler):
+javac.debug = true
+javac.debuglevel = source,lines,vars
+javac.extra.opts=-XDignore.symbol.file=true
+javac.includes=
+javac.lint.opts = -Xlint:all,-deprecation -Werror
+javac.source = 8
+javac.target = 8
 
-# boot.java.home = /opt/jdk/1.7.0
-boot.java = ${boot.java.home}/bin/java
-boot.javac = ${boot.java.home}/bin/javac
+#javac configuration for bootstrap build (these will be passed to the compiler from the given boot JDK):
+boot.javac.extra.opts=-XDignore.symbol.file=true
+boot.javac.includes = \
+        javax/annotation/processing/ \
+        javax/lang/model/ \
+        javax/tools/ \
+        jdk/ \
+        com/sun/source/ \
+        com/sun/tools/javac/ \
+        com/sun/tools/doclint/
+boot.javac.lint.opts=
 boot.javac.source = 8
 boot.javac.target = 8
 
-# This is the JDK used to run the product version of the tools,
-# for example, for testing. If you're building a complete JDK, specify that.
-# Override this path as needed, either on the command line or in
-# one of the standard user build.properties files (see build.xml)
+#configuration of submodules (share by both the bootstrap and normal compilation):
+langtools.modules=java.base:java.compiler:jdk.compiler:jdk.dev:jdk.javadoc
+java.base.dependencies=
+java.compiler.dependencies=java.base
+jdk.compiler.dependencies=java.base:java.compiler
+jdk.javadoc.dependencies=java.base:java.compiler:jdk.compiler
+jdk.dev.dependencies=java.base:java.compiler:jdk.compiler
 
-# target.java.home = /opt/jdk/1.8.0
-target.java = ${target.java.home}/bin/java
+#test configuration:
+jtreg.tests=
+boot.javac.tests = tools/javac
+crules.tests = ../make/test/crules
+
+#javadoc configuration
+javadoc.jls.cite=The Java&trade; Language Specification
+javadoc.jls.option=-tag "jls:a:See &lt;cite&gt;${javadoc.jls.cite}&lt;/cite&gt;:" \
+    -tag "implNote:a:Implementation Note:"
 
 # Version info -- override as needed
 jdk.version = 1.9.0
@@ -55,146 +76,4 @@
 # timestamps
 # FIXME -- need to include openjdk as needed
 release = ${jdk.version}-${milestone}
-bootstrap.release = ${release}_bootstrap
 full.version = ${release}-${build.number}
-bootstrap.full.version = ${bootstrap.release}-${build.number}
-
-# options for the <javac> tasks used to compile the tools
-javac.source = 8
-javac.target = 8
-javac.debug = true
-javac.debuglevel = source,lines
-javac.no.jdk.warnings = -XDignore.symbol.file=true
-# set the following to -version to verify the versions of javac being used
-javac.version.opt =
-# in time, there should be no exceptions to -Xlint:all
-javac.lint.opts = -Xlint:all,-deprecation -Werror
-
-# options for the <javadoc> task for javac
-#javadoc.jls3.url=http://java.sun.com/docs/books/jls/
-#javadoc.jls3.cite=&lt;a href=&quot;${javadoc.jls3.url}&quot;&gt;The Java Language Specification, Third Edition&lt;/a&gt;
-#javadoc.jls3.option=-tag "jls3:a:See &lt;cite&gt;${javadoc.jls3.cite}&lt;/cite&gt;:"
-
-
-javadoc.jls.cite=The Java&trade; Language Specification
-
-javadoc.jls.option=-tag "jls:a:See &lt;cite&gt;${javadoc.jls.cite}&lt;/cite&gt;:"
-
-
-
-
-
-# jtreg, used to run the JDK regression tests
-# See http://openjdk.java.net/jtreg/
-# Override this path as needed, either on the command line or in
-# one of the standard user build.properties files (see build.xml)
-
-# jtreg.home = /opt/jtreg/4.1
-
-# findbugs
-# See http://findbugs.sourceforge.net/
-# Override this path as needed, either on the command line or in
-# one of the standard user build.properties files (see build.xml)
-
-# findbugs.home = /opt/findbugs/1.2.1
-
-# vizant (graph visualization tool for Ant)
-# See http://vizant.sourceforge.net/
-# Override this path as needed, either on the command line or in
-# one of the standard user build.properties files (see build.xml)
-
-# vizant.jar = /opt/vizant/0.1.2/vizant-0.1.2.jar
-# dot = dot
-
-#------------------------------------------------------------
-
-# The following properties define the packages for each of the tools.
-# Syntactically, they should be suitable as arguments for the "includes"
-# parameter of Ant filesets. In particular, note the trailing '/'.
-
-javac.includes = \
-        javax/annotation/processing/ \
-        javax/lang/model/ \
-        javax/tools/ \
-        jdk/ \
-        com/sun/source/ \
-        com/sun/tools/javac/ \
-        com/sun/tools/doclint/
-
-javac.tests = \
-        tools/javac
-
-#
-
-javadoc.includes = \
-        com/sun/javadoc/ \
-        com/sun/tools/javadoc/ \
-        com/sun/tools/doclets/
-
-javadoc.tests = \
-        tools/javadoc/ \
-        com/sun/javadoc/
-
-#
-
-javah.includes = \
-        com/sun/tools/javah/
-
-javah.tests = \
-        tools/javah/
-
-#
-
-javap.includes = \
-        com/sun/tools/classfile/ \
-        com/sun/tools/javap/ \
-        com/sun/tools/jdeps/ \
-        sun/tools/javap/
-
-javap.tests = \
-        tools/javap/
-
-#
-
-sjavac.includes = \
-        com/sun/tools/sjavac/
-
-sjavac.tests = \
-        tools/sjavac
-
-crules.tests = ../make/test/crules
-
-#
-
-# The following files require the latest JDK to be available.
-# The API can be provided by using a suitable boot.java.home
-# or by setting import.jdk
-require.latest.jdk.files = \
-    com/sun/tools/javac/nio/*.java
-
-# The following files in the import jdk source directory are required
-# in order to compile the files defined in ${require.latest.jdk.files}
-#
-# For NIO, the list of stub files is defined by the contents of the primary
-# API packages, together with such types that may be required in order to
-# compile the stubs. Some of these dependencies would go away if the stub
-# generator were to be improved -- e.g. by removing unnecessary imports.
-#
-import.jdk.stub.files = \
-    java/io/File.java \
-    java/nio/file/**.java \
-    java/nio/file/attribute/**.java \
-    java/nio/file/spi/**.java \
-    java/nio/channels/AsynchronousChannel.java \
-    java/nio/channels/AsynchronousFileChannel.java \
-    java/nio/channels/CompletionHandler.java \
-    java/nio/channels/SeekableByteChannel.java
-
-# The following value is used by the main jtreg target.
-# An empty value means all tests
-# Override as desired to run a specific set of tests
-jtreg.tests =
-
-# Check style configuration
-# overridable name and version
-checkstyle.name.version = checkstyle-5.4
--- a/langtools/make/build.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/build.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -25,10 +25,10 @@
 -->
 
 <!--
- This is the main build file for the complete langtools repository.
- It is used when building JDK (in which case it is invoked from the
- Makefile), and it can be used when working on the tools themselves,
- in an IDE such as NetBeans.
+ This is a convenience build file supporting development in the langtools
+ repository. It can be run either standalone, or from IDEs. This build script
+ is for a developer use only, it is not used to build the production version
+ of javac or other langtools tools.
 
  External dependencies are specified via properties. These can be given
  on the command line, or by providing a local build.properties file.
@@ -39,58 +39,27 @@
  For example, to run any of the jtreg tests you must set jtreg.home,
  to run findbugs on the code you must set findbugs.home, and so on.
 
- For the most part, javac can be built using the previous version of JDK.
- However, a small number of javac files require access to the latest JDK,
- which may not yet have been compiled. To compile these files, you can do
- one of the following:
- - Set boot.java.home to a recent build of the latest version of JDK.
- - Set import.jdk to either a recent build (containing jre/lib/rt.jar)
-   or to jdk source repository.  In the latter case, stub files will
-   automatically be generated and used for the required API, to avoid
-   unnecessary compilation of the source repository.
- If you do neither, the relevant files will not be built.
-
  The main build happens in two phases:
- - First, javac and other tools as needed are built using ${boot.java.home}.
-   (This implies a constraint on the source code that they can be compiled
-   with the previous version of JDK.
+ - First, javac is built using ${boot.java.home}. (This implies a constraint
+   on the source code that they can be compiled with the previous version of JDK.
  - Second, all required classes are compiled with the latest javac, created
    in the previous step.
- The first phase is called the bootstrap phase. All targets, properties and
- tasks that are specific to that phase have "bootstrap" in their name.
+ The build generally builds one module at time.
 
- For more details on the JDK build, see
-    http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
-    http://openjdk.java.net/groups/build/
  For more details on the stub generator, see
     http://blogs.sun.com/jjg/entry/building_javac_for_jdk7
 
  Internal details ...
 
- Interim build products are created in the build/ directory.
- Final build products are created in the dist/ directory.
- When building JDK, the dist/directory will contain:
- - A bootstrap compiler suitable for running with ${boot.java.home}
-   suitable for compiling downstream parts of JDK
- - Source files and class files for inclusion in the JDK being built
- When building standalone, the dist/directory will contain:
- - Separate jar files for each of the separate langtools components
- - Simple scripts to invoke the tools by executing the corresponding
-   jar files.
- These jar files and scripts are "for developer use only".
+ Bootstrap classes are built into the build/bootstrap/<module-name>/classes directory.
+ Final classes are built into the build/<module-name>/classes directory.
+ Final runnable javac is in dist/bin and dist/lib. Bootstrap javac (if requested by
+ using the build-bootstrap-javac target) is built into dist/bootstrap.
 
  This file is organized into sections as follows:
  - global property definitions
- - general top level targets
- - general diagnostic/debugging targets
- - groups of targets for each tool: javac, javadoc, javah, javap
-    Within each group, the following targets are provided, where applicable
-      build-bootstrap-TOOL      build the bootstrap version of the tool
-      build-classes-TOOL        build the classes for the tool
-      build-TOOL                build the jar file and script for the tool
-      jtreg-TOOL                build the tool and run the appropriate tests
-      findbugs-TOOL             run findbugs on the tool's source code
-      TOOL                      build the tool, run the tests, and run findbugs
+ - primary top level targets (cleaning, building, testing, producing javac)
+ - secondary top level targets (code analysis, diagnostics, extra documentation, etc.)
  - utility definitions
  -->
 
@@ -99,13 +68,6 @@
     **** Global property definitions.
     -->
 
-    <!-- Force full debuginfo for javac if the debug.classfiles
-    property is set.  This must be BEFORE the include of
-    build.properties because it sets javac.debuglevel.  -->
-    <condition property="javac.debuglevel" value="source,lines,vars">
-        <equals arg1="${debug.classfiles}" arg2="true"/>
-    </condition>
-
     <!-- The following locations can be used to override default property values. -->
 
     <!-- Use this location for customizations specific to this instance of this workspace -->
@@ -119,36 +81,24 @@
 
     <!-- Convenient shorthands for standard locations within the workspace. -->
     <property name="build.dir" location="build"/>
-    <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
-    <property name="build.coverage.dir" location="${build.dir}/coverage"/>
-    <property name="build.classes.dir" location="${build.dir}/classes"/>
-    <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
-    <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
-    <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
+    <property name="build.crules.dir" location="${build.dir}/crules"/>
     <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
     <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
+    <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
     <property name="dist.dir" location="dist"/>
     <property name="dist.bin.dir" location="${dist.dir}/bin"/>
-    <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
+    <property name="dist.lib.dir" location="${dist.dir}/lib"/>
     <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
     <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>
-    <property name="dist.lib.dir" location="${dist.dir}/lib"/>
     <property name="make.dir" location="make"/>
     <property name="make.conf.dir" location="${make.dir}/conf"/>
     <property name="make.tools.dir" location="${make.dir}/tools"/>
-    <property name="src.dir" location="src"/>
-    <property name="src.bin.dir" location="${src.dir}/share/bin"/>
     <property name="test.dir" location="test"/>
 
-    <path id="src.dirs">
-      <pathelement path="${src.dir}/java.base/share/classes"/>
-      <pathelement path="${src.dir}/java.compiler/share/classes"/>
-      <pathelement path="${src.dir}/jdk.compiler/share/classes"/>
-      <pathelement path="${src.dir}/jdk.dev/share/classes"/>
-      <pathelement path="${src.dir}/jdk.javadoc/share/classes"/>
-    </path>
-
-    <pathconvert pathsep="," property="src.dirs.property" refid="src.dirs" />
+    <property name="boot.build.dir" location="${build.dir}/bootstrap"/>
+    <property name="boot.dist.dir" location="${dist.dir}/bootstrap"/>
+    <property name="boot.dist.bin.dir" location="${boot.dist.dir}/bin"/>
+    <property name="boot.dist.lib.dir" location="${boot.dist.dir}/lib"/>
 
     <!-- java.marker is set to a marker file to check for within a Java install dir.
          The best file to check for across Solaris/Linux/Windows/MacOS is one of the
@@ -172,110 +122,89 @@
         <isset property="target.java.home"/>
     </condition>
 
-    <!-- Logic for handling access import jdk classes, if available.
-        import.jdk should be unset, or set to jdk home (to use rt.jar)
-        or to jdk repo (to use src/share/classes).
-        Based on the value, if any, set up default values for javac's sourcepath,
-        classpath and bootclasspath. Note: the default values are overridden
-        in the build-bootstrap-classes macro. -->
-
-    <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
-        filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
-    <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
-        ignoresystemclasses="true"
-        classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
-
-    <!-- Set the default bootclasspath option used for javac.
-        Note that different variants of the option are used, meaning we can't just
-        define the value for the option.
-        Note the explicit use of the standard property ${path.separator} in the following.
-        This is because Ant is not clever enough to handle direct use of : or ; -->
-    <condition property="javac.bootclasspath.opt"
-            value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
-            else="-Xbootclasspath/p:${build.classes.dir}">
-        <isset property="import.jdk.jar"/>
-    </condition>
-
-    <condition property="boot.java.provides.latest.jdk">
-        <available
-            ignoresystemclasses="true"
-            classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
-    </condition>
-
-    <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
-        <isset property="boot.java.provides.latest.jdk"/>
-    </condition>
-
-    <condition property="exclude.files" value="" else="${require.latest.jdk.files}">
-        <or>
-            <isset property="boot.java.provides.latest.jdk"/>
-            <isset property="import.jdk"/>
-        </or>
-    </condition>
-
-    <condition property="require.import.jdk.stubs">
-        <and>
-            <not>
-                <isset property="boot.java.provides.latest.jdk"/>
-            </not>
-            <isset property="import.jdk.src.dir"/>
-        </and>
-    </condition>
-
-    <!-- Set the default value of the sourcepath used for javac. -->
-    <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
-        <isset property="require.import.jdk.stubs"/>
-    </condition>
-
-    <!-- Set the default value of the classpath used for javac. -->
-    <property name="javac.classpath" value=""/>
-
+    <!-- setup basic properties holding paths to all sources, generated source and class directories
+         (both boot and non-boot) -->
+    <pathconvert property="langtools.sources">
+        <path>
+            <pathelement path="${langtools.modules}" />
+        </path>
+        <map from="${basedir}/" to="${basedir}/src/" />
+        <mapper type="glob" from="*" to="*/share/classes"/>
+    </pathconvert>
+    <pathconvert property="langtools.gensrc">
+        <path>
+            <pathelement path="${langtools.modules}" />
+        </path>
+        <map from="${basedir}/" to="${build.dir}/" />
+        <mapper type="glob" from="*" to="*/gensrc"/>
+    </pathconvert>
+    <pathconvert property="langtools.boot.classes">
+        <path>
+            <pathelement path="${langtools.modules}" />
+        </path>
+        <map from="${basedir}/" to="${boot.build.dir}/" />
+        <mapper type="glob" from="*" to="*/classes"/>
+    </pathconvert>
+    <pathconvert property="langtools.classes">
+        <path>
+            <pathelement path="${langtools.modules}" />
+        </path>
+        <map from="${basedir}/" to="${build.dir}/" />
+        <mapper type="glob" from="*" to="*/classes"/>
+    </pathconvert>
 
     <!--
-    **** General top level targets.
+        **** Primary targets
     -->
 
-    <!-- Standard target to build deliverables for JDK build. -->
-
-    <target name="build" depends="build-bootstrap-tools,build-all-classes">
-        <copy todir="${dist.dir}/bootstrap">
-            <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
-        </copy>
-        <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
-            <include name="*"/>
-        </chmod>
-        <mkdir dir="${dist.lib.dir}"/>
-        <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
-        <zip file="${dist.lib.dir}/src.zip">
-            <multirootfileset basedirs="${src.dirs.property}" />
-        </zip>
-    </target>
-
-    <target name="build-bootstrap-tools"
-        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-javah,build-bootstrap-sjavac"
-    />
-
-    <target name="build-all-tools"
-        depends="build-javac,build-javadoc,build-javah,build-javap,build-sjavac"
-    />
-
-    <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
-        <build-classes includes="${javac.includes} ${javadoc.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
-    </target>
-
-    <!-- clean -->
-
     <target name="clean" description="Delete all generated files">
         <delete dir="${build.dir}"/>
         <delete dir="${dist.dir}"/>
     </target>
 
-    <!-- Additional targets for running tools on the build -->
+    <target name="build" depends="build-all-tools">
+    </target>
+
+    <target name="build-all-tools" depends="build-all-classes,-def-build-all-module-jars,-def-build-tool">
+        <build-all-module-jars />
+        <build-tool name="javac"/>
+        <build-tool name="javadoc"/>
+        <build-tool name="javap"/>
+        <build-tool name="javah"/>
+        <build-tool name="sjavac"/>
+    </target>
+
+    <target name="build-all-classes" depends="-def-build-all-module-classes,build-bootstrap-javac-classes">
+        <build-all-module-classes />
+    </target>
 
     <target name="jtreg" depends="build-all-tools,-def-jtreg">
         <jtreg-tool name="all" tests="${jtreg.tests}"/>
     </target>
 
+    <target name="javadoc" depends="build-all-classes,-def-javadoc-tool">
+        <javadoc-tool options="${javadoc.jls.option}"/>
+    </target>
+
+    <target name="build-bootstrap-javac-classes" depends="-check-boot.java.home,-def-build-all-module-classes">
+        <build-all-module-classes compilation.kind="boot." />
+    </target>
+
+    <!--
+        **** Extra targets
+    -->
+
+    <target name="build-bootstrap-javac" depends="build-bootstrap-javac-classes,-def-build-all-module-jars,-def-build-tool">
+        <build-all-module-jars compilation.kind="boot." />
+        <build-tool name="javac" compilation.kind="boot." />
+    </target>
+
+    <target name="jtreg-bootstrap-javac" depends="build-bootstrap-javac,-def-jtreg">
+        <jtreg-tool name="bootstrap-javac"
+                    tests="${boot.javac.tests}"
+                    langtools.classes="${langtools.boot.classes}"/>
+    </target>
+
     <target name="checkstyle" depends="-def-checkstyle"
         description="Generates reports for code convention violations.">
         <mkdir dir="${dist.checkstyle.dir}"/>
@@ -325,9 +254,13 @@
             warningsProperty="findbugs.all.warnings"
             jvm="${target.java.home}/bin/java"
             jvmargs="-Xmx512M">
-            <class location="${build.classes.dir}"/>
+            <class location="${build.dir}/java.base/classes"/>
+            <class location="${build.dir}/java.compiler/classes"/>
+            <class location="${build.dir}/jdk.compiler/classes"/>
+            <class location="${build.dir}/jdk.javadoc/classes"/>
+            <class location="${build.dir}/jdk.dev/classes"/>
             <sourcePath>
-                <path refid="src.dirs"/>
+                <pathelement path="${langtools.sources}"/>
             </sourcePath>
         </findbugs>
         <exec executable="sh">
@@ -339,49 +272,7 @@
         </exec>
     </target>
 
-    <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
-
-    <target name="instrument-classes" depends="-def-cobertura">
-        <!-- only define the following property when we want coverage info -->
-        <path id="coverage.classpath">
-            <pathelement location="${build.coverage.dir}/classes"/>
-            <path refid="cobertura.classpath"/>
-        </path>
-        <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
-        <property name="coverage.classpath" refid="coverage.classpath"/>
-        <mkdir dir="${build.coverage.dir}/classes"/>
-        <delete file="${build.coverage.dir}/cobertura.ser"/>
-        <cobertura-instrument todir="${build.coverage.dir}/classes"
-            datafile="${build.coverage.dir}/cobertura.ser">
-            <fileset dir="${build.classes.dir}"
-               includes="**/*.class" excludes="**/resources/*.class"/>
-        </cobertura-instrument>
-    </target>
-
-    <target name="coverage-report" depends="-def-cobertura">
-        <mkdir dir="${dist.coverage.dir}"/>
-        <cobertura-report
-            destdir="${dist.coverage.dir}"
-            datafile="${build.coverage.dir}/cobertura.ser">
-            <fileset dir="${src.dir}/java.base/share/classes"/>
-            <fileset dir="${src.dir}/java.compiler/share/classes"/>
-            <fileset dir="${src.dir}/jdk.compiler/share/classes"/>
-            <fileset dir="${src.dir}/jdk.dev/share/classes"/>
-            <fileset dir="${src.dir}/jdk.javadoc/share/classes"/>
-        </cobertura-report>
-        <cobertura-report
-            format="xml"
-            destdir="${dist.coverage.dir}"
-            datafile="${build.coverage.dir}/cobertura.ser">
-            <fileset dir="${src.dir}/java.base/share/classes"/>
-            <fileset dir="${src.dir}/java.compiler/share/classes"/>
-            <fileset dir="${src.dir}/jdk.compiler/share/classes"/>
-            <fileset dir="${src.dir}/jdk.dev/share/classes"/>
-            <fileset dir="${src.dir}/jdk.javadoc/share/classes"/>
-        </cobertura-report>
-    </target>
-
-    <target name="diags-examples" depends="build-javac,build-javap">
+    <target name="diags-examples" depends="build-all-tools">
         <!-- can override the following on the command line if desired. -->
         <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
         <mkdir dir="${build.dir}/diag-examples/classes"/>
@@ -391,7 +282,7 @@
             destdir="${build.dir}/diag-examples/classes"
             includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
             sourcepath=""
-            classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
+            classpath="${langtools.classes}"
             includeAntRuntime="no"
             debug="${javac.debug}"
             debuglevel="${javac.debuglevel}">
@@ -400,7 +291,7 @@
         <java fork="true"
             jvm="${target.java.home}/bin/java"
             dir="test/tools/javac/diags"
-            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
+            classpath="${build.dir}/diag-examples/classes;${langtools.classes}"
             classname="RunExamples">
             <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
             <arg value="-examples"/>
@@ -413,56 +304,16 @@
         </java>
     </target>
 
-    <!-- a patching facility to speed up incorporating the langtools' classfiles
-         into a jdk of your choice. Either target.java.home or patch.jdk can be
-         set on the command line; setting target.java.home has the advantage of
-         patching the jdk used for jtreg and other tests.
-    -->
-    <target name="patch" depends="build-all-classes">
-        <condition property="patch.jdk" value="${target.java.home}">
-            <available file="${target.java.home}" type="dir"/>
-        </condition>
-        <fail message="patch.jdk or target.java.home is not set, please set target.java.home, or patch.jdk for an alternate jdk image to patch">
-            <condition>
-                <not>
-                    <isset property="patch.jdk"/>
-                </not>
-            </condition>
-        </fail>
-        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
-        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
-        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
-            <condition>
-                <not>
-                    <available file="${patch.tools.jar}" type="file"/>
-                </not>
-            </condition>
-        </fail>
-        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
-            <condition>
-                <not>
-                    <available file="${patch.rt.jar}" type="file"/>
-                </not>
-            </condition>
-        </fail>
-        <zip zipfile="${patch.tools.jar}" update="true">
-            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
-        </zip>
-        <zip zipfile="${patch.rt.jar}" update="true">
-            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
-        </zip>
-    </target>
-
     <target name="doclint-api" depends="build-all-classes">
         <delete dir="${build.dir}/doclint/classes"/>
         <mkdir dir="${build.dir}/doclint/classes"/>
         <javac fork="true"
-               executable="${boot.javac}"
+               executable="${boot.java.home}/bin/javac"
                destdir="${build.dir}/doclint/classes"
                includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"
                excludes=""
-               sourcepath="${javac.sourcepath}"
-               classpath="${javac.classpath}"
+               sourcepath=""
+               classpath="${langtools.classes}"
                includeAntRuntime="no"
                source="${javac.source}"
                target="${javac.target}"
@@ -471,12 +322,11 @@
             <compilerarg value="-implicit:none"/>
             <compilerarg value="-Xprefer:source"/>
             <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
-            <compilerarg line="${javac.no.jdk.warnings}"/>
-            <compilerarg line="${javac.version.opt}"/>
+            <compilerarg line="${javac.extra.opts}"/>
             <compilerarg line="-Xdoclint:all/protected,-missing"/>
             <src>
-                <path refid="src.dirs"/>
-                <path location="${build.gensrc.dir}"/>
+                <pathelement path="${langtools.sources}"/>
+                <pathelement path="${langtools.gensrc}"/>
             </src>
         </javac>
     </target>
@@ -515,17 +365,12 @@
             </classpath>
             <!-- platform classes used for documentation -->
             <bootclasspath>
-                <pathelement path="${build.dir}/classes"/>
+                <pathelement path="${langtools.classes}"/>
                 <pathelement path="${target.java.home}/jre/lib/rt.jar"/>
             </bootclasspath>
         </javadoc>
     </target>
 
-    <!--
-    **** Debugging/diagnostic targets.
-    -->
-
-    <!-- standard JDK target -->
     <target name="sanity"
         description="display settings of configuration values">
         <echo level="info">ant.home = ${ant.home}</echo>
@@ -536,257 +381,32 @@
         <echo level="info">checkstyle.home = ${checkstyle.home}</echo>
     </target>
 
-    <target name="post-sanity" depends="-def-jtreg,sanity,build"
-        description="perform basic validation after a standard build">
-        <jtreg
-            dir="make/test"
-            workDir="${build.jtreg.dir}/post-sanity/work"
-            reportDir="${build.jtreg.dir}/post-sanity/report"
-            jdk="${target.java.home}"
-            verbose="summary"
-            failonerror="false" resultproperty="jtreg.post-sanity.result">
-        </jtreg>
-    </target>
-
-    <!-- use vizant tool to generate graphical image of this Ant file.-->
-    <target name="vizant" depends="-def-vizant">
-        <mkdir dir="${build.dir}"/>
-        <echo message="Generating ${build.dir}/build.dot"/>
-        <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
-        <echo message="Generating ${build.dir}/build.png"/>
-        <exec executable="${dot}" >
-            <arg value="-Tpng"/>
-            <arg value="-o"/>
-            <arg file="${build.dir}/build.png"/>
-            <arg file="${build.dir}/build.dot"/>
-        </exec>
-    </target>
-
-    <target name="check-import.jdk">
-        <echo message="import.jdk: ${import.jdk}"/>
-        <echo message="import.jdk.jar: ${import.jdk.jar}"/>
-        <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
-    </target>
-
     <target name="diagnostics">
         <diagnostics/>
     </target>
 
-
-    <!--
-    **** javac targets.
-    -->
-
-    <target name="build-bootstrap-javac"
-            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
-        <build-bootstrap-classes includes="${javac.includes}"/>
-        <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
-        <build-bootstrap-tool    name="javac"/>
-    </target>
-
-    <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
-        <build-classes includes="${javac.includes}"/>
-    </target>
-
-    <target name="build-javac" depends="build-classes-javac">
-        <build-jar  name="javac" includes="${javac.includes}"/>
-        <build-tool name="javac"/>
-    </target>
-
-    <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
-        <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/>
-    </target>
-
-    <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
-        <jtreg-tool name="javac" tests="${javac.tests}"/>
-    </target>
-
-    <target name="findbugs-javac" depends="build-javac,-def-findbugs">
-        <findbugs-tool name="javac"/>
-    </target>
-
-    <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
-
-
-    <!--
-    **** javadoc targets.
-    -->
-
-    <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
-        <build-bootstrap-classes includes="${javadoc.includes}"/>
-        <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
-                                 jarclasspath="javac.jar"/>
-        <build-bootstrap-tool    name="javadoc"/>
-    </target>
-
-    <target name="build-classes-javadoc" depends="build-classes-javac">
-        <build-classes includes="${javadoc.includes}"/>
-    </target>
-
-    <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
-        <build-jar  name="javadoc" includes="${javadoc.includes}"
-                    jarclasspath="javac.jar"/>
-        <build-tool name="javadoc"/>
-    </target>
-
-    <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
-        <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
-    </target>
-
-    <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
-        <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
-    </target>
-
-    <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
-        <findbugs-tool name="javadoc"/>
-    </target>
-
-    <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
-
-    <!--
-    **** javah targets.
-    -->
-
-    <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
-        <build-bootstrap-classes includes="${javah.includes}"/>
-        <build-bootstrap-jar     name="javah" includes="${javah.includes}"
-                                 jarclasspath="javadoc.jar javac.jar"/>
-        <build-bootstrap-tool    name="javah"/>
-    </target>
-
-    <target name="build-javah" depends="build-javac,build-classes-javah">
-        <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
-        <build-tool name="javah"/>
-    </target>
-
-    <target name="build-classes-javah" depends="build-classes-javadoc">
-        <build-classes includes="${javah.includes}"/>
-    </target>
-
-    <!-- (no javadoc for javah) -->
-
-    <target name="jtreg-javah" depends="build-javah,-def-jtreg">
-        <jtreg-tool name="javah" tests="${javah.tests}"/>
-    </target>
-
-    <target name="findbugs-javah" depends="build-javah,-def-findbugs">
-        <findbugs-tool name="javah"/>
-    </target>
-
-    <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
-
-
-    <!--
-    **** javap targets.
-    -->
-
-    <target name="build-bootstrap-javap"
-            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
-        <build-bootstrap-classes includes="${javap.includes}"/>
-        <build-bootstrap-jar     name="javap" includes="${javap.includes}"
-                                 jarmainclass="sun.tools.javap.Main"/>
-        <build-bootstrap-tool    name="javap"/>
-    </target>
-
-    <target name="build-classes-javap" depends="build-classes-javac">
-        <build-classes includes="${javap.includes}"/>
-    </target>
-
-    <target name="build-javap" depends="build-javac,build-classes-javap">
-        <build-jar  name="javap" includes="${javap.includes}"
-                    jarmainclass="com.sun.tools.javap.Main"
-                    jarclasspath="javac.jar"/>
-        <build-tool name="javap"/>
-    </target>
-
-    <!-- (no javadoc for javap) -->
-
-    <target name="jtreg-javap" depends="build-javap,-def-jtreg">
-        <jtreg-tool name="javap" tests="${javap.tests}"/>
-    </target>
-
-    <target name="findbugs-javap" depends="build-javap,-def-findbugs">
-        <findbugs-tool name="javap"/>
-    </target>
-
-    <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
-
-    <!--
-    **** sjavac targets.
-    -->
-
-    <target name="build-bootstrap-sjavac"
-            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
-        <build-bootstrap-classes includes="${sjavac.includes}"/>
-        <build-bootstrap-jar     name="sjavac" includes="${sjavac.includes}"
-                                 jarmainclass="com.sun.tools.sjavac.Main"/>
-        <build-bootstrap-tool    name="sjavac"/>
-    </target>
-
-    <target name="build-classes-sjavac" depends="build-classes-javac">
-        <build-classes includes="${sjavac.includes}"/>
-    </target>
-
-    <target name="build-sjavac" depends="build-classes-sjavac">
-        <build-jar  name="sjavac" includes="${sjavac.includes}"
-                    jarmainclass="com.sun.tools.sjavac.Main"
-                    jarclasspath="sjavac.jar"/>
-        <build-tool name="sjavac"/>
-    </target>
-
-    <!-- (no javadoc for javap) -->
-
-    <target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg">
-        <jtreg-tool name="sjavac" tests="${sjavac.tests}"/>
-    </target>
-
-    <target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs">
-        <findbugs-tool name="sjavac"/>
-    </target>
-
-    <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>
-
-    <!--
-    **** crules targets.
-    -->
-
-    <target name="build-crules"
-            depends="-def-compilecrules,-def-build-jar-with-services,build-bootstrap-javac,-create-import-jdk-stubs">
-        <compilecrules/>
-        <build-jar-with-services
-                    name="crules"
-                    includes="crules/* crules/resources/*"
-                    classes.dir="${build.toolclasses.dir}"
-                    lib.dir="${build.toolclasses.dir}"
-                    jarmainclass=""
-                    jarclasspath="crules.jar"
-                    service.type="com.sun.source.util.Plugin"
-                    service.provider="crules.CodingRulesAnalyzerPlugin"/>
-        <build-tool name="crules"/>
-    </target>
-
-    <target name="jtreg-crules" depends="build-javac,build-crules,-def-jtreg">
+    <target name="jtreg-crules" depends="build-all-classes,-def-jtreg">
+        <mkdir dir="${build.crules.dir}/classes"/>
+        <javac fork="true"
+               source="${boot.javac.source}"
+               target="${boot.javac.target}"
+               executable="${boot.java.home}/bin/javac"
+               srcdir="${make.tools.dir}"
+               includes="crules/*"
+               destdir="${build.crules.dir}/classes"
+               includeantruntime="false">
+            <compilerarg value="-Xbootclasspath/p:${langtools.classes}"/>
+            <compilerarg line="${javac.lint.opts}"/>
+        </javac>
+        <copy todir="${build.crules.dir}/classes" includeemptydirs="false">
+            <fileset dir="${make.tools.dir}">
+                <include name="**/*.properties"/>
+            </fileset>
+        </copy>
+        <echo file="${build.crules.dir}/classes/META-INF/services/com.sun.source.util.Plugin">crules.CodingRulesAnalyzerPlugin</echo>
         <jtreg-tool name="crules"
                     tests="${crules.tests}"
-                    extra.jvmargs="-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar" />
-    </target>
-
-    <target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules">
-        <build-classes includes="${javac.includes}"
-            plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:coding_rules" />
-    </target>
-
-    <!--
-    **** Create import JDK stubs.
-    -->
-
-    <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
-        <mkdir dir="${build.genstubs.dir}"/>
-        <genstubs
-            srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
-            includes="${import.jdk.stub.files}"
-            fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
-        />
+                    extra.jvmargs="-Xbootclasspath/a:${build.crules.dir}/classes" />
     </target>
 
     <!--
@@ -821,8 +441,8 @@
         <check name="target java" property="target.java.home" marker="${java.marker}"/>
     </target>
 
-    <target name="-check-cobertura.home" depends="-def-check">
-        <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
+    <target name="-check-jtreg.home" depends="-def-check">
+        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
     </target>
 
     <target name="-check-findbugs.home" depends="-def-check">
@@ -830,27 +450,57 @@
     </target>
 
     <target name="-check-checkstyle.home" depends="-def-check">
-        <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
+        <check name="checkstyle" property="checkstyle.home" marker=""/> <!--TODO: better checkstyle verification-->
     </target>
 
-    <target name="-check-jtreg.home" depends="-def-check">
-        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
+    <!-- Definitions -->
+
+    <target name="-def-build-all-module-jars" depends="-def-build-module-jar">
+        <macrodef name="build-all-module-jars">
+            <attribute name="compilation.kind" default=""/>
+            <sequential>
+                <build-module-jar module.name="java.base" compilation.kind="@{compilation.kind}" />
+                <build-module-jar module.name="java.compiler" compilation.kind="@{compilation.kind}" />
+                <build-module-jar module.name="jdk.compiler" compilation.kind="@{compilation.kind}" />
+                <build-module-jar module.name="jdk.javadoc" compilation.kind="@{compilation.kind}" />
+                <build-module-jar module.name="jdk.dev" compilation.kind="@{compilation.kind}" />
+            </sequential>
+        </macrodef>
     </target>
 
-    <target name="-check-vizant" depends="-def-check">
-        <check name="vizant" property="vizant.jar"/>
-        <check name="dot" property="dot"/>
+    <target name="-def-build-module-jar">
+        <macrodef name="build-module-jar">
+            <attribute name="module.name"/>
+            <attribute name="compilation.kind"/>
+            <attribute name="dependencies" default="${@{compilation.kind}@{module.name}.dependencies}"/>
+            <attribute name="build.dir" default="${@{compilation.kind}build.dir}"/>
+            <attribute name="lib.dir" default="${@{compilation.kind}dist.lib.dir}"/>
+            <attribute name="classes.dir" default="@{build.dir}/@{module.name}/classes"/>
+            <sequential>
+                <mkdir dir="@{lib.dir}"/>
+                <local name="jarclasspath" />
+                <pathconvert property="jarclasspath">
+                    <path>
+                        <pathelement path="@{dependencies}" />
+                    </path>
+                    <map from="${basedir}/" to="" />
+                    <mapper type="glob" from="*" to="*.jar"/>
+                </pathconvert>
+                <jar destfile="@{lib.dir}/@{module.name}.jar"
+                     basedir="@{classes.dir}">
+                    <manifest>
+                        <attribute name="Class-Path" value="@{jarclasspath}"/>
+                    </manifest>
+                </jar>
+            </sequential>
+        </macrodef>
     </target>
 
-
-    <!--
-    **** Targets for Ant macro and task definitions.
-    -->
-
     <target name="-def-build-tool">
         <macrodef name="build-tool">
             <attribute name="name"/>
-            <attribute name="bin.dir" default="${dist.bin.dir}"/>
+            <attribute name="compilation.kind" default=""/>
+            <attribute name="bin.dir" default="${@{compilation.kind}dist.bin.dir}"/>
             <attribute name="java" default="${launcher.java}"/>
             <sequential>
                 <mkdir dir="@{bin.dir}"/>
@@ -866,84 +516,73 @@
         </macrodef>
     </target>
 
-    <target name="-def-build-jar">
-        <macrodef name="build-jar">
-            <attribute name="name"/>
-            <attribute name="includes"/>
-            <attribute name="classes.dir" default="${build.classes.dir}"/>
-            <attribute name="lib.dir" default="${dist.lib.dir}"/>
-            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
-            <attribute name="jarclasspath" default=""/>
+    <target name="-def-build-all-module-classes" depends="-def-build-module-classes">
+        <macrodef name="build-all-module-classes">
+            <attribute name="compilation.kind" default=""/>
             <sequential>
-                <mkdir dir="@{lib.dir}"/>
-                <jar destfile="@{lib.dir}/@{name}.jar"
-                     basedir="@{classes.dir}"
-                     includes="@{includes}">
-                    <manifest>
-                        <attribute name="Main-Class" value="@{jarmainclass}"/>
-                        <attribute name="Class-Path" value="@{jarclasspath}"/>
-                    </manifest>
-                </jar>
+                <build-module-classes module.name="java.base"
+                                      compilation.kind="@{compilation.kind}" />
+                <build-module-classes module.name="java.compiler"
+                                      compilation.kind="@{compilation.kind}" />
+                <build-module-classes module.name="jdk.compiler"
+                                      compilation.kind="@{compilation.kind}" />
+                <build-module-classes module.name="jdk.javadoc"
+                                      compilation.kind="@{compilation.kind}" />
+                <build-module-classes module.name="jdk.dev"
+                                      compilation.kind="@{compilation.kind}" />
             </sequential>
         </macrodef>
     </target>
 
-    <target name="-def-build-jar-with-services">
-        <macrodef name="build-jar-with-services">
-            <attribute name="name"/>
-            <attribute name="includes"/>
-            <attribute name="classes.dir" default="${build.classes.dir}"/>
-            <attribute name="lib.dir" default="${dist.lib.dir}"/>
-            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
-            <attribute name="jarclasspath" default=""/>
-            <attribute name="service.type" default=""/>
-            <attribute name="service.provider" default=""/>
-            <sequential>
-                <mkdir dir="${build.toolclasses.dir}"/>
-                <jar destfile="@{lib.dir}/@{name}.jar"
-                     basedir="@{classes.dir}"
-                     includes="@{includes}">
-                    <service type="@{service.type}" provider="@{service.provider}"/>
-                    <manifest>
-                        <attribute name="Main-Class" value="@{jarmainclass}"/>
-                        <attribute name="Class-Path" value="@{jarclasspath}"/>
-                    </manifest>
-                </jar>
-            </sequential>
-        </macrodef>
-    </target>
-
-    <target name="-def-build-classes" depends="-def-pcompile">
-        <macrodef name="build-classes">
-            <attribute name="includes"/>
+    <target name="-def-build-module-classes" depends="-def-pcompile">
+        <macrodef name="build-module-classes">
+            <attribute name="module.name"/>
+            <attribute name="compilation.kind" default=""/>
+            <attribute name="dependencies" default="${@{module.name}.dependencies}"/>
+            <attribute name="includes" default="${@{compilation.kind}javac.includes}"/>
+            <attribute name="javac.lint.opts" default="${@{compilation.kind}javac.lint.opts}"/>
+            <attribute name="javac.extra.opts" default="${@{compilation.kind}javac.extra.opts}"/>
+            <attribute name="build.dir" default="${@{compilation.kind}build.dir}"/>
             <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
-            <attribute name="classes.dir" default="${build.classes.dir}"/>
-            <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
-            <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
-            <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
-            <attribute name="classpath" default="${javac.classpath}"/>
-            <attribute name="sourcepath" default="${javac.sourcepath}"/>
+            <attribute name="classes.dir" default="@{build.dir}/@{module.name}/classes"/>
+            <attribute name="gensrc.dir" default="@{build.dir}/@{module.name}/gensrc"/>
+            <attribute name="depcache.dir" default="@{build.dir}/@{module.name}/depcache"/>
             <attribute name="java.home" default="${boot.java.home}"/>
-            <attribute name="source" default="${javac.source}"/>
-            <attribute name="target" default="${javac.target}"/>
+            <attribute name="source" default="${@{compilation.kind}javac.source}"/>
+            <attribute name="target" default="${@{compilation.kind}javac.target}"/>
             <attribute name="release" default="${release}"/>
             <attribute name="full.version" default="${full.version}"/>
             <attribute name="plugin.options" default=""/>
             <sequential>
                 <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
-                <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
                 <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
                 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
+                <echo level="verbose" message="build-classes: dependencies=@{dependencies}"/>
+                <local name="src.dir" />
+                <property name="src.dir" location="${basedir}/src/@{module.name}/share/classes"/>
+                <local name="classpath" />
+                <pathconvert property="classpath">
+                    <path>
+                        <pathelement path="@{dependencies}" />
+                    </path>
+                    <map from="${basedir}/" to="@{build.dir}/" />
+                    <mapper type="glob" from="*" to="*/classes"/>
+                </pathconvert>
+                <local name="bootclasspath.prepend"/>
+                <condition property="bootclasspath.prepend" value="" else="${langtools.boot.classes}">
+                    <equals arg1="@{compilation.kind}" arg2="boot."/>
+                </condition>
+                <mkdir dir="@{classes.dir}"/>
                 <mkdir dir="@{gensrc.dir}"/>
-                <mkdir dir="@{classes.dir}"/>
+                <mkdir dir="@{depcache.dir}"/>
                 <pcompile destdir="@{gensrc.dir}"
                           includes="@{includes}">
                     <src>
-                        <path refid="src.dirs"/>
+                        <path location="${src.dir}"/>
                     </src>
                 </pcompile>
                 <copy todir="@{gensrc.dir}">
-                    <multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" />
+                    <fileset dir="${src.dir}" includes="@{includes}" />
                     <globmapper from="*.properties-template" to="*.properties"/>
                     <filterset begintoken="$(" endtoken=")">
                         <filter token="JDK_VERSION" value="${jdk.version}"/>
@@ -957,13 +596,20 @@
                         <pathelement location="@{gensrc.dir}"/>
                     </src>
                 </pcompile>
+                <antcall target="-do-depend">
+                    <param name="src.dir" value="${src.dir}" />
+                    <param name="classes.dir" value="@{classes.dir}" />
+                    <param name="gensrc.dir" value="@{gensrc.dir}" />
+                    <param name="depcache.dir" value="@{depcache.dir}" />
+                    <param name="classpath" value="${classpath}" />
+                </antcall>
                 <javac fork="true"
                        executable="@{java.home}/bin/javac"
                        destdir="@{classes.dir}"
                        includes="@{includes}"
                        excludes="@{excludes}"
-                       sourcepath="@{sourcepath}"
-                       classpath="@{classpath}"
+                       sourcepath="${src.dir}:@{gensrc.dir}"
+                       classpath="${classpath}"
                        includeAntRuntime="no"
                        source="@{source}"
                        target="@{target}"
@@ -971,19 +617,18 @@
                        debuglevel="${javac.debuglevel}">
                     <compilerarg value="-implicit:none"/>
                     <compilerarg value="-Xprefer:source"/>
-                    <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
-                    <compilerarg line="@{bootclasspath.opt}"/>
-                    <compilerarg line="${javac.no.jdk.warnings}"/>
-                    <compilerarg line="${javac.version.opt}"/>
-                    <compilerarg line="${javac.lint.opts}"/>
+                    <compilerarg value="-J-Xbootclasspath/p:${bootclasspath.prepend}"/>
+                    <compilerarg value="-Xbootclasspath/p:${classpath}"/>
+                    <compilerarg line="@{javac.extra.opts}"/>
+                    <compilerarg line="@{javac.lint.opts}"/>
                     <compilerarg line="@{plugin.options}"/>
                     <src>
-                        <path refid="src.dirs"/>
+                        <path location="${src.dir}"/>
                         <path location="@{gensrc.dir}"/>
                     </src>
                 </javac>
                 <copy todir="@{classes.dir}" includeemptydirs="false">
-                    <multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" excludes="@{excludes}">
+                    <fileset dir="${src.dir}" includes="@{includes}" excludes="@{excludes}">
                         <exclude name="**/*.java"/>
                         <exclude name="**/*.properties"/>
                         <exclude name="**/*-template"/>
@@ -991,42 +636,15 @@
                         <exclude name="**/*.orig"/>
                         <exclude name="**/overview.html"/>
                         <exclude name="**/package.html"/>
-                    </multirootfileset>
+                    </fileset>
                 </copy>
             </sequential>
         </macrodef>
     </target>
 
-    <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
-        <presetdef name="build-bootstrap-tool">
-            <build-tool
-                bin.dir="${build.bootstrap.dir}/bin"
-                java="${boot.java}"/>
-        </presetdef>
-    </target>
-
-    <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
-        <presetdef name="build-bootstrap-jar">
-            <build-jar
-                classes.dir="${build.bootstrap.dir}/classes"
-                lib.dir="${build.bootstrap.dir}/lib"/>
-        </presetdef>
-    </target>
-
-    <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
-        <presetdef name="build-bootstrap-classes">
-            <build-classes
-                source="${boot.javac.source}"
-                target="${boot.javac.target}"
-                gensrc.dir="${build.bootstrap.dir}/gensrc"
-                classes.dir="${build.bootstrap.dir}/classes"
-                javac.bootclasspath=""
-                bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
-                sourcepath=""
-                release="${bootstrap.release}"
-                full.version="${bootstrap.full.version}"
-                excludes="${bootstrap.exclude.files} **/package-info.java"/>
-        </presetdef>
+    <target name="-do-depend" if="do.depend">
+        <depend srcdir="${src.dir}:${gensrc.dir}" destdir="${classes.dir}" classpath="${classpath}"
+                cache="${depcache.dir}"/>
     </target>
 
     <target name="-def-pcompile">
@@ -1048,55 +666,9 @@
                  classpath="${build.toolclasses.dir}/"/>
     </target>
 
-    <target name="-def-compilecrules">
-        <macrodef name="compilecrules">
-            <sequential>
-                <mkdir dir="${build.toolclasses.dir}"/>
-                <javac fork="true"
-                       source="${boot.javac.source}"
-                       target="${boot.javac.target}"
-                       executable="${boot.java.home}/bin/javac"
-                       srcdir="${make.tools.dir}"
-                       includes="crules/*"
-                       destdir="${build.toolclasses.dir}/"
-                       classpath="${ant.core.lib}"
-                       bootclasspath="${boot.java.home}/jre/lib/rt.jar"
-                       includeantruntime="false">
-                    <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
-                    <compilerarg line="${javac.lint.opts}"/>
-                </javac>
-                <copy todir="${build.toolclasses.dir}/" includeemptydirs="false">
-                    <fileset dir="${make.tools.dir}">
-                        <include name="**/*.properties"/>
-                    </fileset>
-                </copy>
-            </sequential>
-        </macrodef>
-    </target>
-
-    <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
-        <mkdir dir="${build.toolclasses.dir}"/>
-        <javac fork="true"
-               source="${boot.javac.source}"
-               target="${boot.javac.target}"
-               executable="${boot.java.home}/bin/javac"
-               srcdir="${make.tools.dir}"
-               includes="genstubs/* anttasks/GenStubs*"
-               destdir="${build.toolclasses.dir}/"
-               classpath="${ant.core.lib}"
-               includeantruntime="false">
-            <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
-            <compilerarg line="${javac.lint.opts}"/>
-        </javac>
-        <taskdef name="genstubs"
-                 classname="anttasks.GenStubsTask"
-                 classpath="${build.toolclasses.dir}/"/>
-    </target>
-
     <target name="-def-javadoc-tool" depends="-check-target.java.home">
         <macrodef name="javadoc-tool">
-            <attribute name="name"/>
-            <attribute name="includes"/>
+            <attribute name="includes" default="${javac.includes}"/>
             <attribute name="options" default=""/>
             <attribute name="source" default="${javac.source}"/>
             <sequential>
@@ -1106,7 +678,7 @@
                 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
                 <javadoc
                     executable="${target.java.home}/bin/javadoc"
-                    destdir="${build.javadoc.dir}/@{name}"
+                    destdir="${build.javadoc.dir}"
                     source="@{source}"
                     windowtitle="UNOFFICIAL"
                     failonerror="true"
@@ -1116,57 +688,30 @@
                     packagenames="${javadoc.packagenames}" >
                     <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
                     <arg line="@{options}"/>
-                    <arg value="-tag" />
-                    <arg value="implNote:a:Implementation Note:"/>
                     <bootclasspath>
-                        <path location="${build.classes.dir}"/>
+                        <pathelement path="${langtools.classes}"/>
                         <path location="${target.java.home}/jre/lib/rt.jar"/>
                     </bootclasspath>
                     <sourcepath>
-                        <path refid="src.dirs"/>
+                        <pathelement path="${langtools.sources}"/>
                     </sourcepath>
                     <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
                     <!-- means that {@link some.package} will not work, which is no good. -->
                     <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
                     <!-- which also causes duplicates in the class index for included files.) -->
-                    <packageset dir="${src.dir}/java.base/share/classes" includes="@{includes}">
+                    <packageset dir="${basedir}/src/java.compiler/share/classes" includes="@{includes}">
                         <or>
-                            <filename name="java/"/>
                             <filename name="javax/"/>
-                            <filename name="com/sun/javadoc/"/>
-                            <filename name="com/sun/source/"/>
                         </or>
                     </packageset>
-                    <packageset dir="${src.dir}/java.compiler/share/classes" includes="@{includes}">
+                    <packageset dir="${basedir}/src/jdk.compiler/share/classes" includes="@{includes}">
                         <or>
-                            <filename name="java/"/>
-                            <filename name="javax/"/>
-                            <filename name="com/sun/javadoc/"/>
                             <filename name="com/sun/source/"/>
                         </or>
                     </packageset>
-                    <packageset dir="${src.dir}/jdk.compiler/share/classes" includes="@{includes}">
-                        <or>
-                            <filename name="java/"/>
-                            <filename name="javax/"/>
-                            <filename name="com/sun/javadoc/"/>
-                            <filename name="com/sun/source/"/>
-                        </or>
-                    </packageset>
-                    <packageset dir="${src.dir}/jdk.dev/share/classes" includes="@{includes}">
+                    <packageset dir="${basedir}/src/jdk.javadoc/share/classes" includes="@{includes}">
                         <or>
-                            <filename name="java/"/>
-                            <filename name="javax/"/>
                             <filename name="com/sun/javadoc/"/>
-                            <filename name="com/sun/source/"/>
-                        </or>
-                    </packageset>
-                    <packageset dir="${src.dir}/jdk.javadoc/share/classes" includes="@{includes}">
-                        <or>
-                            <filename name="java/"/>
-                            <filename name="javax/"/>
-                            <filename name="com/sun/javadoc/"/>
-                            <filename name="com/sun/source/"/>
                         </or>
                     </packageset>
                 </javadoc>
@@ -1184,6 +729,7 @@
         <macrodef name="jtreg-tool">
             <attribute name="name"/>
             <attribute name="tests"/>
+            <attribute name="langtools.classes" default="${langtools.classes}"/>
             <attribute name="jdk" default="${target.java.home}"/>
             <attribute name="samevm" default="true"/>
             <attribute name="verbose" default="${default.jtreg.verbose}"/>
@@ -1191,6 +737,7 @@
             <attribute name="keywords" default="-keywords:!ignore"/>
             <attribute name="jpda.jvmargs" default=""/>
             <attribute name="extra.jvmargs" default=""/>
+            <attribute name="build.dir" default="${build.dir}"/>
             <sequential>
                 <property name="coverage.options" value=""/>              <!-- default -->
                 <property name="coverage.classpath" value=""/>            <!-- default -->
@@ -1204,7 +751,7 @@
                     samevm="@{samevm}" verbose="@{verbose}"
                     failonerror="false" resultproperty="jtreg.@{name}.result"
                     javacoptions="-g"
-                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs} @{extra.jvmargs}">
+                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}@{langtools.classes} @{jpda.jvmargs} @{extra.jvmargs}">
                     <arg line="@{keywords}"/>
                     <arg line="@{options}"/>
                     <arg line="@{tests}"/>
@@ -1220,21 +767,12 @@
         <property name="jtreg.defined" value="true"/>
     </target>
 
-    <target name="-def-cobertura" depends="-check-cobertura.home">
-        <path id="cobertura.classpath">
-            <fileset dir="${cobertura.home}">
-                <include name="cobertura.jar"/>
-                <include name="lib/**/*.jar"/>
-            </fileset>
-        </path>
-        <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
-    </target>
-
-    <target name="-def-checkstyle" unless="checkstyle.defined"
-        depends="-check-checkstyle.home">
+    <target name="-def-checkstyle" unless="checkstyle.defined" depends="-check-checkstyle.home">
         <taskdef resource="checkstyletask.properties">
             <classpath>
-                <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
+              <fileset dir="${checkstyle.home}">
+                <include name="checkstyle-*-all.jar"/>
+              </fileset>
             </classpath>
         </taskdef>
         <property name="checkstyle.defined" value="true"/>
@@ -1265,7 +803,7 @@
                     jvmargs="-Xmx512M" >
                     <class location="${dist.dir}/lib/@{name}.jar"/>
                     <auxClasspath>
-                        <pathelement location="${build.classes.dir}"/>
+                        <pathelement location="${langtools.classes}"/>
                     </auxClasspath>
                     <sourcePath>
                         <path refid="src.dirs"/>
@@ -1276,11 +814,6 @@
         <property name="findbugs.defined" value="true"/>
     </target>
 
-    <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
-        <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
-        <property name="vizant.defined" value="true"/>
-    </target>
-
     <target name="-def-check">
         <macrodef name="check">
             <attribute name="name"/>
--- a/langtools/make/intellij/build.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/intellij/build.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -2,10 +2,8 @@
 <project name="langtools" basedir="..">
 
     <script language="javascript" classpath=".idea/classes">
-        var ideaListener = project.getBuildListeners().firstElement();            
         var LangtoolsLogger = Java.type("idea.LangtoolsIdeaAntLogger");
-        project.removeBuildListener(ideaListener)
-        project.addBuildListener(new LangtoolsLogger(ideaListener))
+        new LangtoolsLogger(project)
     </script>
 
     <import file="../make/build.xml"/>
--- a/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,9 @@
 package idea;
 
 import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
 import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
 
 import java.util.EnumSet;
 import java.util.Stack;
@@ -166,21 +168,17 @@
             }
         },
         /** build bootstrap tool target - executed when bootstrapping javac */
-        BUILD_BOOTSTRAP_TOOL("build-bootstrap-.*") {
+        BUILD_BOOTSTRAP_JAVAC("build-bootstrap-javac-classes") {
             @Override
             String getDisplayMessage(BuildEvent e) {
-                String targetName = e.getTarget().getName();
-                String tool = targetName.split("-")[2];
-                return "Building bootstrap " + tool + "...";
+                return "Building bootstrap javac...";
             }
         },
         /** build classes target - executed when building classes of given tool */
-        BUILD_TOOL("build-classes-.*") {
+        BUILD_ALL_CLASSES("build-all-classes") {
             @Override
             String getDisplayMessage(BuildEvent e) {
-                String targetName = e.getTarget().getName();
-                String tool = targetName.split("-")[2];
-                return "Building " + tool + "...";
+                return "Building all classes...";
             }
         },
         /** synthetic target catching any other target not in this list */
@@ -195,14 +193,14 @@
             }
         };
 
-        String targetRegex;
+        String targetName;
 
-        Target(String targetRegex) {
-            this.targetRegex = targetRegex;
+        Target(String targetName) {
+            this.targetName = targetName;
         }
 
         boolean matches(String msg) {
-            return msg.matches(targetRegex);
+            return msg.equals(targetName);
         }
 
         abstract String getDisplayMessage(BuildEvent e);
@@ -253,8 +251,14 @@
     /** stack of pending tasks */
     Stack<Task> tasks = new Stack<>();
 
-    public LangtoolsIdeaAntLogger(DefaultLogger logger) {
-        this.logger = logger;
+    public LangtoolsIdeaAntLogger(Project project) {
+        for (Object o : project.getBuildListeners()) {
+            if (o instanceof DefaultLogger) {
+                this.logger = (DefaultLogger)o;
+                project.removeBuildListener((BuildListener)o);
+                project.addBuildListener(this);
+            }
+        }
         tasks.push(Task.ROOT);
     }
 
--- a/langtools/make/intellij/workspace.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/intellij/workspace.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -10,7 +10,7 @@
     <!-- standard tools -->
     <configuration default="false" name="javac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -24,12 +24,12 @@
       <ConfigurationWrapper RunnerId="Run" />
       <method>
         <option name="Make" enabled="false" />
-        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-classes-javac" />
+        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
       </method>
     </configuration>
     <configuration default="false" name="javadoc" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javadoc.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -43,12 +43,12 @@
       <ConfigurationWrapper RunnerId="Run" />
       <method>
         <option name="Make" enabled="false" />
-        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-classes-javadoc" />
+        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
       </method> 
     </configuration>
     <configuration default="false" name="javap" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -62,12 +62,12 @@
       <ConfigurationWrapper RunnerId="Run" />
       <method>
         <option name="Make" enabled="false" />
-        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-classes-javap" />
+        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
       </method> 
     </configuration>
     <configuration default="false" name="javah" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -81,12 +81,12 @@
       <ConfigurationWrapper RunnerId="Run" />
       <method>
         <option name="Make" enabled="false" />
-        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-classes-javah" />
+        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
       </method> 
     </configuration>
     <configuration default="false" name="sjavac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -100,13 +100,13 @@
       <ConfigurationWrapper RunnerId="Run" />
       <method>
         <option name="Make" enabled="false" />
-        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-classes-sjavac" />
+        <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
       </method> 
     </configuration>
     <!-- bootstrap javac -->
     <configuration default="false" name="javac (bootstrap)" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/bootstrap/classes" />
+            <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/bootstrap/java.compiler/classes:build/bootstrap/jdk.compiler/classes:build/bootstrap/java.base/classes:build/bootstrap/jdk.javadoc/classes:build/bootstrap/jdk.dev/classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
--- a/langtools/make/launcher.sh-template	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/launcher.sh-template	Mon Nov 17 09:36:40 2014 +0100
@@ -43,10 +43,9 @@
 # dependent jar files for additional dependencies.
 
 if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
-   cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF |
-       grep "Class-Path:" |
-       sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1#PS#|g'`
-   bcp="$mylib/#PROGRAM#.jar#PS#$cp"
+   cp=`echo "$mylib"/*.jar |
+       sed -e 's|\([a-z.]*\.jar\) *|\1#PS#|g'`
+   bcp=$cp
 fi
 
 # tools currently assumes that assertions are enabled in the launcher
@@ -72,4 +71,4 @@
 unset DUALCASE
 
 IFS=$nl
-"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mylib}/#PROGRAM#.jar" ${toolOpts}
+"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} com.sun.tools.#PROGRAM#.Main ${toolOpts}
--- a/langtools/make/netbeans/langtools/build.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/netbeans/langtools/build.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -46,48 +46,34 @@
      -->
     <import file="../../build.xml"/>
 
-    <!-- Build project. (action: build; F11)
-        If langtools.tool.name is set, then just build that tool; otherwise
-        build all tools.
-    -->
-
-    <target name="build" depends="-get-tool-if-set,-build-tool,-build-all"
-        description="Build one or all langtools tools"
-        />
+    <!-- Build project. (action: build; F11) -->
 
-    <condition property="use_bootstrap" value="bootstrap-" else="">
-        <isset property="langtools.tool.bootstrap"/>
-    </condition>
-    <condition property="with_bootclasspath" value="${build.bootstrap.dir}/classes" else="${build.classes.dir}">
-        <isset property="langtools.tool.bootstrap"/>
-    </condition>
-
-    <target name="-build-tool" if="langtools.tool.name">
-        <echo level="info" message="Building ${use_bootstrap}${langtools.tool.name}"/>
-        <echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/>
-        <antcall target="build-${use_bootstrap}${langtools.tool.name}"/>
+    <target name="build" depends="-get-tool-if-set,-build-bootstrap-javac,-build-all" />
+    <target name="-build-bootstrap-javac" if="langtools.tool.bootstrap">
+        <antcall target="build-bootstrap-javac"/>
     </target>
-
-    <target name="-build-all" unless="langtools.tool.name">
-        <echo level="info" message="Building all tools"/>
-        <echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/>
+    <target name="-build-all" unless="langtools.tool.bootstrap">
         <antcall target="build-all-tools"/>
     </target>
 
     <!-- Compile a single file. (action: compile.single; F9) -->
 
-    <target name="compile-single" depends="build-bootstrap-javac">
+    <target name="compile-single" depends="-get-tool-if-set,build-bootstrap-javac-classes" unless="langtools.tool.bootstrap">
         <fail unless="includes">Must set property 'includes'</fail>
-        <javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
-               srcdir="${srcdir}"
-               destdir="${build.classes.dir}"
+        <mkdir dir="${build.dir}/${module.name}/classes" />
+        <javac fork="true" executable="${boot.java.home}/bin/javac"
+               srcdir="${basedir}/src/${module.name}/share/classes"
+               destdir="${build.dir}/${module.name}/classes"
                includes="${includes}"
                sourcepath=""
+               classpath="${langtools.classes}"
                includeAntRuntime="no"
                source="${javac.source}"
                target="${javac.target}"
                debug="${javac.debug}"
-               debuglevel="${javac.debuglevel}"/>
+               debuglevel="${javac.debuglevel}">
+            <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
+        </javac>
     </target>
 
     <!-- Run tool. (action: run; F6)
@@ -95,16 +81,24 @@
         the user.
     -->
 
-    <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args"
+    <target name="run" depends="-check-target.java.home,-build-classes,-def-run,-get-tool-and-args,-setup-bootclasspath"
             description="run tool">
         <echo level="info" message="${with_bootclasspath}"/>
         <echo level="info" message="Run ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
         <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
     </target>
 
+    <target name="-build-classes" depends="-get-tool-if-set,-build-classes-bootstrap-javac,-build-classes-all" />
+    <target name="-build-classes-bootstrap-javac" if="langtools.tool.bootstrap">
+        <antcall target="build-bootstrap-javac-classes"/>
+    </target>
+    <target name="-build-classes-all" unless="langtools.tool.bootstrap">
+        <antcall target="build-all-classes"/>
+    </target>
+
     <!-- Run a selected class. (action: run.single;  shift-F6) -->
 
-    <target name="run-single" depends="-check-target.java.home,-def-run">
+    <target name="run-single" depends="-check-target.java.home,-setup-bootclasspath,-def-run">
         <fail unless="run.classname">Must set property 'run.classname' </fail>
         <echo level="info" message="run ${run.classname}"/>
         <run mainclass="${run.classname}" args=""/>
@@ -115,22 +109,22 @@
         test all tools.
     -->
 
-    <target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all"
-        description="Test one or all langtools tools"
+    <target name="jtreg" depends="-get-tool-if-set,-jtreg-bootstrap-javac,-jtreg-all"
+        description="Test langtools tools or bootstrap javac"
         />
 
-    <target name="-jtreg-tool" if="langtools.tool.name">
-        <echo level="info" message="Testing ${langtools.tool.name}"/>
-        <echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/>
+    <target name="-jtreg-bootstrap-javac" if="langtools.tool.bootstrap">
+        <echo level="info" message="Testing bootstrap javac"/>
+        <echo level="verbose" message="(Unset langtools.tool.bootstrap to test all tools)"/>
         <antcall>
-            <target name="jtreg-${langtools.tool.name}"/>
+            <target name="jtreg-bootstrap-javac"/>
             <target name="-show-jtreg"/>
         </antcall>
     </target>
 
-    <target name="-jtreg-all" unless="langtools.tool.name">
+    <target name="-jtreg-all" unless="langtools.tool.bootstrap">
         <echo level="info" message="Testing all tools"/>
-        <echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/>
+        <echo level="verbose" message="(Set langtools.tool.bootstrap to test bootstrap javac)"/>
         <antcall>
             <target name="langtools.jtreg"/>
             <target name="-show-jtreg"/>
@@ -165,7 +159,7 @@
 
     <!-- Debug tool in NetBeans. -->
 
-    <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home">
+    <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,-setup-bootclasspath,-build-classes" if="netbeans.home">
         <echo level="info" message="Debug ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
         <start-debugger/>
         <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
@@ -179,20 +173,29 @@
     </target>
 
     <!-- Debug a jtreg test. -->
-    <target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg">
+    <target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg,-get-tool-if-set,-setup-bootclasspath">
         <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
         <start-debugger/>
-        <jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/>
+        <jtreg-tool name="debug"
+                    samevm="false"
+                    tests="${jtreg.tests}"
+                    jpda.jvmargs="${jpda.jvmargs}"
+                    langtools.classes="${with_bootclasspath}"/>
     </target>
 
     <!-- Update a class being debugged. -->
 
-    <target name="debug-fix">
+    <target name="debug-fix" depends="-get-tool-if-set">
         <fail unless="class">Must set property 'class'
         </fail>
         <antcall target="compile-single">
             <param name="includes" value="${class}.java"/>
         </antcall>
+        <condition property="build.classes.dir"
+                   value="${build.dir}/${module.name}/classes"
+                   else="${boot.build.dir}/${module.name}/classes">
+            <isset property="use_bootstrap"/>
+        </condition>
         <nbjpdareload>
             <fileset dir="${build.classes.dir}">
                 <include name="${class}.class"/>
@@ -205,31 +208,10 @@
         test all tools.
     -->
 
-    <target name="javadoc" depends="-javadoc-tool,-javadoc-all"
-        description="Generate javadoc for one or all langtools tools"
-        />
-
-    <target name="-javadoc-tool" if="langtools.tool.name">
-        <echo level="info" message="Generate javadoc for ${langtools.tool.name}"/>
-        <echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/>
-        <antcall>
-            <target name="javadoc-${langtools.tool.name}"/>
-            <target name="-show-javadoc"/>
-        </antcall>
-    </target>
-
-    <target name="-javadoc-all" unless="langtools.tool.name">
-        <echo level="info" message="Generate javadoc for all tools"/>
-        <echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/>
-        <antcall>
-            <target name="langtools.javadoc"/>
-            <target name="-show-javadoc"/>
-        </antcall>
-    </target>
+    <target name="javadoc" depends="langtools.javadoc,-show-javadoc" />
 
     <target name="-show-javadoc" if="netbeans.home">
-        <!-- what if doing javadoc for all? -->
-        <nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/>
+        <nbbrowse file="${build.javadoc.dir}/index.html"/>
     </target>
 
     <!-- Prompt for values. -->
@@ -253,6 +235,15 @@
             />
     </target>
 
+    <target name="-setup-bootclasspath">
+        <condition property="use_bootstrap" value="bootstrap-" else="">
+            <isset property="langtools.tool.bootstrap"/>
+        </condition>
+        <condition property="with_bootclasspath" value="${langtools.boot.classes}" else="${langtools.classes}">
+            <isset property="langtools.tool.bootstrap"/>
+        </condition>
+    </target>
+
     <!-- Macro to run a tool or selected class - used by run* and debug* tasks -->
     <target name="-def-run">
         <macrodef name="run">
@@ -262,7 +253,7 @@
             <attribute name="jpda.jvmargs" default=""/>
 
             <sequential>
-                <java fork="true" jvm="${target.java}" classname="@{mainclass}">
+                <java fork="true" jvm="${target.java.home}/bin/java" classname="@{mainclass}">
                     <jvmarg line="-Xbootclasspath/p:@{bcp}"/>
                     <jvmarg line="@{jpda.jvmargs}"/>
                     <arg line="@{args}"/>
@@ -278,11 +269,11 @@
             <sequential>
                 <nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">
                     <bootclasspath>
-                        <pathelement location="${build.classes.dir}"/>
+                        <pathelement path="${langtools.classes}"/>
                         <pathelement location="${target.java.home}/jre/lib/rt.jar"/>
                     </bootclasspath>
                     <sourcepath>
-                        <path refid="src.dirs"/>
+                        <pathelement path="${langtools.sources}"/>
                     </sourcepath>
                 </nbjpdastart>
                 <property
--- a/langtools/make/netbeans/langtools/nbproject/project.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/netbeans/langtools/nbproject/project.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -107,7 +107,7 @@
                 </action>
                 <action name="compile.single">
                     <target>compile-single</target>
-                    <property name="srcdir">src/java.base/share/classes</property>
+                    <property name="module.name">java.base</property>
                     <context>
                         <property>includes</property>
                         <folder>${root}/src/java.base/share/classes</folder>
@@ -120,7 +120,7 @@
                 </action>
                 <action name="compile.single">
                     <target>compile-single</target>
-                    <property name="srcdir">src/java.compiler/share/classes</property>
+                    <property name="module.name">java.compiler</property>
                     <context>
                         <property>includes</property>
                         <folder>${root}/src/java.compiler/share/classes</folder>
@@ -133,7 +133,7 @@
                 </action>
                 <action name="compile.single">
                     <target>compile-single</target>
-                    <property name="srcdir">src/jdk.compiler/share/classes</property>
+                    <property name="module.name">jdk.compiler</property>
                     <context>
                         <property>includes</property>
                         <folder>${root}/src/jdk.compiler/share/classes</folder>
@@ -146,7 +146,7 @@
                 </action>
                 <action name="compile.single">
                     <target>compile-single</target>
-                    <property name="srcdir">src/jdk.dev/share/classes</property>
+                    <property name="module.name">jdk.dev</property>
                     <context>
                         <property>includes</property>
                         <folder>${root}/src/jdk.dev/share/classes</folder>
@@ -159,7 +159,7 @@
                 </action>
                 <action name="compile.single">
                     <target>compile-single</target>
-                    <property name="srcdir">src/jdk.javadoc/share/classes</property>
+                    <property name="module.name">jdk.javadoc</property>
                     <context>
                         <property>includes</property>
                         <folder>${root}/src/jdk.javadoc/share/classes</folder>
@@ -333,7 +333,7 @@
                 </action>
                 <action name="debug.fix">
                     <target>debug-fix</target>
-                    <property name="srcdir">src/java.base/share/classes</property>
+                    <property name="module.name">java.base</property>
                     <context>
                         <property>class</property>
                         <folder>${root}/src/java.base/share/classes</folder>
@@ -346,7 +346,7 @@
                 </action>
                 <action name="debug.fix">
                     <target>debug-fix</target>
-                    <property name="srcdir">src/java.compiler/share/classes</property>
+                    <property name="module.name">java.compiler</property>
                     <context>
                         <property>class</property>
                         <folder>${root}/src/java.compiler/share/classes</folder>
@@ -359,7 +359,7 @@
                 </action>
                 <action name="debug.fix">
                     <target>debug-fix</target>
-                    <property name="srcdir">src/jdk.compiler/share/classes</property>
+                    <property name="module.name">jdk.compiler</property>
                     <context>
                         <property>class</property>
                         <folder>${root}/src/jdk.compiler/share/classes</folder>
@@ -372,7 +372,7 @@
                 </action>
                 <action name="debug.fix">
                     <target>debug-fix</target>
-                    <property name="srcdir">src/jdk.dev/share/classes</property>
+                    <property name="module.name">jdk.dev</property>
                     <context>
                         <property>class</property>
                         <folder>${root}/src/jdk.dev/share/classes</folder>
@@ -385,7 +385,7 @@
                 </action>
                 <action name="debug.fix">
                     <target>debug-fix</target>
-                    <property name="srcdir">src/jdk.dev/share/classes</property>
+                    <property name="module.name">jdk.javadoc</property>
                     <context>
                         <property>class</property>
                         <folder>${root}/src/jdk.javadoc/share/classes</folder>
@@ -478,11 +478,31 @@
         <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
             <compilation-unit>
                 <package-root>${root}/src/java.base/share/classes</package-root>
+                <built-to>${root}/build/java.base/classes</built-to>
+                <source-level>1.8</source-level>
+            </compilation-unit>
+            <compilation-unit>
                 <package-root>${root}/src/java.compiler/share/classes</package-root>
+                <classpath mode="compile">${root}/build/java.base/classes</classpath>
+                <built-to>${root}/build/java.compiler/classes</built-to>
+                <source-level>1.8</source-level>
+            </compilation-unit>
+            <compilation-unit>
                 <package-root>${root}/src/jdk.compiler/share/classes</package-root>
+                <classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes</classpath>
+                <built-to>${root}/build/jdk.compiler/classes</built-to>
+                <source-level>1.8</source-level>
+            </compilation-unit>
+            <compilation-unit>
                 <package-root>${root}/src/jdk.dev/share/classes</package-root>
+                <classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes</classpath>
+                <built-to>${root}/build/jdk.dev/classes</built-to>
+                <source-level>1.8</source-level>
+            </compilation-unit>
+            <compilation-unit>
                 <package-root>${root}/src/jdk.javadoc/share/classes</package-root>
-                <built-to>${root}/build/classes</built-to>
+                <classpath mode="compile">${root}/build/java.base/classes:${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes</classpath>
+                <built-to>${root}/build/jdk.javadoc/classes</built-to>
                 <source-level>1.8</source-level>
             </compilation-unit>
         </java-data>
--- a/langtools/make/tools/anttasks/SelectToolTask.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/make/tools/anttasks/SelectToolTask.java	Mon Nov 17 09:36:40 2014 +0100
@@ -74,7 +74,18 @@
 
     enum ToolChoices {
         NONE(""),
-        JAVAC("javac"),
+        BOOSTRAP_JAVAC("bootstrap-javac", true) {
+            @Override
+            public ToolChoices baseTool() {
+                return JAVAC;
+            }
+        },
+        JAVAC("javac") {
+            @Override
+            public ToolChoices asBootstrap() {
+                return BOOSTRAP_JAVAC;
+            }
+        },
         JAVADOC("javadoc"),
         JAVAH("javah"),
         JAVAP("javap");
@@ -91,6 +102,14 @@
             this.bootstrap = bootstrap;
         }
 
+        public ToolChoices asBootstrap() {
+            return this;
+        }
+
+        public ToolChoices baseTool() {
+            return this;
+        }
+
         @Override
         public String toString() {
             return toolName;
@@ -176,9 +195,11 @@
         JOptionPane p = createPane(guiProps);
         p.createDialog("Select Tool").setVisible(true);
 
-        toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
+        ToolChoices tool = (ToolChoices)toolChoice.getSelectedItem();
+
+        toolName = tool.baseTool().toolName;
+        toolBootstrap = tool.bootstrap;
         toolArgs = argsField.getText();
-        toolBootstrap = bootstrapCheckbox.isSelected();
         if (defaultCheck.isSelected()) {
             if (toolName.equals("")) {
                 fileProps.remove("tool.name");
@@ -213,30 +234,31 @@
         EnumSet<ToolChoices> toolChoices = toolProperty == null ?
                 EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
         toolChoice = new JComboBox<>(toolChoices.toArray());
-        if (toolName != null)
-            toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
+        ToolChoices tool = toolName != null ? ToolChoices.valueOf(toolName.toUpperCase()) : null;
+        if (toolName != null) {
+            if (toolBootstrap)
+                tool = tool.asBootstrap();
+            toolChoice.setSelectedItem(tool);
+        }
         toolChoice.addItemListener(new ItemListener() {
             @Override
             public void itemStateChanged(ItemEvent e) {
-                String tn = ((ToolChoices)e.getItem()).toolName;
-                argsField.setText(getDefaultArgsForTool(props, tn));
+                ToolChoices tool = (ToolChoices)e.getItem();
+                argsField.setText(getDefaultArgsForTool(props, tool));
                 if (toolProperty != null)
-                    okButton.setEnabled(!tn.equals(""));
+                    okButton.setEnabled(tool != ToolChoices.NONE);
             }
         });
-        GridBagConstraints checkConstraint = new GridBagConstraints();
         fc.anchor = GridBagConstraints.EAST;
 
         GridBagConstraints toolConstraint = new GridBagConstraints();
         fc.anchor = GridBagConstraints.WEST;
 
         toolPane.add(toolChoice, toolConstraint);
-        bootstrapCheckbox = new JCheckBox("bootstrap", toolBootstrap);
-        toolPane.add(bootstrapCheckbox, checkConstraint);
 
         body.add(toolPane, fc);
 
-        argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
+        argsField = new JTextField(getDefaultArgsForTool(props, tool), 40);
         if (toolProperty == null || argsProperty != null) {
             JLabel argsLabel = new JLabel("Args:");
             body.add(argsLabel, lc);
@@ -322,8 +344,11 @@
         }
     }
 
-    String getDefaultArgsForTool(Properties props, String tn) {
-        return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
+    String getDefaultArgsForTool(Properties props, ToolChoices tool) {
+        if (tool == null)
+            return "";
+        String toolName = tool.baseTool().toolName;
+        return toolName.equals("") ? "" : props.getProperty(toolName + ".args", "");
     }
 
     // Ant task parameters
@@ -335,7 +360,6 @@
 
     // GUI components
     private JComboBox<?> toolChoice;
-    private JCheckBox bootstrapCheckbox;
     private JTextField argsField;
     private JCheckBox defaultCheck;
     private JButton okButton;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/TaskListener.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/TaskListener.java	Mon Nov 17 09:36:40 2014 +0100
@@ -37,13 +37,19 @@
 {
     /**
      * Invoked when an event has begun.
+     *
+     * @implSpec The default implementation of this method does nothing.
+     *
      * @param e the event
      */
-    public void started(TaskEvent e);
+    default void started(TaskEvent e) { }
 
     /**
      * Invoked when an event has been completed.
+     *
+     * @implSpec The default implementation of this method does nothing.
+     *
      * @param e the event
      */
-    public void finished(TaskEvent e);
+    default void finished(TaskEvent e) { }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Mon Nov 17 09:36:40 2014 +0100
@@ -191,7 +191,7 @@
             }
         }
         for (List<String> p: pluginsToCall) {
-            Log.instance(context).error("msg.plugin.not.found", p.head);
+            Log.instance(context).error("plugin.not.found", p.head);
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package com.sun.tools.javac.api;
 
+import java.io.IOException;
 import java.nio.CharBuffer;
 import java.util.*;
 import java.util.concurrent.Callable;
@@ -67,6 +68,7 @@
 public class JavacTaskImpl extends BasicJavacTask {
     private final Arguments args;
     private JavaCompiler compiler;
+    private JavaFileManager fileManager;
     private Locale locale;
     private Map<JavaFileObject, JCCompilationUnit> notYetEntered;
     private ListBuffer<Env<AttrContext>> genList;
@@ -76,6 +78,7 @@
     JavacTaskImpl(Context context) {
         super(context, true);
         args = Arguments.instance(context);
+        fileManager = context.get(JavaFileManager.class);
     }
 
     @Override @DefinedBy(Api.COMPILER)
@@ -202,6 +205,12 @@
     void cleanup() {
         if (compiler != null)
             compiler.close();
+        if (fileManager instanceof BaseFileManager && ((BaseFileManager) fileManager).autoClose) {
+            try {
+                fileManager.close();
+            } catch (IOException ignore) {
+            }
+        }
         compiler = null;
         context = null;
         notYetEntered = null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Mon Nov 17 09:36:40 2014 +0100
@@ -43,6 +43,7 @@
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.main.Arguments;
 import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -151,8 +152,12 @@
             else
                 context.put(Log.outKey, new PrintWriter(out, true));
 
-            if (fileManager == null)
+            if (fileManager == null) {
                 fileManager = getStandardFileManager(diagnosticListener, null, null);
+                if (fileManager instanceof BaseFileManager) {
+                    ((BaseFileManager) fileManager).autoClose = true;
+                }
+            }
             fileManager = ccw.wrap(fileManager);
 
             context.put(JavaFileManager.class, fileManager);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java	Mon Nov 17 09:36:40 2014 +0100
@@ -305,7 +305,32 @@
          *  the table of its outer scope.
          */
         public WriteableScope dupUnshared(Symbol newOwner) {
-            return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems);
+            if (shared > 0) {
+                //The nested Scopes might have already added something to the table, so all items
+                //that don't originate in this Scope or any of its outer Scopes need to be cleared:
+                Set<Scope> acceptScopes = Collections.newSetFromMap(new IdentityHashMap<>());
+                ScopeImpl c = this;
+                while (c != null) {
+                    acceptScopes.add(c);
+                    c = c.next;
+                }
+                int n = 0;
+                Entry[] oldTable = this.table;
+                Entry[] newTable = new Entry[this.table.length];
+                for (int i = 0; i < oldTable.length; i++) {
+                    Entry e = oldTable[i];
+                    while (e != null && e != sentinel && !acceptScopes.contains(e.scope)) {
+                        e = e.shadowed;
+                    }
+                    if (e != null) {
+                        n++;
+                        newTable[i] = e;
+                    }
+                }
+                return new ScopeImpl(this, newOwner, newTable, n);
+            } else {
+                return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems);
+            }
         }
 
         /** Remove all entries of this scope from its table, if shared
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Mon Nov 17 09:36:40 2014 +0100
@@ -145,7 +145,7 @@
     public final int bound_index;
 
     // For type parameter and method parameter
-    public final int parameter_index;
+    public int parameter_index;
 
     // For class extends, implements, and throws clauses
     public final int type_index;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Mon Nov 17 09:36:40 2014 +0100
@@ -2677,10 +2677,19 @@
                 while (t.hasTag(TYPEVAR))
                     t = t.getUpperBound();
                 TypeSymbol c = t.tsym;
+                Symbol bestSoFar = null;
                 for (Symbol sym : c.members().getSymbolsByName(ms.name, implFilter)) {
-                    if (sym != null &&
-                             sym.overrides(ms, origin, Types.this, checkResult))
-                        return (MethodSymbol)sym;
+                    if (sym != null && sym.overrides(ms, origin, Types.this, checkResult)) {
+                        bestSoFar = sym;
+                        if ((sym.flags() & ABSTRACT) == 0) {
+                            //if concrete impl is found, exit immediately
+                            break;
+                        }
+                    }
+                }
+                if (bestSoFar != null) {
+                    //return either the (only) concrete implementation or the first abstract one
+                    return (MethodSymbol)bestSoFar;
                 }
             }
             return null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1196,35 +1196,35 @@
             boolean hasDefault = false;      // Is there a default label?
             for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
                 JCCase c = l.head;
+                if (c.pat != null) {
+                    if (enumSwitch) {
+                        Symbol sym = enumConstant(c.pat, seltype);
+                        if (sym == null) {
+                            log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
+                        } else if (!labels.add(sym)) {
+                            log.error(c.pos(), "duplicate.case.label");
+                        }
+                    } else {
+                        Type pattype = attribExpr(c.pat, switchEnv, seltype);
+                        if (!pattype.hasTag(ERROR)) {
+                            if (pattype.constValue() == null) {
+                                log.error(c.pat.pos(),
+                                          (stringSwitch ? "string.const.req" : "const.expr.req"));
+                            } else if (labels.contains(pattype.constValue())) {
+                                log.error(c.pos(), "duplicate.case.label");
+                            } else {
+                                labels.add(pattype.constValue());
+                            }
+                        }
+                    }
+                } else if (hasDefault) {
+                    log.error(c.pos(), "duplicate.default.label");
+                } else {
+                    hasDefault = true;
+                }
                 Env<AttrContext> caseEnv =
                     switchEnv.dup(c, env.info.dup(switchEnv.info.scope.dup()));
                 try {
-                    if (c.pat != null) {
-                        if (enumSwitch) {
-                            Symbol sym = enumConstant(c.pat, seltype);
-                            if (sym == null) {
-                                log.error(c.pat.pos(), "enum.label.must.be.unqualified.enum");
-                            } else if (!labels.add(sym)) {
-                                log.error(c.pos(), "duplicate.case.label");
-                            }
-                        } else {
-                            Type pattype = attribExpr(c.pat, switchEnv, seltype);
-                            if (!pattype.hasTag(ERROR)) {
-                                if (pattype.constValue() == null) {
-                                    log.error(c.pat.pos(),
-                                              (stringSwitch ? "string.const.req" : "const.expr.req"));
-                                } else if (labels.contains(pattype.constValue())) {
-                                    log.error(c.pos(), "duplicate.case.label");
-                                } else {
-                                    labels.add(pattype.constValue());
-                                }
-                            }
-                        }
-                    } else if (hasDefault) {
-                        log.error(c.pos(), "duplicate.default.label");
-                    } else {
-                        hasDefault = true;
-                    }
                     attribStats(c.stats, caseEnv);
                 } finally {
                     caseEnv.info.scope.leave();
@@ -1429,21 +1429,28 @@
                 case APPLY:
                     JCMethodInvocation speculativeMethodTree =
                             (JCMethodInvocation)deferredAttr.attribSpeculative(tree, env, unknownExprInfo);
-                    Type owntype = TreeInfo.symbol(speculativeMethodTree.meth).type.getReturnType();
-                    return types.unboxedTypeOrType(owntype).isPrimitive();
+                    Symbol msym = TreeInfo.symbol(speculativeMethodTree.meth);
+                    Type receiverType = speculativeMethodTree.meth.hasTag(IDENT) ?
+                            env.enclClass.type :
+                            ((JCFieldAccess)speculativeMethodTree.meth).selected.type;
+                    Type owntype = types.memberType(receiverType, msym).getReturnType();
+                    return primitiveOrBoxed(owntype);
                 case NEWCLASS:
                     JCExpression className =
                             removeClassParams.translate(((JCNewClass)tree).clazz);
                     JCExpression speculativeNewClassTree =
                             (JCExpression)deferredAttr.attribSpeculative(className, env, unknownTypeInfo);
-                    return types.unboxedTypeOrType(speculativeNewClassTree.type).isPrimitive();
+                    return primitiveOrBoxed(speculativeNewClassTree.type);
                 default:
                     Type speculativeType = deferredAttr.attribSpeculative(tree, env, unknownExprInfo).type;
-                    speculativeType = types.unboxedTypeOrType(speculativeType);
-                    return speculativeType.isPrimitive();
+                    return primitiveOrBoxed(speculativeType);
             }
         }
         //where
+            boolean primitiveOrBoxed(Type t) {
+                return (!t.hasTag(TYPEVAR) && types.unboxedTypeOrType(t).isPrimitive());
+            }
+
             TreeTranslator removeClassParams = new TreeTranslator() {
                 @Override
                 public void visitTypeApply(JCTypeApply tree) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1213,7 +1213,10 @@
                 return;
             }
             scan(tree.falsepart);
-            result = reduce(ArgumentExpressionKind.PRIMITIVE);
+            result = reduce(ArgumentExpressionKind.PRIMITIVE).isPrimitive() ?
+                    ArgumentExpressionKind.PRIMITIVE :
+                    ArgumentExpressionKind.POLY;
+
         }
 
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -676,13 +676,19 @@
         ListBuffer<Pair<Type, Type>> commonSupertypes = new ListBuffer<>();
         for (Type sup : supertypesToCheck) {
             if (sup.isParameterized()) {
-                Type asSuperOfT = types.asSuper(t, sup.tsym);
-                Type asSuperOfS = types.asSuper(s, sup.tsym);
+                Type asSuperOfT = asSuper(t, sup);
+                Type asSuperOfS = asSuper(s, sup);
                 commonSupertypes.add(new Pair<>(asSuperOfT, asSuperOfS));
             }
         }
         return commonSupertypes.toList();
     }
+    //where
+        private Type asSuper(Type t, Type sup) {
+            return (sup.hasTag(ARRAY)) ?
+                    new ArrayType(asSuper(types.elemtype(t), types.elemtype(sup)), syms.arrayClass) :
+                    types.asSuper(t, sup.tsym);
+        }
 
     /**
      * This enumeration defines an entry point for doing inference variable
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Nov 17 09:36:40 2014 +0100
@@ -2642,9 +2642,10 @@
                       syms.intType, tree.sym);
             ordParam.mods.flags |= SYNTHETIC; ordParam.sym.flags_field |= SYNTHETIC;
 
+            MethodSymbol m = tree.sym;
             tree.params = tree.params.prepend(ordParam).prepend(nameParam);
-
-            MethodSymbol m = tree.sym;
+            incrementParamTypeAnnoIndexes(m, 2);
+
             m.extraParams = m.extraParams.prepend(ordParam.sym);
             m.extraParams = m.extraParams.prepend(nameParam.sym);
             Type olderasure = m.erasure(types);
@@ -2667,6 +2668,17 @@
         }
     }
     //where
+    private void incrementParamTypeAnnoIndexes(MethodSymbol m,
+                                               int amount) {
+        for (final Attribute.TypeCompound anno : m.getRawTypeAttributes()) {
+            // Increment the parameter_index of any existing formal
+            // parameter annotations.
+            if (anno.position.type == TargetType.METHOD_FORMAL_PARAMETER) {
+                anno.position.parameter_index += amount;
+            }
+        }
+    }
+
     private void visitMethodDefInternal(JCMethodDecl tree) {
         if (tree.name == names.init &&
             (currentClass.isInner() || currentClass.isLocal())) {
@@ -2697,8 +2709,10 @@
             // Add this$n (if needed) in front of and free variables behind
             // constructor parameter list.
             tree.params = tree.params.appendList(fvdefs);
-            if (currentClass.hasOuterInstance())
+            if (currentClass.hasOuterInstance()) {
                 tree.params = tree.params.prepend(otdef);
+                incrementParamTypeAnnoIndexes(m, 1);
+            }
 
             // If this is an initial constructor, i.e., it does not start with
             // this(...), insert initializers for this$n and proxies
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Nov 17 09:36:40 2014 +0100
@@ -2033,10 +2033,11 @@
             // Return the type variable if we have it, and have no
             // immediate member, OR the type variable is for a method.
             if (tyvar != typeNotFound) {
-                if (sym == typeNotFound ||
+                if (env.baseClause || sym == typeNotFound ||
                     (tyvar.kind == TYP && tyvar.exists() &&
-                     tyvar.owner.kind == MTH))
+                     tyvar.owner.kind == MTH)) {
                     return tyvar;
+                }
             }
 
             // If the environment is a class def, finish up,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Nov 17 09:36:40 2014 +0100
@@ -130,8 +130,6 @@
         if (register)
             context.put(JavaFileManager.class, this);
         setContext(context);
-        if (System.getProperty("show.fm.open.close") != null)
-            System.err.println("JavacFileManager.open " + this.hashCode());
     }
 
     /**
@@ -573,8 +571,6 @@
      */
     @DefinedBy(Api.COMPILER)
     public void close() {
-        if (System.getProperty("show.fm.open.close") != null)
-            System.err.println("JavacFileManager.close " + this.hashCode());
         for (Iterator<Archive> i = archives.values().iterator(); i.hasNext(); ) {
             Archive a = i.next();
             i.remove();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Nov 17 09:36:40 2014 +0100
@@ -1133,6 +1133,10 @@
 compiler.err.cant.read.file=\
     cannot read: {0}
 
+# 0: string
+compiler.err.plugin.not.found=\
+    plug-in not found: {0}
+
 #####
 
 # Fatal Errors
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Mon Nov 17 09:36:40 2014 +0100
@@ -289,8 +289,7 @@
     not a directory: {0}
 javac.err.file.not.file=\
     not a file: {0}
-javac.msg.plugin.not.found=\
-    plug-in not found: {0}
+
 ## messages
 
 javac.msg.usage.header=\
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Mon Nov 17 09:36:40 2014 +0100
@@ -104,6 +104,12 @@
 
     protected Locations locations;
 
+    /**
+     * A flag for clients to use to indicate that this file manager should
+     * be closed when it is no longer required.
+     */
+    public boolean autoClose;
+
     protected Source getSource() {
         String sourceName = options.get(Option.SOURCE);
         Source source = null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -111,6 +111,8 @@
         Collection<String> args = formatArguments(d, l);
         String msg = localize(l, d.getCode(), args.toArray());
         String[] lines = msg.split("\n");
+        if (lines.length == 0) // will happen when msg only contains one or more separators: "\n", "\n\n", etc.
+            lines = new String[] { "" };
         if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) {
             currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY);
             buf.append(indent(lines[0], currentIndentation)); //summary
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java	Mon Nov 17 09:36:40 2014 +0100
@@ -413,17 +413,17 @@
 
     int run(String[] args) {
         try {
-            handleOptions(args);
+            try {
+                handleOptions(args);
 
-            // the following gives consistent behavior with javac
-            if (classes == null || classes.size() == 0) {
-                if (options.help || options.version || options.fullVersion)
-                    return EXIT_OK;
-                else
-                    return EXIT_CMDERR;
-            }
+                // the following gives consistent behavior with javac
+                if (classes == null || classes.size() == 0) {
+                    if (options.help || options.version || options.fullVersion)
+                        return EXIT_OK;
+                    else
+                        return EXIT_CMDERR;
+                }
 
-            try {
                 return run();
             } finally {
                 if (defaultFileManager != null) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Mon Nov 17 09:36:40 2014 +0100
@@ -91,7 +91,7 @@
 
         // Get maximum heap size from the server!
         SysInfo sysinfo = sjavac.getSysInfo();
-        if (sysinfo.numCores == -1) {
+        if (sysinfo == null) {
             Log.error("Could not query server for sysinfo!");
             return false;
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java	Mon Nov 17 09:36:40 2014 +0100
@@ -218,21 +218,21 @@
             // Collect the name of all compiled packages.
             Set<String> recently_compiled = new HashSet<>();
             boolean[] rc = new boolean[1];
+            boolean background = Util.extractBooleanOption("background", options.getServerConf(), true);
             Sjavac sjavac;
-            boolean background = Util.extractBooleanOption("background", options.getServerConf(), true);
+            // Create an sjavac implementation to be used for compilation
+            if (background) {
+                sjavac = new SjavacClient(options);
+            } else {
+                int poolsize = Util.extractIntOption("poolsize", options.getServerConf());
+                if (poolsize <= 0)
+                    poolsize = Runtime.getRuntime().availableProcessors();
+                sjavac = new PooledSjavac(new SjavacImpl(), poolsize);
+            }
+
             do {
                 // Clean out artifacts in tainted packages.
                 javac_state.deleteClassArtifactsInTaintedPackages();
-                // Create an sjavac implementation to be used for compilation
-                if (background) {
-                    sjavac = new SjavacClient(options);
-                } else {
-                    int poolsize = Util.extractIntOption("poolsize", options.getServerConf());
-                    if (poolsize <= 0)
-                        poolsize = Runtime.getRuntime().availableProcessors();
-                    sjavac = new PooledSjavac(new SjavacImpl(), poolsize);
-                }
-
                 again = javac_state.performJavaCompilations(sjavac, options, recently_compiled, rc);
                 if (!rc[0]) break;
             } while (again);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,31 +25,33 @@
 
 package com.sun.tools.sjavac.client;
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Scanner;
 import java.util.Set;
 
 import com.sun.tools.sjavac.Log;
-import com.sun.tools.sjavac.ProblemException;
 import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.options.OptionHelper;
+import com.sun.tools.sjavac.options.Options;
 import com.sun.tools.sjavac.server.CompilationResult;
 import com.sun.tools.sjavac.server.PortFile;
 import com.sun.tools.sjavac.server.Sjavac;
 import com.sun.tools.sjavac.server.SjavacServer;
 import com.sun.tools.sjavac.server.SysInfo;
-import com.sun.tools.sjavac.options.Options;
 
 /**
  * Sjavac implementation that delegates requests to a SjavacServer.
@@ -64,10 +66,9 @@
     // The id can perhaps be used in the future by the javac server to reuse the
     // JavaCompiler instance for several compiles using the same id.
     private final String id;
-    private final String portfileName;
+    private final PortFile portFile;
     private final String logfile;
     private final String stdouterrfile;
-    private final boolean background;
 
     // Default keepalive for server is 120 seconds.
     // I.e. it will accept 120 seconds of inactivity before quitting.
@@ -88,16 +89,27 @@
     // Store the server conf settings here.
     private final String settings;
 
-    public SjavacClient(Options options) {
+    // This constructor should not throw FileNotFoundException (to be resolved
+    // in JDK-8060030)
+    public SjavacClient(Options options) throws FileNotFoundException {
         String tmpServerConf = options.getServerConf();
         String serverConf = (tmpServerConf!=null)? tmpServerConf : "";
         String tmpId = Util.extractStringOption("id", serverConf);
         id = (tmpId!=null) ? tmpId : "id"+(((new java.util.Random()).nextLong())&Long.MAX_VALUE);
-        String p = Util.extractStringOption("portfile", serverConf);
-        portfileName = (p!=null) ? p : options.getStateDir().toFile().getAbsolutePath()+File.separatorChar+"javac_server";
+        String defaultPortfile = options.getStateDir()
+                                        .resolve("javac_server")
+                                        .toAbsolutePath()
+                                        .toString();
+        String portfileName = Util.extractStringOption("portfile", serverConf, defaultPortfile);
+        try {
+            portFile = SjavacServer.getPortFile(portfileName);
+        } catch (FileNotFoundException e) {
+            // Reached for instance if directory of port file does not exist
+            Log.error("Port file inaccessable: " + e);
+            throw e;
+        }
         logfile = Util.extractStringOption("logfile", serverConf, portfileName + ".javaclog");
         stdouterrfile = Util.extractStringOption("stdouterrfile", serverConf, portfileName + ".stdouterr");
-        background = Util.extractBooleanOption("background", serverConf, true);
         sjavacForkCmd = Util.extractStringOption("sjavac", serverConf, "sjavac");
         int poolsize = Util.extractIntOption("poolsize", serverConf);
         keepalive = Util.extractIntOption("keepalive", serverConf, 120);
@@ -138,8 +150,11 @@
             return (SysInfo) ois.readObject();
         } catch (IOException | ClassNotFoundException ex) {
             Log.error("[CLIENT] Exception caught: " + ex);
-            StringWriter sw = new StringWriter();
-            ex.printStackTrace(new PrintWriter(sw));
+            Log.debug(Util.getStackTrace(ex));
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt(); // Restore interrupt
+            Log.error("[CLIENT] getSysInfo interrupted.");
+            Log.debug(Util.getStackTrace(ie));
         }
         return null;
     }
@@ -170,106 +185,127 @@
             oos.flush();
             result = (CompilationResult) ois.readObject();
         } catch (IOException | ClassNotFoundException ex) {
-            Log.error("Exception caught: " + ex);
+            Log.error("[CLIENT] Exception caught: " + ex);
             result = new CompilationResult(CompilationResult.ERROR_FATAL);
             result.stderr = Util.getStackTrace(ex);
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt(); // Restore interrupt
+            Log.error("[CLIENT] compile interrupted.");
+            result = new CompilationResult(CompilationResult.ERROR_FATAL);
+            result.stderr = Util.getStackTrace(ie);
         }
         return result;
     }
 
-    private Socket tryConnect() throws IOException {
-
-        PortFile portFile;
-        try {
-            // This should be taken care of at a higher level (JDK-8048451)
-            portFile = SjavacServer.getPortFile(portfileName);
-        } catch (FileNotFoundException e) {
-            // Reached for instance if directory of port file does not exist
-            Log.error("Port file inaccessable: " + e);
-            throw new RuntimeException(e);
-        }
-        for (int i = 0; i < MAX_CONNECT_ATTEMPTS; i++) {
-            Log.info(String.format("Trying to connect (attempt %d of %d)",
-                                   i+1, MAX_CONNECT_ATTEMPTS));
+    /*
+     * Makes MAX_CONNECT_ATTEMPTS attepmts to connect to server.
+     */
+    private Socket tryConnect() throws IOException, InterruptedException {
+        makeSureServerIsRunning(portFile);
+        int attempt = 0;
+        while (true) {
+            Log.info("Trying to connect. Attempt " + (++attempt) + " of " + MAX_CONNECT_ATTEMPTS);
             try {
-                if (!makeSureServerIsRunning(portFile))
-                    continue;
-                Socket socket = new Socket();
-                InetAddress localhost = InetAddress.getByName(null);
-                socket.connect(new InetSocketAddress(localhost, portFile.getPort()),
-                               CONNECTION_TIMEOUT);
-                return socket;
-            } catch (ProblemException | IOException ex) {
-                Log.error("Caught exception during tryConnect: " + ex);
+                return makeConnectionAttempt();
+            } catch (IOException ex) {
+                Log.error("Connection attempt failed: " + ex.getMessage());
+                if (attempt >= MAX_CONNECT_ATTEMPTS) {
+                    Log.error("Giving up");
+                    throw new IOException("Could not connect to server", ex);
+                }
             }
-
-            try {
-                Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-            }
+            Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
         }
-        throw new IOException("Could not connect to server");
     }
 
-    private boolean makeSureServerIsRunning(PortFile portFile)
-            throws IOException, ProblemException, FileNotFoundException {
+    private Socket makeConnectionAttempt() throws IOException {
+        Socket socket = new Socket();
+        InetAddress localhost = InetAddress.getByName(null);
+        InetSocketAddress address = new InetSocketAddress(localhost, portFile.getPort());
+        socket.connect(address, CONNECTION_TIMEOUT);
+        Log.info("Connected");
+        return socket;
+    }
 
-        synchronized (portFile) {
-            portFile.lock();
-            portFile.getValues();
-            portFile.unlock();
+    /*
+     * Will return immediately if a server already seems to be running,
+     * otherwise fork a new server and block until it seems to be running.
+     */
+    private void makeSureServerIsRunning(PortFile portFile)
+            throws IOException, InterruptedException {
+
+        portFile.lock();
+        portFile.getValues();
+        portFile.unlock();
+
+        if (portFile.containsPortInfo()) {
+            // Server seems to already be running
+            return;
         }
 
-        if (!portFile.containsPortInfo()) {
-            String forkCmd = SjavacServer.fork(sjavacForkCmd,
-                                               portFile.getFilename(),
-                                               logfile,
-                                               poolsize,
-                                               keepalive,
-                                               System.err,
-                                               stdouterrfile,
-                                               background);
-            if (!portFile.waitForValidValues()) {
-                // This can be simplified once JDK-8048457 has been addressed
-                // since we won't have an SjavacClient if background = false
-                if (background) {
-                    // There seems be some problem with spawning the external
-                    // process (for instance no fork command provided and no
-                    // sjavac on path)
-                    StringWriter sw = new StringWriter();
-                    SjavacClient.printFailedAttempt(forkCmd,
-                                                    stdouterrfile,
-                                                    new PrintWriter(sw));
-                    Log.error(sw.toString());
-                }
-            }
-        }
-        return portFile.containsPortInfo();
-    }
-
-
-    public static void printFailedAttempt(String cmd, String f, PrintWriter err) {
-        err.println("---- Failed to start javac server with this command -----");
-        err.println(cmd);
-        try {
-            BufferedReader in = new BufferedReader(new FileReader(f));
-            err.println("---- stdout/stderr output from attempt to start javac server -----");
-            for (;;) {
-                String l = in.readLine();
-                if (l == null) {
-                    break;
-                }
-                err.println(l);
-            }
-            err.println("------------------------------------------------------------------");
-        } catch (Exception e) {
-            err.println("The stdout/stderr output in file " + f + " does not exist and the server did not start.");
-        }
+        // Fork a new server and wait for it to start
+        SjavacClient.fork(sjavacForkCmd,
+                          portFile,
+                          logfile,
+                          poolsize,
+                          keepalive,
+                          System.err,
+                          stdouterrfile);
     }
 
     @Override
     public void shutdown() {
         // Nothing to clean up
     }
+
+    /*
+     * Fork a server process process and wait for server to come around
+     */
+    public static void fork(String sjavacCmd,
+                            PortFile portFile,
+                            String logfile,
+                            int poolsize,
+                            int keepalive,
+                            final PrintStream err,
+                            String stdouterrfile)
+                                    throws IOException, InterruptedException {
+        List<String> cmd = new ArrayList<>();
+        cmd.addAll(Arrays.asList(OptionHelper.unescapeCmdArg(sjavacCmd).split(" ")));
+        cmd.add("--startserver:"
+              + "portfile=" + portFile.getFilename()
+              + ",logfile=" + logfile
+              + ",stdouterrfile=" + stdouterrfile
+              + ",poolsize=" + poolsize
+              + ",keepalive="+ keepalive);
+
+        Process p = null;
+        Log.info("Starting server. Command: " + String.join(" ", cmd));
+        try {
+            // If the cmd for some reason can't be executed (file not found, or
+            // is not executable) this will throw an IOException with a decent
+            // error message.
+            p = new ProcessBuilder(cmd)
+                        .redirectErrorStream(true)
+                        .redirectOutput(new File(stdouterrfile))
+                        .start();
+
+            // Throws an IOException if no valid values materialize
+            portFile.waitForValidValues();
+
+        } catch (IOException ex) {
+            // Log and rethrow exception
+            Log.error("Faild to launch server.");
+            Log.error("    Message: " + ex.getMessage());
+            String rc = p == null || p.isAlive() ? "n/a" : "" + p.exitValue();
+            Log.error("    Server process exit code: " + rc);
+            Log.error("Server log:");
+            Log.error("------- Server log start -------");
+            try (Scanner s = new Scanner(new File(stdouterrfile))) {
+                while (s.hasNextLine())
+                    Log.error(s.nextLine());
+            }
+            Log.error("------- Server log end ---------");
+            throw ex;
+        }
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 package com.sun.tools.sjavac.comp;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.URI;
@@ -76,90 +77,93 @@
                                      Set<URI> sourcesToCompile,
                                      Set<URI> visibleSources) {
         JavacTool compiler = JavacTool.create();
-        StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
-        SmartFileManager smartFileManager = new SmartFileManager(fileManager);
-        Context context = new Context();
+        try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null)) {
+            SmartFileManager smartFileManager = new SmartFileManager(fileManager);
+            Context context = new Context();
 
-        // Now setup the actual compilation....
-        CompilationResult compilationResult = new CompilationResult(0);
+            // Now setup the actual compilation....
+            CompilationResult compilationResult = new CompilationResult(0);
 
-        // First deal with explicit source files on cmdline and in at file.
-        ListBuffer<JavaFileObject> compilationUnits = new ListBuffer<>();
-        for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(explicitSources)) {
-            compilationUnits.append(i);
-        }
-        // Now deal with sources supplied as source_to_compile.
-        ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
-        for (URI u : sourcesToCompile) {
-            sourcesToCompileFiles.append(new File(u));
-        }
-        for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) {
-            compilationUnits.append(i);
-        }
+            // First deal with explicit source files on cmdline and in at file.
+            ListBuffer<JavaFileObject> compilationUnits = new ListBuffer<>();
+            for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(explicitSources)) {
+                compilationUnits.append(i);
+            }
+            // Now deal with sources supplied as source_to_compile.
+            ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
+            for (URI u : sourcesToCompile) {
+                sourcesToCompileFiles.append(new File(u));
+            }
+            for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) {
+                compilationUnits.append(i);
+            }
 
-        // Create a new logger.
-        StringWriter stdoutLog = new StringWriter();
-        StringWriter stderrLog = new StringWriter();
-        PrintWriter stdout = new PrintWriter(stdoutLog);
-        PrintWriter stderr = new PrintWriter(stderrLog);
-        com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
-        DependencyCollector depsCollector = new DependencyCollector();
-        PublicApiCollector pubApiCollector = new PublicApiCollector();
-        PathAndPackageVerifier papVerifier = new PathAndPackageVerifier();
-        try {
-            if (compilationUnits.size() > 0) {
-                smartFileManager.setVisibleSources(visibleSources);
-                smartFileManager.cleanArtifacts();
-                smartFileManager.setLog(stdout);
+            // Create a new logger.
+            StringWriter stdoutLog = new StringWriter();
+            StringWriter stderrLog = new StringWriter();
+            PrintWriter stdout = new PrintWriter(stdoutLog);
+            PrintWriter stderr = new PrintWriter(stderrLog);
+            com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
+            DependencyCollector depsCollector = new DependencyCollector();
+            PublicApiCollector pubApiCollector = new PublicApiCollector();
+            PathAndPackageVerifier papVerifier = new PathAndPackageVerifier();
+            try {
+                if (compilationUnits.size() > 0) {
+                    smartFileManager.setVisibleSources(visibleSources);
+                    smartFileManager.cleanArtifacts();
+                    smartFileManager.setLog(stdout);
 
-                // Do the compilation!
-                JavacTaskImpl task =
-                        (JavacTaskImpl) compiler.getTask(stderr,
-                                                         smartFileManager,
-                                                         null,
-                                                         Arrays.asList(args),
-                                                         null,
-                                                         compilationUnits,
-                                                         context);
-                smartFileManager.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file"));
-                task.addTaskListener(depsCollector);
-                task.addTaskListener(pubApiCollector);
-                task.addTaskListener(papVerifier);
-                rc = task.doCall();
-                smartFileManager.flush();
+                    // Do the compilation!
+                    JavacTaskImpl task =
+                            (JavacTaskImpl) compiler.getTask(stderr,
+                                                             smartFileManager,
+                                                             null,
+                                                             Arrays.asList(args),
+                                                             null,
+                                                             compilationUnits,
+                                                             context);
+                    smartFileManager.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file"));
+                    task.addTaskListener(depsCollector);
+                    task.addTaskListener(pubApiCollector);
+                    task.addTaskListener(papVerifier);
+                    rc = task.doCall();
+                    smartFileManager.flush();
+                }
+            } catch (Exception e) {
+                stderrLog.append(Util.getStackTrace(e));
+                rc = com.sun.tools.javac.main.Main.Result.ERROR;
             }
-        } catch (Exception e) {
-            stderrLog.append(Util.getStackTrace(e));
-            rc = com.sun.tools.javac.main.Main.Result.ERROR;
-        }
 
-        compilationResult.packageArtifacts = smartFileManager.getPackageArtifacts();
+            compilationResult.packageArtifacts = smartFileManager.getPackageArtifacts();
 
-        Dependencies deps = Dependencies.instance(context);
-        for (PackageSymbol from : depsCollector.getSourcePackages()) {
-            for (PackageSymbol to : depsCollector.getDependenciesForPkg(from))
-                deps.collect(from.fullname, to.fullname);
-        }
+            Dependencies deps = Dependencies.instance(context);
+            for (PackageSymbol from : depsCollector.getSourcePackages()) {
+                for (PackageSymbol to : depsCollector.getDependenciesForPkg(from))
+                    deps.collect(from.fullname, to.fullname);
+            }
 
-        for (ClassSymbol cs : pubApiCollector.getClassSymbols())
-            deps.visitPubapi(cs);
+            for (ClassSymbol cs : pubApiCollector.getClassSymbols())
+                deps.visitPubapi(cs);
 
-        if (papVerifier.getMisplacedCompilationUnits().size() > 0) {
-            for (CompilationUnitTree cu : papVerifier.getMisplacedCompilationUnits()) {
-                System.err.println("Misplaced compilation unit.");
-                System.err.println("    Directory: " + Paths.get(cu.getSourceFile().toUri()).getParent());
-                System.err.println("    Package:   " + cu.getPackageName());
+            if (papVerifier.getMisplacedCompilationUnits().size() > 0) {
+                for (CompilationUnitTree cu : papVerifier.getMisplacedCompilationUnits()) {
+                    System.err.println("Misplaced compilation unit.");
+                    System.err.println("    Directory: " + Paths.get(cu.getSourceFile().toUri()).getParent());
+                    System.err.println("    Package:   " + cu.getPackageName());
+                }
+                rc = com.sun.tools.javac.main.Main.Result.ERROR;
             }
-            rc = com.sun.tools.javac.main.Main.Result.ERROR;
+
+            compilationResult.packageDependencies = deps.getDependencies();
+            compilationResult.packagePubapis = deps.getPubapis();
+            compilationResult.stdout = stdoutLog.toString();
+            compilationResult.stderr = stderrLog.toString();
+            compilationResult.returnCode = rc.exitCode;
+
+            return compilationResult;
+        } catch (IOException e) {
+            throw new Error(e);
         }
-
-        compilationResult.packageDependencies = deps.getDependencies();
-        compilationResult.packagePubapis = deps.getPubapis();
-        compilationResult.stdout = stdoutLog.toString();
-        compilationResult.stderr = stderrLog.toString();
-        compilationResult.returnCode = rc.exitCode;
-
-        return compilationResult;
     }
 
     @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,7 +25,6 @@
 
 package com.sun.tools.sjavac.options;
 
-import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
@@ -159,4 +158,9 @@
             }
         }
     }
+
+    public static String unescapeCmdArg(String arg) {
+        return arg.replaceAll("%20", " ")
+                  .replaceAll("%2C", ",");
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,6 +33,8 @@
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.nio.channels.FileLockInterruptionException;
+import java.util.concurrent.Semaphore;
+
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.sjavac.Log;
 
@@ -61,7 +63,12 @@
     private File stopFile;
     private RandomAccessFile rwfile;
     private FileChannel channel;
+
+    // FileLock used to solve inter JVM synchronization, lockSem used to avoid
+    // JVM internal OverlappingFileLockExceptions.
+    // Class invariant: lock.isValid() <-> lockSem.availablePermits() == 0
     private FileLock lock;
+    private Semaphore lockSem = new Semaphore(1);
 
     private boolean containsPortInfo;
     private int serverPort;
@@ -88,7 +95,8 @@
     /**
      * Lock the port file.
      */
-    public void lock() throws IOException {
+    public void lock() throws IOException, InterruptedException {
+        lockSem.acquire();
         lock = channel.lock();
     }
 
@@ -195,34 +203,37 @@
         Assert.check(lock != null);
         lock.release();
         lock = null;
+        lockSem.release();
     }
 
     /**
      * Wait for the port file to contain values that look valid.
-     * Return true, if a-ok, false if the valid values did not materialize within 5 seconds.
      */
-    public synchronized boolean waitForValidValues() throws IOException, FileNotFoundException {
-        for (int tries = 0; tries < 50; tries++) {
+    public void waitForValidValues() throws IOException, InterruptedException {
+        final int MAX_ATTEMPTS = 10;
+        final int MS_BETWEEN_ATTEMPTS = 500;
+        long startTime = System.currentTimeMillis();
+        for (int attempt = 0; ; attempt++) {
+            Log.debug("Looking for valid port file values...");
             lock();
             getValues();
             unlock();
             if (containsPortInfo) {
-                Log.debug("Found valid values in port file after waiting "+(tries*100)+"ms");
-                return true;
+                Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
+                return;
             }
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e)
-            {}
+            if (attempt >= MAX_ATTEMPTS) {
+                throw new IOException("No port file values materialized. Giving up after " +
+                                      (System.currentTimeMillis() - startTime) + " ms");
+            }
+            Thread.sleep(MS_BETWEEN_ATTEMPTS);
         }
-        Log.debug("Gave up waiting for valid values in port file");
-        return false;
     }
 
     /**
      * Check if the portfile still contains my values, assuming that I am the server.
      */
-    public synchronized boolean stillMyValues() throws IOException, FileNotFoundException {
+    public boolean stillMyValues() throws IOException, FileNotFoundException, InterruptedException {
         for (;;) {
             try {
                 lock();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFileMonitor.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFileMonitor.java	Mon Nov 17 09:36:40 2014 +0100
@@ -75,6 +75,10 @@
                 } catch (IOException e) {
                     e.printStackTrace(server.theLog);
                     server.flushLog();
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    e.printStackTrace(server.theLog);
+                    server.flushLog();
                 }
             }
         };
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/ServerMain.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/ServerMain.java	Mon Nov 17 09:36:40 2014 +0100
@@ -46,8 +46,8 @@
         try {
             SjavacServer server = new SjavacServer(args[0], System.err);
             exitCode = server.startServer();
-        } catch (IOException ioex) {
-            ioex.printStackTrace();
+        } catch (IOException | InterruptedException ex) {
+            ex.printStackTrace();
             exitCode = -1;
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,7 +24,6 @@
  */
 package com.sun.tools.sjavac.server;
 
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintStream;
@@ -34,16 +33,14 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import com.sun.tools.sjavac.ProblemException;
 import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.comp.PooledSjavac;
 import com.sun.tools.sjavac.comp.SjavacImpl;
-import com.sun.tools.sjavac.comp.PooledSjavac;
 
 /**
  * The JavacServer class contains methods both to setup a server that responds to requests and methods to connect to this server.
@@ -95,13 +92,26 @@
     private static Map<String, Long> maxServerMemory;
 
     public SjavacServer(String settings, PrintStream err) throws FileNotFoundException {
-        // Extract options. TODO: Change to proper constructor args
-        portfilename = Util.extractStringOption("portfile", settings);
-        logfile = Util.extractStringOption("logfile", settings);
-        stdouterrfile = Util.extractStringOption("stdouterrfile", settings);
-        keepalive = Util.extractIntOption("keepalive", settings, 120);
-        poolsize = Util.extractIntOption("poolsize", settings,
-                                         Runtime.getRuntime().availableProcessors());
+        this(Util.extractStringOption("portfile", settings),
+             Util.extractStringOption("logfile", settings),
+             Util.extractStringOption("stdouterrfile", settings),
+             Util.extractIntOption("poolsize", settings, Runtime.getRuntime().availableProcessors()),
+             Util.extractIntOption("keepalive", settings, 120),
+             err);
+    }
+
+    public SjavacServer(String portfilename,
+                        String logfile,
+                        String stdouterrfile,
+                        int poolsize,
+                        int keepalive,
+                        PrintStream err)
+                                throws FileNotFoundException {
+        this.portfilename = portfilename;
+        this.logfile = logfile;
+        this.stdouterrfile = stdouterrfile;
+        this.poolsize = poolsize;
+        this.keepalive = keepalive;
         this.err = err;
 
         myCookie = new Random().nextLong();
@@ -180,7 +190,7 @@
      * Start a server using a settings string. Typically: "--startserver:portfile=/tmp/myserver,poolsize=3" and the string "portfile=/tmp/myserver,poolsize=3"
      * is sent as the settings parameter. Returns 0 on success, -1 on failure.
      */
-    public int startServer() throws IOException {
+    public int startServer() throws IOException, InterruptedException {
         long serverStart = System.currentTimeMillis();
 
         // The port file is locked and the server port and cookie is written into it.
@@ -250,64 +260,6 @@
         return 0;
     }
 
-    /**
-     * Fork a background process. Returns the command line used that can be printed if something failed.
-     */
-    public static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive,
-            final PrintStream err, String stdouterrfile, boolean background)
-            throws IOException, ProblemException {
-        if (stdouterrfile != null && stdouterrfile.trim().equals("")) {
-            stdouterrfile = null;
-        }
-        final String startserver = "--startserver:portfile=" + portfile + ",logfile=" + logfile + ",stdouterrfile=" + stdouterrfile + ",poolsize=" + poolsize + ",keepalive="+ keepalive;
-
-        if (background) {
-            sjavac += "%20" + startserver;
-            sjavac = sjavac.replaceAll("%20", " ");
-            sjavac = sjavac.replaceAll("%2C", ",");
-            // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
-            String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
-            if (!(new File("/bin/sh")).canExecute()) {
-                ArrayList<String> wincmd = new ArrayList<>();
-                wincmd.add("cmd");
-                wincmd.add("/c");
-                wincmd.add("start");
-                wincmd.add("cmd");
-                wincmd.add("/c");
-                wincmd.add(sjavac + " >> " + stdouterrfile + " 2>&1");
-                cmd = wincmd.toArray(new String[wincmd.size()]);
-            }
-            Process pp = null;
-            try {
-                pp = Runtime.getRuntime().exec(cmd);
-            } catch (Exception e) {
-                e.printStackTrace(err);
-                e.printStackTrace(new PrintWriter(stdouterrfile));
-            }
-            StringBuilder rs = new StringBuilder();
-            for (String s : cmd) {
-                rs.append(s + " ");
-            }
-            return rs.toString();
-        }
-
-        // Do not spawn a background server, instead run it within the same JVM.
-        Thread t = new Thread() {
-            @Override
-            public void run() {
-                try {
-                    SjavacServer server = new SjavacServer(startserver, err);
-                    server.startServer();
-                } catch (Throwable t) {
-                    t.printStackTrace(err);
-                }
-            }
-        };
-        t.setDaemon(true);
-        t.start();
-        return "";
-    }
-
     @Override
     public void shutdown(String quitMsg) {
         if (!keepAcceptingRequests.compareAndSet(true, false)) {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Mon Nov 17 09:36:40 2014 +0100
@@ -656,6 +656,9 @@
         // properties aren't named setA* or getA*
         private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
         private boolean isPropertyMethod(MethodDoc method) {
+            if (!configuration.javafx) {
+               return false;
+            }
             if (!method.name().endsWith("Property")) {
                 return false;
             }
@@ -667,7 +670,9 @@
             if (pattern.matcher(method.name()).matches()) {
                 return false;
             }
-
+            if (method.typeParameters().length > 0) {
+                return false;
+            }
             return 0 == method.parameters().length
                     && !"void".equals(method.returnType().simpleTypeName());
         }
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Mon Nov 17 09:36:40 2014 +0100
@@ -89,7 +89,6 @@
     private boolean apiMode;
 
     private JavaFileManager fileManager;
-    private boolean closeFileManagerOnExit;
 
     Start(String programName,
           PrintWriter errWriter,
@@ -242,7 +241,9 @@
             messager.error(Messager.NOPOS, "main.fatal.exception");
             failed = true;
         } finally {
-            if (fileManager != null && closeFileManagerOnExit) {
+            if (fileManager != null
+                    && fileManager instanceof BaseFileManager
+                    && ((BaseFileManager) fileManager).autoClose) {
                 try {
                     fileManager.close();
                 } catch (IOException ignore) {
@@ -343,7 +344,9 @@
         if (fileManager == null) {
             JavacFileManager.preRegister(context);
             fileManager = context.get(JavaFileManager.class);
-            closeFileManagerOnExit = true;
+            if (fileManager instanceof BaseFileManager) {
+                ((BaseFileManager) fileManager).autoClose = true;
+            }
         }
         if (fileManager instanceof BaseFileManager) {
             ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -45,6 +45,7 @@
 
 import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -111,8 +112,12 @@
             else
                 context.put(Log.outKey, new PrintWriter(out, true));
 
-            if (fileManager == null)
+            if (fileManager == null) {
                 fileManager = getStandardFileManager(diagnosticListener, null, null);
+                if (fileManager instanceof BaseFileManager) {
+                    ((BaseFileManager) fileManager).autoClose = true;
+                }
+            }
             fileManager = ccw.wrap(fileManager);
             context.put(JavaFileManager.class, fileManager);
 
--- a/langtools/test/Makefile	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/Makefile	Mon Nov 17 09:36:40 2014 +0100
@@ -186,6 +186,10 @@
   JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR)
 endif
 
+ifdef JCK_TIMEOUT_FACTOR
+  JCK_OPTIONS += -timeout:$(JCK_TIMEOUT_FACTOR)
+endif
+
 # Default verbosity setting for jtreg
 JTREG_VERBOSE = fail,error,nopass
 
@@ -298,7 +302,7 @@
 endif
 
 jtreg-summary: FRC
-	if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
+	@if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
 	    echo ; echo "Summary of jtreg test failures" ; \
 	    cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \
 		grep -v 'Not run' | grep -v 'Passed' ; \
@@ -336,8 +340,8 @@
 	    $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
 	@mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
 	$(JT_JAVA)/bin/java -Xmx512m \
-	    -jar $(JCK_HOME)/JCK-compiler-8/lib/jtjck.jar \
-	    $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
+	    -jar $(JCK_HOME)/JCK-compiler-9/lib/jtjck.jar \
+	    $(if $(JCK_VERBOSE),$(if $(filter $(JCK_VERBOSE),summary),-v,-v:$(JCK_VERBOSE))) \
             -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
             -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
             -jdk:$(TESTJAVA) \
@@ -353,7 +357,7 @@
 endif
 
 jck-compiler-summary: FRC
-	if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
+	@if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
 	    echo ; echo "Summary of JCK-compiler test failures" ; \
 	    cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \
 		grep -v 'Not run' | grep -v 'Passed' ; \
@@ -387,8 +391,8 @@
 	    $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
 	@mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
 	$(JT_JAVA)/bin/java -Xmx512m \
-	    -jar $(JCK_HOME)/JCK-runtime-8/lib/jtjck.jar \
-	    $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
+	    -jar $(JCK_HOME)/JCK-runtime-9/lib/jtjck.jar \
+	    $(if $(JCK_VERBOSE),$(if $(filter $(JCK_VERBOSE),summary),-v,-v:$(JCK_VERBOSE))) \
             -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
             -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
             -jdk:$(TESTJAVA) \
@@ -405,7 +409,7 @@
 endif
 
 jck-runtime-summary: FRC
-	if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
+	@if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
 	    echo ; echo "Summary of JCK-runtime test failures" ; \
 	    cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \
 		grep -v 'Not run' | grep -v 'Passed' ; \
@@ -417,7 +421,7 @@
 check-jck: $(JCK_HOME) $(PRODUCT_HOME)
 
 all-summary: FRC
-	if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
+	@if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
 	    echo ; echo "Summary of test failures" ; \
 	    cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \
 		grep -v 'Not run' | grep -v 'Passed' ; \
--- a/langtools/test/com/sun/javadoc/testJavaFX/C.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-/**
- * @expert Expert tag text
- */
-
-public class C {
-
-    /**
-     * @propertySetter Property
-     * @propertyDescription PropertyDescription
-     */
-    public void CC() {}
-
-    /**
-     * @propertyGetter Property
-     * @expert Expert tag text
-     *
-     */
-    public void B() {}
-
-    /**
-     * Method A documentation
-     * @treatAsPrivate
-     */
-    public void A() {}
-
-    /**
-     * Field i
-     * @defaultValue 1.0
-     */
-    public int i;
-
-
-    /**
-     * Defines the direction/speed at which the {@code Timeline} is expected to
-     * be played.
-     * @defaultValue 11
-     * @since JavaFX 8.0
-     */
-    private DoubleProperty rate;
-
-    public final void setRate(double value) {}
-
-    public final double getRate() {}
-
-    public final DoubleProperty rateProperty() {}
-
-    private BooleanProperty paused;
-
-    public final void setPaused(boolean value) {}
-
-    public final double isPaused() {}
-
-    /**
-     * Defines if paused
-     * @defaultValue false
-     */
-    public final BooleanProperty pausedProperty() {}
-
-    class DoubleProperty {}
-
-    class BooleanProperty {}
-
-    public final BooleanProperty setTestMethodProperty() {}
-
-    private class Inner {
-        private BooleanProperty testMethodProperty() {}
-
-        /**
-         * Defines the direction/speed at which the {@code Timeline} is expected to
-         * be played.
-         * @defaultValue 11
-         */
-        private DoubleProperty rate;
-
-        public final void setRate(double value) {}
-
-        public final double getRate() {}
-
-        public final DoubleProperty rateProperty() {}
-    }
-}
--- a/langtools/test/com/sun/javadoc/testJavaFX/D.java	Sat Nov 15 02:51:48 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-/**
- * @expert Expert tag text
- */
-
-public class D extends C {}
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Mon Nov 17 09:36:40 2014 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7112427 8012295 8025633 8026567
+ * @bug 7112427 8012295 8025633 8026567 8061305
  * @summary Test of the JavaFX doclet features.
  * @author jvalenta
  * @library ../lib
@@ -39,44 +39,143 @@
     }
 
     @Test
-    void test() {
-        javadoc("-d", "out",
+    void test1() {
+        javadoc("-d", "out1",
                 "-sourcepath", testSrc,
                 "-javafx",
-                testSrc("C.java"), testSrc("D.java"));
-        checkExit(Exit.FAILED); // should be EXIT_OK -- need to fix C.java
+                "-package",
+                "pkg1");
+        checkExit(Exit.OK);
 
-        checkOutput("C.html", true,
+        checkOutput("pkg1/C.html", true,
                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
-                + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, \n"
-                + "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>",
+                    + "<dd><a href=\"../pkg1/C.html#getRate--\"><code>getRate()</code></a>, \n"
+                    + "<a href=\"../pkg1/C.html#setRate-double-\">"
+                    + "<code>setRate(double)</code></a></dd>",
                 "<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n"
-                + "<div class=\"block\">Sets the value of the property rate.</div>\n"
-                + "<dl>\n"
-                + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+                    + "<div class=\"block\">Sets the value of the property rate.</div>\n"
+                    + "<dl>\n"
+                    + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
                 "<pre>public final&nbsp;double&nbsp;getRate()</pre>\n"
-                + "<div class=\"block\">Gets the value of the property rate.</div>\n"
-                + "<dl>\n"
-                + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>\n"
-                + "<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to",
+                    + "<div class=\"block\">Gets the value of the property rate.</div>\n"
+                    + "<dl>\n"
+                    + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                    + "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code>\n"
+                    + "<div class=\"block\">Defines the direction/speed at which the "
+                    + "<code>Timeline</code> is expected to",
                 "<span class=\"simpleTagLabel\">Default value:</span>",
                 "<span class=\"simpleTagLabel\">Since:</span></dt>\n"
-                + "<dd>JavaFX 8.0</dd>",
+                    + "<dd>JavaFX 8.0</dd>",
                 "<p>Sets the value of the property <code>Property</code>",
                 "<p>Gets the value of the property <code>Property</code>",
                 "<span class=\"simpleTagLabel\">Property description:</span>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code>&nbsp;</td>",
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                    + "<a href=\"../pkg1/C.html#setTestMethodProperty--\">"
+                    + "setTestMethodProperty</a></span>()</code>&nbsp;</td>",
                 "<h4>isPaused</h4>\n"
-                + "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
-                + "<div class=\"block\">Gets the value of the property paused.</div>");
+                    + "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+                    + "<div class=\"block\">Gets the value of the property paused.</div>");
 
-        checkOutput("C.html", false,
+        checkOutput("pkg1/C.html", false,
                 "A()");
 
-        checkOutput("D.html", true,
-                "<h3>Properties inherited from class&nbsp;<a href=\"C.html\" title=\"class in &lt;Unnamed&gt;\">C</a></h3>\n"
-                + "<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>");
+        checkOutput("pkg1/D.html", true,
+                "<h3>Properties inherited from class&nbsp;pkg1."
+                    + "<a href=\"../pkg1/C.html\" title=\"class in pkg1\">C</a></h3>\n"
+                    + "<code><a href=\"../pkg1/C.html#pausedProperty\">"
+                    + "paused</a>, <a href=\"../pkg1/C.html#rateProperty\">rate</a></code></li>");
     }
-
+    /*
+     * Test with -javafx option enabled, to ensure property getters and setters
+     * are treated correctly.
+     */
+    @Test
+    void test2() {
+        javadoc("-d", "out2a",
+                "-sourcepath", testSrc,
+                "-javafx",
+                "-package",
+                "pkg2");
+        checkExit(Exit.OK);
+        checkOutput("pkg2/Test.html", true,
+                "<li class=\"blockList\"><a name=\"property.detail\">\n"
+                + "<!--   -->\n"
+                + "</a>\n"
+                + "<h3>Property Detail</h3>\n"
+                + "<a name=\"betaProperty\">\n"
+                + "<!--   -->\n"
+                + "</a>\n"
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<h4>beta</h4>\n"
+                + "<pre>public&nbsp;java.lang.Object betaProperty</pre>\n"
+                + "</li>\n"
+                + "</ul>\n"
+                + "<a name=\"gammaProperty\">\n"
+                + "<!--   -->\n"
+                + "</a>\n"
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<h4>gamma</h4>\n"
+                + "<pre>public final&nbsp;java.util.List&lt;"
+                + "java.lang.String&gt; gammaProperty</pre>\n"
+                + "</li>\n"
+                + "</ul>\n"
+                + "<a name=\"deltaProperty\">\n"
+                + "<!--   -->\n"
+                + "</a>\n"
+                + "<ul class=\"blockListLast\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<h4>delta</h4>\n"
+                + "<pre>public final&nbsp;java.util.List&lt;"
+                + "java.util.Set&lt;? super java.lang.Object&gt;&gt; deltaProperty</pre>\n"
+                + "</li>\n"
+                + "</ul>\n"
+                + "</li>");
+    }
+    /*
+     * Test without -javafx option, to ensure property getters and setters
+     * are treated just like any other java method.
+     */
+    @Test
+    void test3() {
+        javadoc("-d", "out2b",
+                "-sourcepath", testSrc,
+                "-package",
+                "pkg2");
+        checkExit(Exit.OK);
+        checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>");
+        checkOutput("pkg2/Test.html", true,
+                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n"
+                + "</tr>\n"
+                + "<tr id=\"i0\" class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><code>&lt;T&gt;&nbsp;java.lang.Object</code></td>\n"
+                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">"
+                + "alphaProperty</a></span>(java.util.List&lt;T&gt;&nbsp;foo)</code>&nbsp;</td>\n"
+                + "</tr>\n"
+                + "<tr id=\"i1\" class=\"rowColor\">\n"
+                + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
+                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code>"
+                + "&nbsp;</td>\n"
+                + "</tr>\n"
+                + "<tr id=\"i2\" class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><code>"
+                + "java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
+                + "</code></td>\n"
+                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#deltaProperty--\">"
+                + "deltaProperty</a></span>()</code>&nbsp;</td>\n"
+                + "</tr>\n"
+                + "<tr id=\"i3\" class=\"rowColor\">\n"
+                + "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;"
+                + "</code></td>\n"
+                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a>"
+                + "</span>()</code>&nbsp;</td>"
+        );
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testJavaFX/pkg1/C.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package pkg1;
+
+public class C {
+
+    /**
+     * @propertySetter Property
+     * @propertyDescription PropertyDescription
+     */
+    public void CC() {}
+
+    /**
+     * @propertyGetter Property
+     *
+     */
+    public void B() {}
+
+    /**
+     * Method A documentation
+     * @treatAsPrivate
+     */
+    public void A() {}
+
+    /**
+     * Field i
+     * @defaultValue 1.0
+     */
+    public int i;
+
+
+    /**
+     * Defines the direction/speed at which the {@code Timeline} is expected to
+     * be played.
+     * @defaultValue 11
+     * @since JavaFX 8.0
+     */
+    private DoubleProperty rate;
+
+    public final void setRate(double value) {}
+
+    public final double getRate() {}
+
+    public final DoubleProperty rateProperty() {}
+
+    private BooleanProperty paused;
+
+    public final void setPaused(boolean value) {}
+
+    public final double isPaused() {}
+
+    /**
+     * Defines if paused
+     * @defaultValue false
+     */
+    public final BooleanProperty pausedProperty() {}
+
+    class DoubleProperty {}
+
+    class BooleanProperty {}
+
+    public final BooleanProperty setTestMethodProperty() {}
+
+    private class Inner {
+        private BooleanProperty testMethodProperty() {}
+
+        /**
+         * Defines the direction/speed at which the {@code Timeline} is expected to
+         * be played.
+         * @defaultValue 11
+         */
+        private DoubleProperty rate;
+
+        public final void setRate(double value) {}
+
+        public final double getRate() {}
+
+        public final DoubleProperty rateProperty() {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testJavaFX/pkg1/D.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package pkg1;
+
+public class D extends C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testJavaFX/pkg2/Test.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package pkg2;
+
+import java.util.List;
+import java.util.Set;
+
+
+public class Test {
+    public <T> Object alphaProperty(List<T> foo) { return null; }
+    public Object betaProperty() { return null; }
+    public final  List<String> gammaProperty()  {return null;}
+    public final List<Set<? super Object>> deltaProperty() {return null;}
+}
--- a/langtools/test/lib/combo/tools/javac/combo/JavacTemplateTestBase.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/lib/combo/tools/javac/combo/JavacTemplateTestBase.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -245,21 +245,22 @@
 
     private File compile(List<File> classpaths, List<JavaFileObject> files, boolean generate) throws IOException {
         JavaCompiler systemJavaCompiler = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = systemJavaCompiler.getStandardFileManager(null, null, null);
-        if (classpaths.size() > 0)
-            fm.setLocation(StandardLocation.CLASS_PATH, classpaths);
-        JavacTask ct = (JavacTask) systemJavaCompiler.getTask(null, fm, diags, compileOptions, null, files);
-        if (generate) {
-            File destDir = new File(root, Integer.toString(counter.incrementAndGet()));
-            // @@@ Assert that this directory didn't exist, or start counter at max+1
-            destDir.mkdirs();
-            fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
-            ct.generate();
-            return destDir;
-        }
-        else {
-            ct.analyze();
-            return nullDir;
+        try (StandardJavaFileManager fm = systemJavaCompiler.getStandardFileManager(null, null, null)) {
+            if (classpaths.size() > 0)
+                fm.setLocation(StandardLocation.CLASS_PATH, classpaths);
+            JavacTask ct = (JavacTask) systemJavaCompiler.getTask(null, fm, diags, compileOptions, null, files);
+            if (generate) {
+                File destDir = new File(root, Integer.toString(counter.incrementAndGet()));
+                // @@@ Assert that this directory didn't exist, or start counter at max+1
+                destDir.mkdirs();
+                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+                ct.generate();
+                return destDir;
+            }
+            else {
+                ct.analyze();
+                return nullDir;
+            }
         }
     }
 
--- a/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -26,7 +26,8 @@
  * @bug 6508981
  * @summary cleanup file separator handling in JavacFileManager
  * (This test is specifically to test the new impl of inferBinaryName)
- * @build p.A
+ * @library /tools/lib
+ * @build ToolBox p.A
  * @run main TestInferBinaryName
  */
 
@@ -61,51 +62,75 @@
         //System.err.println(System.getProperties());
         testDirectory();
         testSymbolArchive();
-        testZipArchive();
-        testZipFileIndexArchive();
-        testZipFileIndexArchive2();
+
+        File testJar = createJar();
+
+        testZipArchive(testJar);
+        testZipFileIndexArchive(testJar);
+        testZipFileIndexArchive2(testJar);
         if (errors > 0)
             throw new Exception(errors + " error found");
     }
 
+    File createJar() throws IOException {
+        File f = new File("test.jar");
+        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
+            ToolBox tb = new ToolBox();
+            tb.new JarTask(f.getPath())
+                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*")
+                .run();
+        }
+        return f;
+    }
+
     void testDirectory() throws IOException {
         String testClassName = "p.A";
-        JavaFileManager fm =
-            getFileManager("test.classes", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
-        test("testDirectory",
-             fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
+        List<File> testClasses = Arrays.asList(new File(System.getProperty("test.classes")));
+        try (JavaFileManager fm =
+                getFileManager(testClasses, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+            test("testDirectory",
+                fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
+        }
     }
 
     void testSymbolArchive() throws IOException {
         String testClassName = "java.lang.String";
-        JavaFileManager fm =
-            getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX);
-        test("testSymbolArchive",
-             fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject");
+        List<File> path = getPath(System.getProperty("sun.boot.class.path"));
+        try (JavaFileManager fm =
+                getFileManager(path, USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
+            test("testSymbolArchive",
+                    fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject");
+        }
     }
 
-    void testZipArchive() throws IOException {
+    void testZipArchive(File testJar) throws IOException {
         String testClassName = "java.lang.String";
-        JavaFileManager fm =
-            getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX);
-        test("testZipArchive",
-             fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
+        List<File> path = Arrays.asList(testJar);
+        try (JavaFileManager fm =
+                getFileManager(path, IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
+            test("testZipArchive",
+                 fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
+        }
     }
 
-    void testZipFileIndexArchive() throws IOException {
+    void testZipFileIndexArchive(File testJar) throws IOException {
         String testClassName = "java.lang.String";
-        JavaFileManager fm =
-            getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
-        test("testZipFileIndexArchive",
-             fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
+        List<File> path = Arrays.asList(testJar);
+        try (JavaFileManager fm =
+                getFileManager(path, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+            test("testZipFileIndexArchive",
+                 fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
+        }
     }
 
-    void testZipFileIndexArchive2() throws IOException {
+    void testZipFileIndexArchive2(File testJar) throws IOException {
         String testClassName = "java.lang.String";
-        JavaFileManager fm =
-            getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
-        test("testZipFileIndexArchive2",
-             fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
+        List<File> path = Arrays.asList(testJar);
+        try (JavaFileManager fm =
+                getFileManager(path, IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+            test("testZipFileIndexArchive2",
+                 fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
+        }
     }
 
     /**
@@ -133,7 +158,7 @@
         System.err.println("OK");
     }
 
-    JavaFileManager getFileManager(String classpathProperty,
+    JavaFileManager getFileManager(List<File> path,
                                    boolean symFileKind,
                                    boolean zipFileIndexKind)
             throws IOException {
@@ -145,7 +170,6 @@
         if (symFileKind == IGNORE_SYMBOL_FILE)
             options.put("ignore.symbol.file", "true");
         JavacFileManager fm = new JavacFileManager(ctx, false, null);
-        List<File> path = getPath(System.getProperty(classpathProperty));
         fm.setLocation(CLASS_PATH, path);
         return fm;
     }
--- a/langtools/test/tools/javac/ConditionalWithVoid.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/ConditionalWithVoid.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,14 +1,16 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 4974927
+ * @bug 4974927 8064464
  * @summary The compiler was allowing void types in its parsing of conditional expressions.
  * @author tball
  *
  * @compile/fail/ref=ConditionalWithVoid.out -XDrawDiagnostics ConditionalWithVoid.java
  */
 public class ConditionalWithVoid {
-    public int test(Object o) {
-        // Should fail to compile since Object.wait() has a void return type.
+    public void test(Object o) {
+        // Should fail to compile since Object.wait() has a void return type. Poly case.
         System.out.println(o instanceof String ? o.hashCode() : o.wait());
+        // Should fail to compile since Object.wait() has a void return type. Standalone case.
+        (o instanceof String ? o.hashCode() : o.wait()).toString();
     }
 }
--- a/langtools/test/tools/javac/ConditionalWithVoid.out	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/ConditionalWithVoid.out	Mon Nov 17 09:36:40 2014 +0100
@@ -1,2 +1,3 @@
-ConditionalWithVoid.java:12:48: compiler.err.neither.conditional.subtype: java.lang.Integer, void
-1 error
+ConditionalWithVoid.java:12:71: compiler.err.void.not.allowed.here
+ConditionalWithVoid.java:14:30: compiler.err.neither.conditional.subtype: java.lang.Integer, void
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TypeVarShadow.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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
+ * @summary Incorrect shadowing of classes vs type parameters
+ * @bug 8035259
+ * @run compile TypeVarShadow.java
+ */
+
+public class TypeVarShadow {
+    class T<E> {}
+
+    abstract class One<E> {
+        abstract E foo();
+    }
+
+    abstract class Two<T> extends One<T> {
+        abstract T foo();
+    }
+}
--- a/langtools/test/tools/javac/annotations/neg/8022765/VerifyErroneousAnnotationsAttributed.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/annotations/neg/8022765/VerifyErroneousAnnotationsAttributed.java	Mon Nov 17 09:36:40 2014 +0100
@@ -44,6 +44,7 @@
 import javax.lang.model.type.TypeKind;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 
@@ -52,22 +53,26 @@
         new VerifyErroneousAnnotationsAttributed().run();
     }
 
-    void run() {
-        int failCount = 0;
-        for (String ann : generateAnnotations()) {
-            String code = PATTERN.replace("PLACEHOLDER", ann);
-            try {
-                validate(code);
-            } catch (Throwable t) {
-                System.out.println("Failed for: ");
-                System.out.println(code);
-                t.printStackTrace(System.out);
-                failCount++;
+    void run() throws IOException {
+        try {
+            int failCount = 0;
+            for (String ann : generateAnnotations()) {
+                String code = PATTERN.replace("PLACEHOLDER", ann);
+                try {
+                    validate(code);
+                } catch (Throwable t) {
+                    System.out.println("Failed for: ");
+                    System.out.println(code);
+                    t.printStackTrace(System.out);
+                    failCount++;
+                }
             }
-        }
 
-        if (failCount > 0) {
-            throw new IllegalStateException("failed sub-tests: " + failCount);
+            if (failCount > 0) {
+                throw new IllegalStateException("failed sub-tests: " + failCount);
+            }
+        } finally {
+            fm.close();
         }
     }
 
@@ -221,13 +226,14 @@
     }
 
     final JavacTool tool = JavacTool.create();
+    final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
     final DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
         @Override public void report(Diagnostic<? extends JavaFileObject> diagnostic) {}
     };
 
     void validate(String code) throws IOException, URISyntaxException {
         JavacTask task = tool.getTask(null,
-                                      null,
+                                      fm,
                                       devNull,
                                       Arrays.asList("-XDshouldStopPolicy=FLOW"),
                                       null,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileInspector.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,950 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+
+import java.lang.annotation.*;
+import java.io.*;
+import java.net.URL;
+import java.util.List;
+
+import com.sun.tools.classfile.*;
+
+/**
+ * A class providing utilities for writing tests that inspect class
+ * files directly, looking for specific type annotations.
+ *
+ * Note: this framework does not currently handle repeating
+ * annotations.
+ */
+public class ClassfileInspector {
+
+    /**
+     * A group of expected annotations to be found in a given class.
+     * If the class name is null, then the template will be applied to
+     * every class.
+     */
+    public static class Expected {
+        /**
+         * The name of the class.  If {@code null} this template will
+         * apply to every class; otherwise, it will only be applied to
+         * the named class.
+         */
+        public final String classname;
+
+        /**
+         * The expected class annotations.  These will be checked
+         * against the class' attributes.
+         */
+        public final ExpectedTypeAnnotation[] classAnnos;
+
+        /**
+         * The expected method annotations.  These will be checked
+         * against all methods in the class.
+         */
+        public final ExpectedMethodTypeAnnotation[] methodAnnos;
+
+        /**
+         * The expected field annotations.  These will be checked
+         * against all fields in the class.
+         */
+        public final ExpectedFieldTypeAnnotation[] fieldAnnos;
+
+        /**
+         * Create an {@code Expected} from its components.
+         *
+         * @param classname The name of the class to match, or {@code
+         *                  null} for all classes.
+         * @param classAnnos The expected class annotations.
+         * @param methodAnnos The expected method annotations.
+         * @param fieldAnnos The expected field annotations.
+         */
+        public Expected(String classname,
+                        ExpectedTypeAnnotation[] classAnnos,
+                        ExpectedMethodTypeAnnotation[] methodAnnos,
+                        ExpectedFieldTypeAnnotation[] fieldAnnos) {
+            this.classname = classname;
+            this.classAnnos = classAnnos;
+            this.methodAnnos = methodAnnos;
+            this.fieldAnnos = fieldAnnos;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            final String newline = System.lineSeparator();
+            sb.append("Expected on class ").append(classname);
+            if (null != classAnnos) {
+                sb.append(newline).append("Class annotations:").append(newline);
+                for(ExpectedTypeAnnotation anno : classAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != methodAnnos) {
+                sb.append(newline).append("Method annotations:").append(newline);
+                for(ExpectedTypeAnnotation anno : methodAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != fieldAnnos) {
+                sb.append(newline).append("Field annotations:").append(newline);
+                for(ExpectedTypeAnnotation anno : fieldAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            return sb.toString();
+        }
+
+        /**
+         * See if this template applies to a class.
+         *
+         * @param classname The classname to check.
+         * @return Whether or not this template should apply.
+         */
+        public boolean matchClassName(String classname) {
+            return this.classname == null || this.classname.equals(classname);
+        }
+
+        /**
+         * After applying the template to all classes, check to see if
+         * any of the expected annotations weren't matched.
+         *
+         * @return The number of missed matches.
+         */
+        public int check() {
+            int count = 0;
+            if (classAnnos != null) {
+                for(ExpectedTypeAnnotation expected : classAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (methodAnnos != null) {
+                for(ExpectedMethodTypeAnnotation expected : methodAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (fieldAnnos != null) {
+                for(ExpectedFieldTypeAnnotation expected : fieldAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            return count;
+        }
+    }
+
+    /**
+     * An expected type annotation.  This is both a superclass for
+     * method and field type annotations, as well as a class for type
+     * annotations on a class.
+     */
+    public static class ExpectedTypeAnnotation {
+        private int count = 0;
+        protected final String expectedName;
+        protected final int expectedCount;
+        protected final TypeAnnotation.TargetType targetType;
+        protected final int bound_index;
+        protected final int parameter_index;
+        protected final int type_index;
+        protected final int exception_index;
+        protected final TypeAnnotation.Position.TypePathEntry[] typePath;
+        protected final boolean visibility;
+
+        /**
+         * Create an {@code ExpectedTypeAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should
+         *                      be seen.  If 0, this asserts that the
+         *                      described annotation is not present.
+         * @param targetType The expected target type.
+         * @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}.
+         * @param parameter_index The expected parameter index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param type_index The expected type index, or {@code Integer.MIN_VALUE}.
+         * @param exception_index The expected exception index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param typePath The expected type path.
+         */
+        public ExpectedTypeAnnotation(String expectedName,
+                                      boolean visibility,
+                                      int expectedCount,
+                                      TypeAnnotation.TargetType targetType,
+                                      int bound_index,
+                                      int parameter_index,
+                                      int type_index,
+                                      int exception_index,
+                                      TypeAnnotation.Position.TypePathEntry... typePath) {
+            this.expectedName = expectedName;
+            this.visibility = visibility;
+            this.expectedCount = expectedCount;
+            this.targetType = targetType;
+            this.bound_index = bound_index;
+            this.parameter_index = parameter_index;
+            this.type_index = type_index;
+            this.exception_index = exception_index;
+            this.typePath = typePath;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ");
+            sb.append(expectedCount);
+            sb.append(" annotation ");
+            sb.append(expectedName);
+            sb.append(visibility ? ", runtime visibile " : ", runtime invisibile ");
+            sb.append(targetType);
+            sb.append(", bound_index = ");
+            sb.append(bound_index);
+            sb.append(", parameter_index = ");
+            sb.append(parameter_index);
+            sb.append(", type_index = ");
+            sb.append(type_index);
+            sb.append(", exception_index = ");
+            sb.append(exception_index);
+            sb.append(", type_path = [");
+            for(int i = 0; i < typePath.length; i++) {
+                if (i != 0) {
+                    sb.append(", ");
+                }
+                sb.append(typePath[i]);
+            }
+            sb.append("]");
+            return sb.toString();
+        }
+
+        /**
+         * See if this template matches the given visibility.
+         *
+         * @param Whether or not the annotation is visible at runtime.
+         * @return Whether or not this template matches the visibility.
+         */
+        public boolean matchVisibility(boolean visibility) {
+            return this.visibility == visibility;
+        }
+
+        /**
+         * Attempty to match this template against an annotation.  If
+         * it does match, then the match count for the template will
+         * be incremented.  Otherwise, nothing will be done.
+         *
+         * @param anno The annotation to attempt to match.
+         */
+        public void matchAnnotation(TypeAnnotation anno) {
+            boolean matches = true;
+
+            try {
+                matches = anno.constant_pool.getUTF8Info(anno.annotation.type_index).value.equals("L" + expectedName + ";");
+            } catch(Exception e) {
+                matches = false;
+            }
+
+            matches = matches && anno.position.type == targetType;
+            matches = matches && anno.position.bound_index == bound_index;
+            matches = matches && anno.position.parameter_index == parameter_index;
+            matches = matches && anno.position.type_index == type_index;
+            matches = matches && anno.position.exception_index == exception_index;
+            matches = matches && anno.position.location.size() == typePath.length;
+
+            if (matches) {
+                int i = 0;
+                for(TypeAnnotation.Position.TypePathEntry entry :
+                         anno.position.location) {
+                    matches = matches && typePath[i++].equals(entry);
+                }
+            }
+
+            if (matches) {
+                count++;
+            }
+        }
+
+        /**
+         * After all matching, check to see if the expected number of
+         * matches equals the actual number.  If not, then print a
+         * failure message and return {@code false}.
+         *
+         * @return Whether or not the expected number of matched
+         *         equals the actual number.
+         */
+        public boolean check() {
+            if (count != expectedCount) {
+                System.err.println(this + ", but saw " + count);
+                return false;
+            } else {
+                return true;
+            }
+        }
+
+        /**
+         * A builder class for creating {@code
+         * ExpectedTypeAnnotation}s in a more convenient fashion.  The
+         * constructor for {@code ExpectedTypeAnnotation} takes a
+         * large number of parameters (by necessity).  This class
+         * allows users to construct a {@code ExpectedTypeAnnotation}s
+         * using only the ones they need.
+         */
+        public static class Builder {
+            protected final String expectedName;
+            protected final int expectedCount;
+            protected final TypeAnnotation.TargetType targetType;
+            protected final boolean visibility;
+            protected int bound_index = Integer.MIN_VALUE;
+            protected int parameter_index = Integer.MIN_VALUE;
+            protected int type_index = Integer.MIN_VALUE;
+            protected int exception_index = Integer.MIN_VALUE;
+            protected TypeAnnotation.Position.TypePathEntry[] typePath =
+                new TypeAnnotation.Position.TypePathEntry[0];
+
+            /**
+             * Create a {@code Builder} from the mandatory parameters.
+             *
+             * @param expectedName The expected annotation name.
+             * @param targetType The expected target type.
+             * @param visibility Whether this annotation should be runtime-visible.
+             * @param expectedCount The number of annotations that should be seen.
+             */
+            public Builder(String expectedName,
+                           TypeAnnotation.TargetType targetType,
+                           boolean visibility,
+                           int expectedCount) {
+                this.expectedName = expectedName;
+                this.visibility = visibility;
+                this.expectedCount = expectedCount;
+                this.targetType = targetType;
+            }
+
+            /**
+             * Create an {@code ExpectedTypeAnnotation} from all
+             * parameters that have been provided.  The default values
+             * will be used for those that have not.
+             *
+             * @return The cretaed {@code ExpectedTypeAnnotation}.
+             */
+            public ExpectedTypeAnnotation build() {
+                return new ExpectedTypeAnnotation(expectedName, visibility,
+                                                  expectedCount, targetType,
+                                                  bound_index, parameter_index,
+                                                  type_index, exception_index,
+                                                  typePath);
+            }
+
+            /**
+             * Provide a bound index parameter.
+             *
+             * @param bound_index The bound_index value.
+             */
+            public Builder setBoundIndex(int bound_index) {
+                this.bound_index = bound_index;
+                return this;
+            }
+
+            /**
+             * Provide a parameter index parameter.
+             *
+             * @param bound_index The parameter_index value.
+             */
+            public Builder setParameterIndex(int parameter_index) {
+                this.parameter_index = parameter_index;
+                return this;
+            }
+
+            /**
+             * Provide a type index parameter.
+             *
+             * @param type_index The type_index value.
+             */
+            public Builder setTypeIndex(int type_index) {
+                this.type_index = type_index;
+                return this;
+            }
+
+            /**
+             * Provide an exception index parameter.
+             *
+             * @param exception_index The exception_index value.
+             */
+            public Builder setExceptionIndex(int exception_index) {
+                this.exception_index = exception_index;
+                return this;
+            }
+
+            /**
+             * Provide a type path parameter.
+             *
+             * @param typePath The type path value.
+             */
+            public Builder setTypePath(TypeAnnotation.Position.TypePathEntry[] typePath) {
+                this.typePath = typePath;
+                return this;
+            }
+        }
+    }
+
+    /**
+     * A type annotation found on a method.
+     */
+    public static class ExpectedMethodTypeAnnotation extends ExpectedTypeAnnotation {
+        private final String methodname;
+
+        /**
+         * Create an {@code ExpectedMethodTypeAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param methodname The expected method name.
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should be seen.
+         * @param targetType The expected target type.
+         * @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}.
+         * @param parameter_index The expected parameter index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param type_index The expected type index, or {@code Integer.MIN_VALUE}.
+         * @param exception_index The expected exception index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param typePath The expected type path.
+         */
+        public ExpectedMethodTypeAnnotation(String methodname,
+                                            String expectedName,
+                                            boolean visibility,
+                                            int expectedCount,
+                                            TypeAnnotation.TargetType targetType,
+                                            int bound_index,
+                                            int parameter_index,
+                                            int type_index,
+                                            int exception_index,
+                                            TypeAnnotation.Position.TypePathEntry... typePath) {
+            super(expectedName, visibility, expectedCount, targetType, bound_index,
+                  parameter_index, type_index, exception_index, typePath);
+            this.methodname = methodname;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ");
+            sb.append(expectedCount);
+            sb.append(" annotation ");
+            sb.append(expectedName);
+            sb.append(visibility ? ", runtime visibile " : ", runtime invisibile ");
+            sb.append(targetType);
+            sb.append(", bound_index = ");
+            sb.append(bound_index);
+            sb.append(", parameter_index = ");
+            sb.append(parameter_index);
+            sb.append(", type_index = ");
+            sb.append(type_index);
+            sb.append(", exception_index = ");
+            sb.append(exception_index);
+            sb.append(", type_path = [");
+            for(int i = 0; i < typePath.length; i++) {
+                if (i != 0) {
+                    sb.append(", ");
+                }
+                sb.append(typePath[i]);
+            }
+            sb.append("]");
+            sb.append(" on method ");
+            sb.append(methodname);
+            return sb.toString();
+        }
+
+        /**
+         * See if this template applies to a method.
+         *
+         * @param methodname The method name to check.
+         * @return Whether or not this template should apply.
+         */
+        public boolean matchMethodName(String methodname) {
+            return this.methodname.equals(methodname);
+        }
+
+        /**
+         * A builder class for creating {@code
+         * ExpectedMethodTypeAnnotation}s in a more convenient fashion.  The
+         * constructor for {@code ExpectedMethodTypeAnnotation} takes a
+         * large number of parameters (by necessity).  This class
+         * allows users to construct a {@code ExpectedMethodTypeAnnotation}s
+         * using only the ones they need.
+         */
+        public static class Builder extends ExpectedTypeAnnotation.Builder {
+            protected final String methodname;
+
+            /**
+             * Create a {@code Builder} from the mandatory parameters.
+             *
+             * @param methodname The expected method name.
+             * @param expectedName The expected annotation name.
+             * @param targetType The expected target type.
+             * @param visibility Whether this annotation should be runtime-visible.
+             * @param expectedCount The number of annotations that should be seen.
+             */
+            public Builder(String methodname,
+                           String expectedName,
+                           TypeAnnotation.TargetType targetType,
+                           boolean visibility,
+                           int expectedCount) {
+                super(expectedName, targetType, visibility, expectedCount);
+                this.methodname = methodname;
+            }
+
+            /**
+             * Create an {@code ExpectedMethodTypeAnnotation} from all
+             * parameters that have been provided.  The default values
+             * will be used for those that have not.
+             *
+             * @return The cretaed {@code ExpectedMethodTypeAnnotation}.
+             */
+            public ExpectedMethodTypeAnnotation build() {
+                return new ExpectedMethodTypeAnnotation(methodname, expectedName,
+                                                        visibility, expectedCount,
+                                                        targetType, bound_index,
+                                                        parameter_index, type_index,
+                                                        exception_index, typePath);
+            }
+        }
+    }
+
+    /**
+     * A type annotation found on a field.
+     */
+    public static class ExpectedFieldTypeAnnotation extends ExpectedTypeAnnotation {
+        private final String fieldname;
+
+        /**
+         * Create an {@code ExpectedFieldTypeAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param fieldname The expected field name.
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should be seen.
+         * @param targetType The expected target type.
+         * @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}.
+         * @param parameter_index The expected parameter index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param type_index The expected type index, or {@code Integer.MIN_VALUE}.
+         * @param exception_index The expected exception index, or
+         *                        {@code Integer.MIN_VALUE}.
+         * @param typePath The expected type path.
+         */
+        public ExpectedFieldTypeAnnotation(String fieldname,
+                                           String expectedName,
+                                           boolean visibility,
+                                           int expectedCount,
+                                           TypeAnnotation.TargetType targetType,
+                                           int bound_index,
+                                           int parameter_index,
+                                           int type_index,
+                                           int exception_index,
+                                           TypeAnnotation.Position.TypePathEntry... typePath) {
+            super(expectedName, visibility, expectedCount, targetType, bound_index,
+                  parameter_index, type_index, exception_index, typePath);
+            this.fieldname = fieldname;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ").append(expectedCount)
+            .append(" annotation ").append(expectedName)
+            .append(visibility ? ", runtime visibile " : ", runtime invisibile ")
+            .append(targetType)
+            .append(", bound_index = ").append(bound_index)
+            .append(", parameter_index = ").append(parameter_index)
+            .append(", type_index = ").append(type_index)
+            .append(", exception_index = ").append(exception_index)
+            .append(", type_path = [");
+
+            for(int i = 0; i < typePath.length; i++) {
+                if (i != 0) {
+                    sb.append(", ");
+                }
+                sb.append(typePath[i]);
+            }
+            sb.append("]")
+            .append(" on field ").append(fieldname);
+            return sb.toString();
+        }
+
+        /**
+         * See if this template applies to a field.
+         *
+         * @param fieldname The field name to check.
+         * @return Whether or not this template should apply.
+         */
+        public boolean matchFieldName(String fieldname) {
+            return this.fieldname.equals(fieldname);
+        }
+
+        /**
+         * A builder class for creating {@code
+         * ExpectedFieldTypeAnnotation}s in a more convenient fashion.  The
+         * constructor for {@code ExpectedFieldTypeAnnotation} takes a
+         * large number of parameters (by necessity).  This class
+         * allows users to construct a {@code ExpectedFieldTypeAnnotation}s
+         * using only the ones they need.
+         */
+        public static class Builder extends ExpectedTypeAnnotation.Builder {
+            protected final String fieldname;
+
+            /**
+             * Create a {@code Builder} from the mandatory parameters.
+             *
+             * @param fieldname The expected field name.
+             * @param expectedName The expected annotation name.
+             * @param targetType The expected target type.
+             * @param visibility Whether this annotation should be runtime-visible.
+             * @param expectedCount The number of annotations that should be seen.
+             */
+            public Builder(String fieldname,
+                           String expectedName,
+                           TypeAnnotation.TargetType targetType,
+                           boolean visibility,
+                           int expectedCount) {
+                super(expectedName, targetType, visibility, expectedCount);
+                this.fieldname = fieldname;
+            }
+
+            /**
+             * Create an {@code ExpectedFieldTypeAnnotation} from all
+             * parameters that have been provided.  The default values
+             * will be used for those that have not.
+             *
+             * @return The cretaed {@code ExpectedFieldTypeAnnotation}.
+             */
+            public ExpectedFieldTypeAnnotation build() {
+                return new ExpectedFieldTypeAnnotation(fieldname, expectedName,
+                                                       visibility, expectedCount,
+                                                       targetType, bound_index,
+                                                       parameter_index, type_index,
+                                                       exception_index, typePath);
+            }
+        }
+    }
+
+    private void matchClassTypeAnnotation(ClassFile classfile,
+                                          ExpectedTypeAnnotation expected)
+        throws ConstantPoolException {
+        for(Attribute attr : classfile.attributes) {
+            attr.accept(typeAnnoMatcher, expected);
+        }
+    }
+
+    private void matchMethodTypeAnnotation(ClassFile classfile,
+                                           ExpectedMethodTypeAnnotation expected)
+        throws ConstantPoolException {
+        for(Method meth : classfile.methods) {
+            if (expected.matchMethodName(meth.getName(classfile.constant_pool))) {
+                for(Attribute attr : meth.attributes) {
+                    attr.accept(typeAnnoMatcher, expected);
+                }
+            }
+        }
+    }
+
+    private void matchFieldTypeAnnotation(ClassFile classfile,
+                                          ExpectedFieldTypeAnnotation expected)
+        throws ConstantPoolException {
+        for(Field field : classfile.fields) {
+            if (expected.matchFieldName(field.getName(classfile.constant_pool))) {
+                for(Attribute attr : field.attributes) {
+                    attr.accept(typeAnnoMatcher, expected);
+                }
+            }
+        }
+    }
+
+    private void matchClassTypeAnnotations(ClassFile classfile,
+                                           ExpectedTypeAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedTypeAnnotation one : expected) {
+            matchClassTypeAnnotation(classfile, one);
+        }
+    }
+
+    private void matchMethodTypeAnnotations(ClassFile classfile,
+                                            ExpectedMethodTypeAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedMethodTypeAnnotation one : expected) {
+            matchMethodTypeAnnotation(classfile, one);
+        }
+    }
+
+    private void matchFieldTypeAnnotations(ClassFile classfile,
+                                           ExpectedFieldTypeAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedFieldTypeAnnotation one : expected) {
+            matchFieldTypeAnnotation(classfile, one);
+        }
+    }
+
+    /**
+     * Run a template on a single {@code ClassFile}.
+     *
+     * @param classfile The {@code ClassFile} on which to run tests.
+     * @param expected The expected annotation template.
+     */
+    public void run(ClassFile classfile,
+                    Expected... expected)
+            throws ConstantPoolException {
+        run(new ClassFile[] { classfile }, expected);
+    }
+
+    /**
+     * Run a template on multiple {@code ClassFile}s.
+     *
+     * @param classfile The {@code ClassFile}s on which to run tests.
+     * @param expected The expected annotation template.
+     */
+    public void run(ClassFile[] classfiles,
+                    Expected... expected)
+            throws ConstantPoolException {
+        for(ClassFile classfile : classfiles) {
+            for(Expected one : expected) {
+                if (one.matchClassName(classfile.getName())) {
+                    if (one.classAnnos != null)
+                        matchClassTypeAnnotations(classfile, one.classAnnos);
+                    if (one.methodAnnos != null)
+                        matchMethodTypeAnnotations(classfile, one.methodAnnos);
+                    if (one.fieldAnnos != null)
+                        matchFieldTypeAnnotations(classfile, one.fieldAnnos);
+                }
+            }
+        }
+        int count = 0;
+        for (Expected one : expected) {
+            count += one.check();
+        }
+
+        if (count != 0) {
+            throw new RuntimeException(count + " errors occurred in test");
+        }
+    }
+
+    /**
+     * Get a {@code ClassFile} from its file name.
+     *
+     * @param name The class' file name.
+     * @return The {@code ClassFile}
+     */
+    public static ClassFile getClassFile(String name)
+        throws IOException, ConstantPoolException {
+        final URL url = ClassfileInspector.class.getResource(name);
+        final InputStream in = url.openStream();
+        try {
+            return ClassFile.read(in);
+        } finally {
+            in.close();
+        }
+    }
+
+    private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher =
+        new Attribute.Visitor<Void, ExpectedTypeAnnotation>() {
+
+        @Override
+        public Void visitBootstrapMethods(BootstrapMethods_attribute attr,
+                                          ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitDefault(DefaultAttribute attr,
+                                 ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitAnnotationDefault(AnnotationDefault_attribute attr,
+                                           ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr,
+                                             ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitCode(Code_attribute attr,
+                              ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitCompilationID(CompilationID_attribute attr,
+                                       ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitConstantValue(ConstantValue_attribute attr,
+                                       ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitDeprecated(Deprecated_attribute attr,
+                                    ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitEnclosingMethod(EnclosingMethod_attribute attr,
+                                         ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitExceptions(Exceptions_attribute attr,
+                                    ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitInnerClasses(InnerClasses_attribute attr,
+                                      ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitLineNumberTable(LineNumberTable_attribute attr,
+                                         ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitLocalVariableTable(LocalVariableTable_attribute attr,
+                                            ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr,
+                                                ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitMethodParameters(MethodParameters_attribute attr,
+                                          ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+            public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr,
+                                                       ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr,
+                                                     ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr,
+                                                            ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr,
+                                                              ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitSignature(Signature_attribute attr,
+                                   ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr,
+                                              ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitSourceFile(SourceFile_attribute attr,
+                                    ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitSourceID(SourceID_attribute attr,
+                                  ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitStackMap(StackMap_attribute attr,
+                                  ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitStackMapTable(StackMapTable_attribute attr,
+                                       ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitSynthetic(Synthetic_attribute attr,
+                                   ExpectedTypeAnnotation expected) {
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr,
+                                                       ExpectedTypeAnnotation expected) {
+            if (expected.matchVisibility(true)) {
+                for(TypeAnnotation anno : attr.annotations) {
+                    expected.matchAnnotation(anno);
+                }
+            }
+
+            return null;
+        }
+
+        @Override
+        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr,
+                                                         ExpectedTypeAnnotation expected) {
+            if (expected.matchVisibility(false)) {
+                for(TypeAnnotation anno : attr.annotations) {
+                    expected.matchAnnotation(anno);
+                }
+            }
+
+            return null;
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, 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 SyntheticParameters
+ * @summary Test generation of annotations on inner class parameters.
+ * @build ClassfileInspector
+ * @run main SyntheticParameters
+ */
+
+import java.io.*;
+import java.lang.annotation.*;
+
+import com.sun.tools.classfile.*;
+
+public class SyntheticParameters extends ClassfileInspector {
+
+    private static final String Inner_class = "SyntheticParameters$Inner.class";
+    private static final String Foo_class = "SyntheticParameters$Foo.class";
+    private static final Expected Inner_expected =
+        new Expected("SyntheticParameters$Inner",
+                     null,
+                     new ExpectedMethodTypeAnnotation[] {
+                         (ExpectedMethodTypeAnnotation)
+                         // Assert there is no annotation on the
+                         // this$0 parameter.
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "<init>",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             0).setParameterIndex(0).build(),
+                         (ExpectedMethodTypeAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "<init>",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             1).setParameterIndex(1).build(),
+                         (ExpectedMethodTypeAnnotation)
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "foo",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             1).setParameterIndex(0).build(),
+                         (ExpectedMethodTypeAnnotation)
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "foo",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             0).setParameterIndex(1).build()
+                     },
+                     null);
+    private static final Expected Foo_expected =
+        new Expected("SyntheticParameters$Foo",
+                     null,
+                     new ExpectedMethodTypeAnnotation[] {
+                         (ExpectedMethodTypeAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$name parameter.
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "<init>",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             0).setParameterIndex(0).build(),
+                         (ExpectedMethodTypeAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$ordinal parameter.
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "<init>",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             0).setParameterIndex(1).build(),
+                         (ExpectedMethodTypeAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedMethodTypeAnnotation.Builder(
+                             "<init>",
+                             "A",
+                             TypeAnnotation.TargetType.METHOD_FORMAL_PARAMETER,
+                             false,
+                             1).setParameterIndex(2).build()
+                     },
+                     null);
+
+    public static void main(String... args) throws Exception {
+        new SyntheticParameters().run(
+            new ClassFile[] { getClassFile(Inner_class), getClassFile(Foo_class) },
+            new Expected[] { Inner_expected, Foo_expected });
+    }
+
+    public class Inner {
+        public Inner(@A int a) {}
+        public void foo(@A int a, int b) {}
+    }
+
+    public static enum Foo {
+        ONE(null);
+        Foo(@A Object a) {}
+    }
+}
+
+@Target({ElementType.TYPE_USE})
+@interface A {}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Mon Nov 17 09:36:40 2014 +0100
@@ -43,7 +43,7 @@
 
     @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {1, 0})
     @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0})
-    @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("%TEST_CLASS_NAME%$Inner")
     public String innerClass() {
         return "class %TEST_CLASS_NAME% { class Inner {" +
@@ -56,7 +56,7 @@
     @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0})
     @TADescription(annotation = "TC", type = METHOD_RECEIVER)
     @TADescription(annotation = "TD", type = METHOD_RETURN, genericLocation = {1, 0})
-    @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("%TEST_CLASS_NAME%$Inner")
     public String innerClass2() {
         return "class %TEST_CLASS_NAME% { class Inner {" +
@@ -70,7 +70,7 @@
     @TADescription(annotation = "TC", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0})
     @TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0})
     @TADescription(annotation = "TE", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0})
-    @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("Outer$Middle$Inner")
     public String innerClass3() {
         return "class Outer { class Middle { class Inner {" +
@@ -89,7 +89,7 @@
 
     @TADescription(annotation = "RTAs", type = METHOD_RETURN, genericLocation = {1, 0})
     @TADescription(annotation = "RTBs", type = METHOD_RETURN, genericLocation = {1, 0})
-    @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("%TEST_CLASS_NAME%$Inner")
     public String innerClassRepeatableAnnotation() {
         return "class %TEST_CLASS_NAME% { class Inner {" +
@@ -102,7 +102,7 @@
     @TADescription(annotation = "RTBs", type = METHOD_RETURN, genericLocation = {1, 0})
     @TADescription(annotation = "RTCs", type = METHOD_RECEIVER)
     @TADescription(annotation = "RTDs", type = METHOD_RETURN, genericLocation = {1, 0})
-    @TADescription(annotation = "RTEs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "RTEs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("%TEST_CLASS_NAME%$Inner")
     public String innerClassRepeatableAnnotation2() {
         return "class %TEST_CLASS_NAME% { class Inner {" +
@@ -116,7 +116,7 @@
     @TADescription(annotation = "RTCs", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0})
     @TADescription(annotation = "RTDs", type = METHOD_RECEIVER, genericLocation = {1, 0})
     @TADescription(annotation = "RTEs", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0})
-    @TADescription(annotation = "RTFs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    @TADescription(annotation = "RTFs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
     @TestClass("Outer$Middle$Inner")
     public String innerClassRepatableAnnotation3() {
         return "class Outer { class Middle { class Inner {" +
--- a/langtools/test/tools/javac/api/TestContainTypes.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/api/TestContainTypes.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -34,19 +34,20 @@
 import java.util.Set;
 import javax.annotation.processing.AbstractProcessor;
 import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.type.DeclaredType;
 import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.ToolProvider;
 
 import com.sun.source.util.JavacTask;
-import javax.annotation.processing.SupportedSourceVersion;
-import javax.lang.model.SourceVersion;
 
 public class TestContainTypes {
 
@@ -127,22 +128,28 @@
         }
     }
 
+    static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+    static final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
     public static void main(String... args) throws Exception {
-        for (ClassType ctA : ClassType.values()) {
-            for (ParameterType ptA : ParameterType.values()) {
-                for (ClassType ctB : ClassType.values()) {
-                    for (ParameterType ptB : ParameterType.values()) {
-                        compileAndCheck(ptA, ctA, ptB, ctB);
+        try {
+            for (ClassType ctA : ClassType.values()) {
+                for (ParameterType ptA : ParameterType.values()) {
+                    for (ClassType ctB : ClassType.values()) {
+                        for (ParameterType ptB : ParameterType.values()) {
+                            compileAndCheck(ptA, ctA, ptB, ctB);
+                        }
                     }
                 }
             }
+        } finally {
+            fm.close();
         }
     }
 
     static void compileAndCheck(ParameterType ptA, ClassType ctA, ParameterType ptB, ClassType ctB) throws Exception {
         JavaSource source = new JavaSource(ptA.instantiate(ctA), ptB.instantiate(ctB));
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, null,
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, null,
                 null, null, Arrays.asList(source));
         ct.setProcessors(Arrays.asList(new ContainTypesTester(ParameterType.contains(ptA, ctA, ptB, ctB), source)));
         System.err.println("A = " + ptA +" / " + ptA.instantiate(ctA));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,537 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8042931
+ * @summary Checking EnclosingMethod attribute of anonymous/local class.
+ * @library /tools/lib /tools/javac/lib ../lib
+ * @build EnclosingMethodTest TestBase TestResult InMemoryFileManager ToolBox
+ * @run main EnclosingMethodTest
+ */
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.EnclosingMethod_attribute;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Stream;
+
+/**
+ * The test checks the enclosing method attribute of anonymous/local classes.
+ * The top-level class contains the anonymous and local classes to be tested. The test examines
+ * each inner class and determine whether the class should have the EnclosingMethod attribute or not.
+ * Golden information about enclosing methods are held in annotation {@code ExpectedEnclosingMethod}.
+ *
+ * The test assumes that a class must have the EnclosingMethod attribute if the class is annotated or
+ * if its parent class is annotated in case of anonymous class. In addition, classes
+ * named {@code VariableInitializer} are introduced to test variable initializer cases. These classes
+ * must not have the enclosing method attribute, but its anonymous derived class must.
+ * After classification of classes, the test checks whether classes contain the correct enclosing
+ * method attribute in case of anonymous/local class, or checks whether classes do not contain
+ * the EnclosingMethod attribute, otherwise.
+ *
+ * Test cases:
+ *   top-level class as enclosing class:
+ *     1. anonymous and local classes in static initializer;
+ *     2. anonymous and local classes in instance initializer;
+ *     3. anonymous and local classes in lambda;
+ *     4. anonymous and local classes in constructor;
+ *     5. anonymous and local classes in method;
+ *     6. static and instance variable initializer.
+ *
+ *   inner class as enclosing class:
+ *     1. anonymous and local classes in static initializer;
+ *     2. anonymous and local classes in instance initializer;
+ *     3. anonymous and local classes in lambda;
+ *     4. anonymous and local classes in constructor;
+ *     5. anonymous and local classes in method;
+ *     6. static and instance variable initializer.
+ *
+ *   enum as enclosing class:
+ *     1. anonymous and local classes in static initializer;
+ *     2. anonymous and local classes in instance initializer;
+ *     3. anonymous and local classes in lambda;
+ *     4. anonymous and local classes in constructor;
+ *     5. anonymous and local classes in method;
+ *     6. static and instance variable initializer.
+ *
+ *   interface as enclosing class:
+ *     1. anonymous and local classes in lambda;
+ *     2. anonymous and local classes in static method;
+ *     3. anonymous and local classes in default method;
+ *     4. static variable initializer.
+ *
+ *   annotation as enclosing class:
+ *     1. anonymous and local classes in lambda;
+ *     2. static variable initializer.
+ */
+public class EnclosingMethodTest extends TestResult {
+
+    private final Map<Class<?>, ExpectedEnclosingMethod> class2EnclosingMethod = new HashMap<>();
+    private final Set<Class<?>> noEnclosingMethod = new HashSet<>();
+
+    public EnclosingMethodTest() throws ClassNotFoundException {
+        Class<EnclosingMethodTest> outerClass = EnclosingMethodTest.class;
+        String outerClassName = outerClass.getSimpleName();
+        File testClasses = getClassDir();
+        FilenameFilter filter = (dir, name) -> name.matches(outerClassName + ".*\\.class");
+
+        for (File file : testClasses.listFiles(filter)) {
+            Class<?> clazz = Class.forName(file.getName().replace(".class", ""));
+            if (clazz.isAnonymousClass()) {
+                // anonymous class cannot be annotated, information is in its parent class.
+                ExpectedEnclosingMethod declaredAnnotation =
+                        clazz.getSuperclass().getDeclaredAnnotation(ExpectedEnclosingMethod.class);
+                class2EnclosingMethod.put(clazz, declaredAnnotation);
+            } else {
+                ExpectedEnclosingMethod enclosingMethod = clazz.getDeclaredAnnotation(ExpectedEnclosingMethod.class);
+                // if class is annotated and it does not contain information for variable initializer cases,
+                // then it must have the enclosing method attribute.
+                if (enclosingMethod != null && !clazz.getSimpleName().contains("VariableInitializer")) {
+                    class2EnclosingMethod.put(clazz, enclosingMethod);
+                } else {
+                    noEnclosingMethod.add(clazz);
+                }
+            }
+        }
+    }
+
+    public void test() throws TestFailedException {
+        try {
+            testEnclosingMethodAttribute();
+            testLackOfEnclosingMethodAttribute();
+        } finally {
+            checkStatus();
+        }
+    }
+
+    private void testLackOfEnclosingMethodAttribute() {
+        for (Class<?> clazz : noEnclosingMethod) {
+            try {
+                addTestCase("Class should not have EnclosingMethod attribute : " + clazz);
+                ClassFile classFile = readClassFile(clazz);
+                checkEquals(countEnclosingMethodAttributes(classFile),
+                        0l, "number of the EnclosingMethod attribute in the class is zero : "
+                                + classFile.getName());
+            } catch (Exception e) {
+                addFailure(e);
+            }
+        }
+    }
+
+    private void testEnclosingMethodAttribute() {
+        class2EnclosingMethod.forEach((clazz, enclosingMethod) -> {
+            try {
+                String info = enclosingMethod.info() + " "
+                        + (clazz.isAnonymousClass() ? "anonymous" : "local");
+                addTestCase(info);
+                printf("Testing test case : %s\n", info);
+                ClassFile classFile = readClassFile(clazz);
+                String className = clazz.getName();
+                checkEquals(countEnclosingMethodAttributes(classFile), 1l,
+                        "number of the EnclosingMethod attribute in the class is one : "
+                                + clazz);
+                EnclosingMethod_attribute attr = (EnclosingMethod_attribute)
+                        classFile.getAttribute(Attribute.EnclosingMethod);
+
+                if (!checkNotNull(attr, "the EnclosingMethod attribute is not null : " + className)) {
+                    // stop checking, attr is null. test case failed
+                    return;
+                }
+                checkEquals(classFile.constant_pool.getUTF8Value(attr.attribute_name_index),
+                        "EnclosingMethod",
+                        "attribute_name_index of EnclosingMethod attribute in the class : " + className);
+                checkEquals(attr.attribute_length, 4,
+                        "attribute_length of EnclosingMethod attribute in the class : " + className);
+                String expectedClassName = enclosingMethod.enclosingClazz().getName();
+                checkEquals(classFile.constant_pool.getClassInfo(attr.class_index).getName(),
+                        expectedClassName, String.format(
+                        "enclosing class of EnclosingMethod attribute in the class %s is %s",
+                                className, expectedClassName));
+
+                String expectedMethodName = enclosingMethod.enclosingMethod();
+                if (expectedMethodName.isEmpty()) {
+                    // class does not have an enclosing method
+                    checkEquals(attr.method_index, 0, String.format(
+                            "enclosing method of EnclosingMethod attribute in the class %s is null", className));
+                } else {
+                    String methodName = classFile.constant_pool.getNameAndTypeInfo(attr.method_index).getName();
+                    checkTrue(methodName.startsWith(expectedMethodName), String.format(
+                            "enclosing method of EnclosingMethod attribute in the class %s" +
+                                    " is method name %s" +
+                                    ", actual method name is %s",
+                            className, expectedMethodName, methodName));
+                }
+            } catch (Exception e) {
+                addFailure(e);
+            }
+        });
+    }
+
+    private long countEnclosingMethodAttributes(ClassFile classFile) {
+        return Stream.of(classFile.attributes.attrs)
+                .filter(x -> x instanceof EnclosingMethod_attribute)
+                .count();
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface ExpectedEnclosingMethod {
+        String info();
+        Class<?> enclosingClazz();
+        String enclosingMethod() default "";
+    }
+
+    public static void main(String[] args) throws ClassNotFoundException, TestFailedException {
+        new EnclosingMethodTest().test();
+    }
+
+    // Test cases: enclosing class is a top-level class
+    static {
+        // anonymous and local classes in static initializer
+        @ExpectedEnclosingMethod(
+                info = "EnclosingStaticInitialization in EnclosingMethodTest",
+                enclosingClazz = EnclosingMethodTest.class
+        )
+        class EnclosingStaticInitialization {
+        }
+        new EnclosingStaticInitialization() {
+        };
+    }
+
+    {
+        // anonymous and local classes in instance initializer
+        @ExpectedEnclosingMethod(
+                info = "EnclosingInitialization in EnclosingMethodTest",
+                enclosingClazz = EnclosingMethodTest.class
+        )
+        class EnclosingInitialization {
+        }
+        new EnclosingInitialization() {
+        };
+    }
+
+    Runnable lambda = () -> {
+        // anonymous and local classes in lambda
+        @ExpectedEnclosingMethod(
+                info = "EnclosingLambda in EnclosingMethodTest",
+                enclosingMethod = "lambda",
+                enclosingClazz = EnclosingMethodTest.class
+        )
+        class EnclosingLambda {
+        }
+        new EnclosingLambda() {
+        };
+    };
+
+    EnclosingMethodTest(int i) {
+        // anonymous and local classes in constructor
+        @ExpectedEnclosingMethod(
+                info = "EnclosingConstructor in EnclosingMethodTest",
+                enclosingMethod = "<init>",
+                enclosingClazz = EnclosingMethodTest.class
+        )
+        class EnclosingConstructor {
+        }
+        new EnclosingConstructor() {
+        };
+    }
+
+    void method() {
+        // anonymous and local classes in method
+        @ExpectedEnclosingMethod(
+                info = "EnclosingMethod in EnclosingMethodTest",
+                enclosingMethod = "method",
+                enclosingClazz = EnclosingMethodTest.class
+        )
+        class EnclosingMethod {
+        }
+        new EnclosingMethod() {
+        };
+    }
+
+    @ExpectedEnclosingMethod(
+            info = "VariableInitializer in EnclosingMethodTest",
+            enclosingClazz = EnclosingMethodTest.class
+    )
+    static class VariableInitializer {
+    }
+
+    // static variable initializer
+    private static final VariableInitializer cvi = new VariableInitializer() {
+    };
+
+    // instance variable initializer
+    private final VariableInitializer ivi = new VariableInitializer() {
+    };
+
+    // Test cases: enclosing class is an inner class
+    public static class notEnclosing01 {
+        static {
+            // anonymous and local classes in static initializer
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingStaticInitialization in notEnclosing01",
+                    enclosingClazz = notEnclosing01.class
+            )
+            class EnclosingStaticInitialization {
+            }
+            new EnclosingStaticInitialization() {
+            };
+        }
+
+        {
+            // anonymous and local classes in instance initializer
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingInitialization in notEnclosing01",
+                    enclosingClazz = notEnclosing01.class
+            )
+            class EnclosingInitialization {
+            }
+            new EnclosingInitialization() {
+            };
+        }
+
+        Runnable lambda = () -> {
+            // anonymous and local classes in lambda
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingLambda in notEnclosing01",
+                    enclosingMethod = "lambda",
+                    enclosingClazz = notEnclosing01.class
+            )
+            class EnclosingLambda {
+            }
+            new EnclosingLambda() {
+            };
+        };
+
+        notEnclosing01() {
+            // anonymous and local classes in constructor
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingConstructor in notEnclosing01",
+                    enclosingMethod = "<init>",
+                    enclosingClazz = notEnclosing01.class
+            )
+            class EnclosingConstructor {
+            }
+            new EnclosingConstructor() {
+            };
+        }
+
+        void method() {
+            // anonymous and local classes in method
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingMethod in notEnclosing01",
+                    enclosingMethod = "method",
+                    enclosingClazz = notEnclosing01.class
+            )
+            class EnclosingMethod {
+            }
+            new EnclosingMethod() {
+            };
+        }
+
+        @ExpectedEnclosingMethod(
+                info = "VariableInitializer in notEnclosing01",
+                enclosingClazz = notEnclosing01.class
+        )
+        static class VariableInitializer {
+        }
+
+        // static variable initializer
+        private static final VariableInitializer cvi = new VariableInitializer() {
+        };
+
+        // instance variable initializer
+        private final VariableInitializer ivi = new VariableInitializer() {
+        };
+    }
+
+    // Test cases: enclosing class is an interface
+    public interface notEnclosing02 {
+        Runnable lambda = () -> {
+            // anonymous and local classes in lambda
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingLambda in notEnclosing02",
+                    enclosingMethod = "lambda",
+                    enclosingClazz = notEnclosing02.class
+            )
+            class EnclosingLambda {
+            }
+            new EnclosingLambda() {
+            };
+        };
+
+        static void staticMethod() {
+            // anonymous and local classes in static method
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingMethod in notEnclosing02",
+                    enclosingMethod = "staticMethod",
+                    enclosingClazz = notEnclosing02.class
+            )
+            class EnclosingMethod {
+            }
+            new EnclosingMethod() {
+            };
+        }
+
+        default void defaultMethod() {
+            // anonymous and local classes in default method
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingMethod in notEnclosing02",
+                    enclosingMethod = "defaultMethod",
+                    enclosingClazz = notEnclosing02.class
+            )
+            class EnclosingMethod {
+            }
+            new EnclosingMethod() {
+            };
+        }
+
+        @ExpectedEnclosingMethod(
+                info = "VariableInitializer in notEnclosing02",
+                enclosingClazz = notEnclosing02.class
+        )
+        static class VariableInitializer {
+        }
+
+        // static variable initializer
+        VariableInitializer cvi = new VariableInitializer() {
+        };
+    }
+
+    // Test cases: enclosing class is an enum
+    public enum notEnclosing03 {;
+
+        static {
+            // anonymous and local classes in static initializer
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingStaticInitialization in notEnclosing03",
+                    enclosingClazz = notEnclosing03.class
+            )
+            class EnclosingStaticInitialization {
+            }
+            new EnclosingStaticInitialization() {
+            };
+        }
+
+        {
+            // anonymous and local classes in instance initializer
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingInitialization in notEnclosing03",
+                    enclosingClazz = notEnclosing03.class
+            )
+            class EnclosingInitialization {
+            }
+            new EnclosingInitialization() {
+            };
+        }
+
+        Runnable lambda = () -> {
+            // anonymous and local classes in lambda
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingLambda in notEnclosing03",
+                    enclosingMethod = "lambda",
+                    enclosingClazz = notEnclosing03.class
+            )
+            class EnclosingLambda {
+            }
+            new EnclosingLambda() {
+            };
+        };
+
+        notEnclosing03() {
+            // anonymous and local classes in constructor
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingConstructor in notEnclosing03",
+                    enclosingMethod = "<init>",
+                    enclosingClazz = notEnclosing03.class
+            )
+            class EnclosingConstructor {
+            }
+            new EnclosingConstructor() {
+            };
+        }
+
+        void method() {
+            // anonymous and local classes in method
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingMethod in notEnclosing03",
+                    enclosingMethod = "method",
+                    enclosingClazz = notEnclosing03.class
+            )
+            class EnclosingMethod {
+            }
+            new EnclosingMethod() {
+            };
+        }
+
+        @ExpectedEnclosingMethod(
+                info = "VariableInitializer in notEnclosing03",
+                enclosingClazz = notEnclosing03.class
+        )
+        static class VariableInitializer {
+        }
+
+        // static variable initializer
+        private static final VariableInitializer cvi = new VariableInitializer() {
+        };
+
+        // instance variable initializer
+        private final VariableInitializer ivi = new VariableInitializer() {
+        };
+    }
+
+    // Test cases: enclosing class is an annotation
+    public @interface notEnclosing04 {
+        Runnable lambda = () -> {
+            // anonymous and local classes in lambda
+            @ExpectedEnclosingMethod(
+                    info = "EnclosingLambda in notEnclosing04",
+                    enclosingMethod = "lambda",
+                    enclosingClazz = notEnclosing04.class
+            )
+            class EnclosingLambda {
+            }
+            new EnclosingLambda() {
+            };
+        };
+
+        @ExpectedEnclosingMethod(
+                info = "VariableInitializer in notEnclosing04",
+                enclosingClazz = notEnclosing04.class
+        )
+        static class VariableInitializer {
+        }
+
+        // static variable initializer
+        VariableInitializer cvi = new VariableInitializer() {
+        };
+    }
+}
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -74,13 +74,13 @@
         addTestCase(src);
         printf("Testing test case: \n%s\n", src);
         try {
-            ClassFile cf = ClassFile.read(compile(
+            ClassFile cf = readClassFile(compile(
                         new String[]{"package-info.java", package_info},
                         new String[]{"notDeprecated.java", src})
-                    .getClasses().get(CLASS_NAME).openInputStream());
+                    .getClasses().get(CLASS_NAME));
             Deprecated_attribute attr =
                     (Deprecated_attribute) cf.getAttribute(Attribute.Deprecated);
-            assertNull(attr, "Class can not have deprecated attribute : " + CLASS_NAME);
+            checkNull(attr, "Class can not have deprecated attribute : " + CLASS_NAME);
         } catch (Exception e) {
             addFailure(e);
         }
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -240,7 +240,7 @@
                     ? "deprecated"
                     : "notDeprecated";
             echo("Testing outer class : " + outerClassName);
-            ClassFile cf = ClassFile.read(classes.get(outerClassName).openInputStream());
+            ClassFile cf = readClassFile(classes.get(outerClassName));
             Deprecated_attribute attr = (Deprecated_attribute)
                     cf.getAttribute(Attribute.Deprecated);
             testAttribute(outerClassName, attr, cf);
@@ -260,7 +260,7 @@
             String innerClassName = cf.constant_pool.
                     getClassInfo(innerClass.inner_class_info_index).getName();
             echo("Testing inner class : " + innerClassName);
-            ClassFile innerCf = ClassFile.read(classes.get(innerClassName).openInputStream());
+            ClassFile innerCf = readClassFile(classes.get(innerClassName));
             Deprecated_attribute attr = (Deprecated_attribute)
                     innerCf.getAttribute(Attribute.Deprecated);
             String innerClassSimpleName = innerClass.getInnerName(cf.constant_pool);
@@ -298,17 +298,18 @@
         if (name.contains("deprecated")) {
             testDeprecatedAttribute(name, attr, cf);
         } else {
-            assertNull(attr, name + " should not have deprecated attribute");
+            checkNull(attr, name + " should not have deprecated attribute");
         }
     }
 
     private void testDeprecatedAttribute(String name, Deprecated_attribute attr, ClassFile cf)
             throws ConstantPoolException {
-        assertNotNull(attr, name + " must have deprecated attribute");
-        assertEquals(0, attr.attribute_length,
-                "attribute_length should equal to 0");
-        assertEquals("Deprecated",
-                cf.constant_pool.getUTF8Value(attr.attribute_name_index),
-                name + " attribute_name_index");
+        if (checkNotNull(attr, name + " must have deprecated attribute")) {
+            checkEquals(0, attr.attribute_length,
+                    "attribute_length should equal to 0");
+            checkEquals("Deprecated",
+                    cf.constant_pool.getUTF8Value(attr.attribute_name_index),
+                    name + " attribute_name_index");
+        }
     }
 }
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -96,21 +96,21 @@
                 ClassFile cf = readClassFile(currentClassName);
                 InnerClasses_attribute attr = (InnerClasses_attribute)
                         cf.getAttribute(Attribute.InnerClasses);
-                assertNotNull(attr, "Class should not contain "
+                checkNotNull(attr, "Class should not contain "
                         + "inner classes attribute : " + currentClassName);
-                assertTrue(innerClasses.containsKey(currentClassName),
+                checkTrue(innerClasses.containsKey(currentClassName),
                         "map contains class name : " + currentClassName);
                 Set<String> setClasses = innerClasses.get(currentClassName);
                 if (setClasses == null) {
                     continue;
                 }
-                assertEquals(attr.number_of_classes,
+                checkEquals(attr.number_of_classes,
                         setClasses.size(),
                         "Check number of inner classes : " + setClasses);
                 for (Info info : attr.classes) {
                     String innerClassName = info
                             .getInnerClassInfo(cf.constant_pool).getBaseName();
-                    assertTrue(setClasses.contains(innerClassName),
+                    checkTrue(setClasses.contains(innerClassName),
                             currentClassName + " contains inner class : "
                                     + innerClassName);
                     if (visitedClasses.add(innerClassName)) {
@@ -124,10 +124,10 @@
 
             Set<String> a_b = removeAll(visitedClasses, allClasses);
             Set<String> b_a = removeAll(allClasses, visitedClasses);
-            assertEquals(visitedClasses, allClasses,
+            checkEquals(visitedClasses, allClasses,
                     "All classes are found\n"
-                    + "visited - all classes : " + a_b
-                    + "\nall classes - visited : " + b_a);
+                            + "visited - all classes : " + a_b
+                            + "\nall classes - visited : " + b_a);
         } catch (Exception e) {
             addFailure(e);
         } finally {
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -78,16 +78,16 @@
                     continue;
                 }
                 foundClasses.add(innerName);
-                assertEquals(info.outer_class_info_index, 0,
+                checkEquals(info.outer_class_info_index, 0,
                         "outer_class_info_index of " + innerName);
                 if (innerName.matches("\\$\\d+")) {
-                    assertEquals(info.inner_name_index, 0,
+                    checkEquals(info.inner_name_index, 0,
                             "inner_name_index of anonymous class");
                 }
             }
             Set<String> expectedClasses = getInnerClasses();
             expectedClasses.remove("InnerClassesIndexTest$Inner");
-            assertEquals(foundClasses, expectedClasses, "All classes are found");
+            checkEquals(foundClasses, expectedClasses, "All classes are found");
         } catch (Exception e) {
             addFailure(e);
         } finally {
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java	Mon Nov 17 09:36:40 2014 +0100
@@ -202,44 +202,44 @@
                     ++count;
                 }
             }
-            assertEquals(1, count, "Number of inner classes attribute");
-            if (innerClasses == null) {
+            checkEquals(1, count, "Number of inner classes attribute");
+            if (!checkNotNull(innerClasses, "InnerClasses attribute should not be null")) {
                 return;
             }
-            assertEquals(cf.constant_pool.
+            checkEquals(cf.constant_pool.
                     getUTF8Info(innerClasses.attribute_name_index).value, "InnerClasses",
                     "innerClasses.attribute_name_index");
             // Inner Classes attribute consists of length (2 bytes)
             // and 8 bytes for each inner class's entry.
-            assertEquals(innerClasses.attribute_length,
+            checkEquals(innerClasses.attribute_length,
                     2 + 8 * class2Flags.size(), "innerClasses.attribute_length");
-            assertEquals(innerClasses.number_of_classes,
+            checkEquals(innerClasses.number_of_classes,
                     class2Flags.size(), "innerClasses.number_of_classes");
             Set<String> visitedClasses = new HashSet<>();
             for (Info e : innerClasses.classes) {
                 String baseName = cf.constant_pool.getClassInfo(
                         e.inner_class_info_index).getBaseName();
                 if (cf.major_version >= 51 && e.inner_name_index == 0) {
-                    assertEquals(e.outer_class_info_index, 0,
-                        "outer_class_info_index "
-                                + "in case of inner_name_index is zero : "
-                                + baseName);
+                    checkEquals(e.outer_class_info_index, 0,
+                            "outer_class_info_index "
+                                    + "in case of inner_name_index is zero : "
+                                    + baseName);
                 }
                 String className = baseName.replaceFirst(".*\\$", "");
-                assertTrue(class2Flags.containsKey(className),
+                checkTrue(class2Flags.containsKey(className),
                         className);
-                assertTrue(visitedClasses.add(className),
+                checkTrue(visitedClasses.add(className),
                         "there are no duplicates in attribute : " + className);
-                assertEquals(e.inner_class_access_flags.getInnerClassFlags(),
+                checkEquals(e.inner_class_access_flags.getInnerClassFlags(),
                         class2Flags.get(className),
                         "inner_class_access_flags " + className);
                 if (!Arrays.asList(skipClasses).contains(className)) {
-                        assertEquals(
-                            cf.constant_pool.getClassInfo(e.inner_class_info_index).getBaseName(),
-                            classToTest + "$" + className,
-                            "inner_class_info_index of " + className);
+                        checkEquals(
+                                cf.constant_pool.getClassInfo(e.inner_class_info_index).getBaseName(),
+                                classToTest + "$" + className,
+                                "inner_class_info_index of " + className);
                     if (e.outer_class_info_index > 0) {
-                        assertEquals(
+                        checkEquals(
                                 cf.constant_pool.getClassInfo(e.outer_class_info_index).getName(),
                                 classToTest,
                                 "outer_class_info_index of " + className);
--- a/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,10 +25,7 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -78,8 +75,8 @@
     /**
      * Compiles sources in memory.
      *
-     * @param sources to compile.
-     * @return memory file manager which contains class files and class loader.
+     * @param sources to compile
+     * @return in-memory file manager which contains class files and class loader
      */
     public InMemoryFileManager compile(String... sources)
             throws IOException, CompilationException {
@@ -91,7 +88,7 @@
      *
      * @param options compiler options.
      * @param sources sources to compile.
-     * @return map where key is className, value is corresponding ClassFile.
+     * @return in-memory file manager which contains class files and class loader.
      */
     public InMemoryFileManager compile(List<String> options, String... sources)
             throws IOException, CompilationException {
@@ -102,7 +99,7 @@
      * Compiles sources in memory.
      *
      * @param sources sources[i][0] - name of file, sources[i][1] - sources.
-     * @return map where key is className, value is corresponding ClassFile.
+     * @return in-memory file manager which contains class files and class loader.
      */
     public InMemoryFileManager compile(String[]... sources) throws IOException,
             CompilationException {
@@ -114,7 +111,7 @@
      *
      * @param options compiler options
      * @param sources sources[i][0] - name of file, sources[i][1] - sources.
-     * @return map where key is className, value is corresponding ClassFile.
+     * @return in-memory file manager which contains class files and class loader.
      */
     public InMemoryFileManager compile(List<String> options, String[]... sources)
             throws IOException, CompilationException {
@@ -142,7 +139,9 @@
      * @throws ConstantPoolException if constant pool error occurs
      */
     public ClassFile readClassFile(JavaFileObject fileObject) throws IOException, ConstantPoolException {
-        return readClassFile(fileObject.openInputStream());
+        try (InputStream is = fileObject.openInputStream()) {
+            return readClassFile(is);
+        }
     }
 
     /**
@@ -205,6 +204,12 @@
         assertEquals(actual, false, message);
     }
 
+    public void assertContains(Set<?> found, Set<?> expected, String message) {
+        Set<?> copy = new HashSet<>(expected);
+        copy.removeAll(found);
+        assertTrue(found.containsAll(expected), message + " : " + copy);
+    }
+
     public File getSourceDir() {
         return new File(System.getProperty("test.src", "."));
     }
--- a/langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,10 +24,7 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.*;
-import java.util.stream.Stream;
-
-import static java.lang.String.format;
-import static java.util.stream.Collectors.joining;
+import java.util.stream.Collectors;
 
 /**
  * This class accumulates test results. Test results can be checked with method @{code checkStatus}.
@@ -52,39 +49,46 @@
 
     private String errorMessage() {
         return testCases.stream().filter(Info::isFailed)
-                .map(tc -> format("Failure in test case:\n%s\n%s", tc.info(), tc.getMessage()))
-                .collect(joining("\n"));
+                .map(tc -> String.format("Failure in test case:\n%s\n%s", tc.info(), tc.getMessage()))
+                .collect(Collectors.joining("\n"));
     }
 
-    @Override
-    public void assertEquals(Object actual, Object expected, String message) {
-        getLastTestCase().assertEquals(actual, expected, message);
+    public boolean checkEquals(Object actual, Object expected, String message) {
+        echo("Testing : " + message);
+        if (!Objects.equals(actual, expected)) {
+            getLastTestCase().addAssert(new AssertionFailedException(
+                    String.format("%s%nGot: %s, Expected: %s", message, actual, expected)));
+            return false;
+        }
+        return true;
     }
 
-    @Override
-    public void assertNull(Object actual, String message) {
-        getLastTestCase().assertEquals(actual, null, message);
+    public boolean checkNull(Object actual, String message) {
+        return checkEquals(actual, null, message);
     }
 
-    @Override
-    public void assertNotNull(Object actual, String message) {
-        getLastTestCase().assertNotNull(actual, message);
-    }
-
-    @Override
-    public void assertFalse(boolean actual, String message) {
-        getLastTestCase().assertEquals(actual, false, message);
+    public boolean checkNotNull(Object actual, String message) {
+        echo("Testing : " + message);
+        if (Objects.isNull(actual)) {
+            getLastTestCase().addAssert(new AssertionFailedException(
+                    message + " : Expected not null value"));
+            return false;
+        }
+        return true;
     }
 
-    @Override
-    public void assertTrue(boolean actual, String message) {
-        getLastTestCase().assertEquals(actual, true, message);
+    public boolean checkFalse(boolean actual, String message) {
+        return checkEquals(actual, false, message);
     }
 
-    public void assertContains(Set<?> found, Set<?> expected, String message) {
+    public boolean checkTrue(boolean actual, String message) {
+        return checkEquals(actual, true, message);
+    }
+
+    public boolean checkContains(Set<?> found, Set<?> expected, String message) {
         Set<?> copy = new HashSet<>(expected);
         copy.removeAll(found);
-        assertTrue(found.containsAll(expected), message + " : " + copy);
+        return checkTrue(found.containsAll(expected), message + " : " + copy);
     }
 
     public void addFailure(Throwable th) {
@@ -99,10 +103,10 @@
     }
 
     /**
-     * Throws {@code TestFailedException} if one of the asserts are failed
+     * Throws {@code TestFailedException} if one of the checks are failed
      * or an exception occurs. Prints error message of failed test cases.
      *
-     * @throws TestFailedException if one of the asserts are failed
+     * @throws TestFailedException if one of the checks are failed
      *                             or an exception occurs
      */
     public void checkStatus() throws TestFailedException {
@@ -115,7 +119,7 @@
     private class Info {
 
         private final String info;
-        private final List<String> asserts;
+        private final List<AssertionFailedException> asserts;
         private final List<Throwable> errors;
 
         private Info(String info) {
@@ -137,45 +141,20 @@
             printf("[ERROR] : %s\n", getStackTrace(th));
         }
 
-        public void addFailure(String message) {
-            String stackTrace = Stream.of(Thread.currentThread().getStackTrace())
-                    // just to get stack trace without TestResult and Thread
-                    .filter(e -> !"TestResult.java".equals(e.getFileName()) &&
-                            !"java.lang.Thread".equals(e.getClassName()))
-                    .map(e -> "\tat " + e)
-                    .collect(joining("\n"));
-            asserts.add(format("%s\n%s", message, stackTrace));
-            printf("[ASSERT] : %s\n", message);
-        }
-
-        public void assertEquals(Object actual, Object expected, String message) {
-            echo("Testing : " + message);
-            if (!Objects.equals(actual, expected)) {
-                addFailure(message + ": Got: " + actual + ", " + "Expected: " + expected);
-            }
-        }
-
-        public void assertNotNull(Object actual, String message) {
-            echo("Testing : " + message);
-            if (actual == null) {
-                addFailure(message + " : Expected not null value");
-            }
+        public void addAssert(AssertionFailedException e) {
+            asserts.add(e);
+            printf("[ASSERT] : %s\n", getStackTrace(e));
         }
 
         public String getMessage() {
-            return (asserts.size() > 0 ? getAssertMessage() + "\n" : "") + getErrorMessage();
+            return (asserts.size() > 0 ? getErrorMessage("[ASSERT]", asserts) + "\n" : "")
+                    + getErrorMessage("[ERROR]", errors);
         }
 
-        public String getAssertMessage() {
-            return asserts.stream()
-                    .map(failure -> "[ASSERT] : " + failure)
-                    .collect(joining("\n"));
-        }
-
-        public String getErrorMessage() {
-            return errors.stream()
-                    .map(throwable -> format("[ERROR] : %s", getStackTrace(throwable)))
-                    .collect(joining("\n"));
+        public String getErrorMessage(String header, List<? extends Throwable> list) {
+            return list.stream()
+                    .map(throwable -> String.format("%s : %s", header, getStackTrace(throwable)))
+                    .collect(Collectors.joining("\n"));
         }
 
         public String getStackTrace(Throwable throwable) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/conditional/8064464/T8064464.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,23 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8064464
+ * @summary regression with type inference of conditional expression
+ * @compile/fail/ref=T8064464.out -XDrawDiagnostics T8064464.java
+ */
+
+import java.util.List;
+
+class T8064464 {
+
+  String f(Object o) { return null; }
+  Integer f(int i) { return null; }
+
+  <X extends Integer> X id() { return null; }
+
+  void m(List<Integer> lx) {
+    Integer i1 = f(!lx.isEmpty() ? 0 : lx.get(0)); //ok --> f(int)
+    Integer i2 = f(!lx.isEmpty() ? lx.get(0) : 0); //ok --> f(int)
+    f(!lx.isEmpty() ? id() : 0); // ambiguous
+    f(!lx.isEmpty() ? 0 : id()); // ambiguous
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/conditional/8064464/T8064464.out	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,3 @@
+T8064464.java:20:5: compiler.err.ref.ambiguous: f, kindname.method, f(java.lang.Object), T8064464, kindname.method, f(int), T8064464
+T8064464.java:21:5: compiler.err.ref.ambiguous: f, kindname.method, f(java.lang.Object), T8064464, kindname.method, f(int), T8064464
+2 errors
--- a/langtools/test/tools/javac/diags/ArgTypeCompilerFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/diags/ArgTypeCompilerFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -100,14 +100,18 @@
             JavacTool tool = JavacTool.create();
 
             StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
-            if (fmOpts != null)
-                fm = new FileManager(fm, fmOpts);
+            try {
+                if (fmOpts != null)
+                    fm = new FileManager(fm, fmOpts);
+
+                Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
 
-            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
-
-            Context c = initContext();
-            JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos, c);
-            return t.call();
+                Context c = initContext();
+                JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos, c);
+                return t.call();
+            } finally {
+                close(fm);
+            }
         }
     }
 
@@ -136,9 +140,14 @@
             Main main = new Main("javac", out);
             Context c = initContext();
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
-            Main.Result result = main.compile(args.toArray(new String[args.size()]), c);
+
+            try {
+                Main.Result result = main.compile(args.toArray(new String[args.size()]), c);
 
-            return result.isOK();
+                return result.isOK();
+            } finally {
+                close(c.get(JavaFileManager.class));
+            }
         }
     }
 
@@ -160,10 +169,15 @@
 
             Context c = initContext();
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
-            Main m = new Main("javac", out);
-            Main.Result result = m.compile(args.toArray(new String[args.size()]), c);
+
+            try {
+                Main m = new Main("javac", out);
+                Main.Result result = m.compile(args.toArray(new String[args.size()]), c);
 
-            return result.isOK();
+                return result.isOK();
+            } finally {
+                close(c.get(JavaFileManager.class));
+            }
         }
     }
 
--- a/langtools/test/tools/javac/diags/Example.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/diags/Example.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -31,6 +31,7 @@
 import javax.tools.DiagnosticCollector;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
@@ -311,24 +312,24 @@
 
         static class DefaultFactory implements Factory {
             public Compiler getCompiler(List<String> opts, boolean verbose) {
-            String first;
-            String[] rest;
-                if (opts == null || opts.isEmpty()) {
-                first = null;
-                rest = new String[0];
-            } else {
-                first = opts.get(0);
-                rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
+                String first;
+                String[] rest;
+                    if (opts == null || opts.isEmpty()) {
+                    first = null;
+                    rest = new String[0];
+                } else {
+                    first = opts.get(0);
+                    rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
+                }
+                if (first == null || first.equals("jsr199"))
+                    return new Jsr199Compiler(verbose, rest);
+                else if (first.equals("simple"))
+                    return new SimpleCompiler(verbose);
+                else if (first.equals("backdoor"))
+                    return new BackdoorCompiler(verbose);
+                else
+                    throw new IllegalArgumentException(first);
             }
-            if (first == null || first.equals("jsr199"))
-                return new Jsr199Compiler(verbose, rest);
-            else if (first.equals("simple"))
-                return new SimpleCompiler(verbose);
-            else if (first.equals("backdoor"))
-                return new BackdoorCompiler(verbose);
-            else
-                throw new IllegalArgumentException(first);
-                }
         }
 
         static Factory factory;
@@ -351,6 +352,14 @@
             loader = cl;
         }
 
+        protected void close(JavaFileManager fm) {
+            try {
+                fm.close();
+            } catch (IOException e) {
+                throw new Error(e);
+            }
+        }
+
         protected ClassLoader loader;
         protected boolean verbose;
     }
@@ -399,21 +408,25 @@
             JavaCompiler c = ToolProvider.getSystemJavaCompiler();
 
             StandardJavaFileManager fm = c.getStandardFileManager(dc, null, null);
-            if (fmOpts != null)
-                fm = new FileManager(fm, fmOpts);
+            try {
+                if (fmOpts != null)
+                    fm = new FileManager(fm, fmOpts);
 
-            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
+                Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
 
-            CompilationTask t = c.getTask(out, fm, dc, opts, null, fos);
-            Boolean ok = t.call();
+                CompilationTask t = c.getTask(out, fm, dc, opts, null, fos);
+                Boolean ok = t.call();
 
-            if (keys != null) {
-                for (Diagnostic<? extends JavaFileObject> d: dc.getDiagnostics()) {
-                    scanForKeys(unwrap(d), keys);
+                if (keys != null) {
+                    for (Diagnostic<? extends JavaFileObject> d: dc.getDiagnostics()) {
+                        scanForKeys(unwrap(d), keys);
+                    }
                 }
+
+                return ok;
+            } finally {
+                close(fm);
             }
-
-            return ok;
         }
 
         /**
@@ -526,14 +539,19 @@
             Context c = new Context();
             JavacFileManager.preRegister(c); // can't create it until Log has been set up
             MessageTracker.preRegister(c, keys);
-            Main m = new Main("javac", pw);
-            Main.Result rc = m.compile(args.toArray(new String[args.size()]), c);
+
+            try {
+                Main m = new Main("javac", pw);
+                Main.Result rc = m.compile(args.toArray(new String[args.size()]), c);
 
-            if (keys != null) {
-                pw.close();
+                if (keys != null) {
+                    pw.close();
+                }
+
+                return rc.isOK();
+            } finally {
+                close(c.get(JavaFileManager.class));
             }
-
-            return rc.isOK();
         }
 
         static class MessageTracker extends JavacMessages {
--- a/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,9 +24,9 @@
 // key: compiler.err.neither.conditional.subtype
 
 class NeitherConditionalSubtype {
-    public int test(Object o) {
+    public int test(boolean cond, Object o) {
         // Should fail to compile since Object.wait() has a void return type.
-        System.out.println(o instanceof String ? o.hashCode() : o.wait());
+        (o instanceof String ? o.hashCode() : o.wait()).toString();
         return 0;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PluginNotFound.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// key: compiler.err.plugin.not.found
+// options: -Xplugin:MissingPlugin
+
+class PluginNotFound { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6987475/T6987475neg.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6987475
+ *
+ * @summary Order of declarations affects whether abstract method considered overridden
+ * @compile/fail/ref=T6987475neg.out -XDrawDiagnostics T6987475neg.java
+ */
+
+class T6987475neg {
+    static abstract class Base<A> {
+        public void go(String s) { }
+        public abstract void go(A a);
+    }
+
+    static abstract class BaseReverse<A> {
+        public abstract void go(A a);
+        public void go(String s) { }
+    }
+
+    static abstract class Sub<A> extends Base<A> {
+        public abstract void go(A a);
+    }
+    static abstract class SubReverse<A> extends BaseReverse<A> {
+        public abstract void go(A a);
+    }
+
+    static class Impl1 extends Sub<String> { }
+    static class Impl2 extends SubReverse<String> { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6987475/T6987475neg.out	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,3 @@
+T6987475neg.java:27:12: compiler.err.does.not.override.abstract: T6987475neg.Impl1, go(java.lang.String), T6987475neg.Sub
+T6987475neg.java:28:12: compiler.err.does.not.override.abstract: T6987475neg.Impl2, go(java.lang.String), T6987475neg.SubReverse
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6987475/T6987475pos.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/*
+ * @test
+ * @bug 6987475
+ *
+ * @summary Order of declarations affects whether abstract method considered overridden
+ * @compile T6987475pos.java
+ */
+
+class T6987475pos {
+    static abstract class Base<A> {
+        public void go(String s) { }
+        public abstract void go(A a);
+    }
+
+    static abstract class BaseReverse<A> {
+        public abstract void go(A a);
+        public void go(String s) { }
+    }
+
+    static class Impl1 extends Base<String> { }
+    static class Impl2 extends BaseReverse<String> { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8062977/T8062977.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8062977
+ * @summary Inference: NullPointerException during bound incorporation
+ *
+ * @compile/fail/ref=T8062977.out -XDrawDiagnostics T8062977.java
+ */
+
+import java.util.List;
+
+class T8062977 {
+    <T extends B, B> T m(Class<B> cb) { return null; }
+
+    void test1(Class<Iterable<?>> cb) {
+        List<Integer>[] r1 = m(cb); //fail
+        List<Integer> r2 = m(cb); //ok
+    }
+
+    void test2(Class<Iterable<?>[]> cb) {
+        List<Integer>[] r1 = m(cb); //ok
+        List<Integer> r2 = m(cb); //fail
+    }
+
+    void test3(Class<Iterable<?>[][]> cb) {
+        List<Integer>[][] r1 = m(cb); //ok
+        List<Integer>[] r2 = m(cb); //fail
+        List<Integer> r3 = m(cb); //fail
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8062977/T8062977.out	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,5 @@
+T8062977.java:15:31: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<java.lang.Integer>[]&java.lang.Iterable<?>, java.util.List<java.lang.Integer>[],java.lang.Iterable<?>,java.lang.Object)
+T8062977.java:21:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Iterable<?>[]&java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>,java.lang.Iterable<?>[],java.lang.Object)
+T8062977.java:26:31: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<java.lang.Integer>[], java.util.List<java.lang.Integer>[],java.lang.Iterable<?>[][],java.lang.Object)
+T8062977.java:27:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Iterable<?>[][]&java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>,java.lang.Iterable<?>[][],java.lang.Object)
+4 errors
--- a/langtools/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -35,6 +35,7 @@
 import java.util.Arrays;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.ToolProvider;
@@ -206,9 +207,8 @@
         String clientFileStr = clientSourceFile.toString();
         System.out.println(clientFileStr.substring(0, clientFileStr.indexOf("\n\n")));
 
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, dc, null, null, Arrays.asList(samSourceFile, clientSourceFile));
+        JavacTask ct = (JavacTask)comp.getTask(null, fm, dc, null, null, Arrays.asList(samSourceFile, clientSourceFile));
         try {
             ct.analyze();
         } catch (Exception e) {
@@ -255,6 +255,9 @@
     ReturnValue returnValue;
     static int count = 0;
 
+    static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+    static JavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
     SamConversionComboTest(FInterface f, Context c, LambdaBody lb, LambdaKind lk, ReturnValue rv) {
         fInterface = f;
         context = c;
@@ -264,17 +267,21 @@
     }
 
     public static void main(String[] args) throws Exception {
-        for(Context ct : Context.values()) {
-            for (FInterface fi : FInterface.values()) {
-                for (LambdaKind lk: LambdaKind.values()) {
-                    for (LambdaBody lb : LambdaBody.values()) {
-                        for(ReturnValue rv : ReturnValue.values()) {
-                            new SamConversionComboTest(fi, ct, lb, lk, rv).test();
+        try {
+            for(Context ct : Context.values()) {
+                for (FInterface fi : FInterface.values()) {
+                    for (LambdaKind lk: LambdaKind.values()) {
+                        for (LambdaBody lb : LambdaBody.values()) {
+                            for(ReturnValue rv : ReturnValue.values()) {
+                                new SamConversionComboTest(fi, ct, lb, lk, rv).test();
+                            }
                         }
                     }
                 }
             }
+        System.out.println("total tests: " + count);
+        } finally {
+            fm.close();
         }
-        System.out.println("total tests: " + count);
     }
 }
--- a/langtools/test/tools/javac/parser/JavacParserTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -67,17 +67,23 @@
 import javax.tools.DiagnosticCollector;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.ToolProvider;
 
 public class JavacParserTest extends TestCase {
     static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+    static final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
 
     private JavacParserTest(){}
 
     public static void main(String... args) throws Exception {
-        new JavacParserTest().run(args);
+        try {
+            new JavacParserTest().run(args);
+        } finally {
+            fm.close();
+        }
     }
 
     class MyFileObject extends SimpleJavaFileObject {
@@ -103,7 +109,7 @@
 
     CompilationUnitTree getCompilationUnitTree(String code) throws IOException {
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         return cut;
@@ -129,7 +135,7 @@
 
         String code = "package test; public class Test {public Test() {super();}}";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         SourcePositions pos = Trees.instance(ct).getSourcePositions();
@@ -168,7 +174,7 @@
         final String theString = "public";
         String code = "package test; " + theString + " enum Test {A;}";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         SourcePositions pos = Trees.instance(ct).getSourcePositions();
@@ -191,7 +197,7 @@
                 "class d {} private void method() { " +
                 "Object o = " + theString + "; } }";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         SourcePositions pos = Trees.instance(ct).getSourcePositions();
@@ -238,7 +244,7 @@
         final List<Diagnostic<? extends JavaFileObject>> errors =
                 new LinkedList<Diagnostic<? extends JavaFileObject>>();
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm,
                 new DiagnosticListener<JavaFileObject>() {
             public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 errors.add(diagnostic);
@@ -261,7 +267,7 @@
 
         String code = "\n@interface Test {}";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         CompilationUnitTree cut = ct.parse().iterator().next();
@@ -300,7 +306,7 @@
         final List<Diagnostic<? extends JavaFileObject>> errors =
                 new LinkedList<Diagnostic<? extends JavaFileObject>>();
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm,
                 new DiagnosticListener<JavaFileObject>() {
 
             public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
@@ -443,7 +449,7 @@
         final List<Diagnostic<? extends JavaFileObject>> errors =
                 new LinkedList<Diagnostic<? extends JavaFileObject>>();
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm,
                 new DiagnosticListener<JavaFileObject>() {
                     public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                         errors.add(diagnostic);
@@ -482,7 +488,7 @@
 
         String code = "package t; class Test { <T> void t() {} }";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
@@ -505,7 +511,7 @@
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<JavaFileObject>();
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         ct.parse();
@@ -529,7 +535,7 @@
                 "if (name != null) class X {} } }";
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<JavaFileObject>();
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         ct.parse();
@@ -552,7 +558,7 @@
                 "if (true) abstract class F {} }}";
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<JavaFileObject>();
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         ct.parse();
@@ -575,7 +581,7 @@
                 "if (name != null) interface X {} } }";
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<JavaFileObject>();
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         ct.parse();
@@ -598,7 +604,7 @@
                 "if (true) } }";
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<JavaFileObject>();
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         ct.parse();
@@ -620,7 +626,7 @@
 
         String code = "\nclass Test { { System.err.println(0e); } }";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         assertNotNull(ct.parse().iterator().next());
@@ -820,7 +826,7 @@
                     + "        };\n"
                     + "    }\n"
                     + "}";
-            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null,
                     null, null, Arrays.asList(new MyFileObject(code)));
             CompilationUnitTree cut = ct.parse().iterator().next();
 
@@ -861,7 +867,7 @@
                     + "    }\n"
                     + "}";
 
-            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null,
                     null, null, Arrays.asList(new MyFileObject(code)));
             CompilationUnitTree cut = ct.parse().iterator().next();
 
@@ -886,7 +892,7 @@
 
         String code = "package t; enum Test { AAA; }";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
                 null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
@@ -905,7 +911,7 @@
                 "}";
         DiagnosticCollector<JavaFileObject> coll =
                 new DiagnosticCollector<>();
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null,
                 null, Arrays.asList(new MyFileObject(code)));
 
         CompilationUnitTree cut = ct.parse().iterator().next();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/plugin/missing/PluginNotFound.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 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
+ * @bug 8063039
+ * @summary incorrect message reference or broken message file
+ * @compile/fail/ref=PluginNotFound.out -Xplugin:MissingPlugin PluginNotFound.java
+ */
+
+class PluginNotFound { }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/plugin/missing/PluginNotFound.out	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,2 @@
+error: plug-in not found: MissingPlugin
+1 error
--- a/langtools/test/tools/javac/plugin/showtype/Test.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/plugin/showtype/Test.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,9 @@
 /**
  *  @test
  *  @bug 8001098 8004961 8004082
+ *  @library /tools/lib
+ *  @build ToolBox
+ *  @run main Test
  *  @summary Provide a simple light-weight "plug-in" mechanism for javac
  */
 
@@ -58,14 +61,16 @@
     final List<String> ref2;
     final JavaCompiler compiler;
     final StandardJavaFileManager fm;
+    ToolBox tb = new ToolBox();
 
     Test() throws Exception {
-        testSrc = new File(System.getProperty("test.src"));
+        testSrc = new File(tb.testSrc);
         pluginSrc = new File(testSrc, "ShowTypePlugin.java");
         pluginClasses = new File("plugin");
+        tb.createDirectories(pluginClasses.toPath());
         pluginJar = new File("plugin.jar");
-        ref1 = readFile(testSrc, "Identifiers.out");
-        ref2 = readFile(testSrc, "Identifiers_PI.out");
+        ref1 = tb.readAllLines((new File(testSrc,"Identifiers.out")).toPath());
+        ref2 = tb.readAllLines((new File(testSrc,"Identifiers_PI.out")).toPath());
         compiler = ToolProvider.getSystemJavaCompiler();
         fm = compiler.getStandardFileManager(null, null, null);
     }
@@ -74,11 +79,15 @@
         try {
             // compile the plugin explicitly, to a non-standard directory
             // so that we don't find it on the wrong path by accident
-            pluginClasses.mkdirs();
-            compile("-d", pluginClasses.getPath(), pluginSrc.getPath());
-            writeFile(new File(pluginClasses, "META-INF/services/com.sun.source.util.Plugin"),
-                    "ShowTypePlugin\n");
-            jar("cf", pluginJar.getPath(), "-C", pluginClasses.getPath(), ".");
+            tb.new JavacTask()
+              .options("-d", pluginClasses.getPath())
+              .files(pluginSrc.getPath())
+              .run();
+
+            File plugin = new File(pluginClasses.getPath(), "META-INF/services/com.sun.source.util.Plugin");
+            tb.writeFile(plugin.getPath(), "ShowTypePlugin\n");
+            tb.new JarTask()
+              .run("cf", pluginJar.getPath(), "-C", pluginClasses.getPath(), ".");
 
             testCommandLine("-Xplugin:showtype", ref1);
             testCommandLine("-Xplugin:showtype PI", ref2);
@@ -100,14 +109,13 @@
         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(identifiers);
 
         System.err.println("test api: " + options + " " + files);
-
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        boolean ok = compiler.getTask(pw, fm, null, options, null, files).call();
-        String out = sw.toString();
-        System.err.println(out);
-        if (!ok)
-            error("testCommandLine: compilation failed");
+        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.API)
+                                  .fileManager(fm)
+                                  .options(opt)
+                                  .files(identifiers.toPath())
+                                  .run(ToolBox.Expect.SUCCESS)
+                                  .writeAll();
+        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
         checkOutput(out, ref);
     }
 
@@ -120,14 +128,11 @@
             identifiers.getPath() };
 
         System.err.println("test command line: " + Arrays.asList(args));
-
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        int rc = com.sun.tools.javac.Main.compile(args, pw);
-        String out = sw.toString();
-        System.err.println(out);
-        if (rc != 0)
-            error("testCommandLine: compilation failed");
+        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+                                  .options(args)
+                                  .run(ToolBox.Expect.SUCCESS)
+                                  .writeAll();
+        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
         checkOutput(out, ref);
     }
 
@@ -140,31 +145,6 @@
         }
     }
 
-    private void compile(String... args) throws Exception {
-        System.err.println("compile: " + Arrays.asList(args));
-        int rc = com.sun.tools.javac.Main.compile(args);
-        if (rc != 0)
-            throw new Exception("compiled failed, rc=" + rc);
-    }
-
-    private void jar(String... args) throws Exception {
-        System.err.println("jar: " + Arrays.asList(args));
-        boolean ok = new sun.tools.jar.Main(System.out, System.err, "jar").run(args);
-        if (!ok)
-            throw new Exception("jar failed");
-    }
-
-    private List<String> readFile(File dir, String name) throws IOException {
-        return Files.readAllLines(new File(dir, name).toPath(), Charset.defaultCharset());
-    }
-
-    private void writeFile(File f, String body) throws IOException {
-        f.getParentFile().mkdirs();
-        try (FileWriter out = new FileWriter(f)) {
-            out.write(body);
-        }
-    }
-
     private void error(String msg) {
         System.err.println(msg);
         errors++;
--- a/langtools/test/tools/javac/processing/model/type/BoundsTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/processing/model/type/BoundsTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,7 +25,6 @@
  * @test
  * @bug 6499673
  * @library /tools/javac/lib
- * @ignore 8062245 Test executes incorrect class
  * @build JavacTestingAbstractProcessor BoundsTest
  * @run main BoundsTest
  * @summary Assertion check for TypeVariable.getUpperBound() fails
@@ -86,8 +85,8 @@
     };
     private static final String[] NoBounds_supers = {};
 
-    private HashSet<CharSequence> expected_bounds;
-    private HashSet<CharSequence> expected_supers;
+    private HashSet<String> expected_bounds;
+    private HashSet<String> expected_supers;
 
     private static final File classesdir = new File("intersectionproperties");
     private static final JavaCompiler comp =
@@ -99,8 +98,8 @@
                        final String[] Test_bounds, final String[] Test_supers)
         throws IOException {
         System.err.println("Testing " + Test_name);
-        expected_bounds = new HashSet<CharSequence>(Arrays.asList(Test_bounds));
-        expected_supers = new HashSet<CharSequence>(Arrays.asList(Test_supers));
+        expected_bounds = new HashSet<>(Arrays.asList(Test_bounds));
+        expected_supers = new HashSet<>(Arrays.asList(Test_supers));
         final Iterable<? extends JavaFileObject> files =
             fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents)));
         final JavacTask ct =
@@ -130,7 +129,7 @@
     }
 
     public static void main(String... args) throws IOException {
-        new IntersectionPropertiesTest().run();
+        new BoundsTest().run();
     }
 
     private static File writeFile(File dir, String path, String body)
@@ -166,18 +165,17 @@
             final List<? extends TypeMirror> bounds = typeParameterElement.getBounds();
             final List<? extends TypeMirror> supers = processingEnv.getTypeUtils().directSupertypes(upperBound);
 
-            final HashSet<CharSequence> actual_bounds = new HashSet<CharSequence>();
-            final HashSet<CharSequence> actual_supers = new HashSet<CharSequence>();
+            final HashSet<String> actual_bounds = new HashSet<>();
+            final HashSet<String> actual_supers = new HashSet<>();
 
             for(TypeMirror ty : bounds) {
-                actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName());
+                actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName().toString());
             }
 
             for(TypeMirror ty : supers) {
-                actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName());
+                actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName().toString());
             }
 
-
             if (!expected_bounds.equals(actual_bounds)) {
                 System.err.println("Mismatched expected and actual bounds.");
                 System.err.println("Expected:");
@@ -190,7 +188,7 @@
             }
 
             if (!expected_supers.equals(actual_supers)) {
-                System.err.println("Mismatched expected and actual bounds.");
+                System.err.println("Mismatched expected and actual supers.");
                 System.err.println("Expected:");
                 for(CharSequence tm : expected_supers)
                     System.err.println("  " + tm);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/scope/DupUnsharedTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2014, 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
+ * @summary WriteableScope.dupUnshared not working properly for shared Scopes.
+ */
+
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.*;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.file.JavacFileManager;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Objects;
+import java.util.Set;
+
+public class DupUnsharedTest {
+    public static void main(String... args) throws Exception {
+        new DupUnsharedTest().run();
+    }
+
+    Context context;
+    Names names;
+    Symtab symtab;
+    Name a;
+    Name b;
+    int errors;
+
+    public DupUnsharedTest() {
+        context = new Context();
+        JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
+        names = Names.instance(context);
+        symtab = Symtab.instance(context);
+        a = names.fromString("a");
+        b = names.fromString("b");
+    }
+
+    void run() throws Exception {
+        runScopeContentTest();
+        runClashTest();
+
+        if (errors > 0)
+            throw new AssertionError("Errors detected (" + errors + ").");
+    }
+
+    void runScopeContentTest() throws Exception {
+        Set<Symbol> expected = Collections.newSetFromMap(new IdentityHashMap<>());
+        Set<Symbol> notExpected = Collections.newSetFromMap(new IdentityHashMap<>());
+        WriteableScope s1 = WriteableScope.create(symtab.rootPackage);
+        ClassSymbol acceptSym = symtab.arrayClass;
+        s1.enter(acceptSym);
+        expected.add(acceptSym);
+        WriteableScope s2 = s1.dup();
+        fillScope(s2, notExpected, a);
+        WriteableScope s3 = s2.dup();
+        fillScope(s3, notExpected, b);
+        WriteableScope s4 = s1.dupUnshared();
+        assertEquals(toSet(s4.getSymbols()), expected);
+        assertEquals(toSet(s4.getSymbolsByName(a)), Collections.emptySet());
+        assertEquals(toSet(s4.getSymbolsByName(b)), Collections.emptySet());
+        assertEquals(toSet(s4.getSymbolsByName(acceptSym.name)), expected);
+        for (Symbol sym : notExpected) {
+            try {
+                s4.remove(sym);
+            } catch (Exception ex) {
+                System.err.println("s4.remove(" + sym + "); crashes with exception:");
+                ex.printStackTrace();
+                errors++;
+            }
+        }
+    }
+
+    void fillScope(WriteableScope scope, Set<Symbol> notExpected, Name name) {
+        VarSymbol var1 = new VarSymbol(0, name, Type.noType, symtab.arrayClass);
+        VarSymbol var2 = new VarSymbol(0, name, Type.noType, symtab.autoCloseableClose.owner);
+        scope.enter(var1);
+        scope.enter(var2);
+        scope.remove(var1);
+        notExpected.add(var1);
+        notExpected.add(var2);
+    }
+
+    Set<Symbol> toSet(Iterable<Symbol> it) {
+        Set<Symbol> result = Collections.newSetFromMap(new IdentityHashMap<>());
+
+        for (Symbol sym : it) {
+            result.add(sym);
+        }
+
+        return result;
+    }
+
+    void assertEquals(Set<Symbol> set1, Set<Symbol> set2) {
+        if (!Objects.equals(set1, set2)) {
+            System.err.println("Sets are not equals: s1=" + set1 + "; s2=" + set2);
+            errors++;
+        }
+    }
+
+    /**
+     * This tests tests the following situation.
+     * - consider empty Scope S1
+     * - a Symbol with name 'A' is added into S1
+     * - S1 is dupped into S2
+     * - a Symbol with name 'B', clashing with 'A', is added into S2
+     * - so the table now looks like: [..., A, ..., B, ...]
+     * - S2 is doubled. As a consequence, the table is re-hashed, and looks like:
+     *   [..., B, ..., A, ...] (note that re-hashing goes from the end, hence the original order).
+     * - B has been chosen so that it clashes in the doubled scope as well. So when looking up 'A',
+     *   B is found (and rejected) first, and only then the A's bucket is tested.
+     * - S2 is dupUshared - the resulting table needs to look like: [..., /sentinel/, ..., A, ...], not
+     *   [..., null, ..., A, ...], as in the latter case lookups would see 'null' while looking for
+     *   'A' and would stop the search prematurely.
+     */
+    void runClashTest() throws Exception {
+        WriteableScope emptyScope = WriteableScope.create(symtab.unnamedPackage);
+        Field tableField = emptyScope.getClass().getDeclaredField("table");
+        tableField.setAccessible(true);
+        Method dble = emptyScope.getClass().getDeclaredMethod("dble");
+        dble.setAccessible(true);
+        Method getIndex = emptyScope.getClass().getDeclaredMethod("getIndex", Name.class);
+        getIndex.setAccessible(true);
+
+        int tries = 0;
+
+        //find a name that will be in the first bucket in table (so that a conflicting name
+        //will be in placed in a bucket after this one).
+        Name first = names.fromString("a");
+        while ((Integer) getIndex.invoke(emptyScope, first) != 0) {
+            if (tries++ > MAX_TRIES) {
+                System.err.println("could not find a name that would be placed in the first bucket");
+                errors++;
+                return ;
+            }
+            first = names.fromString("a" + first.toString());
+        }
+
+        System.out.println("first name: " + first);
+
+        //now, find another name, that will clash with the first one both in the empty and a doubled scope:
+        Scope doubledEmptyScope = WriteableScope.create(symtab.unnamedPackage);
+        dble.invoke(doubledEmptyScope);
+        Integer firstNameTestScopeIndex = (Integer) getIndex.invoke(emptyScope, first);
+        Integer firstNameDoubleScopeIndex = (Integer) getIndex.invoke(doubledEmptyScope, first);
+        Name other = names.fromString("b");
+        while (!Objects.equals(firstNameTestScopeIndex, getIndex.invoke(emptyScope, other)) ||
+               !Objects.equals(firstNameDoubleScopeIndex, getIndex.invoke(doubledEmptyScope, other))) {
+            if (tries++ > MAX_TRIES) {
+                System.err.println("could not find a name that would properly clash with the first chosen name");
+                errors++;
+                return ;
+            }
+            other = names.fromString("b" + other);
+        }
+
+        System.out.println("other name: " + other);
+
+        Symbol firstSymbol = new VarSymbol(0, first, Type.noType, null);
+        Symbol otherSymbol = new VarSymbol(0, other, Type.noType, null);
+
+        //test the situation described above:
+        WriteableScope testScope1 = WriteableScope.create(symtab.unnamedPackage);
+        testScope1.enter(firstSymbol);
+
+        WriteableScope dupped1 = testScope1.dup();
+
+        dupped1.enter(otherSymbol);
+        dble.invoke(dupped1);
+
+        if (testScope1.dupUnshared().findFirst(first) != firstSymbol) {
+            System.err.println("cannot find the Symbol in the dupUnshared scope (1)");
+            errors++;
+        }
+
+        //also check a situation where the clashing Symbol is removed from the dupped scope:
+        WriteableScope testScope2 = WriteableScope.create(symtab.unnamedPackage);
+        testScope2.enter(firstSymbol);
+
+        WriteableScope dupped2 = testScope2.dup();
+
+        dupped2.enter(otherSymbol);
+        dble.invoke(dupped2);
+        dupped2.remove(otherSymbol);
+
+        if (testScope2.dupUnshared().findFirst(first) != firstSymbol) {
+            System.err.println("cannot find the Symbol in the dupUnshared scope (2)");
+            errors++;
+        }
+    }
+
+    int MAX_TRIES = 100; // max tries to find a hash clash before giving up.
+
+}
--- a/langtools/test/tools/javac/tree/TypeAnnotationsPretty.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/javac/tree/TypeAnnotationsPretty.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -40,6 +40,7 @@
 import java.util.LinkedList;
 
 import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.ToolProvider;
@@ -114,13 +115,15 @@
                 code + "; }" +
                 postfix;
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
-                null, Arrays.asList(new MyFileObject(src)));
+        try (JavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
+                    null, Arrays.asList(new MyFileObject(src)));
 
-        for (CompilationUnitTree cut : ct.parse()) {
-            JCTree.JCVariableDecl var =
-                    (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
-            checkMatch(code, var);
+            for (CompilationUnitTree cut : ct.parse()) {
+                JCTree.JCVariableDecl var =
+                        (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+                checkMatch(code, var);
+            }
         }
     }
 
@@ -129,14 +132,16 @@
                 code + "}" +
                 postfix;
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
-                null, Arrays.asList(new MyFileObject(src)));
+        try (JavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
+            JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, null,
+                    null, Arrays.asList(new MyFileObject(src)));
 
 
-        for (CompilationUnitTree cut : ct.parse()) {
-            JCTree.JCMethodDecl meth =
-                    (JCTree.JCMethodDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
-            checkMatch(code, meth);
+            for (CompilationUnitTree cut : ct.parse()) {
+                JCTree.JCMethodDecl meth =
+                        (JCTree.JCMethodDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
+                checkMatch(code, meth);
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/util/NewlineOnlyDiagnostic.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+import javax.annotation.processing.*;
+import javax.tools.Diagnostic.Kind;
+import javax.lang.model.element.TypeElement;
+import java.util.Set;
+
+/*
+ * @test
+ * @bug 8060448
+ * @summary Test that javac doesn't throw ArrayIndexOutOfBoundsException
+ *          when logging the message "\n"
+ * @library /tools/javac/lib
+ * @build   JavacTestingAbstractProcessor NewlineOnlyDiagnostic
+ * @compile -processor NewlineOnlyDiagnostic NewlineOnlyDiagnostic.java
+ */
+
+public class NewlineOnlyDiagnostic extends JavacTestingAbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> types,RoundEnvironment rEnv) {
+        processingEnv.getMessager().printMessage(Kind.NOTE,"\n");
+        return true;
+    }
+}
--- a/langtools/test/tools/lib/ToolBox.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/lib/ToolBox.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.ByteArrayInputStream;
@@ -28,6 +29,7 @@
 import java.io.File;
 import java.io.FilterOutputStream;
 import java.io.FilterWriter;
+import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -49,12 +51,15 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.EnumMap;
+import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Set;
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
@@ -64,18 +69,20 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
+
 import javax.tools.FileObject;
 import javax.tools.ForwardingJavaFileManager;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
+import javax.tools.JavaFileManager.Location;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
 
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.api.JavacTool;
-import java.io.IOError;
 
 /**
  * Utility methods and classes for writing jtreg tests for
@@ -233,7 +240,7 @@
     public void createDirectories(String... paths) throws IOException {
         if (paths.length == 0)
             throw new IllegalArgumentException("no directories specified");
-        for (String p: paths)
+        for (String p : paths)
             Files.createDirectories(Paths.get(p));
     }
 
@@ -248,7 +255,7 @@
     public void createDirectories(Path... paths) throws IOException {
         if (paths.length == 0)
             throw new IllegalArgumentException("no directories specified");
-        for (Path p: paths)
+        for (Path p : paths)
             Files.createDirectories(p);
     }
 
@@ -262,7 +269,7 @@
     public void deleteFiles(String... files) throws IOException {
         if (files.length == 0)
             throw new IllegalArgumentException("no files specified");
-        for (String file: files)
+        for (String file : files)
             Files.delete(Paths.get(file));
     }
 
@@ -392,7 +399,7 @@
     public void writeJavaFiles(Path dir, String... contents) throws IOException {
         if (contents.length == 0)
             throw new IllegalArgumentException("no content specified for any files");
-        for (String c: contents) {
+        for (String c : contents) {
             new JavaSource(c).write(dir);
         }
     }
@@ -1090,7 +1097,7 @@
 
         private List<File> toFiles(String path) {
             List<File> result = new ArrayList<>();
-            for (String s: path.split(File.pathSeparator)) {
+            for (String s : path.split(File.pathSeparator)) {
                 if (!s.isEmpty())
                     result.add(new File(s));
             }
@@ -1108,7 +1115,7 @@
             if (fileObjects == null)
                 return filesAsFileObjects;
             List<JavaFileObject> combinedList = new ArrayList<>();
-            for (JavaFileObject o: filesAsFileObjects)
+            for (JavaFileObject o : filesAsFileObjects)
                 combinedList.add(o);
             combinedList.addAll(fileObjects);
             return combinedList;
@@ -1308,6 +1315,7 @@
         private String mainClass;
         private Path baseDir;
         private List<Path> paths;
+        private Set<FileObject> fileObjects;
 
         /**
          * Creates a task to write jar files, using API mode.
@@ -1315,6 +1323,7 @@
         public JarTask() {
             super(Mode.API);
             paths = Collections.emptyList();
+            fileObjects = new LinkedHashSet<>();
         }
 
         /**
@@ -1392,6 +1401,53 @@
         }
 
         /**
+         * Adds a set of file objects to be written into the jar file, by copying them
+         * from a Location in a JavaFileManager.
+         * The file objects to be written are specified by a series of paths;
+         * each path can be in one of the following forms:
+         * <ul>
+         * <li>The name of a class. For example, java.lang.Object.
+         * In this case, the corresponding .class file will be written to the jar file.
+         * <li>the name of a package followed by {@code .*}. For example, {@code java.lang.*}.
+         * In this case, all the class files in the specified package will be written to
+         * the jar file.
+         * <li>the name of a package followed by {@code .**}. For example, {@code java.lang.**}.
+         * In this case, all the class files in the specified package, and any subpackages
+         * will be written to the jar file.
+         * </ul>
+         *
+         * @param fm the file manager in which to find the file objects
+         * @param l  the location in which to find the file objects
+         * @param paths the paths specifying the file objects to be copied
+         * @return this task object
+         * @throws IOException if errors occur while determining the set of file objects
+         */
+        public JarTask files(JavaFileManager fm, Location l, String... paths)
+                throws IOException {
+            for (String p : paths) {
+                if (p.endsWith(".**"))
+                    addPackage(fm, l, p.substring(0, p.length() - 3), true);
+                else if (p.endsWith(".*"))
+                    addPackage(fm, l, p.substring(0, p.length() - 2), false);
+                else
+                    addFile(fm, l, p);
+            }
+            return this;
+        }
+
+        private void addPackage(JavaFileManager fm, Location l, String pkg, boolean recurse)
+                throws IOException {
+            for (JavaFileObject fo : fm.list(l, pkg, EnumSet.allOf(JavaFileObject.Kind.class), recurse)) {
+                fileObjects.add(fo);
+            }
+        }
+
+        private void addFile(JavaFileManager fm, Location l, String path) throws IOException {
+            JavaFileObject fo = fm.getJavaFileForInput(l, path, Kind.CLASS);
+            fileObjects.add(fo);
+        }
+
+        /**
          * Provides limited jar command-like functionality.
          * The supported commands are:
          * <ul>
@@ -1464,38 +1520,19 @@
             StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
             StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
 
-            int rc;
             Map<OutputKind, String> outputMap = new HashMap<>();
 
             try (OutputStream os = Files.newOutputStream(jar);
                     JarOutputStream jos = openJar(os, m)) {
-                Path base = (baseDir == null) ? currDir : baseDir;
-                for (Path path: paths) {
-                    Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
-                        @Override
-                        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
-                            try {
-                                JarEntry e = new JarEntry(base.relativize(file).toString());
-                                jos.putNextEntry(e);
-                                jos.write(Files.readAllBytes(file));
-                                jos.closeEntry();
-                                return FileVisitResult.CONTINUE;
-                            } catch (IOException e) {
-                                System.err.println("Error adding " + file + " to jar file: " + e);
-                                return FileVisitResult.TERMINATE;
-                            }
-                        }
-                    });
-                }
-                rc = 0;
+                writeFiles(jos);
+                writeFileObjects(jos);
             } catch (IOException e) {
-                System.err.println("Error opening " + jar + ": " + e);
-                rc = 1;
+                error("Exception while opening " + jar, e);
             } finally {
                 outputMap.put(OutputKind.STDOUT, sysOut.close());
                 outputMap.put(OutputKind.STDERR, sysErr.close());
             }
-            return checkExit(new Result(this, rc, outputMap));
+            return checkExit(new Result(this, (errors == 0) ? 0 : 1, outputMap));
         }
 
         private JarOutputStream openJar(OutputStream os, Manifest m) throws IOException {
@@ -1508,6 +1545,79 @@
             }
         }
 
+        private void writeFiles(JarOutputStream jos) throws IOException {
+            Path base = (baseDir == null) ? currDir : baseDir;
+            for (Path path : paths) {
+                Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
+                    @Override
+                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                        try {
+                            String p = base.relativize(file)
+                                    .normalize()
+                                    .toString()
+                                    .replace(File.separatorChar, '/');
+                            JarEntry e = new JarEntry(p);
+                            jos.putNextEntry(e);
+                            try {
+                                jos.write(Files.readAllBytes(file));
+                            } finally {
+                                jos.closeEntry();
+                            }
+                            return FileVisitResult.CONTINUE;
+                        } catch (IOException e) {
+                            error("Exception while adding " + file + " to jar file", e);
+                            return FileVisitResult.TERMINATE;
+                        }
+                    }
+                });
+            }
+        }
+
+        private void writeFileObjects(JarOutputStream jos) throws IOException {
+            for (FileObject fo : fileObjects) {
+                String p = guessPath(fo);
+                JarEntry e = new JarEntry(p);
+                jos.putNextEntry(e);
+                try {
+                    byte[] buf = new byte[1024];
+                    try (BufferedInputStream in = new BufferedInputStream(fo.openInputStream())) {
+                        int n;
+                        while ((n = in.read(buf)) > 0)
+                            jos.write(buf, 0, n);
+                    } catch (IOException ex) {
+                        error("Exception while adding " + fo.getName() + " to jar file", ex);
+                    }
+                } finally {
+                    jos.closeEntry();
+                }
+            }
+        }
+
+        /*
+         * A jar: URL is of the form  jar:URL!/entry  where URL is a URL for the .jar file itself.
+         * In Symbol files (i.e. ct.sym) the underlying entry is prefixed META-INF/sym/<base>.
+         */
+        private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
+
+        private String guessPath(FileObject fo) {
+            URI u = fo.toUri();
+            switch (u.getScheme()) {
+                case "jar":
+                    Matcher m = jarEntry.matcher(u.getSchemeSpecificPart());
+                    if (m.matches()) {
+                        return m.group(1);
+                    }
+                    break;
+            }
+            throw new IllegalArgumentException(fo.getName());
+        }
+
+        private void error(String message, Throwable t) {
+            out.println("Error: " + message + ": " + t);
+            errors++;
+        }
+
+        private int errors;
     }
 
     /**
--- a/langtools/test/tools/sjavac/DependencyCollection.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/langtools/test/tools/sjavac/DependencyCollection.java	Mon Nov 17 09:36:40 2014 +0100
@@ -32,6 +32,7 @@
  * @run main Wrapper DependencyCollection
  */
 
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -55,7 +56,7 @@
 
 public class DependencyCollection {
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws IOException {
         Path src = Paths.get(ToolBox.testSrc, "test-input", "src");
 
         JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
--- a/make/CompileJavaModules.gmk	Sat Nov 15 02:51:48 2014 +0000
+++ b/make/CompileJavaModules.gmk	Mon Nov 17 09:36:40 2014 +0100
@@ -245,7 +245,6 @@
 
 ################################################################################
 # Exclude building of IIOP transport for RMI Connector
-java.management_EXCLUDES := com/sun/jmx/remote/protocol/iiop
 
 ifeq ($(RMICONNECTOR_IIOP), false)
   java.management_EXCLUDES += com/sun/jmx/remote/protocol/iiop
@@ -264,11 +263,11 @@
 java.corba_COPY := .prp
 java.corba_CLEAN := .properties
 
-java.corba_EXCLUDES := \
+java.corba_EXCLUDES += \
     com/sun/corba/se/PortableActivationIDL \
     com/sun/tools/corba/se/logutil \
     #
-java.corba_EXCLUDE_FILES := \
+java.corba_EXCLUDE_FILES += \
     com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
     com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
     com/sun/org/omg/CORBA/IDLTypeOperations.java \
@@ -350,12 +349,12 @@
     $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/Shutdown.java
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  jdk.sctp_EXCLUDE_FILES := $(SCTP_IMPL_CLASSES)
+  jdk.sctp_EXCLUDE_FILES += $(SCTP_IMPL_CLASSES)
 endif
 
 ifeq ($(OPENJDK_TARGET_OS),aix)
   # These files are duplicated in AIX_SRC_DIRS
-  jdk.sctp_EXCLUDE_FILES := $(SCTP_IMPL_CLASSES)
+  jdk.sctp_EXCLUDE_FILES += $(SCTP_IMPL_CLASSES)
 endif
 
 ################################################################################
@@ -373,7 +372,7 @@
 
 ################################################################################
 
-jdk.jdi_EXCLUDES := \
+jdk.jdi_EXCLUDES += \
     com/sun/tools/example/debug/bdi \
     com/sun/tools/example/debug/event \
     com/sun/tools/example/debug/gui \
@@ -414,7 +413,7 @@
 jdk.localedata_COPY := _dict _th
 # Exclude BreakIterator classes that are just used in compile process to generate
 # data files and shouldn't go in the product
-jdk.localedata_EXCLUDE_FILES := sun/text/resources/th/BreakIteratorRules_th.java
+jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
 
 ################################################################################
 # Setup the compilation of each module
--- a/make/Javadoc.gmk	Sat Nov 15 02:51:48 2014 +0000
+++ b/make/Javadoc.gmk	Mon Nov 17 09:36:40 2014 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, 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
@@ -336,6 +336,14 @@
 #################################################################
 
 #
+# Load custom Javadoc rules
+#
+
+$(eval $(call IncludeCustomExtension, , Javadoc.gmk))
+
+#################################################################
+
+#
 # Default target is same as docs target, create core api and all others it can
 #
 
--- a/make/Main.gmk	Sat Nov 15 02:51:48 2014 +0000
+++ b/make/Main.gmk	Mon Nov 17 09:36:40 2014 +0100
@@ -514,7 +514,7 @@
 # If the output directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
 	($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
-	    Makefile compare.sh spec.sh tmp javacservers)
+	    Makefile compare.sh tmp javacservers)
 	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
 	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
 	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
--- a/modules.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/modules.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -792,17 +792,8 @@
       <name>javax.management.timer</name>
     </export>
     <export>
-      <name>com.sun.jmx.defaults</name>
-      <to>jdk.snmp</to>
-    </export>
-    <export>
-      <name>com.sun.jmx.mbeanserver</name>
-      <to>jdk.snmp</to>
-    </export>
-    <export>
       <name>sun.management</name>
       <to>jdk.jconsole</to>
-      <to>jdk.snmp</to>
     </export>
   </module>
   <module>
--- a/nashorn/.hgtags	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/.hgtags	Mon Nov 17 09:36:40 2014 +0100
@@ -271,3 +271,5 @@
 63b8da4c958c3bbadfff082c547983f5daa50c0f jdk9-b35
 10fe62bc188476abb025e55f55128cbfecf24584 jdk9-b36
 dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
+365f55e7b3c45637bf912c88d31b32a127ad7429 jdk9-b38
+900508346b1c2436d7059fe46a621e6ec3ffdaad jdk9-b39
--- a/nashorn/docs/source/EvalFile.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/EvalFile.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,14 +29,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class EvalFile {
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         // create a script engine manager
-        ScriptEngineManager factory = new ScriptEngineManager();
+        final ScriptEngineManager factory = new ScriptEngineManager();
         // create JavaScript engine
-        ScriptEngine engine = factory.getEngineByName("nashorn");
+        final ScriptEngine engine = factory.getEngineByName("nashorn");
         // evaluate JavaScript code from given file - specified by first argument
         engine.eval(new java.io.FileReader(args[0]));
     }
--- a/nashorn/docs/source/EvalScript.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/EvalScript.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,14 +29,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class EvalScript {
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         // create a script engine manager
-        ScriptEngineManager factory = new ScriptEngineManager();
+        final ScriptEngineManager factory = new ScriptEngineManager();
         // create a JavaScript engine
-        ScriptEngine engine = factory.getEngineByName("nashorn");
+        final ScriptEngine engine = factory.getEngineByName("nashorn");
         // evaluate JavaScript code from String
         engine.eval("print('Hello, World')");
     }
--- a/nashorn/docs/source/InvokeScriptFunction.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/InvokeScriptFunction.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,22 +29,25 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class InvokeScriptFunction {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
         // JavaScript code in a String
-        String script = "function hello(name) { print('Hello, ' + name); }";
+        final String script = "function hello(name) { print('Hello, ' + name); }";
         // evaluate script
         engine.eval(script);
 
         // javax.script.Invocable is an optional interface.
         // Check whether your script engine implements or not!
         // Note that the JavaScript engine implements Invocable interface.
-        Invocable inv = (Invocable) engine;
+        final Invocable inv = (Invocable) engine;
 
         // invoke the global function named "hello"
         inv.invokeFunction("hello", "Scripting!!" );
--- a/nashorn/docs/source/InvokeScriptMethod.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/InvokeScriptMethod.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,26 +29,29 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class InvokeScriptMethod {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
         // JavaScript code in a String. This code defines a script object 'obj'
         // with one method called 'hello'.
-        String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }";
+        final String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }";
         // evaluate script
         engine.eval(script);
 
         // javax.script.Invocable is an optional interface.
         // Check whether your script engine implements or not!
         // Note that the JavaScript engine implements Invocable interface.
-        Invocable inv = (Invocable) engine;
+        final Invocable inv = (Invocable) engine;
 
         // get script object on which we want to call the method
-        Object obj = engine.get("obj");
+        final Object obj = engine.get("obj");
 
         // invoke the method named "hello" on the script object "obj"
         inv.invokeMethod(obj, "hello", "Script Method !!" );
--- a/nashorn/docs/source/MultiScopes.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/MultiScopes.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,12 +29,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.SimpleScriptContext;
 
+@SuppressWarnings("javadoc")
 public class MultiScopes {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
         engine.put("x", "hello");
         // print global variable "x"
@@ -42,9 +47,9 @@
         // the above line prints "hello"
 
         // Now, pass a different script context
-        ScriptContext newContext = new SimpleScriptContext();
+        final ScriptContext newContext = new SimpleScriptContext();
         newContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
-        Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE);
+        final Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE);
 
         // add new variable "x" to the new engineScope
         engineScope.put("x", "world");
--- a/nashorn/docs/source/RunnableImpl.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/RunnableImpl.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,28 +29,31 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class RunnableImpl {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
         // JavaScript code in a String
-        String script = "function run() { print('run called'); }";
+        final String script = "function run() { print('run called'); }";
 
         // evaluate script
         engine.eval(script);
 
-        Invocable inv = (Invocable) engine;
+        final Invocable inv = (Invocable) engine;
 
         // get Runnable interface object from engine. This interface methods
         // are implemented by script functions with the matching name.
-        Runnable r = inv.getInterface(Runnable.class);
+        final Runnable r = inv.getInterface(Runnable.class);
 
         // start a new thread that runs the script implemented
         // runnable interface
-        Thread th = new Thread(r);
+        final Thread th = new Thread(r);
         th.start();
         th.join();
     }
--- a/nashorn/docs/source/RunnableImplObject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/RunnableImplObject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,31 +29,34 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class RunnableImplObject {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
         // JavaScript code in a String
-        String script = "var obj = new Object(); obj.run = function() { print('run method called'); }";
+        final String script = "var obj = new Object(); obj.run = function() { print('run method called'); }";
 
         // evaluate script
         engine.eval(script);
 
         // get script object on which we want to implement the interface with
-        Object obj = engine.get("obj");
+        final Object obj = engine.get("obj");
 
-        Invocable inv = (Invocable) engine;
+        final Invocable inv = (Invocable) engine;
 
         // get Runnable interface object from engine. This interface methods
         // are implemented by script methods of object 'obj'
-        Runnable r = inv.getInterface(obj, Runnable.class);
+        final Runnable r = inv.getInterface(obj, Runnable.class);
 
         // start a new thread that runs the script implemented
         // runnable interface
-        Thread th = new Thread(r);
+        final Thread th = new Thread(r);
         th.start();
         th.join();
     }
--- a/nashorn/docs/source/ScriptVars.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/docs/source/ScriptVars.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,15 +29,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.script.*;
-import java.io.*;
+import java.io.File;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
 
+@SuppressWarnings("javadoc")
 public class ScriptVars {
-    public static void main(String[] args) throws Exception {
-        ScriptEngineManager manager = new ScriptEngineManager();
-        ScriptEngine engine = manager.getEngineByName("nashorn");
+    public static void main(final String[] args) throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
 
-        File f = new File("test.txt");
+        final File f = new File("test.txt");
         // expose File object as variable to script
         engine.put("file", f);
 
--- a/nashorn/make/build.xml	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/make/build.xml	Mon Nov 17 09:36:40 2014 +0100
@@ -156,6 +156,7 @@
        <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
     </copy>
     <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
+    <copy file="${src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${build.classes.dir}/jdk/nashorn/internal/codegen"/>
 
     <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
     <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -97,6 +97,7 @@
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
 import jdk.internal.dynalink.support.AutoDiscovery;
 import jdk.internal.dynalink.support.BottomGuardingDynamicLinker;
 import jdk.internal.dynalink.support.ClassLoaderGetterContextProvider;
@@ -105,6 +106,7 @@
 import jdk.internal.dynalink.support.DefaultPrelinkFilter;
 import jdk.internal.dynalink.support.LinkerServicesImpl;
 import jdk.internal.dynalink.support.TypeConverterFactory;
+import jdk.internal.dynalink.support.TypeUtilities;
 
 /**
  * A factory class for creating {@link DynamicLinker}s. The most usual dynamic linker is a linker that is a composition
@@ -115,7 +117,6 @@
  * @author Attila Szegedi
  */
 public class DynamicLinkerFactory {
-
     /**
      * Default value for {@link #setUnstableRelinkThreshold(int) unstable relink threshold}.
      */
@@ -130,6 +131,7 @@
     private boolean syncOnRelink = false;
     private int unstableRelinkThreshold = DEFAULT_UNSTABLE_RELINK_THRESHOLD;
     private GuardedInvocationFilter prelinkFilter;
+    private MethodTypeConversionStrategy autoConversionStrategy;
 
     /**
      * Sets the class loader for automatic discovery of available linkers. If not set explicitly, then the thread
@@ -259,6 +261,29 @@
     }
 
     /**
+     * Sets an object representing the conversion strategy for automatic type conversions. After
+     * {@link TypeConverterFactory#asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)} has
+     * applied all custom conversions to a method handle, it still needs to effect
+     * {@link TypeUtilities#isMethodInvocationConvertible(Class, Class) method invocation conversions} that
+     * can usually be automatically applied as per
+     * {@link java.lang.invoke.MethodHandle#asType(java.lang.invoke.MethodType)}.
+     * However, sometimes language runtimes will want to customize even those conversions for their own call
+     * sites. A typical example is allowing unboxing of null return values, which is by default prohibited by
+     * ordinary {@code MethodHandles.asType}. In this case, a language runtime can install its own custom
+     * automatic conversion strategy, that can deal with null values. Note that when the strategy's
+     * {@link MethodTypeConversionStrategy#asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)}
+     * is invoked, the custom language conversions will already have been applied to the method handle, so by
+     * design the difference between the handle's current method type and the desired final type will always
+     * only be ones that can be subjected to method invocation conversions. The strategy also doesn't need to
+     * invoke a final {@code MethodHandle.asType()} as the converter factory will do that as the final step.
+     * @param autoConversionStrategy the strategy for applying method invocation conversions for the linker
+     * created by this factory.
+     */
+    public void setAutoConversionStrategy(final MethodTypeConversionStrategy autoConversionStrategy) {
+        this.autoConversionStrategy = autoConversionStrategy;
+    }
+
+    /**
      * Creates a new dynamic linker consisting of all the prioritized, autodiscovered, and fallback linkers as well as
      * the pre-link filter.
      *
@@ -324,8 +349,9 @@
             prelinkFilter = new DefaultPrelinkFilter();
         }
 
-        return new DynamicLinker(new LinkerServicesImpl(new TypeConverterFactory(typeConverters), composite),
-                prelinkFilter, runtimeContextArgCount, syncOnRelink, unstableRelinkThreshold);
+        return new DynamicLinker(new LinkerServicesImpl(new TypeConverterFactory(typeConverters,
+                autoConversionStrategy), composite), prelinkFilter, runtimeContextArgCount, syncOnRelink,
+                unstableRelinkThreshold);
     }
 
     private static ClassLoader getThreadContextClassLoader() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Mon Nov 17 09:36:40 2014 +0100
@@ -287,10 +287,21 @@
      */
     private static SingleDynamicMethod createDynamicMethod(final AccessibleObject m) {
         if(CallerSensitiveDetector.isCallerSensitive(m)) {
+            // Method has @CallerSensitive annotation
             return new CallerSensitiveDynamicMethod(m);
         }
+        // Method has no @CallerSensitive annotation
+        final MethodHandle mh;
+        try {
+            mh = unreflectSafely(m);
+        } catch (final IllegalAccessError e) {
+            // java.lang.invoke can in some case conservatively treat as caller sensitive methods that aren't
+            // marked with the annotation. In this case, we'll fall back to treating it as caller sensitive.
+            return new CallerSensitiveDynamicMethod(m);
+        }
+        // Proceed with non-caller sensitive
         final Member member = (Member)m;
-        return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName(), m instanceof Constructor);
+        return new SimpleDynamicMethod(mh, member.getDeclaringClass(), member.getName(), m instanceof Constructor);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/MethodTypeConversionStrategy.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2014 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.linker;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
+
+/**
+ * Interface for objects representing a strategy for converting a method handle to a new type.
+ */
+public interface MethodTypeConversionStrategy {
+    /**
+     * Converts a method handle to a new type.
+     * @param target target method handle
+     * @param newType new type
+     * @return target converted to the new type.
+     */
+    public MethodHandle asType(final MethodHandle target, final MethodType newType);
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -97,6 +97,7 @@
 import jdk.internal.dynalink.linker.GuardedTypeConversion;
 import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
 import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
 
 /**
  * A factory for type converters. This class is the main implementation behind the
@@ -109,6 +110,7 @@
 
     private final GuardingTypeConverterFactory[] factories;
     private final ConversionComparator[] comparators;
+    private final MethodTypeConversionStrategy autoConversionStrategy;
 
     private final ClassValue<ClassMap<MethodHandle>> converterMap = new ClassValue<ClassMap<MethodHandle>>() {
         @Override
@@ -177,8 +179,24 @@
      * Creates a new type converter factory from the available {@link GuardingTypeConverterFactory} instances.
      *
      * @param factories the {@link GuardingTypeConverterFactory} instances to compose.
+     * @param autoConversionStrategy conversion strategy for automatic type conversions. After
+     * {@link #asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)} has applied all custom
+     * conversions to a method handle, it still needs to effect
+     * {@link TypeUtilities#isMethodInvocationConvertible(Class, Class) method invocation conversions} that
+     * can usually be automatically applied as per
+     * {@link java.lang.invoke.MethodHandle#asType(java.lang.invoke.MethodType)}.
+     * However, sometimes language runtimes will want to customize even those conversions for their own call
+     * sites. A typical example is allowing unboxing of null return values, which is by default prohibited by
+     * ordinary {@code MethodHandles.asType}. In this case, a language runtime can install its own custom
+     * automatic conversion strategy, that can deal with null values. Note that when the strategy's
+     * {@link MethodTypeConversionStrategy#asType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)}
+     * is invoked, the custom language conversions will already have been applied to the method handle, so by
+     * design the difference between the handle's current method type and the desired final type will always
+     * only be ones that can be subjected to method invocation conversions. Can be null, in which case no
+     * custom strategy is employed.
      */
-    public TypeConverterFactory(final Iterable<? extends GuardingTypeConverterFactory> factories) {
+    public TypeConverterFactory(final Iterable<? extends GuardingTypeConverterFactory> factories,
+            final MethodTypeConversionStrategy autoConversionStrategy) {
         final List<GuardingTypeConverterFactory> l = new LinkedList<>();
         final List<ConversionComparator> c = new LinkedList<>();
         for(final GuardingTypeConverterFactory factory: factories) {
@@ -189,20 +207,24 @@
         }
         this.factories = l.toArray(new GuardingTypeConverterFactory[l.size()]);
         this.comparators = c.toArray(new ConversionComparator[c.size()]);
-
+        this.autoConversionStrategy = autoConversionStrategy;
     }
 
     /**
      * Similar to {@link MethodHandle#asType(MethodType)} except it also hooks in method handles produced by
      * {@link GuardingTypeConverterFactory} implementations, providing for language-specific type coercing of
-     * parameters. It will apply {@link MethodHandle#asType(MethodType)} for all primitive-to-primitive,
-     * wrapper-to-primitive, primitive-to-wrapper conversions as well as for all upcasts. For all other conversions,
-     * it'll insert {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with composite filters
-     * provided by {@link GuardingTypeConverterFactory} implementations.
+     * parameters. For all conversions that are not a JLS method invocation conversion it'll insert
+     * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with composite filters
+     * provided by {@link GuardingTypeConverterFactory} implementations. For the remaining JLS method invocation
+     * conversions, it will invoke {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)} first
+     * if an automatic conversion strategy was specified in the
+     * {@link #TypeConverterFactory(Iterable, MethodTypeConversionStrategy) constructor}, and finally apply
+     * {@link MethodHandle#asType(MethodType)} for any remaining conversions.
      *
      * @param handle target method handle
      * @param fromType the types of source arguments
-     * @return a method handle that is a suitable combination of {@link MethodHandle#asType(MethodType)} and
+     * @return a method handle that is a suitable combination of {@link MethodHandle#asType(MethodType)},
+     * {@link MethodTypeConversionStrategy#asType(MethodHandle, MethodType)}, and
      * {@link MethodHandles#filterArguments(MethodHandle, int, MethodHandle...)} with
      * {@link GuardingTypeConverterFactory} produced type converters as filters.
      */
@@ -246,8 +268,12 @@
             }
         }
 
-        // Take care of automatic conversions
-        return newHandle.asType(fromType);
+        // Give change to automatic conversion strategy, if one is present.
+        final MethodHandle autoConvertedHandle =
+                autoConversionStrategy != null ? autoConversionStrategy.asType(newHandle, fromType) : newHandle;
+
+        // Do a final asType for any conversions that remain.
+        return autoConvertedHandle.asType(fromType);
     }
 
     private static MethodHandle applyConverters(final MethodHandle handle, final int pos, final List<MethodHandle> converters) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java	Mon Nov 17 09:36:40 2014 +0100
@@ -520,4 +520,13 @@
     public static Class<?> getWrapperType(final Class<?> primitiveType) {
         return WRAPPER_TYPES.get(primitiveType);
     }
+
+    /**
+     * Returns true if the passed type is a wrapper for a primitive type.
+     * @param type the examined type
+     * @return true if the passed type is a wrapper for a primitive type.
+     */
+    public static boolean isWrapperType(final Class<?> type) {
+        return PRIMITIVE_TYPES.containsKey(type);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/AssertsEnabled.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/AssertsEnabled.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,8 +27,8 @@
 
 /**
  * Class that exposes the current state of asserts.
- *
  */
+@SuppressWarnings("all")
 public final class AssertsEnabled {
     private static boolean assertsEnabled = false;
     static {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,6 +29,7 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.EXPLODED_ARGUMENT_PREFIX;
 
 import java.lang.invoke.MethodType;
+import java.net.URL;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Deque;
@@ -93,6 +94,8 @@
 
     private final Deque<List<IdentNode>> explodedArguments = new ArrayDeque<>();
 
+    private final Deque<MethodType> callSiteTypes = new ArrayDeque<>();
+
     private static final String ARGUMENTS = ARGUMENTS_VAR.symbolName();
 
     /**
@@ -118,86 +121,113 @@
         return context.getLogger(this.getClass());
     }
 
+    @SuppressWarnings("serial")
+    private static class TransformFailedException extends RuntimeException {
+        TransformFailedException(final FunctionNode fn, final String message) {
+            super(massageURL(fn.getSource().getURL()) + '.' + fn.getName() + " => " + message, null, false, false);
+        }
+    }
+
+    @SuppressWarnings("serial")
+    private static class AppliesFoundException extends RuntimeException {
+        AppliesFoundException() {
+            super("applies_found", null, false, false);
+        }
+    }
+
+    private static final AppliesFoundException HAS_APPLIES = new AppliesFoundException();
+
+    private boolean hasApplies(final FunctionNode functionNode) {
+        try {
+            functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
+                @Override
+                public boolean enterFunctionNode(final FunctionNode fn) {
+                    return fn == functionNode;
+                }
+
+                @Override
+                public boolean enterCallNode(final CallNode callNode) {
+                    if (isApply(callNode)) {
+                        throw HAS_APPLIES;
+                    }
+                    return true;
+                }
+            });
+        } catch (final AppliesFoundException e) {
+            return true;
+        }
+
+        log.fine("There are no applies in ", DebugLogger.quote(functionNode.getName()), " - nothing to do.");
+        return false; // no applies
+    }
+
     /**
      * Arguments may only be used as args to the apply. Everything else is disqualified
      * We cannot control arguments if they escape from the method and go into an unknown
      * scope, thus we are conservative and treat any access to arguments outside the
      * apply call as a case of "we cannot apply the optimization".
-     *
-     * @return true if arguments escape
      */
-    private boolean argumentsEscape(final FunctionNode functionNode) {
-
-        @SuppressWarnings("serial")
-        final UnsupportedOperationException uoe = new UnsupportedOperationException() {
-            @Override
-            public synchronized Throwable fillInStackTrace() {
-                return null;
-            }
-        };
+    private static void checkValidTransform(final FunctionNode functionNode) {
 
         final Set<Expression> argumentsFound = new HashSet<>();
         final Deque<Set<Expression>> stack = new ArrayDeque<>();
+
         //ensure that arguments is only passed as arg to apply
-        try {
-            functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
-                private boolean isCurrentArg(final Expression expr) {
-                    return !stack.isEmpty() && stack.peek().contains(expr); //args to current apply call
-                }
+        functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
+
+            private boolean isCurrentArg(final Expression expr) {
+                return !stack.isEmpty() && stack.peek().contains(expr); //args to current apply call
+            }
 
-                private boolean isArguments(final Expression expr) {
-                    if (expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName())) {
-                        argumentsFound.add(expr);
+            private boolean isArguments(final Expression expr) {
+                if (expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName())) {
+                    argumentsFound.add(expr);
+                    return true;
+               }
+                return false;
+            }
+
+            private boolean isParam(final String name) {
+                for (final IdentNode param : functionNode.getParameters()) {
+                    if (param.getName().equals(name)) {
                         return true;
                     }
-                    return false;
                 }
+                return false;
+            }
 
-                private boolean isParam(final String name) {
-                    for (final IdentNode param : functionNode.getParameters()) {
-                        if (param.getName().equals(name)) {
-                            return true;
-                        }
-                    }
-                    return false;
+            @Override
+            public Node leaveIdentNode(final IdentNode identNode) {
+                if (isParam(identNode.getName())) {
+                    throw new TransformFailedException(lc.getCurrentFunction(), "parameter: " + identNode.getName());
                 }
-
-                @Override
-                public Node leaveIdentNode(final IdentNode identNode) {
-                    if (isParam(identNode.getName()) || isArguments(identNode) && !isCurrentArg(identNode)) {
-                        throw uoe; //avoid filling in stack trace
-                    }
-                    return identNode;
+                // it's OK if 'argument' occurs as the current argument of an apply
+                if (isArguments(identNode) && !isCurrentArg(identNode)) {
+                    throw new TransformFailedException(lc.getCurrentFunction(), "is 'arguments': " + identNode.getName());
                 }
+                return identNode;
+            }
 
-                @Override
-                public boolean enterCallNode(final CallNode callNode) {
-                    final Set<Expression> callArgs = new HashSet<>();
-                    if (isApply(callNode)) {
-                        final List<Expression> argList = callNode.getArgs();
-                        if (argList.size() != 2 || !isArguments(argList.get(argList.size() - 1))) {
-                            throw new UnsupportedOperationException();
-                        }
-                        callArgs.addAll(callNode.getArgs());
+            @Override
+            public boolean enterCallNode(final CallNode callNode) {
+                final Set<Expression> callArgs = new HashSet<>();
+                if (isApply(callNode)) {
+                    final List<Expression> argList = callNode.getArgs();
+                    if (argList.size() != 2 || !isArguments(argList.get(argList.size() - 1))) {
+                        throw new TransformFailedException(lc.getCurrentFunction(), "argument pattern not matched: " + argList);
                     }
-                    stack.push(callArgs);
-                    return true;
+                    callArgs.addAll(callNode.getArgs());
                 }
+                stack.push(callArgs);
+                return true;
+            }
 
-                @Override
-                public Node leaveCallNode(final CallNode callNode) {
-                    stack.pop();
-                    return callNode;
-                }
-            });
-        } catch (final UnsupportedOperationException e) {
-            if (!argumentsFound.isEmpty()) {
-                log.fine("'arguments' is used but escapes, or is reassigned in '" + functionNode.getName() + "'. Aborting");
+            @Override
+            public Node leaveCallNode(final CallNode callNode) {
+                stack.pop();
+                return callNode;
             }
-            return true; //bad
-        }
-
-        return false;
+       });
     }
 
     @Override
@@ -224,12 +254,14 @@
 
             final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall();
 
-            log.fine("Transformed ",
-                    callNode,
-                    " from apply to call => ",
-                    newCallNode,
-                    " in ",
-                    DebugLogger.quote(lc.getCurrentFunction().getName()));
+            if (log.isEnabled()) {
+                log.fine("Transformed ",
+                        callNode,
+                        " from apply to call => ",
+                        newCallNode,
+                        " in ",
+                        DebugLogger.quote(lc.getCurrentFunction().getName()));
+            }
 
             return newCallNode;
         }
@@ -237,12 +269,12 @@
         return callNode;
     }
 
-    private boolean pushExplodedArgs(final FunctionNode functionNode) {
+    private void pushExplodedArgs(final FunctionNode functionNode) {
         int start = 0;
 
         final MethodType actualCallSiteType = compiler.getCallSiteType(functionNode);
         if (actualCallSiteType == null) {
-            return false;
+            throw new TransformFailedException(lc.getCurrentFunction(), "No callsite type");
         }
         assert actualCallSiteType.parameterType(actualCallSiteType.parameterCount() - 1) != Object[].class : "error vararg callsite passed to apply2call " + functionNode.getName() + " " + actualCallSiteType;
 
@@ -264,8 +296,8 @@
             }
         }
 
+        callSiteTypes.push(actualCallSiteType);
         explodedArguments.push(newParams);
-        return true;
     }
 
     @Override
@@ -288,11 +320,30 @@
             return false;
         }
 
-        if (argumentsEscape(functionNode)) {
+        if (!hasApplies(functionNode)) {
             return false;
         }
 
-        return pushExplodedArgs(functionNode);
+        if (log.isEnabled()) {
+            log.info("Trying to specialize apply to call in '",
+                    functionNode.getName(),
+                    "' params=",
+                    functionNode.getParameters(),
+                    " id=",
+                    functionNode.getId(),
+                    " source=",
+                    massageURL(functionNode.getSource().getURL()));
+        }
+
+        try {
+            checkValidTransform(functionNode);
+            pushExplodedArgs(functionNode);
+        } catch (final TransformFailedException e) {
+            log.info("Failure: ", e.getMessage());
+            return false;
+        }
+
+        return true;
     }
 
     /**
@@ -300,8 +351,8 @@
      * @return true if successful, false otherwise
      */
     @Override
-    public Node leaveFunctionNode(final FunctionNode functionNode0) {
-        FunctionNode newFunctionNode = functionNode0;
+    public Node leaveFunctionNode(final FunctionNode functionNode) {
+        FunctionNode newFunctionNode = functionNode;
         final String functionName = newFunctionNode.getName();
 
         if (changed.contains(newFunctionNode.getId())) {
@@ -310,17 +361,18 @@
                     setParameters(lc, explodedArguments.peek());
 
             if (log.isEnabled()) {
-                log.info("Successfully specialized apply to call in '",
+                log.info("Success: ",
+                        massageURL(newFunctionNode.getSource().getURL()),
+                        '.',
                         functionName,
-                        " params=",
-                        explodedArguments.peek(),
                         "' id=",
                         newFunctionNode.getId(),
-                        " source=",
-                        newFunctionNode.getSource().getURL());
+                        " params=",
+                        callSiteTypes.peek());
             }
         }
 
+        callSiteTypes.pop();
         explodedArguments.pop();
 
         return newFunctionNode.setState(lc, CompilationState.BUILTINS_TRANSFORMED);
@@ -331,4 +383,15 @@
         return f instanceof AccessNode && "apply".equals(((AccessNode)f).getProperty());
     }
 
+    private static String massageURL(final URL url) {
+        if (url == null) {
+            return "<null>";
+        }
+        final String str = url.toString();
+        final int slash = str.lastIndexOf('/');
+        if (slash == -1) {
+            return str;
+        }
+        return str.substring(slash + 1);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon Nov 17 09:36:40 2014 +0100
@@ -615,7 +615,6 @@
 
         static final TypeBounds UNBOUNDED = new TypeBounds(Type.UNKNOWN, Type.OBJECT);
         static final TypeBounds INT = exact(Type.INT);
-        static final TypeBounds NUMBER = exact(Type.NUMBER);
         static final TypeBounds OBJECT = exact(Type.OBJECT);
         static final TypeBounds BOOLEAN = exact(Type.BOOLEAN);
 
@@ -3569,7 +3568,8 @@
                     operandBounds = new TypeBounds(binaryNode.getType(), Type.OBJECT);
                 } else {
                     // Non-optimistic, non-FP +. Allow it to overflow.
-                    operandBounds = new TypeBounds(binaryNode.getWidestOperandType(), Type.OBJECT);
+                    operandBounds = new TypeBounds(Type.narrowest(binaryNode.getWidestOperandType(), resultBounds.widest),
+                            Type.OBJECT);
                     forceConversionSeparation = binaryNode.getWidestOperationType().narrowerThan(resultBounds.widest);
                 }
                 loadBinaryOperands(binaryNode.lhs(), binaryNode.rhs(), operandBounds, false, forceConversionSeparation);
@@ -3856,12 +3856,8 @@
                         operandBounds = numericBounds;
                     } else {
                         final boolean isOptimistic = isValid(getProgramPoint());
-                        if(isOptimistic) {
+                        if(isOptimistic || node.isTokenType(TokenType.DIV) || node.isTokenType(TokenType.MOD)) {
                             operandBounds = new TypeBounds(node.getType(), Type.NUMBER);
-                        } else if(node.isTokenType(TokenType.DIV) || node.isTokenType(TokenType.MOD)) {
-                            // Non-optimistic division must always take double arguments as its result must also be
-                            // double.
-                            operandBounds = TypeBounds.NUMBER;
                         } else {
                             // Non-optimistic, non-FP subtraction or multiplication. Allow them to overflow.
                             operandBounds = new TypeBounds(Type.narrowest(node.getWidestOperandType(),
@@ -3897,7 +3893,7 @@
 
     private static boolean isRhsZero(final BinaryNode binaryNode) {
         final Expression rhs = binaryNode.rhs();
-        return rhs instanceof LiteralNode && INT_ZERO.equals(((LiteralNode)rhs).getValue());
+        return rhs instanceof LiteralNode && INT_ZERO.equals(((LiteralNode<?>)rhs).getValue());
     }
 
     private void loadBIT_XOR(final BinaryNode binaryNode) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java	Mon Nov 17 09:36:40 2014 +0100
@@ -31,7 +31,6 @@
 import java.util.Deque;
 import java.util.HashMap;
 import java.util.Map;
-
 import jdk.nashorn.internal.IntDeque;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.Block;
@@ -250,7 +249,7 @@
     static Type getTypeForSlotDescriptor(final char typeDesc) {
         // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see
         // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor().
-        switch(typeDesc) {
+        switch (typeDesc) {
             case 'I':
             case 'i':
                 return Type.INT;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -389,6 +389,7 @@
      * @param continuationEntryPoints  continuation entry points for restof method
      * @param runtimeScope             runtime scope for recompilation type lookup in {@code TypeEvaluator}
      */
+    @SuppressWarnings("unused")
     public Compiler(
             final Context context,
             final ScriptEnvironment env,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysFalse;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue;
-
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -236,12 +235,12 @@
         private byte conversions;
 
         void recordConversion(final LvarType from, final LvarType to) {
-            switch(from) {
+            switch (from) {
             case UNDEFINED:
                 return;
             case INT:
             case BOOLEAN:
-                switch(to) {
+                switch (to) {
                 case LONG:
                     recordConversion(I2L);
                     return;
@@ -256,7 +255,7 @@
                     return;
                 }
             case LONG:
-                switch(to) {
+                switch (to) {
                 case DOUBLE:
                     recordConversion(L2D);
                     return;
@@ -1425,6 +1424,7 @@
      * @param symbol the symbol representing the variable
      * @param type the type
      */
+    @SuppressWarnings("unused")
     private void setType(final Symbol symbol, final LvarType type) {
         if(getLocalVariableTypeOrNull(symbol) == type) {
             return;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -1591,7 +1591,7 @@
     /**
      * Abstraction for performing a conditional jump of any type
      *
-     * @see MethodEmitter.Condition
+     * @see Condition
      *
      * @param cond      the condition to test
      * @param trueLabel the destination label is condition is true
@@ -2217,6 +2217,10 @@
      * @return the method emitter
      */
     MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) {
+        if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names
+            return load(name).dynamicGetIndex(valueType, flags, isMethod);
+        }
+
         debug("dynamic_get", name, valueType, getProgramPoint(flags));
 
         Type type = valueType;
@@ -2240,9 +2244,14 @@
      * @param name  name of property
      * @param flags call site flags
      */
-     void dynamicSet(final String name, final int flags) {
-         assert !isOptimistic(flags);
-         debug("dynamic_set", name, peekType());
+    void dynamicSet(final String name, final int flags) {
+        if (name.length() > LARGE_STRING_THRESHOLD) { // use setIndex for extremely long names
+            load(name).swap().dynamicSetIndex(flags);
+            return;
+        }
+
+        assert !isOptimistic(flags);
+        debug("dynamic_set", name, peekType());
 
         Type type = peekType();
         if (type.isObject() || type.isBoolean()) { //promote strings to objects etc
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.codegen.MethodEmitter.LARGE_STRING_THRESHOLD;
+
 import java.util.HashMap;
 
 /**
@@ -66,27 +68,28 @@
     }
 
     /**
-     * Create a uniqueName name in the namespace in the form base$n where n varies
-     * .
+     * Create a uniqueName name in the namespace in the form base$n where n varies.
+     * Also truncates very long names that would otherwise break ASM.
+     *
      * @param base Base of name.  Base will be returned if uniqueName.
-     *
      * @return Generated uniqueName name.
      */
     public String uniqueName(final String base) {
+        final String truncatedBase = base.length() > LARGE_STRING_THRESHOLD ? base.substring(0, LARGE_STRING_THRESHOLD) : base;
         for (Namespace namespace = this; namespace != null; namespace = namespace.getParent()) {
             final HashMap<String, Integer> namespaceDirectory = namespace.directory;
-            final Integer                  counter            = namespaceDirectory.get(base);
+            final Integer                  counter            = namespaceDirectory.get(truncatedBase);
 
             if (counter != null) {
                 final int count = counter + 1;
-                namespaceDirectory.put(base, count);
-                return base + '-' + count;
+                namespaceDirectory.put(truncatedBase, count);
+                return truncatedBase + '-' + count;
             }
         }
 
-        directory.put(base, 0);
+        directory.put(truncatedBase, 0);
 
-        return base;
+        return truncatedBase;
     }
 
     @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,6 +33,8 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -221,11 +223,37 @@
     private static void reportError(final String msg, final File file, final Exception e) {
         final long now = System.currentTimeMillis();
         if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
-            getLogger().warning(String.format("Failed to %s %s", msg, file), e);
+            reportError(String.format("Failed to %s %s", msg, file), e);
             lastReportedError = now;
         }
     }
 
+    /**
+     * Logs an error message with warning severity (reasoning being that we're reporting an error that'll disable the
+     * type info cache, but it's only logged as a warning because that doesn't prevent Nashorn from running, it just
+     * disables a performance-enhancing cache).
+     * @param msg the message to log
+     * @param e the exception that represents the error.
+     */
+    private static void reportError(final String msg, final Exception e) {
+        getLogger().warning(msg, "\n", exceptionToString(e));
+    }
+
+    /**
+     * A helper that prints an exception stack trace into a string. We have to do this as if we just pass the exception
+     * to {@link DebugLogger#warning(Object...)}, it will only log the exception message and not the stack, making
+     * problems harder to diagnose.
+     * @param e the exception
+     * @return the string representation of {@link Exception#printStackTrace()} output.
+     */
+    private static String exceptionToString(final Exception e) {
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw, false);
+        e.printStackTrace(pw);
+        pw.flush();
+        return sw.toString();
+    }
+
     private static File createBaseCacheDir() {
         if(MAX_FILES == 0 || Options.getBooleanProperty("nashorn.typeInfo.disabled")) {
             return null;
@@ -233,7 +261,7 @@
         try {
             return createBaseCacheDirPrivileged();
         } catch(final Exception e) {
-            getLogger().warning("Failed to create cache dir", e);
+            reportError("Failed to create cache dir", e);
             return null;
         }
     }
@@ -267,7 +295,7 @@
         try {
             return createCacheDirPrivileged(baseDir);
         } catch(final Exception e) {
-            getLogger().warning("Failed to create cache dir", e);
+            reportError("Failed to create cache dir", e);
             return null;
         }
     }
@@ -280,7 +308,7 @@
                 try {
                     versionDirName = getVersionDirName();
                 } catch(final Exception e) {
-                    getLogger().warning("Failed to calculate version dir name", e);
+                    reportError("Failed to calculate version dir name", e);
                     return null;
                 }
                 final File versionDir = new File(baseDir, versionDirName);
@@ -323,10 +351,17 @@
      * per-code-version directory. Normally, this will create the SHA-1 digest of the nashorn.jar. In case the classpath
      * for nashorn is local directory (e.g. during development), this will create the string "dev-" followed by the
      * timestamp of the most recent .class file.
-     * @return
+     *
+     * @return digest of currently running nashorn
+     * @throws Exception if digest could not be created
      */
-    private static String getVersionDirName() throws Exception {
-        final URL url = OptimisticTypesPersistence.class.getResource("");
+    public static String getVersionDirName() throws Exception {
+        // NOTE: getResource("") won't work if the JAR file doesn't have directory entries (and JAR files in JDK distro
+        // don't, or at least it's a bad idea counting on it). Alternatively, we could've tried
+        // getResource("OptimisticTypesPersistence.class") but behavior of getResource with regard to its willingness
+        // to hand out URLs to .class files is also unspecified. Therefore, the most robust way to obtain an URL to our
+        // package is to have a small non-class anchor file and start out from its URL.
+        final URL url = OptimisticTypesPersistence.class.getResource("anchor.properties");
         final String protocol = url.getProtocol();
         if (protocol.equals("jar")) {
             // Normal deployment: nashorn.jar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/anchor.properties	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+
+# This file exists only so OptimisticTypesPersistence.getVersionDirName() can take its URL.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -55,6 +55,7 @@
 
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.nashorn.internal.codegen.CompilerConstants;
+import jdk.nashorn.internal.runtime.JSType;
 
 /**
  * Type class: INT
@@ -230,19 +231,21 @@
 
     @Override
     public Type div(final MethodVisitor method, final int programPoint) {
-        // Never perform non-optimistic integer division in JavaScript.
-        assert programPoint != INVALID_PROGRAM_POINT;
-
-        method.visitInvokeDynamicInsn("idiv", "(II)I", MATHBOOTSTRAP, programPoint);
+        if (programPoint == INVALID_PROGRAM_POINT) {
+            JSType.DIV_ZERO.invoke(method);
+        } else {
+            method.visitInvokeDynamicInsn("idiv", "(II)I", MATHBOOTSTRAP, programPoint);
+        }
         return INT;
     }
 
     @Override
     public Type rem(final MethodVisitor method, final int programPoint) {
-        // Never perform non-optimistic integer remainder in JavaScript.
-        assert programPoint != INVALID_PROGRAM_POINT;
-
-        method.visitInvokeDynamicInsn("irem", "(II)I", MATHBOOTSTRAP, programPoint);
+        if (programPoint == INVALID_PROGRAM_POINT) {
+            JSType.REM_ZERO.invoke(method);
+        } else {
+            method.visitInvokeDynamicInsn("irem", "(II)I", MATHBOOTSTRAP, programPoint);
+        }
         return INT;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -170,19 +170,21 @@
 
     @Override
     public Type div(final MethodVisitor method, final int programPoint) {
-        // Never perform non-optimistic integer division in JavaScript.
-        assert programPoint != INVALID_PROGRAM_POINT;
-
-        method.visitInvokeDynamicInsn("ldiv", "(JJ)J", MATHBOOTSTRAP, programPoint);
+        if (programPoint == INVALID_PROGRAM_POINT) {
+            JSType.DIV_ZERO_LONG.invoke(method);
+        } else {
+            method.visitInvokeDynamicInsn("ldiv", "(JJ)J", MATHBOOTSTRAP, programPoint);
+        }
         return LONG;
     }
 
     @Override
     public Type rem(final MethodVisitor method, final int programPoint) {
-        // Never perform non-optimistic integer remainder in JavaScript.
-        assert programPoint != INVALID_PROGRAM_POINT;
-
-        method.visitInvokeDynamicInsn("lrem", "(JJ)J", MATHBOOTSTRAP, programPoint);
+        if (programPoint == INVALID_PROGRAM_POINT) {
+            JSType.REM_ZERO_LONG.invoke(method);
+        } else {
+            method.visitInvokeDynamicInsn("lrem", "(JJ)J", MATHBOOTSTRAP, programPoint);
+        }
         return LONG;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java	Mon Nov 17 09:36:40 2014 +0100
@@ -356,7 +356,7 @@
             final int pp = input.readInt();
             final int typeChar = input.readByte();
             final Type type;
-            switch(typeChar) {
+            switch (typeChar) {
                 case 'L': type = Type.OBJECT; break;
                 case 'D': type = Type.NUMBER; break;
                 case 'J': type = Type.LONG; break;
@@ -376,13 +376,13 @@
     }
 
     private static jdk.internal.org.objectweb.asm.Type lookupInternalType(final Class<?> type) {
-        final Map<Class<?>, jdk.internal.org.objectweb.asm.Type> cache = INTERNAL_TYPE_CACHE;
-        jdk.internal.org.objectweb.asm.Type itype = cache.get(type);
+        final Map<Class<?>, jdk.internal.org.objectweb.asm.Type> c = INTERNAL_TYPE_CACHE;
+        jdk.internal.org.objectweb.asm.Type itype = c.get(type);
         if (itype != null) {
             return itype;
         }
         itype = jdk.internal.org.objectweb.asm.Type.getType(type);
-        cache.put(type, itype);
+        c.put(type, itype);
         return itype;
     }
 
@@ -1155,6 +1155,10 @@
         return type;
     }
 
+    /**
+     * Read resolve
+     * @return resolved type
+     */
     protected final Object readResolve() {
         return Type.typeFor(clazz);
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -264,6 +264,10 @@
         case COMMARIGHT: {
             return rhs.getType(localVariableTypes);
         }
+        case AND:
+        case OR:{
+            return Type.widestReturnType(lhs.getType(localVariableTypes), rhs.getType(localVariableTypes));
+        }
         default:
             if (isComparison()) {
                 return Type.BOOLEAN;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
-
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import jdk.internal.dynalink.CallSiteDescriptor;
@@ -44,6 +43,9 @@
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.arrays.TypedArrayData;
 
+/**
+ * ArrayBufferView, es6 class or TypedArray implementation
+ */
 @ScriptClass("ArrayBufferView")
 public abstract class ArrayBufferView extends ScriptObject {
     private final NativeArrayBuffer buffer;
@@ -71,6 +73,13 @@
         setArray(data);
     }
 
+    /**
+     * Constructor
+     *
+     * @param buffer         underlying NativeArrayBuffer
+     * @param byteOffset     byte offset for buffer
+     * @param elementLength  element length in bytes
+     */
     protected ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) {
         this(buffer, byteOffset, elementLength, Global.instance());
     }
@@ -89,22 +98,42 @@
         return factory().bytesPerElement;
     }
 
+    /**
+     * Buffer getter as per spec
+     * @param self ArrayBufferView instance
+     * @return buffer
+     */
     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE)
     public static Object buffer(final Object self) {
         return ((ArrayBufferView)self).buffer;
     }
 
+    /**
+     * Buffer offset getter as per spec
+     * @param self ArrayBufferView instance
+     * @return buffer offset
+     */
     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE)
     public static int byteOffset(final Object self) {
         return ((ArrayBufferView)self).byteOffset;
     }
 
+    /**
+     * Byte length getter as per spec
+     * @param self ArrayBufferView instance
+     * @return array buffer view length in bytes
+     */
     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE)
     public static int byteLength(final Object self) {
         final ArrayBufferView view = (ArrayBufferView)self;
         return ((TypedArrayData<?>)view.getArray()).getElementLength() * view.bytesPerElement();
     }
 
+    /**
+     * Length getter as per spec
+     * @param self ArrayBufferView instance
+     * @return length in elements
+     */
     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE)
     public static int length(final Object self) {
         return ((ArrayBufferView)self).elementLength();
@@ -119,15 +148,29 @@
         return ((TypedArrayData<?>)getArray()).getElementLength();
     }
 
+    /**
+     * Factory class for byte ArrayBufferViews
+     */
     protected static abstract class Factory {
         final int bytesPerElement;
         final int maxElementLength;
 
+        /**
+         * Constructor
+         *
+         * @param bytesPerElement number of bytes per element for this buffer
+         */
         public Factory(final int bytesPerElement) {
             this.bytesPerElement  = bytesPerElement;
             this.maxElementLength = Integer.MAX_VALUE / bytesPerElement;
         }
 
+        /**
+         * Factory method
+         *
+         * @param elementLength number of elements
+         * @return new ArrayBufferView
+         */
         public final ArrayBufferView construct(final int elementLength) {
             if (elementLength > maxElementLength) {
                 throw rangeError("inappropriate.array.buffer.length", JSType.toString(elementLength));
@@ -135,15 +178,47 @@
             return construct(new NativeArrayBuffer(elementLength * bytesPerElement), 0, elementLength);
         }
 
-        public abstract ArrayBufferView construct(NativeArrayBuffer buffer, int byteOffset, int elementLength);
+        /**
+         * Factory method
+         *
+         * @param buffer         underlying buffer
+         * @param byteOffset     byte offset
+         * @param elementLength  number of elements
+         *
+         * @return new ArrayBufferView
+         */
+        public abstract ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength);
 
-        public abstract TypedArrayData<?> createArrayData(ByteBuffer nb, int start, int end);
+        /**
+         * Factory method for array data
+         *
+         * @param nb    underlying nativebuffer
+         * @param start start element
+         * @param end   end element
+         *
+         * @return      new array data
+         */
+        public abstract TypedArrayData<?> createArrayData(final ByteBuffer nb, final int start, final int end);
 
+        /**
+         * Get the class name for this type of buffer
+         *
+         * @return class name
+         */
         public abstract String getClassName();
     }
 
+    /**
+     * Get the factor for this kind of buffer
+     * @return Factory
+     */
     protected abstract Factory factory();
 
+    /**
+     * Get the prototype for this ArrayBufferView
+     * @param global global instance
+     * @return prototype
+     */
     protected abstract ScriptObject getPrototype(final Global global);
 
     @Override
@@ -151,10 +226,23 @@
         return factory().getClassName();
     }
 
+    /**
+     * Check if this array contains floats
+     * @return true if float array (or double)
+     */
     protected boolean isFloatArray() {
         return false;
     }
 
+    /**
+     * Inheritable constructor implementation
+     *
+     * @param newObj   is this a new constructor
+     * @param args     arguments
+     * @param factory  factory
+     *
+     * @return new ArrayBufferView
+     */
     protected static ArrayBufferView constructorImpl(final boolean newObj, final Object[] args, final Factory factory) {
         final Object          arg0 = args.length != 0 ? args[0] : 0;
         final ArrayBufferView dest;
@@ -200,6 +288,15 @@
         return dest;
     }
 
+    /**
+     * Inheritable implementation of set, if no efficient implementation is available
+     *
+     * @param self     ArrayBufferView instance
+     * @param array    array
+     * @param offset0  array offset
+     *
+     * @return result of setter
+     */
     protected static Object setImpl(final Object self, final Object array, final Object offset0) {
         final ArrayBufferView dest = (ArrayBufferView)self;
         final int length;
@@ -244,6 +341,15 @@
         return (int)(length & Integer.MAX_VALUE);
     }
 
+    /**
+     * Implementation of subarray if no efficient override exists
+     *
+     * @param self    ArrayBufferView instance
+     * @param begin0  begin index
+     * @param end0    end index
+     *
+     * @return sub array
+     */
     protected static ScriptObject subarrayImpl(final Object self, final Object begin0, final Object end0) {
         final ArrayBufferView arrayView       = (ArrayBufferView)self;
         final int             byteOffset      = arrayView.byteOffset;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,6 +29,7 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
@@ -41,7 +42,6 @@
 import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicReference;
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -54,7 +54,6 @@
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.GlobalConstants;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.NativeJavaPackage;
@@ -438,9 +437,6 @@
         this.scontext = scontext;
     }
 
-    // global constants for this global - they can be replaced with MethodHandle.constant until invalidated
-    private static AtomicReference<GlobalConstants> gcsInstance = new AtomicReference<>();
-
     @Override
     protected Context getContext() {
         return context;
@@ -470,11 +466,6 @@
         super(checkAndGetMap(context));
         this.context = context;
         this.setIsScope();
-        //we can only share one instance of Global constants between globals, or we consume way too much
-        //memory - this is good enough for most programs
-        while (gcsInstance.get() == null) {
-            gcsInstance.compareAndSet(null, new GlobalConstants(context.getLogger(GlobalConstants.class)));
-        }
     }
 
     /**
@@ -493,15 +484,6 @@
     }
 
     /**
-     * Return the global constants map for fields that
-     * can be accessed as MethodHandle.constant
-     * @return constant map
-     */
-    public static GlobalConstants getConstants() {
-        return gcsInstance.get();
-    }
-
-    /**
      * Check if we have a Global instance
      * @return true if one exists
      */
@@ -559,16 +541,16 @@
      * as well as our extension builtin objects like "Java", "JSAdapter" as properties
      * of the global scope object.
      *
-     * @param engine ScriptEngine to initialize
+     * @param eng ScriptEngine to initialize
      */
-    public void initBuiltinObjects(final ScriptEngine engine) {
+    public void initBuiltinObjects(final ScriptEngine eng) {
         if (this.builtinObject != null) {
             // already initialized, just return
             return;
         }
 
-        this.engine = engine;
-        init(engine);
+        this.engine = eng;
+        init(eng);
     }
 
     /**
@@ -1717,7 +1699,7 @@
         return func;
     }
 
-    private void init(final ScriptEngine engine) {
+    private void init(final ScriptEngine eng) {
         assert Context.getGlobal() == this : "this global is not set as current";
 
         final ScriptEnvironment env = getContext().getEnv();
@@ -1835,7 +1817,7 @@
             addOwnProperty("$ARG", Attribute.NOT_ENUMERABLE, arguments);
         }
 
-        if (engine != null) {
+        if (eng != null) {
             // default file name
             addOwnProperty(ScriptEngine.FILENAME, Attribute.NOT_ENUMERABLE, null);
             // __noSuchProperty__ hook for ScriptContext search of missing variables
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Mon Nov 17 09:36:40 2014 +0100
@@ -35,7 +35,6 @@
 import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_STRICT;
 
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.SwitchPoint;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -93,17 +92,6 @@
     private static final Object CALL_CMP                 = new Object();
     private static final Object TO_LOCALE_STRING         = new Object();
 
-    private SwitchPoint     lengthMadeNotWritableSwitchPoint;
-    private PushLinkLogic   pushLinkLogic;
-    private PopLinkLogic    popLinkLogic;
-    private ConcatLinkLogic concatLinkLogic;
-
-    /**
-     * Index for the modification SwitchPoint that triggers when length
-     * becomes not writable
-     */
-    private static final int LENGTH_NOT_WRITABLE_SWITCHPOINT = 0;
-
     /*
      * Constructors.
      */
@@ -271,12 +259,83 @@
     @Override
     public Object getLength() {
         final long length = JSType.toUint32(getArray().length());
-        if(length < Integer.MAX_VALUE) {
+        if (length < Integer.MAX_VALUE) {
             return (int)length;
         }
         return length;
     }
 
+    private boolean defineLength(final long oldLen, final PropertyDescriptor oldLenDesc, final PropertyDescriptor desc, final boolean reject) {
+        // Step 3a
+        if (!desc.has(VALUE)) {
+            return super.defineOwnProperty("length", desc, reject);
+        }
+
+        // Step 3b
+        final PropertyDescriptor newLenDesc = desc;
+
+        // Step 3c and 3d - get new length and convert to long
+        final long newLen = NativeArray.validLength(newLenDesc.getValue(), true);
+
+        // Step 3e
+        newLenDesc.setValue(newLen);
+
+        // Step 3f
+        // increasing array length - just need to set new length value (and attributes if any) and return
+        if (newLen >= oldLen) {
+            return super.defineOwnProperty("length", newLenDesc, reject);
+        }
+
+        // Step 3g
+        if (!oldLenDesc.isWritable()) {
+            if (reject) {
+                throw typeError("property.not.writable", "length", ScriptRuntime.safeToString(this));
+            }
+            return false;
+        }
+
+        // Step 3h and 3i
+        final boolean newWritable = !newLenDesc.has(WRITABLE) || newLenDesc.isWritable();
+        if (!newWritable) {
+            newLenDesc.setWritable(true);
+        }
+
+        // Step 3j and 3k
+        final boolean succeeded = super.defineOwnProperty("length", newLenDesc, reject);
+        if (!succeeded) {
+            return false;
+        }
+
+        // Step 3l
+        // make sure that length is set till the point we can delete the old elements
+        long o = oldLen;
+        while (newLen < o) {
+            o--;
+            final boolean deleteSucceeded = delete(o, false);
+            if (!deleteSucceeded) {
+                newLenDesc.setValue(o + 1);
+                if (!newWritable) {
+                    newLenDesc.setWritable(false);
+                }
+                super.defineOwnProperty("length", newLenDesc, false);
+                if (reject) {
+                    throw typeError("property.not.writable", "length", ScriptRuntime.safeToString(this));
+                }
+                return false;
+            }
+        }
+
+        // Step 3m
+        if (!newWritable) {
+            // make 'length' property not writable
+            final ScriptObject newDesc = Global.newEmptyInstance();
+            newDesc.set(WRITABLE, false, 0);
+            return super.defineOwnProperty("length", newDesc, false);
+        }
+
+        return true;
+    }
+
     /**
      * ECMA 15.4.5.1 [[DefineOwnProperty]] ( P, Desc, Throw )
      */
@@ -290,82 +349,16 @@
 
         // Step 2
         // get old length and convert to long
-        long oldLen = NativeArray.validLength(oldLenDesc.getValue(), true);
+        final long oldLen = NativeArray.validLength(oldLenDesc.getValue(), true);
 
         // Step 3
         if ("length".equals(key)) {
             // check for length being made non-writable
+            final boolean result = defineLength(oldLen, oldLenDesc, desc, reject);
             if (desc.has(WRITABLE) && !desc.isWritable()) {
                 setIsLengthNotWritable();
             }
-
-            // Step 3a
-            if (!desc.has(VALUE)) {
-                return super.defineOwnProperty("length", desc, reject);
-            }
-
-            // Step 3b
-            final PropertyDescriptor newLenDesc = desc;
-
-            // Step 3c and 3d - get new length and convert to long
-            final long newLen = NativeArray.validLength(newLenDesc.getValue(), true);
-
-            // Step 3e
-            newLenDesc.setValue(newLen);
-
-            // Step 3f
-            // increasing array length - just need to set new length value (and attributes if any) and return
-            if (newLen >= oldLen) {
-                return super.defineOwnProperty("length", newLenDesc, reject);
-            }
-
-            // Step 3g
-            if (!oldLenDesc.isWritable()) {
-                if (reject) {
-                    throw typeError("property.not.writable", "length", ScriptRuntime.safeToString(this));
-                }
-                return false;
-            }
-
-            // Step 3h and 3i
-            final boolean newWritable = !newLenDesc.has(WRITABLE) || newLenDesc.isWritable();
-            if (!newWritable) {
-                newLenDesc.setWritable(true);
-            }
-
-            // Step 3j and 3k
-            final boolean succeeded = super.defineOwnProperty("length", newLenDesc, reject);
-            if (!succeeded) {
-                return false;
-            }
-
-            // Step 3l
-            // make sure that length is set till the point we can delete the old elements
-            while (newLen < oldLen) {
-                oldLen--;
-                final boolean deleteSucceeded = delete(oldLen, false);
-                if (!deleteSucceeded) {
-                    newLenDesc.setValue(oldLen + 1);
-                    if (!newWritable) {
-                        newLenDesc.setWritable(false);
-                    }
-                    super.defineOwnProperty("length", newLenDesc, false);
-                    if (reject) {
-                        throw typeError("property.not.writable", "length", ScriptRuntime.safeToString(this));
-                    }
-                    return false;
-                }
-            }
-
-            // Step 3m
-            if (!newWritable) {
-                // make 'length' property not writable
-                final ScriptObject newDesc = Global.newEmptyInstance();
-                newDesc.set(WRITABLE, false, 0);
-                return super.defineOwnProperty("length", newDesc, false);
-            }
-
-            return true;
+            return result;
         }
 
         // Step 4a
@@ -441,23 +434,7 @@
     @Override
     public void setIsLengthNotWritable() {
         super.setIsLengthNotWritable();
-        /*
-         * Switchpoints are created lazily. If we link any push or pop site,
-         * we need to create the "length made not writable" switchpoint, if it
-         * doesn't exist.
-         *
-         * If the switchpoint already exists, we will find it here, and invalidate
-         * it, invalidating all previous callsites that use it.
-         *
-         * If the switchpoint doesn't exist, no push/pop has been linked so far,
-         * because that would create it too. We invalidate it immediately and the
-         * check link logic for all future callsites will fail immediately at link
-         * time
-         */
-        if (lengthMadeNotWritableSwitchPoint == null) {
-            lengthMadeNotWritableSwitchPoint = new SwitchPoint();
-        }
-        SwitchPoint.invalidateAll(new SwitchPoint[] { lengthMadeNotWritableSwitchPoint });
+        setArray(ArrayData.setIsLengthNotWritable(getArray()));
     }
 
     /**
@@ -494,7 +471,7 @@
     @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
     public static void length(final Object self, final Object length) {
         if (isArray(self)) {
-            ((ScriptObject) self).setLength(validLength(length, true));
+            ((ScriptObject)self).setLength(validLength(length, true));
         }
     }
 
@@ -1306,10 +1283,13 @@
                 // Get only non-missing elements. Missing elements go at the end
                 // of the sorted array. So, just don't copy these to sort input.
                 final ArrayList<Object> src = new ArrayList<>();
-                for (long i = 0; i < len; i = array.nextIndex(i)) {
-                    if (array.has((int) i)) {
-                        src.add(array.getObject((int) i));
+
+                for (final Iterator<Long> iter = array.indexIterator(); iter.hasNext(); ) {
+                    final long index = iter.next();
+                    if (index >= len) {
+                        break;
                     }
+                    src.add(array.getObject((int)index));
                 }
 
                 final Object[] sorted = sort(src.toArray(), comparefn);
@@ -1767,11 +1747,11 @@
     @Override
     public SpecializedFunction.LinkLogic getLinkLogic(final Class<? extends LinkLogic> clazz) {
         if (clazz == PushLinkLogic.class) {
-            return pushLinkLogic == null ? new PushLinkLogic(this) : pushLinkLogic;
+            return PushLinkLogic.INSTANCE;
         } else if (clazz == PopLinkLogic.class) {
-            return popLinkLogic == null ? new PopLinkLogic(this) : pushLinkLogic;
+            return PopLinkLogic.INSTANCE;
         } else if (clazz == ConcatLinkLogic.class) {
-            return concatLinkLogic == null ? new ConcatLinkLogic(this) : concatLinkLogic;
+            return ConcatLinkLogic.INSTANCE;
         }
         return null;
     }
@@ -1787,21 +1767,7 @@
      * modification switchpoint which is touched when length is written.
      */
     private static abstract class ArrayLinkLogic extends SpecializedFunction.LinkLogic {
-        private final NativeArray array;
-
-        protected ArrayLinkLogic(final NativeArray array) {
-            this.array = array;
-        }
-
-        private SwitchPoint getSwitchPoint() {
-            return array.lengthMadeNotWritableSwitchPoint;
-        }
-
-        private SwitchPoint newSwitchPoint() {
-            assert array.lengthMadeNotWritableSwitchPoint == null;
-            final SwitchPoint sp = new SwitchPoint();
-            array.lengthMadeNotWritableSwitchPoint = sp;
-            return sp;
+        protected ArrayLinkLogic() {
         }
 
         protected static ContinuousArrayData getContinuousArrayData(final Object self) {
@@ -1822,68 +1788,13 @@
         public Class<? extends Throwable> getRelinkException() {
             return ClassCastException.class;
         }
-
-        @Override
-        public boolean hasModificationSwitchPoints() {
-            return getSwitchPoint() != null;
-        }
-
-        @Override
-        public boolean hasModificationSwitchPoint(final int index) {
-            assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT;
-            return hasModificationSwitchPoints();
-        }
-
-        @Override
-        public SwitchPoint getOrCreateModificationSwitchPoint(final int index) {
-            assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT;
-            SwitchPoint sp = getSwitchPoint();
-            if (sp == null) {
-                sp = newSwitchPoint();
-            }
-            return sp;
-        }
-
-        @Override
-        public SwitchPoint[] getOrCreateModificationSwitchPoints() {
-            return new SwitchPoint[] { getOrCreateModificationSwitchPoint(LENGTH_NOT_WRITABLE_SWITCHPOINT) };
-        }
-
-        @Override
-        public void invalidateModificationSwitchPoint(final int index) {
-            assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT;
-            invalidateModificationSwitchPoints();
-        }
-
-        @Override
-        public void invalidateModificationSwitchPoints() {
-            final SwitchPoint sp = getSwitchPoint();
-            assert sp != null : "trying to invalidate non-existant modified SwitchPoint";
-            if (!sp.hasBeenInvalidated()) {
-                SwitchPoint.invalidateAll(new SwitchPoint[] { sp });
-            }
-        }
-
-        @Override
-        public boolean hasInvalidatedModificationSwitchPoint(final int index) {
-            assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT;
-            return hasInvalidatedModificationSwitchPoints();
-        }
-
-        @Override
-        public boolean hasInvalidatedModificationSwitchPoints() {
-            final SwitchPoint sp = getSwitchPoint();
-            return sp != null && !sp.hasBeenInvalidated();
-        }
     }
 
     /**
      * This is linker logic for optimistic concatenations
      */
     private static final class ConcatLinkLogic extends ArrayLinkLogic {
-        private ConcatLinkLogic(final NativeArray array) {
-            super(array);
-        }
+        private static final LinkLogic INSTANCE = new ConcatLinkLogic();
 
         @Override
         public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) {
@@ -1915,9 +1826,7 @@
      * This is linker logic for optimistic pushes
      */
     private static final class PushLinkLogic extends ArrayLinkLogic {
-        private PushLinkLogic(final NativeArray array) {
-            super(array);
-        }
+        private static final LinkLogic INSTANCE = new PushLinkLogic();
 
         @Override
         public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) {
@@ -1929,9 +1838,7 @@
      * This is linker logic for optimistic pops
      */
     private static final class PopLinkLogic extends ArrayLinkLogic {
-        private PopLinkLogic(final NativeArray array) {
-            super(array);
-        }
+        private static final LinkLogic INSTANCE = new PopLinkLogic();
 
         /**
          * We need to check if we are dealing with a continuous non empty array data here,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 package jdk.nashorn.internal.objects;
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
-
 import java.nio.ByteBuffer;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -34,6 +33,7 @@
 import jdk.nashorn.internal.objects.annotations.Getter;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
+import jdk.nashorn.internal.objects.annotations.Where;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -138,6 +138,19 @@
     }
 
     /**
+     * Returns true if an object is an ArrayBufferView
+     *
+     * @param self self
+     * @param obj  object to check
+     *
+     * @return true if obj is an ArrayBufferView
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isView(final Object self, final Object obj) {
+        return obj instanceof ArrayBufferView;
+    }
+
+    /**
      * Slice function
      * @param self   native array buffer
      * @param begin0 start byte index
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java	Mon Nov 17 09:36:40 2014 +0100
@@ -39,6 +39,7 @@
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.events.RuntimeEvent;
 import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
@@ -66,6 +67,36 @@
     }
 
     /**
+     * Return the ArrayData class for this ScriptObject
+     * @param self self
+     * @param obj script object to check
+     * @return ArrayData class, or undefined if no ArrayData is present
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static Object getArrayDataClass(final Object self, final Object obj) {
+        try {
+            return ((ScriptObject)obj).getArray().getClass();
+        } catch (final ClassCastException e) {
+            return ScriptRuntime.UNDEFINED;
+        }
+    }
+
+    /**
+     * Return the ArrayData for this ScriptObject
+     * @param self self
+     * @param obj script object to check
+     * @return ArrayData, ArrayDatas have toString methods, return Undefined if data missing
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static Object getArrayData(final Object self, final Object obj) {
+        try {
+            return ((ScriptObject)obj).getArray();
+        } catch (final ClassCastException e) {
+            return ScriptRuntime.UNDEFINED;
+        }
+    }
+
+    /**
      * Nashorn extension: get context, context utility
      *
      * @param self self reference
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,6 +29,7 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -572,7 +573,7 @@
         try {
             return ((CharSequence)self).charAt(pos);
         } catch (final IndexOutOfBoundsException e) {
-            throw new ClassCastException();
+            throw new ClassCastException(); //invalid char, out of bounds, force relink
         }
     }
 
@@ -1380,7 +1381,6 @@
      * sequence and that we are in range
      */
     private static final class CharCodeAtLinkLogic extends SpecializedFunction.LinkLogic {
-
         private static final CharCodeAtLinkLogic INSTANCE = new CharCodeAtLinkLogic();
 
         @Override
@@ -1389,7 +1389,7 @@
                 //check that it's a char sequence or throw cce
                 final CharSequence cs = (CharSequence)self;
                 //check that the index, representable as an int, is inside the array
-                final int intIndex = JSType.toInteger(request.getArguments()[1]);
+                final int intIndex = JSType.toInteger(request.getArguments()[2]);
                 return intIndex >= 0 && intIndex < cs.length(); //can link
             } catch (final ClassCastException | IndexOutOfBoundsException e) {
                 //fallthru
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java	Mon Nov 17 09:36:40 2014 +0100
@@ -30,7 +30,6 @@
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.SwitchPoint;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -62,10 +61,6 @@
          */
         public static final LinkLogic EMPTY_INSTANCE = new Empty();
 
-        private static final SwitchPoint[] INVALIDATED_SWITCHPOINTS = new SwitchPoint[0];
-
-        private SwitchPoint[] modificationSwitchPoints; //cache
-
         /** Empty link logic class - allow all linking, no guards */
         private static final class Empty extends LinkLogic {
             @Override
@@ -167,92 +162,6 @@
         }
 
         /**
-         * Return the modification SwitchPoint of a particular index from this OptimisticBuiltins
-         * If none exists, one is created and that one is return.
-         *
-         * The implementor must map indexes to specific SwitchPoints for specific events and keep
-         * track of what they mean, for example NativeArray.LENGTH_NOT_WRITABLE_SWITCHPOINT
-         * might be a useful index mapping
-         *
-         * @param index index for SwitchPoint to get or create
-         * @return modification SwitchPoint of particular index for the receiver
-         */
-        public SwitchPoint getOrCreateModificationSwitchPoint(final int index) {
-            return null;
-        }
-
-        /**
-         * Return the modification SwitchPoint from this OptimisticBuiltins. If none
-         * exists, one is created and that one is return.
-         *
-         * @return modification SwitchPoint for the receiver
-         */
-        public SwitchPoint[] getOrCreateModificationSwitchPoints() {
-            return null;
-        }
-
-        /**
-         * Hook to invalidate a modification SwitchPoint by index.
-         *
-         * @param index index for SwitchPoint to invalidate
-         */
-        public void invalidateModificationSwitchPoint(final int index) {
-            //empty
-        }
-
-        /**
-         * Hook to invalidate all modification SwitchPoints for a receiver
-         */
-        public void invalidateModificationSwitchPoints() {
-            //empty
-        }
-
-        /**
-         * Check whether the receiver has an invalidated modification SwitchPoint.
-         *
-         * @param  index index for the modification SwitchPoint
-         * @return true if the particular SwitchPoint at the index is invalidated
-         */
-        public boolean hasInvalidatedModificationSwitchPoint(final int index) {
-            return false;
-        }
-
-        /**
-         * Check whether at least one of the modification SwitchPoints has been
-         * invalidated
-         * @return true if one of the SwitchPoints has been invalidated
-         */
-        public boolean hasInvalidatedModificationSwitchPoints() {
-            return false;
-        }
-
-        /**
-         * Check whether this OptimisticBuiltins has a SwitchPoints of particular
-         * index.
-         *
-         * As creation overhead for a SwitchPoint is non-zero, we have to create them lazily instead of,
-         * e.g. in the constructor of every subclass.
-         *
-         * @param index index for the modification SwitchPoint
-         * @return true if a modification SwitchPoint exists, no matter if it has been invalidated or not
-         */
-        public boolean hasModificationSwitchPoint(final int index) {
-            return false;
-        }
-
-        /**
-         * Check whether this OptimisticBuiltins has SwitchPoints.
-         *
-         * As creation overhead for a SwitchPoint is non-zero, we have to create them lazily instead of,
-         * e.g. in the constructor of every subclass.
-         *
-         * @return true if a modification SwitchPoint exists, no matter if it has been invalidated or not
-         */
-        public boolean hasModificationSwitchPoints() {
-            return false;
-        }
-
-        /**
          * Check, given a link request and a receiver, if this specialization
          * fits This is used by the linker in {@link ScriptFunction} to figure
          * out if an optimistic builtin can be linked when first discovered
@@ -265,47 +174,9 @@
          *         pick a non specialized target
          */
         public boolean checkLinkable(final Object self, final CallSiteDescriptor desc, final LinkRequest request) {
-            // no matter what the modification switchpoints are, if any of them are invalidated,
-            // we can't link. Side effect is that if it's the first time we see this callsite,
-            // we have to create the SwitchPoint(s) so future modification switchpoint invalidations
-            // relink it
-            final SwitchPoint[] sps = getOrCreateModificationSwitchPoints(self);
-            if (sps == INVALIDATED_SWITCHPOINTS) {
-                // nope, can't do the fast link as this assumption
-                // has been invalidated already, e.g. length of an
-                // array set to not writable
-                return false;
-            }
-            modificationSwitchPoints = sps; //cache
-
             // check the link guard, if it says we can link, go ahead
             return canLink(self, desc, request);
         }
-
-        private SwitchPoint[] getOrCreateModificationSwitchPoints(final Object self) {
-            final SwitchPoint[] sps = getOrCreateModificationSwitchPoints(); //ask for all my switchpoints
-            if (sps != null) { //switchpoint exists, but some may be invalidated
-                for (final SwitchPoint sp : sps) {
-                    if (sp.hasBeenInvalidated()) {
-                        return INVALIDATED_SWITCHPOINTS;
-                    }
-                }
-            }
-            return sps;
-        }
-
-        /**
-         * Get the cached modification switchpoints. Only possible to do after a link
-         * check call has been performed, one that has answered "true", or you will get the
-         * wrong information.
-         *
-         * Should be used only from {@link ScriptFunction#findCallMethod}
-         *
-         * @return cached modification switchpoints for this callsite, null if none
-         */
-        public SwitchPoint[] getModificationSwitchPoints() {
-            return modificationSwitchPoints == null ? null : modificationSwitchPoints.clone();
-        }
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContext.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContext.java	Mon Nov 17 09:36:40 2014 +0100
@@ -141,9 +141,8 @@
                 return breakable;
             }
             return null;
-        } else {
-            return getBreakable();
         }
+        return getBreakable();
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextBaseNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextBaseNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -56,7 +56,7 @@
 
     /**
      * Returns a single flag
-     * @param flag
+     * @param flag flag
      * @return A single flag
      */
     protected int getFlag(final int flag) {
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @param flag
+     * @param flag flag
      * @return the new flags
      */
     @Override
@@ -82,7 +82,7 @@
     }
 
     /**
-     * @param statements
+     * @param statements statements
      */
     @Override
     public void setStatements(final List<Statement> statements) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java	Mon Nov 17 09:36:40 2014 +0100
@@ -41,6 +41,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.ServiceLoader;
+import jdk.nashorn.internal.codegen.OptimisticTypesPersistence;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
 import jdk.nashorn.internal.runtime.logging.Loggable;
@@ -81,10 +82,9 @@
      * Returns a new code store instance.
      *
      * @param context the current context
-     * @return The instance
-     * @throws IOException If an error occurs
+     * @return The instance, or null if code store could not be created
      */
-    public static CodeStore newCodeStore(final Context context) throws IOException {
+    public static CodeStore newCodeStore(final Context context) {
         final Class<CodeStore> baseClass = CodeStore.class;
         try {
             // security check first
@@ -102,9 +102,14 @@
         } catch (final AccessControlException e) {
             context.getLogger(CodeStore.class).warning("failed to load code store provider ", e);
         }
-        final CodeStore store = new DirectoryCodeStore();
-        store.initLogger(context);
-        return store;
+        try {
+            final CodeStore store = new DirectoryCodeStore(context);
+            store.initLogger(context);
+            return store;
+        } catch (final IOException e) {
+            context.getLogger(CodeStore.class).warning("failed to create cache directory ", e);
+            return null;
+        }
     }
 
 
@@ -210,32 +215,34 @@
         /**
          * Constructor
          *
+         * @param context the current context
          * @throws IOException if there are read/write problems with the cache and cache directory
          */
-        public DirectoryCodeStore() throws IOException {
-            this(Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache"), false, DEFAULT_MIN_SIZE);
+        public DirectoryCodeStore(final Context context) throws IOException {
+            this(context, Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache"), false, DEFAULT_MIN_SIZE);
         }
 
         /**
          * Constructor
          *
+         * @param context the current context
          * @param path    directory to store code in
          * @param readOnly is this a read only code store
          * @param minSize minimum file size for caching scripts
          * @throws IOException if there are read/write problems with the cache and cache directory
          */
-        public DirectoryCodeStore(final String path, final boolean readOnly, final int minSize) throws IOException {
-            this.dir = checkDirectory(path, readOnly);
+        public DirectoryCodeStore(final Context context, final String path, final boolean readOnly, final int minSize) throws IOException {
+            this.dir = checkDirectory(path, context.getEnv(), readOnly);
             this.readOnly = readOnly;
             this.minSize = minSize;
         }
 
-        private static File checkDirectory(final String path, final boolean readOnly) throws IOException {
+        private static File checkDirectory(final String path, final ScriptEnvironment env, final boolean readOnly) throws IOException {
             try {
                 return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() {
                     @Override
                     public File run() throws IOException {
-                        final File dir = new File(path).getAbsoluteFile();
+                        final File dir = new File(path, getVersionDir(env)).getAbsoluteFile();
                         if (readOnly) {
                             if (!dir.exists() || !dir.isDirectory()) {
                                 throw new IOException("Not a directory: " + dir.getPath());
@@ -257,6 +264,15 @@
             }
         }
 
+        private static String getVersionDir(final ScriptEnvironment env) throws IOException {
+            try {
+                final String versionDir = OptimisticTypesPersistence.getVersionDirName();
+                return env._optimistic_types ? versionDir + "_opt" : versionDir;
+            } catch (final Exception e) {
+                throw new IOException(e);
+            }
+        }
+
         @Override
         public StoredScript load(final Source source, final String functionKey) {
             if (source.getLength() < minSize) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,16 +27,17 @@
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
-
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.MutableCallSite;
 import java.lang.invoke.SwitchPoint;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.function.Supplier;
@@ -727,34 +728,58 @@
      * @param ipp
      * @return string describing the ipp map
      */
-    private static String toStringInvalidations(final Map<Integer, Type> ipp) {
+    private static List<String> toStringInvalidations(final Map<Integer, Type> ipp) {
         if (ipp == null) {
-            return "";
+            return Collections.emptyList();
         }
 
-        final StringBuilder sb = new StringBuilder();
+        final List<String> list = new ArrayList<>();
 
         for (final Iterator<Map.Entry<Integer, Type>> iter = ipp.entrySet().iterator(); iter.hasNext(); ) {
             final Map.Entry<Integer, Type> entry = iter.next();
             final char bct = entry.getValue().getBytecodeStackType();
+            final String type;
 
+            switch (entry.getValue().getBytecodeStackType()) {
+            case 'A':
+                type = "object";
+                break;
+            case 'I':
+                type = "int";
+                break;
+            case 'J':
+                type = "long";
+                break;
+            case 'D':
+                type = "double";
+                break;
+            default:
+                type = String.valueOf(bct);
+                break;
+            }
+
+            final StringBuilder sb = new StringBuilder();
             sb.append('[').
+                    append("program point: ").
                     append(entry.getKey()).
-                    append("->").
-                    append(bct == 'A' ? 'O' : bct).
+                    append(" -> ").
+                    append(type).
                     append(']');
 
-            if (iter.hasNext()) {
-                sb.append(' ');
-            }
+            list.add(sb.toString());
         }
 
-        return sb.toString();
+        return list;
     }
 
     private void logRecompile(final String reason, final FunctionNode fn, final MethodType type, final Map<Integer, Type> ipp) {
         if (log.isEnabled()) {
-            log.info(reason, DebugLogger.quote(fn.getName()), " signature: ", type, " ", toStringInvalidations(ipp));
+            log.info(reason, DebugLogger.quote(fn.getName()), " signature: ", type);
+            log.indent();
+            for (final String str : toStringInvalidations(ipp)) {
+                log.fine(str);
+            }
+            log.unindent();
         }
     }
 
@@ -770,14 +795,21 @@
      */
     private synchronized MethodHandle handleRewriteException(final OptimismInfo oldOptInfo, final RewriteException re) {
         if (log.isEnabled()) {
-            log.info(new RecompilationEvent(Level.INFO, re, re.getReturnValueNonDestructive()), "RewriteException ", re.getMessageShort());
+            log.info(
+                    new RecompilationEvent(
+                        Level.INFO,
+                        re,
+                        re.getReturnValueNonDestructive()),
+                    "caught RewriteException ",
+                    re.getMessageShort());
+            log.indent();
         }
 
         final MethodType type = type();
 
         // Compiler needs a call site type as its input, which always has a callee parameter, so we must add it if
         // this function doesn't have a callee parameter.
-        final MethodType callSiteType = type.parameterType(0) == ScriptFunction.class ?
+        final MethodType ct = type.parameterType(0) == ScriptFunction.class ?
                 type :
                 type.insertParameterTypes(0, ScriptFunction.class);
         final OptimismInfo currentOptInfo = optimismInfo;
@@ -788,44 +820,44 @@
         final OptimismInfo effectiveOptInfo = currentOptInfo != null ? currentOptInfo : oldOptInfo;
         FunctionNode fn = effectiveOptInfo.reparse();
         final boolean serialized = effectiveOptInfo.isSerialized();
-        final Compiler compiler = effectiveOptInfo.getCompiler(fn, callSiteType, re); //set to non rest-of
+        final Compiler compiler = effectiveOptInfo.getCompiler(fn, ct, re); //set to non rest-of
 
         if (!shouldRecompile) {
             // It didn't necessarily recompile, e.g. for an outer invocation of a recursive function if we already
             // recompiled a deoptimized version for an inner invocation.
             // We still need to do the rest of from the beginning
-            logRecompile("Rest-of compilation [STANDALONE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
+            logRecompile("Rest-of compilation [STANDALONE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints);
             return restOfHandle(effectiveOptInfo, compiler.compile(fn, serialized ? CompilationPhases.COMPILE_SERIALIZED_RESTOF : CompilationPhases.COMPILE_ALL_RESTOF), currentOptInfo != null);
         }
 
-        logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
+        logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, ct, effectiveOptInfo.invalidatedProgramPoints);
         fn = compiler.compile(fn, serialized ? CompilationPhases.RECOMPILE_SERIALIZED_UPTO_BYTECODE : CompilationPhases.COMPILE_UPTO_BYTECODE);
-        log.info("Reusable IR generated");
+        log.fine("Reusable IR generated");
 
         // compile the rest of the function, and install it
         log.info("Generating and installing bytecode from reusable IR...");
-        logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
+        logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints);
         final FunctionNode normalFn = compiler.compile(fn, CompilationPhases.GENERATE_BYTECODE_AND_INSTALL);
 
         if (effectiveOptInfo.data.usePersistentCodeCache()) {
             final RecompilableScriptFunctionData data = effectiveOptInfo.data;
             final int functionNodeId = data.getFunctionNodeId();
-            final TypeMap typeMap = data.typeMap(callSiteType);
+            final TypeMap typeMap = data.typeMap(ct);
             final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
             final String cacheKey = CodeStore.getCacheKey(functionNodeId, paramTypes);
             compiler.persistClassInfo(cacheKey, normalFn);
         }
 
-        log.info("Done.");
-
         final boolean canBeDeoptimized = normalFn.canBeDeoptimized();
 
         if (log.isEnabled()) {
-            log.info("Recompiled '", fn.getName(), "' (", Debug.id(this), ") ", canBeDeoptimized ? " can still be deoptimized." : " is completely deoptimized.");
+            log.unindent();
+            log.info("Done.");
+
+            log.info("Recompiled '", fn.getName(), "' (", Debug.id(this), ") ", canBeDeoptimized ? "can still be deoptimized." : " is completely deoptimized.");
+            log.finest("Looking up invoker...");
         }
 
-        log.info("Looking up invoker...");
-
         final MethodHandle newInvoker = effectiveOptInfo.data.lookup(fn);
         invoker     = newInvoker.asType(type.changeReturnType(newInvoker.type().returnType()));
         constructor = null; // Will be regenerated when needed
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,6 +33,7 @@
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.Source.sourceFor;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -60,6 +61,7 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 import java.util.logging.Level;
@@ -262,6 +264,10 @@
     // persistent code store
     private CodeStore codeStore;
 
+    // A factory for linking global properties as constant method handles. It is created when the first Global
+    // is created, and invalidated forever once the second global is created.
+    private final AtomicReference<GlobalConstants> globalConstantsRef = new AtomicReference<>();
+
     /**
      * Get the current global scope
      * @return the current global scope
@@ -293,7 +299,10 @@
         assert getGlobal() != global;
         //same code can be cached between globals, then we need to invalidate method handle constants
         if (global != null) {
-            Global.getConstants().invalidateAll();
+            final GlobalConstants globalConstants = getContext(global).getGlobalConstants();
+            if (globalConstants != null) {
+                globalConstants.invalidateAll();
+            }
         }
         currentGlobal.set(global);
     }
@@ -500,11 +509,7 @@
         }
 
         if (env._persistent_cache) {
-            try {
-                codeStore = newCodeStore(this);
-            } catch (final IOException e) {
-                throw new RuntimeException("Error initializing code cache", e);
-            }
+            codeStore = newCodeStore(this);
         }
 
         // print version info if asked.
@@ -529,6 +534,15 @@
     }
 
     /**
+     * Returns the factory for constant method handles for global properties. The returned factory can be
+     * invalidated if this Context has more than one Global.
+     * @return the factory for constant method handles for global properties.
+     */
+    GlobalConstants getGlobalConstants() {
+        return globalConstantsRef.get();
+    }
+
+    /**
      * Get the error manager for this context
      * @return error manger
      */
@@ -1016,9 +1030,32 @@
      * @return the global script object
      */
     public Global newGlobal() {
+        createOrInvalidateGlobalConstants();
         return new Global(this);
     }
 
+    private void createOrInvalidateGlobalConstants() {
+        for (;;) {
+            final GlobalConstants currentGlobalConstants = getGlobalConstants();
+            if (currentGlobalConstants != null) {
+                // Subsequent invocation; we're creating our second or later Global. GlobalConstants is not safe to use
+                // with more than one Global, as the constant method handle linkages it creates create a coupling
+                // between the Global and the call sites in the compiled code.
+                currentGlobalConstants.invalidateForever();
+                return;
+            }
+            final GlobalConstants newGlobalConstants = new GlobalConstants(getLogger(GlobalConstants.class));
+            if (globalConstantsRef.compareAndSet(null, newGlobalConstants)) {
+                // First invocation; we're creating the first Global in this Context. Create the GlobalConstants object
+                // for this Context.
+                return;
+            }
+
+            // If we reach here, then we started out as the first invocation, but another concurrent invocation won the
+            // CAS race. We'll just let the loop repeat and invalidate the CAS race winner.
+        }
+    }
+
     /**
      * Initialize given global scope object.
      *
@@ -1057,12 +1094,19 @@
      * @return current global's context
      */
     static Context getContextTrusted() {
-        return ((ScriptObject)Context.getGlobal()).getContext();
+        return getContext(getGlobal());
     }
 
     static Context getContextTrustedOrNull() {
         final Global global = Context.getGlobal();
-        return global == null ? null : ((ScriptObject)global).getContext();
+        return global == null ? null : getContext(global);
+    }
+
+    private static Context getContext(final Global global) {
+        // We can't invoke Global.getContext() directly, as it's a protected override, and Global isn't in our package.
+        // In order to access the method, we must cast it to ScriptObject first (which is in our package) and then let
+        // virtual invocation do its thing.
+        return ((ScriptObject)global).getContext();
     }
 
     /**
@@ -1150,10 +1194,9 @@
 
         StoredScript storedScript = null;
         FunctionNode functionNode = null;
-        // We only use the code store here if optimistic types are disabled. With optimistic types,
-        // code is stored per function in RecompilableScriptFunctionData.
-        // TODO: This should really be triggered by lazy compilation, not optimistic types.
-        final boolean useCodeStore = env._persistent_cache && !env._parse_only && !env._optimistic_types;
+        // We only use the code store here if optimistic types are disabled. With optimistic types, initial compilation
+        // just creates a thin wrapper, and actual code is stored per function in RecompilableScriptFunctionData.
+        final boolean useCodeStore = codeStore != null && !env._parse_only && !env._optimistic_types;
         final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null;
 
         if (useCodeStore) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java	Mon Nov 17 09:36:40 2014 +0100
@@ -96,15 +96,17 @@
         // If thrown object is an Error or sub-object like TypeError, then
         // an ECMAException object has been already initialized at constructor.
         if (thrown instanceof ScriptObject) {
-            final ScriptObject sobj = (ScriptObject)thrown;
-            final Object exception = getException(sobj);
+            final Object exception = getException((ScriptObject)thrown);
             if (exception instanceof ECMAException) {
-                // copy over file name, line number and column number.
                 final ECMAException ee = (ECMAException)exception;
-                ee.setFileName(fileName);
-                ee.setLineNumber(line);
-                ee.setColumnNumber(column);
-                return ee;
+                // Make sure exception has correct thrown reference because that's what will end up getting caught.
+                if (ee.getThrown() == thrown) {
+                    // copy over file name, line number and column number.
+                    ee.setFileName(fileName);
+                    ee.setLineNumber(line);
+                    ee.setColumnNumber(column);
+                    return ee;
+                }
             }
         }
 
@@ -154,7 +156,11 @@
      * @return a {@link ECMAException}
      */
     public static Object getException(final ScriptObject errObj) {
-        return errObj.get(ECMAException.EXCEPTION_PROPERTY);
+        // Exclude inherited properties that may belong to errors in the prototype chain.
+        if (errObj.hasOwnProperty(ECMAException.EXCEPTION_PROPERTY)) {
+            return errObj.get(ECMAException.EXCEPTION_PROPERTY);
+        }
+        return null;
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java	Mon Nov 17 09:36:40 2014 +0100
@@ -31,12 +31,14 @@
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.getProgramPoint;
 import static jdk.nashorn.internal.runtime.logging.DebugLogger.quote;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.SwitchPoint;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Level;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.DynamicLinker;
@@ -50,7 +52,7 @@
 import jdk.nashorn.internal.runtime.logging.Logger;
 
 /**
- * Each global owns one of these. This is basically table of accessors
+ * Each context owns one of these. This is basically table of accessors
  * for global properties. A global constant is evaluated to a MethodHandle.constant
  * for faster access and to avoid walking to proto chain looking for it.
  *
@@ -67,12 +69,19 @@
  * reregister the switchpoint. Set twice or more - don't try again forever, or we'd
  * just end up relinking our way into megamorphisism.
  *
+ * Also it has to be noted that this kind of linking creates a coupling between a Global
+ * and the call sites in compiled code belonging to the Context. For this reason, the
+ * linkage becomes incorrect as soon as the Context has more than one Global. The
+ * {@link #invalidateForever()} is invoked by the Context to invalidate all linkages and
+ * turn off the functionality of this object as soon as the Context's {@link Context#newGlobal()} is invoked
+ * for second time.
+ *
  * We can extend this to ScriptObjects in general (GLOBAL_ONLY=false), which requires
  * a receiver guard on the constant getter, but it currently leaks memory and its benefits
  * have not yet been investigated property.
  *
- * As long as all Globals share the same constant instance, we need synchronization
- * whenever we access the instance.
+ * As long as all Globals in a Context share the same GlobalConstants instance, we need synchronization
+ * whenever we access it.
  */
 @Logger(name="const")
 public final class GlobalConstants implements Loggable {
@@ -82,7 +91,7 @@
      * Script objects require a receiver guard, which is memory intensive, so this is currently
      * disabled. We might implement a weak reference based approach to this later.
      */
-    private static final boolean GLOBAL_ONLY = true;
+    public static final boolean GLOBAL_ONLY = true;
 
     private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
 
@@ -98,6 +107,8 @@
      */
     private final Map<String, Access> map = new HashMap<>();
 
+    private final AtomicBoolean invalidatedForever = new AtomicBoolean(false);
+
     /**
      * Constructor - used only by global
      * @param log logger, or null if none
@@ -216,10 +227,34 @@
      * the same class for a new global, but the builtins and global scoped variables
      * will have changed.
      */
-    public synchronized void invalidateAll() {
-        log.info("New global created - invalidating all constant callsites without increasing invocation count.");
-        for (final Access acc : map.values()) {
-            acc.invalidateUncounted();
+    public void invalidateAll() {
+        if (!invalidatedForever.get()) {
+            log.info("New global created - invalidating all constant callsites without increasing invocation count.");
+            synchronized (this) {
+                for (final Access acc : map.values()) {
+                    acc.invalidateUncounted();
+                }
+            }
+        }
+    }
+
+    /**
+     * To avoid an expensive global guard "is this the same global", similar to the
+     * receiver guard on the ScriptObject level, we invalidate all getters when the
+     * second Global is created by the Context owning this instance. After this
+     * method is invoked, this GlobalConstants instance will both invalidate all the
+     * switch points it produced, and it will stop handing out new method handles
+     * altogether.
+     */
+    public void invalidateForever() {
+        if (invalidatedForever.compareAndSet(false, true)) {
+            log.info("New global created - invalidating all constant callsites.");
+            synchronized (this) {
+                for (final Access acc : map.values()) {
+                    acc.invalidateForever();
+                }
+                map.clear();
+            }
         }
     }
 
@@ -251,7 +286,7 @@
         return obj;
     }
 
-    private synchronized Access getOrCreateSwitchPoint(final String name) {
+    private Access getOrCreateSwitchPoint(final String name) {
         Access acc = map.get(name);
         if (acc != null) {
             return acc;
@@ -267,9 +302,13 @@
      * @param name name of property
      */
     void delete(final String name) {
-        final Access acc = map.get(name);
-        if (acc != null) {
-            acc.invalidateForever();
+        if (!invalidatedForever.get()) {
+            synchronized (this) {
+                final Access acc = map.get(name);
+                if (acc != null) {
+                    acc.invalidateForever();
+                }
+            }
         }
     }
 
@@ -313,45 +352,45 @@
      *
      * @return null if failed to set up constant linkage
      */
-    synchronized GuardedInvocation findSetMethod(final FindProperty find, final ScriptObject receiver, final GuardedInvocation inv, final CallSiteDescriptor desc, final LinkRequest request) {
-        if (GLOBAL_ONLY && !isGlobalSetter(receiver, find)) {
+    GuardedInvocation findSetMethod(final FindProperty find, final ScriptObject receiver, final GuardedInvocation inv, final CallSiteDescriptor desc, final LinkRequest request) {
+        if (invalidatedForever.get() || (GLOBAL_ONLY && !isGlobalSetter(receiver, find))) {
             return null;
         }
 
         final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
 
-        final Access acc  = getOrCreateSwitchPoint(name);
+        synchronized (this) {
+            final Access acc  = getOrCreateSwitchPoint(name);
 
-        if (log.isEnabled()) {
-            log.fine("Trying to link constant SETTER ", acc);
-        }
+            if (log.isEnabled()) {
+                log.fine("Trying to link constant SETTER ", acc);
+            }
 
-        if (!acc.mayRetry()) {
-            if (log.isEnabled()) {
-                log.fine("*** SET: Giving up on " + quote(name) + " - retry count has exceeded " + DynamicLinker.getLinkedCallSiteLocation());
+            if (!acc.mayRetry() || invalidatedForever.get()) {
+                if (log.isEnabled()) {
+                    log.fine("*** SET: Giving up on " + quote(name) + " - retry count has exceeded " + DynamicLinker.getLinkedCallSiteLocation());
+                }
+                return null;
             }
-            return null;
-        }
-
-        assert acc.mayRetry();
 
-        if (acc.hasBeenInvalidated()) {
-            log.info("New chance for " + acc);
-            acc.newSwitchPoint();
-        }
+            if (acc.hasBeenInvalidated()) {
+                log.info("New chance for " + acc);
+                acc.newSwitchPoint();
+            }
 
-        assert !acc.hasBeenInvalidated();
+            assert !acc.hasBeenInvalidated();
 
-        // if we haven't given up on this symbol, add a switchpoint invalidation filter to the receiver parameter
-        final MethodHandle target           = inv.getInvocation();
-        final Class<?>     receiverType     = target.type().parameterType(0);
-        final MethodHandle boundInvalidator = MH.bindTo(INVALIDATE_SP,  this);
-        final MethodHandle invalidator      = MH.asType(boundInvalidator, boundInvalidator.type().changeParameterType(0, receiverType).changeReturnType(receiverType));
-        final MethodHandle mh               = MH.filterArguments(inv.getInvocation(), 0, MH.insertArguments(invalidator, 1, acc));
+            // if we haven't given up on this symbol, add a switchpoint invalidation filter to the receiver parameter
+            final MethodHandle target           = inv.getInvocation();
+            final Class<?>     receiverType     = target.type().parameterType(0);
+            final MethodHandle boundInvalidator = MH.bindTo(INVALIDATE_SP,  this);
+            final MethodHandle invalidator      = MH.asType(boundInvalidator, boundInvalidator.type().changeParameterType(0, receiverType).changeReturnType(receiverType));
+            final MethodHandle mh               = MH.filterArguments(inv.getInvocation(), 0, MH.insertArguments(invalidator, 1, acc));
 
-        assert inv.getSwitchPoints() == null : Arrays.asList(inv.getSwitchPoints());
-        log.info("Linked setter " + quote(name) + " " + acc.getSwitchPoint());
-        return new GuardedInvocation(mh, inv.getGuard(), acc.getSwitchPoint(), inv.getException());
+            assert inv.getSwitchPoints() == null : Arrays.asList(inv.getSwitchPoints());
+            log.info("Linked setter " + quote(name) + " " + acc.getSwitchPoint());
+            return new GuardedInvocation(mh, inv.getGuard(), acc.getSwitchPoint(), inv.getException());
+        }
     }
 
     /**
@@ -380,11 +419,11 @@
      *
      * @return resulting getter, or null if failed to create constant
      */
-    synchronized GuardedInvocation findGetMethod(final FindProperty find, final ScriptObject receiver, final CallSiteDescriptor desc) {
+    GuardedInvocation findGetMethod(final FindProperty find, final ScriptObject receiver, final CallSiteDescriptor desc) {
         // Only use constant getter for fast scope access, because the receiver may change between invocations
         // for slow-scope and non-scope callsites.
         // Also return null for user accessor properties as they may have side effects.
-        if (!NashornCallSiteDescriptor.isFastScope(desc)
+        if (invalidatedForever.get() || !NashornCallSiteDescriptor.isFastScope(desc)
                 || (GLOBAL_ONLY && !find.getOwner().isGlobal())
                 || find.getProperty() instanceof UserAccessorProperty) {
             return null;
@@ -395,51 +434,53 @@
         final Class<?> retType      = desc.getMethodType().returnType();
         final String   name         = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
 
-        final Access acc = getOrCreateSwitchPoint(name);
+        synchronized (this) {
+            final Access acc = getOrCreateSwitchPoint(name);
 
-        log.fine("Starting to look up object value " + name);
-        final Object c = find.getObjectValue();
+            log.fine("Starting to look up object value " + name);
+            final Object c = find.getObjectValue();
 
-        if (log.isEnabled()) {
-            log.fine("Trying to link constant GETTER " + acc + " value = " + c);
-        }
+            if (log.isEnabled()) {
+                log.fine("Trying to link constant GETTER " + acc + " value = " + c);
+            }
 
-        if (acc.hasBeenInvalidated() || acc.guardFailed()) {
-            if (log.isEnabled()) {
-                log.info("*** GET: Giving up on " + quote(name) + " - retry count has exceeded " + DynamicLinker.getLinkedCallSiteLocation());
+            if (acc.hasBeenInvalidated() || acc.guardFailed() || invalidatedForever.get()) {
+                if (log.isEnabled()) {
+                    log.info("*** GET: Giving up on " + quote(name) + " - retry count has exceeded " + DynamicLinker.getLinkedCallSiteLocation());
+                }
+                return null;
             }
-            return null;
-        }
+
+            final MethodHandle cmh = constantGetter(c);
 
-        final MethodHandle cmh = constantGetter(c);
-
-        MethodHandle mh;
-        MethodHandle guard;
+            MethodHandle mh;
+            MethodHandle guard;
 
-        if (isOptimistic) {
-            if (JSType.getAccessorTypeIndex(cmh.type().returnType()) <= JSType.getAccessorTypeIndex(retType)) {
-                //widen return type - this is pessimistic, so it will always work
-                mh = MH.asType(cmh, cmh.type().changeReturnType(retType));
+            if (isOptimistic) {
+                if (JSType.getAccessorTypeIndex(cmh.type().returnType()) <= JSType.getAccessorTypeIndex(retType)) {
+                    //widen return type - this is pessimistic, so it will always work
+                    mh = MH.asType(cmh, cmh.type().changeReturnType(retType));
+                } else {
+                    //immediately invalidate - we asked for a too wide constant as a narrower one
+                    mh = MH.dropArguments(MH.insertArguments(JSType.THROW_UNWARRANTED.methodHandle(), 0, c, programPoint), 0, Object.class);
+                }
             } else {
-                //immediately invalidate - we asked for a too wide constant as a narrower one
-                mh = MH.dropArguments(MH.insertArguments(JSType.THROW_UNWARRANTED.methodHandle(), 0, c, programPoint), 0, Object.class);
+                //pessimistic return type filter
+                mh = Lookup.filterReturnType(cmh, retType);
             }
-        } else {
-            //pessimistic return type filter
-            mh = Lookup.filterReturnType(cmh, retType);
-        }
 
-        if (find.getOwner().isGlobal()) {
-            guard = null;
-        } else {
-            guard = MH.insertArguments(RECEIVER_GUARD, 0, acc, receiver);
-        }
+            if (find.getOwner().isGlobal()) {
+                guard = null;
+            } else {
+                guard = MH.insertArguments(RECEIVER_GUARD, 0, acc, receiver);
+            }
 
-        if (log.isEnabled()) {
-            log.info("Linked getter " + quote(name) + " as MethodHandle.constant() -> " + c + " " + acc.getSwitchPoint());
-            mh = MethodHandleFactory.addDebugPrintout(log, Level.FINE, mh, "get const " + acc);
+            if (log.isEnabled()) {
+                log.info("Linked getter " + quote(name) + " as MethodHandle.constant() -> " + c + " " + acc.getSwitchPoint());
+                mh = MethodHandleFactory.addDebugPrintout(log, Level.FINE, mh, "get const " + acc);
+            }
+
+            return new GuardedInvocation(mh, guard, acc.getSwitchPoint(), null);
         }
-
-        return new GuardedInvocation(mh, guard, acc.getSwitchPoint(), null);
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -150,6 +150,12 @@
     /** Div exact wrapper for potentially integer division that turns into float point */
     public static final Call DIV_EXACT       = staticCall(JSTYPE_LOOKUP, JSType.class, "divExact", int.class, int.class, int.class, int.class);
 
+    /** Div zero wrapper for integer division that handles (0/0)|0 == 0 */
+    public static final Call DIV_ZERO        = staticCall(JSTYPE_LOOKUP, JSType.class, "divZero", int.class, int.class, int.class);
+
+    /** Mod zero wrapper for integer division that handles (0%0)|0 == 0 */
+    public static final Call REM_ZERO        = staticCall(JSTYPE_LOOKUP, JSType.class, "remZero", int.class, int.class, int.class);
+
     /** Mod exact wrapper for potentially integer remainders that turns into float point */
     public static final Call REM_EXACT       = staticCall(JSTYPE_LOOKUP, JSType.class, "remExact", int.class, int.class, int.class, int.class);
 
@@ -174,6 +180,12 @@
     /** Div exact wrapper for potentially integer division that turns into float point */
     public static final Call DIV_EXACT_LONG       = staticCall(JSTYPE_LOOKUP, JSType.class, "divExact", long.class, long.class, long.class, int.class);
 
+    /** Div zero wrapper for long division that handles (0/0) >>> 0 == 0 */
+    public static final Call DIV_ZERO_LONG        = staticCall(JSTYPE_LOOKUP, JSType.class, "divZero", long.class, long.class, long.class);
+
+    /** Mod zero wrapper for long division that handles (0%0) >>> 0 == 0 */
+    public static final Call REM_ZERO_LONG       = staticCall(JSTYPE_LOOKUP, JSType.class, "remZero", long.class, long.class, long.class);
+
     /** Mod exact wrapper for potentially integer remainders that turns into float point */
     public static final Call REM_EXACT_LONG       = staticCall(JSTYPE_LOOKUP, JSType.class, "remExact", long.class, long.class, long.class, int.class);
 
@@ -1486,6 +1498,28 @@
     }
 
     /**
+     * Implements int division but allows {@code x / 0} to be represented as 0. Basically equivalent to
+     * {@code (x / y)|0} JavaScript expression (division of two ints coerced to int).
+     * @param x the dividend
+     * @param y the divisor
+     * @return the result
+     */
+    public static int divZero(final int x, final int y) {
+        return y == 0 ? 0 : x / y;
+    }
+
+    /**
+     * Implements int remainder but allows {@code x % 0} to be represented as 0. Basically equivalent to
+     * {@code (x % y)|0} JavaScript expression (remainder of two ints coerced to int).
+     * @param x the dividend
+     * @param y the divisor
+     * @return the remainder
+     */
+    public static int remZero(final int x, final int y) {
+        return y == 0 ? 0 : x % y;
+    }
+
+    /**
      * Wrapper for modExact. Throws UnwarrantedOptimismException if the modulo can't be represented as int.
      *
      * @param x first term
@@ -1529,6 +1563,28 @@
     }
 
     /**
+     * Implements long division but allows {@code x / 0} to be represented as 0. Useful when division of two longs
+     * is coerced to long.
+     * @param x the dividend
+     * @param y the divisor
+     * @return the result
+     */
+    public static long divZero(final long x, final long y) {
+        return y == 0L ? 0L : x / y;
+    }
+
+    /**
+     * Implements long remainder but allows {@code x % 0} to be represented as 0. Useful when remainder of two longs
+     * is coerced to long.
+     * @param x the dividend
+     * @param y the divisor
+     * @return the remainder
+     */
+    public static long remZero(final long x, final long y) {
+        return y == 0L ? 0L : x % y;
+    }
+
+    /**
      * Wrapper for modExact. Throws UnwarrantedOptimismException if the modulo can't be represented as int.
      *
      * @param x first term
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java	Mon Nov 17 09:36:40 2014 +0100
@@ -84,7 +84,7 @@
     private transient WeakHashMap<Property, SoftReference<PropertyMap>> history;
 
     /** History of prototypes, used to limit map duplication. */
-    private transient WeakHashMap<PropertyMap, SoftReference<PropertyMap>> protoHistory;
+    private transient WeakHashMap<ScriptObject, SoftReference<PropertyMap>> protoHistory;
 
     /** property listeners */
     private transient PropertyListeners listeners;
@@ -677,14 +677,14 @@
     /**
      * Check prototype history for an existing property map with specified prototype.
      *
-     * @param parentMap New prototype object.
+     * @param proto New prototype object.
      *
      * @return Existing {@link PropertyMap} or {@code null} if not found.
      */
-    private PropertyMap checkProtoHistory(final PropertyMap parentMap) {
+    private PropertyMap checkProtoHistory(final ScriptObject proto) {
         final PropertyMap cachedMap;
         if (protoHistory != null) {
-            final SoftReference<PropertyMap> weakMap = protoHistory.get(parentMap);
+            final SoftReference<PropertyMap> weakMap = protoHistory.get(proto);
             cachedMap = (weakMap != null ? weakMap.get() : null);
         } else {
             cachedMap = null;
@@ -700,15 +700,15 @@
     /**
      * Add a map to the prototype history.
      *
-     * @param parentMap Prototype to add (key.)
+     * @param newProto Prototype to add (key.)
      * @param newMap   {@link PropertyMap} associated with prototype.
      */
-    private void addToProtoHistory(final PropertyMap parentMap, final PropertyMap newMap) {
+    private void addToProtoHistory(final ScriptObject newProto, final PropertyMap newMap) {
         if (protoHistory == null) {
             protoHistory = new WeakHashMap<>();
         }
 
-        protoHistory.put(parentMap, new SoftReference<>(newMap));
+        protoHistory.put(newProto, new SoftReference<>(newMap));
     }
 
     /**
@@ -883,8 +883,7 @@
      */
     public PropertyMap changeProto(final ScriptObject newProto) {
 
-        final PropertyMap parentMap = newProto == null ? null : newProto.getMap();
-        final PropertyMap nextMap = checkProtoHistory(parentMap);
+        final PropertyMap nextMap = checkProtoHistory(newProto);
         if (nextMap != null) {
             return nextMap;
         }
@@ -894,7 +893,7 @@
         }
 
         final PropertyMap newMap = new PropertyMap(this);
-        addToProtoHistory(parentMap, newMap);
+        addToProtoHistory(newProto, newMap);
 
         return newMap;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 package jdk.nashorn.internal.runtime;
 
 import static jdk.nashorn.internal.lookup.Lookup.MH;
-
 import java.io.IOException;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -475,6 +474,7 @@
      * @return either the existing map, or a loaded map from the persistent type info cache, or a new empty map if
      * neither an existing map or a persistent cached type info is available.
      */
+    @SuppressWarnings("unused")
     private static Map<Integer, Type> getEffectiveInvalidatedProgramPoints(
             final Map<Integer, Type> invalidatedProgramPoints, final Object typeInformationFile) {
         if(invalidatedProgramPoints != null) {
@@ -619,20 +619,25 @@
         return f;
     }
 
-    MethodHandle lookup(final FunctionInitializer fnInit) {
+    private void logLookup(final boolean shouldLog, final MethodType targetType) {
+        if (shouldLog && log.isEnabled()) {
+            log.info("Looking up ", DebugLogger.quote(functionName), " type=", targetType);
+        }
+    }
+
+    private MethodHandle lookup(final FunctionInitializer fnInit, final boolean shouldLog) {
         final MethodType type = fnInit.getMethodType();
+        logLookup(shouldLog, type);
         return lookupCodeMethod(fnInit.getCode(), type);
     }
 
     MethodHandle lookup(final FunctionNode fn) {
         final MethodType type = new FunctionSignature(fn).getMethodType();
+        logLookup(true, type);
         return lookupCodeMethod(fn.getCompileUnit().getCode(), type);
     }
 
     MethodHandle lookupCodeMethod(final Class<?> codeClass, final MethodType targetType) {
-        if (log.isEnabled()) {
-            log.info("Looking up ", DebugLogger.quote(functionName), " type=", targetType);
-        }
         return MH.findStatic(LOOKUP, codeClass, functionName, targetType);
     }
 
@@ -648,7 +653,7 @@
         if(!code.isEmpty()) {
             throw new IllegalStateException(name);
         }
-        addCode(lookup(initializer), null, null, initializer.getFlags());
+        addCode(lookup(initializer, true), null, null, initializer.getFlags());
     }
 
     private CompiledFunction addCode(final MethodHandle target, final Map<Integer, Type> invalidatedProgramPoints,
@@ -670,10 +675,10 @@
      */
     private CompiledFunction addCode(final FunctionInitializer fnInit, final MethodType callSiteType) {
         if (isVariableArity()) {
-            return addCode(lookup(fnInit), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags());
+            return addCode(lookup(fnInit, true), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags());
         }
 
-        final MethodHandle handle = lookup(fnInit);
+        final MethodHandle handle = lookup(fnInit, true);
         final MethodType fromType = handle.type();
         MethodType toType = needsCallee(fromType) ? callSiteType.changeParameterType(0, ScriptFunction.class) : callSiteType.dropParameterTypes(0, 1);
         toType = toType.changeReturnType(fromType.returnType());
@@ -698,7 +703,7 @@
             toType = toType.dropParameterTypes(fromCount, toCount);
         }
 
-        return addCode(lookup(fnInit).asType(toType), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags());
+        return addCode(lookup(fnInit, false).asType(toType), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags());
     }
 
     /**
@@ -727,7 +732,7 @@
 
         assert existingBest != null;
         //we are calling a vararg method with real args
-        boolean applyToCall = existingBest.isVarArg() && !CompiledFunction.isVarArgsType(callSiteType);
+        boolean varArgWithRealArgs = existingBest.isVarArg() && !CompiledFunction.isVarArgsType(callSiteType);
 
         //if the best one is an apply to call, it has to match the callsite exactly
         //or we need to regenerate
@@ -736,14 +741,16 @@
             if (best != null) {
                 return best;
             }
-            applyToCall = true;
+            varArgWithRealArgs = true;
         }
 
-        if (applyToCall) {
+        if (varArgWithRealArgs) {
+            // special case: we had an apply to call, but we failed to make it fit.
+            // Try to generate a specialized one for this callsite. It may
+            // be another apply to call specialization, or it may not, but whatever
+            // it is, it is a specialization that is guaranteed to fit
             final FunctionInitializer fnInit = compileTypeSpecialization(callSiteType, runtimeScope, false);
-            if ((fnInit.getFlags() & FunctionNode.HAS_APPLY_TO_CALL_SPECIALIZATION) != 0) { //did the specialization work
-                existingBest = addCode(fnInit, callSiteType);
-            }
+            existingBest = addCode(fnInit, callSiteType);
         }
 
         return existingBest;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Mon Nov 17 09:36:40 2014 +0100
@@ -212,6 +212,7 @@
      * @param out output print writer
      * @param err error print writer
      */
+    @SuppressWarnings("unused")
     public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
         this.out = out;
         this.err = err;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java	Mon Nov 17 09:36:40 2014 +0100
@@ -603,16 +603,6 @@
                     log.info("Linking optimistic builtin function: '", name, "' args=", Arrays.toString(request.getArguments()), " desc=", desc);
                 }
 
-                final SwitchPoint[] msps = linkLogic.getModificationSwitchPoints();
-                if (msps != null) {
-                    for (final SwitchPoint sp : msps) {
-                        if (sp != null) {
-                            assert !sp.hasBeenInvalidated();
-                            sps.add(sp);
-                        }
-                    }
-                }
-
                 exceptionGuard = linkLogic.getRelinkException();
 
                 break;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -47,6 +47,7 @@
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
 import static jdk.nashorn.internal.runtime.linker.NashornGuards.explicitInstanceOfCheck;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -509,6 +510,13 @@
         }
     }
 
+    private void invalidateGlobalConstant(final String key) {
+        final GlobalConstants globalConstants = getGlobalConstants();
+        if (globalConstants != null) {
+            globalConstants.delete(key);
+        }
+    }
+
     /**
      * ECMA 8.12.9 [[DefineOwnProperty]] (P, Desc, Throw)
      *
@@ -524,6 +532,8 @@
         final Object             current = getOwnPropertyDescriptor(key);
         final String             name    = JSType.toString(key);
 
+        invalidateGlobalConstant(key);
+
         if (current == UNDEFINED) {
             if (isExtensible()) {
                 // add a new own property
@@ -922,7 +932,8 @@
                 if (property instanceof UserAccessorProperty) {
                     ((UserAccessorProperty)property).setAccessors(this, getMap(), null);
                 }
-                Global.getConstants().delete(property.getKey());
+
+                invalidateGlobalConstant(property.getKey());
                 return true;
             }
         }
@@ -1348,12 +1359,9 @@
         final PropertyMap  selfMap = this.getMap();
 
         final ArrayData array  = getArray();
-        final long length      = array.length();
-
-        for (long i = 0; i < length; i = array.nextIndex(i)) {
-            if (array.has((int)i)) {
-                keys.add(JSType.toString(i));
-            }
+
+        for (final Iterator<Long> iter = array.indexIterator(); iter.hasNext(); ) {
+            keys.add(JSType.toString(iter.next().longValue()));
         }
 
         for (final Property property : selfMap.getProperties()) {
@@ -1512,12 +1520,12 @@
      *
      * @return {@code true} if 'length' property is non-writable
      */
-    public final boolean isLengthNotWritable() {
+    public boolean isLengthNotWritable() {
         return (flags & IS_LENGTH_NOT_WRITABLE) != 0;
     }
 
     /**
-     * Flag this object as having non-writable length property
+     * Flag this object as having non-writable length property.
      */
     public void setIsLengthNotWritable() {
         flags |= IS_LENGTH_NOT_WRITABLE;
@@ -1983,9 +1991,12 @@
             }
         }
 
-        final GuardedInvocation cinv = Global.getConstants().findGetMethod(find, this, desc);
-        if (cinv != null) {
-            return cinv;
+        final GlobalConstants globalConstants = getGlobalConstants();
+        if (globalConstants != null) {
+            final GuardedInvocation cinv = globalConstants.findGetMethod(find, this, desc);
+            if (cinv != null) {
+                return cinv;
+            }
         }
 
         final Class<?> returnType = desc.getMethodType().returnType();
@@ -2183,14 +2194,22 @@
 
         final GuardedInvocation inv = new SetMethodCreator(this, find, desc, request).createGuardedInvocation(findBuiltinSwitchPoint(name));
 
-        final GuardedInvocation cinv = Global.getConstants().findSetMethod(find, this, inv, desc, request);
-        if (cinv != null) {
-            return cinv;
+        final GlobalConstants globalConstants = getGlobalConstants();
+        if (globalConstants != null) {
+            final GuardedInvocation cinv = globalConstants.findSetMethod(find, this, inv, desc, request);
+            if (cinv != null) {
+                return cinv;
+            }
         }
 
         return inv;
     }
 
+    private GlobalConstants getGlobalConstants() {
+        // Avoid hitting getContext() which might be costly for a non-Global unless needed.
+        return GlobalConstants.GLOBAL_ONLY && !isGlobal() ? null : getContext().getGlobalConstants();
+    }
+
     private GuardedInvocation createEmptySetMethod(final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final String strictErrorMessage, final boolean canBeFastScope) {
         final String  name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         if (NashornCallSiteDescriptor.isStrict(desc)) {
@@ -3137,6 +3156,8 @@
     public final void setObject(final FindProperty find, final int callSiteFlags, final String key, final Object value) {
         FindProperty f = find;
 
+        invalidateGlobalConstant(key);
+
         if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty)) {
             final boolean isScope = NashornCallSiteDescriptor.isScopeFlag(callSiteFlags);
             // If the start object of the find is not this object it means the property was found inside a
@@ -3162,7 +3183,6 @@
                 if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) {
                     throw typeError("property.not.writable", key, ScriptRuntime.safeToString(this));
                 }
-
                 return;
             }
 
@@ -3573,7 +3593,6 @@
             }
             return false;
         }
-
         return deleteObject(JSType.toObject(key), strict);
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -30,6 +30,9 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Array;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
@@ -56,6 +59,21 @@
     public static final ArrayData EMPTY_ARRAY = new UntouchedArrayData();
 
     /**
+     * Length of the array data. Not necessarily length of the wrapped array.
+     * This is private to ensure that no one in a subclass is able to touch the length
+     * without going through {@link setLength}. This is used to implement
+     * {@link LengthNotWritableFilter}s, ensuring that there are no ways past
+     * a {@link setLength} function replaced by a nop
+     */
+    private long length;
+
+    /**
+     * Method handle to throw an {@link UnwarrantedOptimismException} when getting an element
+     * of the wrong type
+     */
+    protected static final CompilerConstants.Call THROW_UNWARRANTED = staticCall(MethodHandles.lookup(), ArrayData.class, "throwUnwarranted", void.class, ArrayData.class, int.class, int.class);
+
+    /**
      * Immutable empty array to get ScriptObjects started.
      * Use the same array and convert it to mutable as soon as it is modified
      */
@@ -82,7 +100,7 @@
 
         @Override
         public ContinuousArrayData copy() {
-            return new UntouchedArrayData((int)length);
+            return new UntouchedArrayData((int)length());
         }
 
         @Override
@@ -98,6 +116,10 @@
         @Override
         public ArrayData ensure(final long safeIndex) {
             if (safeIndex > 0L) {
+                if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH) {
+                    return new SparseArrayData(this, safeIndex + 1);
+                }
+                //known to fit in int
                 return toRealArrayData((int)safeIndex).ensure(safeIndex);
            }
            return this;
@@ -109,6 +131,16 @@
         }
 
         @Override
+        public ArrayData delete(final int index) {
+            return new DeletedRangeArrayFilter(this, index, index);
+        }
+
+        @Override
+        public ArrayData delete(final long fromIndex, final long toIndex) {
+            return new DeletedRangeArrayFilter(this, fromIndex, toIndex);
+        }
+
+        @Override
         public void shiftLeft(final int by) {
             //nop, always empty or we wouldn't be of this class
         }
@@ -169,16 +201,6 @@
         }
 
         @Override
-        public ArrayData delete(final int index) {
-            return new DeletedRangeArrayFilter(this, index, index);
-        }
-
-        @Override
-        public ArrayData delete(final long fromIndex, final long toIndex) {
-            return new DeletedRangeArrayFilter(this, fromIndex, toIndex);
-        }
-
-        @Override
         public Object pop() {
             return ScriptRuntime.UNDEFINED;
         }
@@ -227,17 +249,6 @@
     };
 
     /**
-     * Length of the array data. Not necessarily length of the wrapped array.
-     */
-    protected long length;
-
-    /**
-     * Method handle to throw an {@link UnwarrantedOptimismException} when getting an element
-     * of the wrong type
-     */
-    protected static final CompilerConstants.Call THROW_UNWARRANTED = staticCall(MethodHandles.lookup(), ArrayData.class, "throwUnwarranted", void.class, ArrayData.class, int.class, int.class);
-
-    /**
      * Constructor
      * @param length Virtual length of the array.
      */
@@ -390,6 +401,16 @@
     }
 
     /**
+     * Prevent this array from having its length reset
+     *
+     * @param underlying the underlying ArrayDAta to wrap in the non extensible filter
+     * @return new array data, filtered
+     */
+    public static final ArrayData setIsLengthNotWritable(final ArrayData underlying) {
+        return new LengthNotWritableFilter(underlying);
+    }
+
+    /**
      * Return the length of the array data. This may differ from the actual
      * length of the array this wraps as length may be set or gotten as any
      * other JavaScript Property
@@ -442,6 +463,22 @@
     }
 
     /**
+     * Increase length by 1
+     * @return the new length, not the old one (i.e. pre-increment)
+     */
+    protected final long increaseLength() {
+        return ++this.length;
+    }
+
+    /**
+     * Decrease length by 1.
+     * @return the new length, not the old one (i.e. pre-decrement)
+     */
+    protected final long decreaseLength() {
+        return --this.length;
+    }
+
+    /**
      * Shift the array data left
      *
      * TODO: explore start at an index and not at zero, to make these operations
@@ -450,7 +487,7 @@
      *
      * @param by offset to shift
      */
-    public abstract void shiftLeft(int by);
+    public abstract void shiftLeft(final int by);
 
     /**
      * Shift the array right
@@ -459,7 +496,7 @@
 
      * @return New arraydata (or same)
      */
-    public abstract ArrayData shiftRight(int by);
+    public abstract ArrayData shiftRight(final int by);
 
     /**
      * Ensure that the given index exists and won't fail subsequent
@@ -467,7 +504,7 @@
      * @param safeIndex the index to ensure wont go out of bounds
      * @return new array data (or same)
      */
-    public abstract ArrayData ensure(long safeIndex);
+    public abstract ArrayData ensure(final long safeIndex);
 
     /**
      * Shrink the array to a new length, may or may not retain the
@@ -477,7 +514,7 @@
      *
      * @return new array data (or same)
      */
-    public abstract ArrayData shrink(long newLength);
+    public abstract ArrayData shrink(final long newLength);
 
     /**
      * Set an object value at a given index
@@ -487,7 +524,7 @@
      * @param strict are we in strict mode
      * @return new array data (or same)
      */
-    public abstract ArrayData set(int index, Object value, boolean strict);
+    public abstract ArrayData set(final int index, final Object value, final boolean strict);
 
     /**
      * Set an int value at a given index
@@ -497,7 +534,7 @@
      * @param strict are we in strict mode
      * @return new array data (or same)
      */
-    public abstract ArrayData set(int index, int value, boolean strict);
+    public abstract ArrayData set(final int index, final int value, final boolean strict);
 
     /**
      * Set a long value at a given index
@@ -507,7 +544,7 @@
      * @param strict are we in strict mode
      * @return new array data (or same)
      */
-    public abstract ArrayData set(int index, long value, boolean strict);
+    public abstract ArrayData set(final int index, final long value, final boolean strict);
 
     /**
      * Set an double value at a given index
@@ -517,7 +554,7 @@
      * @param strict are we in strict mode
      * @return new array data (or same)
      */
-    public abstract ArrayData set(int index, double value, boolean strict);
+    public abstract ArrayData set(final int index, final double value, final boolean strict);
 
     /**
      * Set an empty value at a given index. Should only affect Object array.
@@ -548,7 +585,7 @@
      * @param index the index
      * @return the value
      */
-    public abstract int getInt(int index);
+    public abstract int getInt(final int index);
 
     /**
      * Returns the optimistic type of this array data. Basically, when an array data object needs to throw an
@@ -577,7 +614,7 @@
      * @param index the index
      * @return the value
      */
-    public abstract long getLong(int index);
+    public abstract long getLong(final int index);
 
     /**
      * Get optimistic long - default is that it's impossible. Overridden
@@ -597,7 +634,7 @@
      * @param index the index
      * @return the value
      */
-    public abstract double getDouble(int index);
+    public abstract double getDouble(final int index);
 
     /**
      * Get optimistic double - default is that it's impossible. Overridden
@@ -617,14 +654,14 @@
      * @param index the index
      * @return the value
      */
-    public abstract Object getObject(int index);
+    public abstract Object getObject(final int index);
 
     /**
      * Tests to see if an entry exists (avoids boxing.)
      * @param index the index
      * @return true if entry exists
      */
-    public abstract boolean has(int index);
+    public abstract boolean has(final int index);
 
     /**
      * Returns if element at specific index can be deleted or not.
@@ -670,7 +707,7 @@
      * @param index the index
      * @return new array data (or same)
      */
-    public abstract ArrayData delete(int index);
+    public abstract ArrayData delete(final int index);
 
     /**
      * Delete a given range from this array;
@@ -680,7 +717,7 @@
      *
      * @return new ArrayData after deletion
      */
-    public abstract ArrayData delete(long fromIndex, long toIndex);
+    public abstract ArrayData delete(final long fromIndex, final long toIndex);
 
     /**
      * Convert the ArrayData to one with a different element type
@@ -690,7 +727,7 @@
      * @param type new element type
      * @return new array data
      */
-    public abstract ArrayData convert(Class<?> type);
+    public abstract ArrayData convert(final Class<?> type);
 
     /**
      * Push an array of items to the end of the array
@@ -774,7 +811,7 @@
      * @param to   end index + 1
      * @return new array data
      */
-    public abstract ArrayData slice(long from, long to);
+    public abstract ArrayData slice(final long from, final long to);
 
     /**
      * Fast splice operation. This just modifies the array according to the number of
@@ -819,6 +856,34 @@
     }
 
     /**
+     * Return a list of keys in the array for the iterators
+     * @return iterator key list
+     */
+    protected List<Long> computeIteratorKeys() {
+        final List<Long> keys = new ArrayList<>();
+
+        final long len = length();
+        for (long i = 0L; i < len; i = nextIndex(i)) {
+            if (has((int)i)) {
+                keys.add(i);
+            }
+        }
+
+        return keys;
+    }
+
+    /**
+     * Return an iterator that goes through all indexes of elements
+     * in this array. This includes those after array.length if
+     * they exist
+     *
+     * @return iterator
+     */
+    public Iterator<Long> indexIterator() {
+        return computeIteratorKeys().iterator();
+    }
+
+    /**
      * Exponential growth function for array size when in
      * need of resizing.
      *
@@ -837,7 +902,7 @@
      *
      * @return the next index
      */
-    public long nextIndex(final long index) {
+    long nextIndex(final long index) {
         return index + 1;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -39,7 +39,7 @@
     protected ArrayData underlying;
 
     ArrayFilter(final ArrayData underlying) {
-        super(underlying.length);
+        super(underlying.length());
         this.underlying = underlying;
     }
 
@@ -70,62 +70,55 @@
     @Override
     public void shiftLeft(final int by) {
         underlying.shiftLeft(by);
-        setLength(underlying.length);
+        setLength(underlying.length());
     }
 
     @Override
     public ArrayData shiftRight(final int by) {
         underlying = underlying.shiftRight(by);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData ensure(final long safeIndex) {
         underlying = underlying.ensure(safeIndex);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData shrink(final long newLength) {
         underlying = underlying.shrink(newLength);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final Object value, final boolean strict) {
         underlying = underlying.set(index, value, strict);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         underlying = underlying.set(index, value, strict);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final long value, final boolean strict) {
         underlying = underlying.set(index, value, strict);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final double value, final boolean strict) {
         underlying = underlying.set(index, value, strict);
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return this;
     }
 
@@ -189,29 +182,28 @@
     @Override
     public ArrayData delete(final int index) {
         underlying = underlying.delete(index);
-        setLength(underlying.length);
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData delete(final long from, final long to) {
         underlying = underlying.delete(from, to);
-        setLength(underlying.length);
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public ArrayData convert(final Class<?> type) {
         underlying = underlying.convert(type);
-        setLength(underlying.length);
+        setLength(underlying.length());
         return this;
     }
 
     @Override
     public Object pop() {
         final Object value = underlying.pop();
-        setLength(underlying.length);
-
+        setLength(underlying.length());
         return value;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -65,7 +65,7 @@
      * @return true if we don't need to do any array reallocation to fit an element at index
      */
     public final boolean hasRoomFor(final int index) {
-        return has(index) || (index == length && ensure(index) == this);
+        return has(index) || (index == length() && ensure(index) == this);
     }
 
     /**
@@ -73,7 +73,7 @@
      * @return true if empty
      */
     public boolean isEmpty() {
-        return length == 0L;
+        return length() == 0L;
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -38,8 +38,7 @@
 
     DeletedArrayFilter(final ArrayData underlying) {
         super(underlying);
-
-        this.deleted = new BitVector(underlying.length);
+        this.deleted = new BitVector(underlying.length());
     }
 
     @Override
@@ -79,25 +78,24 @@
     @Override
     public void shiftLeft(final int by) {
         super.shiftLeft(by);
-        deleted.shiftLeft(by, length);
+        deleted.shiftLeft(by, length());
     }
 
     @Override
     public ArrayData shiftRight(final int by) {
         super.shiftRight(by);
-        deleted.shiftRight(by, length);
-
+        deleted.shiftRight(by, length());
         return this;
     }
 
     @Override
     public ArrayData ensure(final long safeIndex) {
-        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length) {
+        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length()) {
             return new SparseArrayData(this, safeIndex + 1);
         }
 
         super.ensure(safeIndex);
-        deleted.resize(length);
+        deleted.resize(length());
 
         return this;
     }
@@ -105,36 +103,31 @@
     @Override
     public ArrayData shrink(final long newLength) {
         super.shrink(newLength);
-        deleted.resize(length);
-
+        deleted.resize(length());
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final Object value, final boolean strict) {
         deleted.clear(ArrayIndex.toLongIndex(index));
-
         return super.set(index, value, strict);
     }
 
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         deleted.clear(ArrayIndex.toLongIndex(index));
-
         return super.set(index, value, strict);
     }
 
     @Override
     public ArrayData set(final int index, final long value, final boolean strict) {
         deleted.clear(ArrayIndex.toLongIndex(index));
-
         return super.set(index, value, strict);
     }
 
     @Override
     public ArrayData set(final int index, final double value, final boolean strict) {
         deleted.clear(ArrayIndex.toLongIndex(index));
-
         return super.set(index, value, strict);
     }
 
@@ -146,7 +139,7 @@
     @Override
     public ArrayData delete(final int index) {
         final long longIndex = ArrayIndex.toLongIndex(index);
-        assert longIndex >= 0 && longIndex < length;
+        assert longIndex >= 0 && longIndex < length();
         deleted.set(longIndex);
         underlying.setEmpty(index);
         return this;
@@ -154,7 +147,7 @@
 
     @Override
     public ArrayData delete(final long fromIndex, final long toIndex) {
-        assert fromIndex >= 0 && fromIndex <= toIndex && toIndex < length;
+        assert fromIndex >= 0 && fromIndex <= toIndex && toIndex < length();
         deleted.setRange(fromIndex, toIndex + 1);
         underlying.setEmpty(fromIndex, toIndex);
         return this;
@@ -162,7 +155,7 @@
 
     @Override
     public Object pop() {
-        final long index = length - 1;
+        final long index = length() - 1;
 
         if (super.has((int)index)) {
             final boolean isDeleted = deleted.isSet(index);
@@ -179,7 +172,7 @@
         final ArrayData newArray = underlying.slice(from, to);
         final DeletedArrayFilter newFilter = new DeletedArrayFilter(newArray);
         newFilter.getDeleted().copy(deleted);
-        newFilter.getDeleted().shiftLeft(from, newFilter.length);
+        newFilter.getDeleted().shiftLeft(from, newFilter.length());
 
         return newFilter;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -42,10 +42,10 @@
     }
 
     private static ArrayData maybeSparse(final ArrayData underlying, final long hi) {
-        if(hi < SparseArrayData.MAX_DENSE_LENGTH || underlying instanceof SparseArrayData) {
+        if (hi < SparseArrayData.MAX_DENSE_LENGTH || underlying instanceof SparseArrayData) {
             return underlying;
         }
-        return new SparseArrayData(underlying, underlying.length);
+        return new SparseArrayData(underlying, underlying.length());
     }
 
     private boolean isEmpty() {
@@ -93,7 +93,7 @@
 
     @Override
     public ArrayData ensure(final long safeIndex) {
-        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length) {
+        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length()) {
             return new SparseArrayData(this, safeIndex + 1);
         }
 
@@ -110,7 +110,7 @@
     @Override
     public ArrayData shiftRight(final int by) {
         super.shiftRight(by);
-        final long len = length;
+        final long len = length();
         lo = Math.min(len, lo + by);
         hi = Math.min(len - 1, hi + by);
 
@@ -238,7 +238,7 @@
 
     @Override
     public Object pop() {
-        final int index = (int)length - 1;
+        final int index = (int)length() - 1;
         if (super.has(index)) {
             final boolean isDeleted = isDeleted(index);
             final Object value      = super.pop();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,9 +26,9 @@
 package jdk.nashorn.internal.runtime.arrays;
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
-
 import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.PropertyDescriptor;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
 
 /**
  * ArrayData after the array has been frozen by Object.freeze call.
@@ -79,4 +79,15 @@
         }
         return this;
     }
+
+    @Override
+    public ArrayData push(final boolean strict, final Object... items) {
+        return this; //nop
+    }
+
+    @Override
+    public Object pop() {
+        final int len = (int)underlying.length();
+        return len == 0 ? ScriptRuntime.UNDEFINED : underlying.getObject(len - 1);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -119,22 +119,24 @@
 
     @Override
     public IntArrayData copy() {
-        return new IntArrayData(array.clone(), (int)length);
+        return new IntArrayData(array.clone(), (int)length());
     }
 
     @Override
     public Object asArrayOfType(final Class<?> componentType) {
         if (componentType == int.class) {
-            return array.length == length ? array.clone() : Arrays.copyOf(array, (int)length);
+            final int len = (int)length();
+            return array.length == len ? array.clone() : Arrays.copyOf(array, len);
         }
         return super.asArrayOfType(componentType);
     }
 
     private Object[] toObjectArray(final boolean trim) {
-        assert length <= array.length : "length exceeds internal array size";
-        final Object[] oarray = new Object[trim ? (int)length : array.length];
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
+        final Object[] oarray = new Object[trim ? len : array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             oarray[index] = Integer.valueOf(array[index]);
         }
 
@@ -142,10 +144,11 @@
     }
 
     private double[] toDoubleArray() {
-        assert length <= array.length : "length exceeds internal array size";
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
         final double[] darray = new double[array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             darray[index] = array[index];
         }
 
@@ -153,10 +156,11 @@
     }
 
     private long[] toLongArray() {
-        assert length <= array.length : "length exceeds internal array size";
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
         final long[] larray = new long[array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             larray[index] = array[index];
         }
 
@@ -164,15 +168,15 @@
     }
 
     private LongArrayData convertToLong() {
-        return new LongArrayData(toLongArray(), (int)length);
+        return new LongArrayData(toLongArray(), (int)length());
     }
 
     private NumberArrayData convertToDouble() {
-        return new NumberArrayData(toDoubleArray(), (int)length);
+        return new NumberArrayData(toDoubleArray(), (int)length());
     }
 
     private ObjectArrayData convertToObject() {
-        return new ObjectArrayData(toObjectArray(false), (int)length);
+        return new ObjectArrayData(toObjectArray(false), (int)length());
     }
 
     @Override
@@ -196,7 +200,7 @@
 
     @Override
     public ArrayData shiftRight(final int by) {
-        final ArrayData newData = ensure(by + length - 1);
+        final ArrayData newData = ensure(by + length() - 1);
         if (newData != this) {
             newData.shiftRight(by);
             return newData;
@@ -241,7 +245,7 @@
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
 
         return this;
     }
@@ -250,7 +254,7 @@
     public ArrayData set(final int index, final long value, final boolean strict) {
         if (JSType.isRepresentableAsInt(value)) {
             array[index] = JSType.toInt32(value);
-            setLength(Math.max(index + 1, length));
+            setLength(Math.max(index + 1, length()));
             return this;
         }
 
@@ -261,7 +265,7 @@
     public ArrayData set(final int index, final double value, final boolean strict) {
         if (JSType.isRepresentableAsInt(value)) {
             array[index] = (int)(long)value;
-            setLength(Math.max(index + 1, length));
+            setLength(Math.max(index + 1, length()));
             return this;
         }
 
@@ -305,7 +309,7 @@
 
     @Override
     public boolean has(final int index) {
-        return 0 <= index && index < length;
+        return 0 <= index && index < length();
     }
 
     @Override
@@ -320,11 +324,12 @@
 
     @Override
     public Object pop() {
-        if (length == 0) {
+        final int len = (int)length();
+        if (len == 0) {
             return ScriptRuntime.UNDEFINED;
         }
 
-        final int newLength = (int)length - 1;
+        final int newLength = len - 1;
         final int elem = array[newLength];
         array[newLength] = 0;
         setLength(newLength);
@@ -334,12 +339,12 @@
 
     @Override
     public ArrayData slice(final long from, final long to) {
-        return new IntArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)(to - (from < 0 ? from + length : from)));
+        return new IntArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)(to - (from < 0 ? from + length() : from)));
     }
 
     @Override
     public final ArrayData push(final boolean strict, final int item) {
-        final long      len     = length;
+        final long      len     = length();
         final ArrayData newData = ensure(len);
         if (newData == this) {
             array[(int)len] = item;
@@ -350,7 +355,7 @@
 
     @Override
     public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
-        final long oldLength = length;
+        final long oldLength = length();
         final long newLength = oldLength - removed + added;
         if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
             throw new UnsupportedOperationException();
@@ -384,21 +389,21 @@
 
     @Override
     public long fastPush(final int arg) {
-        final int len = (int)length;
+        final int len = (int)length();
         if (len == array.length) {
             array = Arrays.copyOf(array, nextSize(len));
         }
         array[len] = arg;
-        return ++length;
+        return increaseLength();
     }
 
     //length must not be zero
     @Override
     public int fastPopInt() {
-        if (length == 0) {
+        if (length() == 0) {
             throw new ClassCastException(); //relink
         }
-        final int newLength = (int)--length;
+        final int newLength = (int)decreaseLength();
         final int elem = array[newLength];
         array[newLength] = 0;
         return elem;
@@ -421,8 +426,8 @@
 
     @Override
     public ContinuousArrayData fastConcat(final ContinuousArrayData otherData) {
-        final int   otherLength = (int)otherData.length;
-        final int   thisLength  = (int)length;
+        final int   otherLength = (int)otherData.length();
+        final int   thisLength  = (int)length();
         assert otherLength > 0 && thisLength > 0;
 
         final int[] otherArray  = ((IntArrayData)otherData).array;
@@ -437,7 +442,7 @@
 
     @Override
     public String toString() {
-        assert length <= array.length : length + " > " + array.length;
-        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length));
+        assert length() <= array.length : length() + " > " + array.length;
+        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length()));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LengthNotWritableFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,198 @@
+package jdk.nashorn.internal.runtime.arrays;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+
+/**
+ * Filter to use for ArrayData where the length is not writable.
+ * The default behavior is just to ignore {@link ArrayData#setLength}
+ */
+final class LengthNotWritableFilter extends ArrayFilter {
+    private final SortedMap<Long, Object> extraElements; //elements with index >= length
+
+    /**
+     * Constructor
+     * @param underlying array
+     */
+    LengthNotWritableFilter(final ArrayData underlying) {
+        this(underlying, new TreeMap<Long, Object>());
+    }
+
+    private LengthNotWritableFilter(final ArrayData underlying, final SortedMap<Long, Object> extraElements) {
+        super(underlying);
+        this.extraElements = extraElements;
+    }
+
+    @Override
+    public ArrayData copy() {
+        return new LengthNotWritableFilter(underlying.copy(), new TreeMap<>(extraElements));
+    }
+
+    @Override
+    public boolean has(final int index) {
+        return super.has(index) || extraElements.containsKey((long)index);
+    }
+
+    /**
+     * Set the length of the data array
+     *
+     * @param length the new length for the data array
+     */
+    @Override
+    public void setLength(final long length) {
+        //empty - setting length for a LengthNotWritableFilter is always a nop
+    }
+
+    @Override
+    public ArrayData ensure(final long index) {
+        return this;
+    }
+
+    @Override
+    public ArrayData slice(final long from, final long to) {
+        //return array[from...to), or array[from...length] if undefined, in this case not as we are an ArrayData
+        return new LengthNotWritableFilter(underlying.slice(from, to), extraElements.subMap(from, to));
+    }
+
+    private boolean checkAdd(final long index, final Object value) {
+        if (index >= length()) {
+            extraElements.put(index, value);
+            return true;
+        }
+        return false;
+    }
+
+    private Object get(final long index) {
+        final Object obj = extraElements.get(index);
+        if (obj == null) {
+            return ScriptRuntime.UNDEFINED;
+        }
+        return obj;
+    }
+
+    @Override
+    public int getInt(final int index) {
+        if (index >= length()) {
+            return JSType.toInt32(get(index));
+        }
+        return underlying.getInt(index);
+    }
+
+    @Override
+    public int getIntOptimistic(final int index, final int programPoint) {
+        if (index >= length()) {
+            return JSType.toInt32Optimistic(get(index), programPoint);
+        }
+        return underlying.getIntOptimistic(index, programPoint);
+    }
+
+    @Override
+    public long getLong(final int index) {
+        if (index >= length()) {
+            return JSType.toLong(get(index));
+        }
+        return underlying.getLong(index);
+    }
+
+    @Override
+    public long getLongOptimistic(final int index, final int programPoint) {
+        if (index >= length()) {
+            return JSType.toLongOptimistic(get(index), programPoint);
+        }
+        return underlying.getLongOptimistic(index, programPoint);
+    }
+
+    @Override
+    public double getDouble(final int index) {
+        if (index >= length()) {
+            return JSType.toNumber(get(index));
+        }
+        return underlying.getDouble(index);
+    }
+
+    @Override
+    public double getDoubleOptimistic(final int index, final int programPoint) {
+        if (index >= length()) {
+            return JSType.toNumberOptimistic(get(index), programPoint);
+        }
+        return underlying.getDoubleOptimistic(index, programPoint);
+    }
+
+    @Override
+    public Object getObject(final int index) {
+        if (index >= length()) {
+            return get(index);
+        }
+        return underlying.getObject(index);
+    }
+
+    @Override
+    public ArrayData set(final int index, final Object value, final boolean strict) {
+        if (checkAdd(index, value)) {
+            return this;
+        }
+        underlying = underlying.set(index, value, strict);
+        return this;
+    }
+
+    @Override
+    public ArrayData set(final int index, final int value, final boolean strict) {
+        if (checkAdd(index, value)) {
+            return this;
+        }
+        underlying = underlying.set(index, value, strict);
+        return this;
+    }
+
+    @Override
+    public ArrayData set(final int index, final long value, final boolean strict) {
+        if (checkAdd(index, value)) {
+            return this;
+        }
+        underlying = underlying.set(index, value, strict);
+        return this;
+    }
+
+    @Override
+    public ArrayData set(final int index, final double value, final boolean strict) {
+        if (checkAdd(index, value)) {
+            return this;
+        }
+        underlying = underlying.set(index, value, strict);
+        return this;
+    }
+
+    @Override
+    public ArrayData delete(final int index) {
+        extraElements.remove(index);
+        underlying = underlying.delete(index);
+        return this;
+    }
+
+    @Override
+    public ArrayData delete(final long fromIndex, final long toIndex) {
+        for (final Iterator<Long> iter = extraElements.keySet().iterator(); iter.hasNext();) {
+            final long next = iter.next();
+            if (next >= fromIndex && next <= toIndex) {
+                iter.remove();
+            }
+            if (next > toIndex) { //ordering guaranteed because TreeSet
+                break;
+            }
+        }
+        underlying = underlying.delete(fromIndex, toIndex);
+        return this;
+    }
+
+    @Override
+    public Iterator<Long> indexIterator() {
+        final List<Long> keys = computeIteratorKeys();
+        keys.addAll(extraElements.keySet()); //even if they are outside length this is fine
+        return keys.iterator();
+    }
+
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.util.Arrays;
@@ -77,7 +76,7 @@
 
     @Override
     public LongArrayData copy() {
-        return new LongArrayData(array.clone(), (int)length);
+        return new LongArrayData(array.clone(), (int)length());
     }
 
     @Override
@@ -86,10 +85,11 @@
     }
 
     private Object[] toObjectArray(final boolean trim) {
-        assert length <= array.length : "length exceeds internal array size";
-        final Object[] oarray = new Object[trim ? (int)length : array.length];
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
+        final Object[] oarray = new Object[trim ? len : array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             oarray[index] = Long.valueOf(array[index]);
         }
 
@@ -99,16 +99,18 @@
     @Override
     public Object asArrayOfType(final Class<?> componentType) {
         if (componentType == long.class) {
-            return array.length == length ? array.clone() : Arrays.copyOf(array, (int)length);
+            final int len = (int)length();
+            return array.length == len ? array.clone() : Arrays.copyOf(array, len);
         }
         return super.asArrayOfType(componentType);
     }
 
     private double[] toDoubleArray() {
-        assert length <= array.length : "length exceeds internal array size";
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
         final double[] darray = new double[array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             darray[index] = array[index];
         }
 
@@ -120,7 +122,7 @@
         if (type == Integer.class || type == Long.class) {
             return this;
         }
-        final int len = (int)length;
+        final int len = (int)length();
         if (type == Double.class) {
             return new NumberArrayData(toDoubleArray(), len);
         }
@@ -134,7 +136,7 @@
 
     @Override
     public ArrayData shiftRight(final int by) {
-        final ArrayData newData = ensure(by + length - 1);
+        final ArrayData newData = ensure(by + length() - 1);
         if (newData != this) {
             newData.shiftRight(by);
             return newData;
@@ -179,14 +181,14 @@
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final long value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
@@ -194,7 +196,7 @@
     public ArrayData set(final int index, final double value, final boolean strict) {
         if (JSType.isRepresentableAsLong(value)) {
             array[index] = (long)value;
-            setLength(Math.max(index + 1, length));
+            setLength(Math.max(index + 1, length()));
             return this;
         }
         return convert(Double.class).set(index, value, strict);
@@ -265,7 +267,7 @@
 
     @Override
     public boolean has(final int index) {
-        return 0 <= index && index < length;
+        return 0 <= index && index < length();
     }
 
     @Override
@@ -280,11 +282,12 @@
 
     @Override
     public Object pop() {
-        if (length == 0) {
+        final int len = (int)length();
+        if (len == 0) {
             return ScriptRuntime.UNDEFINED;
         }
 
-        final int newLength = (int)length - 1;
+        final int newLength = len - 1;
         final long elem = array[newLength];
         array[newLength] = 0;
         setLength(newLength);
@@ -294,14 +297,14 @@
 
     @Override
     public ArrayData slice(final long from, final long to) {
-        final long start     = from < 0 ? from + length : from;
+        final long start     = from < 0 ? from + length() : from;
         final long newLength = to - start;
         return new LongArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
 
     @Override
     public final ArrayData push(final boolean strict, final long item) {
-        final long      len     = length;
+        final long      len     = length();
         final ArrayData newData = ensure(len);
         if (newData == this) {
             array[(int)len] = item;
@@ -312,7 +315,7 @@
 
     @Override
     public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
-        final long oldLength = length;
+        final long oldLength = length();
         final long newLength = oldLength - removed + added;
         if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
             throw new UnsupportedOperationException();
@@ -345,20 +348,20 @@
 
     @Override
     public long fastPush(final long arg) {
-        final int len = (int)length;
+        final int len = (int)length();
         if (len == array.length) {
             array = Arrays.copyOf(array, nextSize(len));
         }
         array[len] = arg;
-        return ++length;
+        return increaseLength();
     }
 
     @Override
     public long fastPopLong() {
-        if (length == 0) {
-            throw new ClassCastException();
+        if (length() == 0) {
+            throw new ClassCastException(); //undefined result
         }
-        final int newLength = (int)--length;
+        final int newLength = (int)decreaseLength();
         final long elem = array[newLength];
         array[newLength] = 0;
         return elem;
@@ -376,8 +379,8 @@
 
     @Override
     public ContinuousArrayData fastConcat(final ContinuousArrayData otherData) {
-        final int   otherLength = (int)otherData.length;
-        final int   thisLength  = (int)length;
+        final int   otherLength = (int)otherData.length();
+        final int   thisLength  = (int)length();
         assert otherLength > 0 && thisLength > 0;
 
         final long[] otherArray  = ((LongArrayData)otherData).array;
@@ -392,13 +395,14 @@
 
     @Override
     public String toString() {
-        assert length <= array.length : length + " > " + array.length;
+        assert length() <= array.length : length() + " > " + array.length;
 
         final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).
                 append(": [");
-        for (int i = 0; i < length; i++) {
+        final int len = (int)length();
+        for (int i = 0; i < len; i++) {
             sb.append(array[i]).append('L'); //make sure L suffix is on elements, to discriminate this from IntArrayData.toString()
-            if (i + 1 < length) {
+            if (i + 1 < len) {
                 sb.append(", ");
             }
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NonExtensibleArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NonExtensibleArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -7,13 +7,13 @@
 /**
  * Filter class that wrap arrays that have been tagged non extensible
  */
-public class NonExtensibleArrayFilter extends ArrayFilter {
+final class NonExtensibleArrayFilter extends ArrayFilter {
 
     /**
      * Constructor
      * @param underlying array
      */
-    public NonExtensibleArrayFilter(final ArrayData underlying) {
+    NonExtensibleArrayFilter(final ArrayData underlying) {
         super(underlying);
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.util.Arrays;
@@ -76,7 +75,7 @@
 
     @Override
     public NumberArrayData copy() {
-        return new NumberArrayData(array.clone(), (int)length);
+        return new NumberArrayData(array.clone(), (int)length());
     }
 
     @Override
@@ -85,10 +84,11 @@
     }
 
     private Object[] toObjectArray(final boolean trim) {
-        assert length <= array.length : "length exceeds internal array size";
-        final Object[] oarray = new Object[trim ? (int)length : array.length];
+        assert length() <= array.length : "length exceeds internal array size";
+        final int len = (int)length();
+        final Object[] oarray = new Object[trim ? len : array.length];
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < len; index++) {
             oarray[index] = Double.valueOf(array[index]);
         }
         return oarray;
@@ -96,8 +96,9 @@
 
     @Override
     public Object asArrayOfType(final Class<?> componentType) {
-        if(componentType == double.class) {
-            return array.length == length ? array.clone() : Arrays.copyOf(array, (int)length);
+        if (componentType == double.class) {
+            final int len = (int)length();
+            return array.length == len ? array.clone() : Arrays.copyOf(array, len);
         }
         return super.asArrayOfType(componentType);
     }
@@ -105,7 +106,7 @@
     @Override
     public ContinuousArrayData convert(final Class<?> type) {
         if (type != Double.class && type != Integer.class && type != Long.class) {
-            final int len = (int)length;
+            final int len = (int)length();
             return new ObjectArrayData(toObjectArray(false), len);
         }
         return this;
@@ -118,7 +119,7 @@
 
     @Override
     public ArrayData shiftRight(final int by) {
-        final ArrayData newData = ensure(by + length - 1);
+        final ArrayData newData = ensure(by + length() - 1);
         if (newData != this) {
             newData.shiftRight(by);
             return newData;
@@ -163,21 +164,21 @@
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final long value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final double value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
@@ -241,7 +242,7 @@
 
     @Override
     public boolean has(final int index) {
-        return 0 <= index && index < length;
+        return 0 <= index && index < length();
     }
 
     @Override
@@ -256,11 +257,12 @@
 
     @Override
     public Object pop() {
-        if (length == 0) {
+        final int len = (int)length();
+        if (len == 0) {
             return UNDEFINED;
         }
 
-        final int newLength = (int)length - 1;
+        final int newLength = len - 1;
         final double elem = array[newLength];
         array[newLength] = 0;
         setLength(newLength);
@@ -269,14 +271,14 @@
 
     @Override
     public ArrayData slice(final long from, final long to) {
-        final long start     = from < 0 ? from + length : from;
+        final long start     = from < 0 ? from + length() : from;
         final long newLength = to - start;
         return new NumberArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
 
     @Override
     public final ArrayData push(final boolean strict, final double item) {
-        final long      len     = length;
+        final long      len     = length();
         final ArrayData newData = ensure(len);
         if (newData == this) {
             array[(int)len] = item;
@@ -287,7 +289,7 @@
 
     @Override
     public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
-        final long oldLength = length;
+        final long oldLength = length();
         final long newLength = oldLength - removed + added;
         if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
             throw new UnsupportedOperationException();
@@ -325,21 +327,21 @@
 
     @Override
     public long fastPush(final double arg) {
-        final int len = (int)length;
+        final int len = (int)length();
         if (len == array.length) {
            //note that fastpush never creates spares arrays, there is nothing to gain by that - it will just use even more memory
            array = Arrays.copyOf(array, nextSize(len));
         }
         array[len] = arg;
-        return ++length;
+        return increaseLength();
     }
 
     @Override
     public double fastPopDouble() {
-        if (length == 0) {
+        if (length() == 0) {
             throw new ClassCastException();
         }
-        final int newLength = (int)--length;
+        final int newLength = (int)decreaseLength();
         final double elem = array[newLength];
         array[newLength] = 0;
         return elem;
@@ -352,8 +354,8 @@
 
     @Override
     public ContinuousArrayData fastConcat(final ContinuousArrayData otherData) {
-        final int   otherLength = (int)otherData.length;
-        final int   thisLength  = (int)length;
+        final int   otherLength = (int)otherData.length();
+        final int   thisLength  = (int)length();
         assert otherLength > 0 && thisLength > 0;
 
         final double[] otherArray = ((NumberArrayData)otherData).array;
@@ -368,7 +370,7 @@
 
     @Override
     public String toString() {
-        assert length <= array.length : length + " > " + array.length;
-        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length));
+        assert length() <= array.length : length() + " > " + array.length;
+        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length()));
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 package jdk.nashorn.internal.runtime.arrays;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.util.Arrays;
@@ -77,16 +76,16 @@
 
     @Override
     public ObjectArrayData copy() {
-        return new ObjectArrayData(array.clone(), (int)length);
+        return new ObjectArrayData(array.clone(), (int)length());
     }
 
     @Override
     public Object[] asObjectArray() {
-        return array.length == length ? array.clone() : asObjectArrayCopy();
+        return array.length == length() ? array.clone() : asObjectArrayCopy();
     }
 
     private Object[] asObjectArrayCopy() {
-        final long len = length;
+        final long len = length();
         assert len <= Integer.MAX_VALUE;
         final Object[] copy = new Object[(int)len];
         System.arraycopy(array, 0, copy, 0, (int)len);
@@ -105,7 +104,7 @@
 
     @Override
     public ArrayData shiftRight(final int by) {
-        final ArrayData newData = ensure(by + length - 1);
+        final ArrayData newData = ensure(by + length() - 1);
         if (newData != this) {
             newData.shiftRight(by);
             return newData;
@@ -137,28 +136,28 @@
     @Override
     public ArrayData set(final int index, final Object value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final int value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final long value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData set(final int index, final double value, final boolean strict) {
         array[index] = value;
-        setLength(Math.max(index + 1, length));
+        setLength(Math.max(index + 1, length()));
         return this;
     }
 
@@ -231,7 +230,7 @@
 
     @Override
     public boolean has(final int index) {
-        return 0 <= index && index < length;
+        return 0 <= index && index < length();
     }
 
     @Override
@@ -263,20 +262,20 @@
 
     @Override
     public long fastPush(final Object arg) {
-        final int len = (int)length;
+        final int len = (int)length();
         if (len == array.length) {
             array = Arrays.copyOf(array, nextSize(len));
         }
         array[len] = arg;
-        return ++length;
+        return increaseLength();
     }
 
     @Override
     public Object fastPopObject() {
-        if (length == 0) {
+        if (length() == 0) {
             return ScriptRuntime.UNDEFINED;
         }
-        final int newLength = (int)--length;
+        final int newLength = (int)decreaseLength();
         final Object elem = array[newLength];
         array[newLength] = ScriptRuntime.EMPTY;
         return elem;
@@ -284,11 +283,11 @@
 
     @Override
     public Object pop() {
-        if (length == 0) {
+        if (length() == 0) {
             return ScriptRuntime.UNDEFINED;
         }
 
-        final int newLength = (int)length - 1;
+        final int newLength = (int)length() - 1;
         final Object elem = array[newLength];
         setEmpty(newLength);
         setLength(newLength);
@@ -297,14 +296,14 @@
 
     @Override
     public ArrayData slice(final long from, final long to) {
-        final long start     = from < 0 ? from + length : from;
+        final long start     = from < 0 ? from + length() : from;
         final long newLength = to - start;
         return new ObjectArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
 
     @Override
     public ArrayData push(final boolean strict, final Object item) {
-        final long      len     = length;
+        final long      len     = length();
         final ArrayData newData = ensure(len);
         if (newData == this) {
             array[(int)len] = item;
@@ -315,7 +314,7 @@
 
     @Override
     public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
-        final long oldLength = length;
+        final long oldLength = length();
         final long newLength = oldLength - removed + added;
         if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
             throw new UnsupportedOperationException();
@@ -343,8 +342,8 @@
 
     @Override
     public ContinuousArrayData fastConcat(final ContinuousArrayData otherData) {
-        final int   otherLength = (int)otherData.length;
-        final int   thisLength  = (int)length;
+        final int   otherLength = (int)otherData.length();
+        final int   thisLength  = (int)length();
         assert otherLength > 0 && thisLength > 0;
 
         final Object[] otherArray = ((ObjectArrayData)otherData).array;
@@ -359,7 +358,7 @@
 
     @Override
     public String toString() {
-        assert length <= array.length : length + " > " + array.length;
-        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length));
+        assert length() <= array.length : length() + " > " + array.length;
+        return getClass().getSimpleName() + ':' + Arrays.toString(Arrays.copyOf(array, (int)length()));
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -36,7 +36,7 @@
  * Handle arrays where the index is very large.
  */
 class SparseArrayData extends ArrayData {
-    static final long MAX_DENSE_LENGTH = 16 * 512 * 1024;
+    static final int MAX_DENSE_LENGTH = 8 * 1024 * 1024;
 
     /** Underlying array. */
     private ArrayData underlying;
@@ -53,21 +53,21 @@
 
     SparseArrayData(final ArrayData underlying, final long length, final TreeMap<Long, Object> sparseMap) {
         super(length);
-        assert underlying.length <= length;
+        assert underlying.length() <= length;
         this.underlying = underlying;
-        this.maxDenseLength = Math.max(MAX_DENSE_LENGTH, underlying.length);
+        this.maxDenseLength = Math.max(MAX_DENSE_LENGTH, underlying.length());
         this.sparseMap = sparseMap;
     }
 
     @Override
     public ArrayData copy() {
-        return new SparseArrayData(underlying.copy(), length, new TreeMap<>(sparseMap));
+        return new SparseArrayData(underlying.copy(), length(), new TreeMap<>(sparseMap));
     }
 
     @Override
     public Object[] asObjectArray() {
-        final int len = (int)Math.min(length, Integer.MAX_VALUE);
-        final int underlyingLength = (int)Math.min(len, underlying.length);
+        final int len = (int)Math.min(length(), Integer.MAX_VALUE);
+        final int underlyingLength = (int)Math.min(len, underlying.length());
         final Object[] objArray = new Object[len];
 
         for (int i = 0; i < underlyingLength; i++) {
@@ -104,14 +104,15 @@
         }
 
         sparseMap = newSparseMap;
-        setLength(Math.max(length - by, 0));
+        setLength(Math.max(length() - by, 0));
     }
 
     @Override
     public ArrayData shiftRight(final int by) {
         final TreeMap<Long, Object> newSparseMap = new TreeMap<>();
-        if (underlying.length + by > maxDenseLength) {
-            for (long i = maxDenseLength - by; i < underlying.length; i++) {
+        final long len = underlying.length();
+        if (len + by > maxDenseLength) {
+            for (long i = maxDenseLength - by; i < len; i++) {
                 if (underlying.has((int) i)) {
                     newSparseMap.put(Long.valueOf(i + by), underlying.getObject((int) i));
                 }
@@ -127,23 +128,23 @@
         }
 
         sparseMap = newSparseMap;
-        setLength(length + by);
+        setLength(length() + by);
 
         return this;
     }
 
     @Override
     public ArrayData ensure(final long safeIndex) {
-        if (safeIndex < maxDenseLength && underlying.length <= safeIndex) {
+        if (safeIndex < maxDenseLength && underlying.length() <= safeIndex) {
             underlying = underlying.ensure(safeIndex);
         }
-        setLength(Math.max(safeIndex + 1, length));
+        setLength(Math.max(safeIndex + 1, length()));
         return this;
     }
 
     @Override
     public ArrayData shrink(final long newLength) {
-        if (newLength < underlying.length) {
+        if (newLength < underlying.length()) {
             underlying = underlying.shrink(newLength);
             underlying.setLength(newLength);
             sparseMap.clear();
@@ -160,11 +161,11 @@
         if (index >= 0 && index < maxDenseLength) {
             ensure(index);
             underlying = underlying.set(index, value, strict);
-            setLength(Math.max(underlying.length, length));
+            setLength(Math.max(underlying.length(), length()));
         } else {
             final Long longIndex = indexToKey(index);
             sparseMap.put(longIndex, value);
-            setLength(Math.max(longIndex + 1, length));
+            setLength(Math.max(longIndex + 1, length()));
         }
 
         return this;
@@ -175,11 +176,11 @@
         if (index >= 0 && index < maxDenseLength) {
             ensure(index);
             underlying = underlying.set(index, value, strict);
-            setLength(Math.max(underlying.length, length));
+            setLength(Math.max(underlying.length(), length()));
         } else {
             final Long longIndex = indexToKey(index);
             sparseMap.put(longIndex, value);
-            setLength(Math.max(longIndex + 1, length));
+            setLength(Math.max(longIndex + 1, length()));
         }
         return this;
     }
@@ -189,11 +190,11 @@
         if (index >= 0 && index < maxDenseLength) {
             ensure(index);
             underlying = underlying.set(index, value, strict);
-            setLength(Math.max(underlying.length, length));
+            setLength(Math.max(underlying.length(), length()));
         } else {
             final Long longIndex = indexToKey(index);
             sparseMap.put(longIndex, value);
-            setLength(Math.max(longIndex + 1, length));
+            setLength(Math.max(longIndex + 1, length()));
         }
         return this;
     }
@@ -203,11 +204,11 @@
         if (index >= 0 && index < maxDenseLength) {
             ensure(index);
             underlying = underlying.set(index, value, strict);
-            setLength(Math.max(underlying.length, length));
+            setLength(Math.max(underlying.length(), length()));
         } else {
             final Long longIndex = indexToKey(index);
             sparseMap.put(longIndex, value);
-            setLength(Math.max(longIndex + 1, length));
+            setLength(Math.max(longIndex + 1, length()));
         }
         return this;
     }
@@ -294,7 +295,7 @@
     @Override
     public boolean has(final int index) {
         if (index >= 0 && index < maxDenseLength) {
-            return index < underlying.length && underlying.has(index);
+            return index < underlying.length() && underlying.has(index);
         }
 
         return sparseMap.containsKey(indexToKey(index));
@@ -303,7 +304,7 @@
     @Override
     public ArrayData delete(final int index) {
         if (index >= 0 && index < maxDenseLength) {
-            if (index < underlying.length) {
+            if (index < underlying.length()) {
                 underlying = underlying.delete(index);
             }
         } else {
@@ -315,8 +316,8 @@
 
     @Override
     public ArrayData delete(final long fromIndex, final long toIndex) {
-        if (fromIndex < maxDenseLength && fromIndex < underlying.length) {
-            underlying = underlying.delete(fromIndex, Math.min(toIndex, underlying.length - 1));
+        if (fromIndex < maxDenseLength && fromIndex < underlying.length()) {
+            underlying = underlying.delete(fromIndex, Math.min(toIndex, underlying.length() - 1));
         }
         if (toIndex >= maxDenseLength) {
             sparseMap.subMap(fromIndex, true, toIndex, true).clear();
@@ -336,30 +337,34 @@
 
     @Override
     public Object pop() {
-        if (length == 0) {
+        final long len = length();
+        final long underlyingLen = underlying.length();
+        if (len == 0) {
             return ScriptRuntime.UNDEFINED;
         }
-        if (length == underlying.length) {
+        if (len == underlyingLen) {
             final Object result = underlying.pop();
-            setLength(underlying.length);
+            setLength(underlying.length());
             return result;
         }
-        setLength(length - 1);
-        final Long key = Long.valueOf(length);
+        setLength(len - 1);
+        final Long key = Long.valueOf(len - 1);
         return sparseMap.containsKey(key) ? sparseMap.remove(key) : ScriptRuntime.UNDEFINED;
     }
 
     @Override
     public ArrayData slice(final long from, final long to) {
-        assert to <= length;
-        final long start = from < 0 ? (from + length) : from;
+        assert to <= length();
+        final long start = from < 0 ? (from + length()) : from;
         final long newLength = to - start;
 
+        final long underlyingLength = underlying.length();
+
         if (start >= 0 && to <= maxDenseLength) {
-            if (newLength <= underlying.length) {
+            if (newLength <= underlyingLength) {
                 return underlying.slice(from, to);
             }
-            return underlying.slice(from, to).ensure(newLength - 1).delete(underlying.length, newLength);
+            return underlying.slice(from, to).ensure(newLength - 1).delete(underlyingLength, newLength);
         }
 
         ArrayData sliced = EMPTY_ARRAY;
@@ -369,13 +374,13 @@
                 sliced = sliced.set((int)(i - start), getObject((int)i), false);
             }
         }
-        assert sliced.length == newLength;
+        assert sliced.length() == newLength;
         return sliced;
     }
 
     @Override
     public long nextIndex(final long index) {
-        if (index < underlying.length - 1) {
+        if (index < underlying.length() - 1) {
             return underlying.nextIndex(index);
         }
 
@@ -383,6 +388,7 @@
         if (nextKey != null) {
             return nextKey;
         }
-        return length;
+
+        return length();
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java	Mon Nov 17 09:36:40 2014 +0100
@@ -58,7 +58,7 @@
      * @return element length
      */
     public final int getElementLength() {
-        return (int)length;
+        return (int)length();
     }
 
     /**
@@ -119,7 +119,7 @@
 
     @Override
     public final boolean has(final int index) {
-        return 0 <= index && index < length;
+        return 0 <= index && index < length();
     }
 
     @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -39,8 +39,7 @@
 
     UndefinedArrayFilter(final ArrayData underlying) {
         super(underlying);
-
-        this.undefined = new BitVector(underlying.length);
+        this.undefined = new BitVector(underlying.length());
     }
 
     @Override
@@ -80,25 +79,24 @@
     @Override
     public void shiftLeft(final int by) {
         super.shiftLeft(by);
-        undefined.shiftLeft(by, length);
+        undefined.shiftLeft(by, length());
     }
 
     @Override
     public ArrayData shiftRight(final int by) {
         super.shiftRight(by);
-        undefined.shiftRight(by, length);
-
+        undefined.shiftRight(by, length());
         return this;
     }
 
     @Override
     public ArrayData ensure(final long safeIndex) {
-        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length) {
+        if (safeIndex >= SparseArrayData.MAX_DENSE_LENGTH && safeIndex >= length()) {
             return new SparseArrayData(this, safeIndex + 1);
         }
 
         super.ensure(safeIndex);
-        undefined.resize(length);
+        undefined.resize(length());
 
         return this;
     }
@@ -106,8 +104,7 @@
     @Override
     public ArrayData shrink(final long newLength) {
         super.shrink(newLength);
-        undefined.resize(length);
-
+        undefined.resize(length());
         return this;
     }
 
@@ -216,7 +213,7 @@
 
     @Override
     public Object pop() {
-        final long index = length - 1;
+        final long index = length() - 1;
 
         if (super.has((int)index)) {
             final boolean isUndefined = undefined.isSet(index);
@@ -233,7 +230,7 @@
         final ArrayData newArray = underlying.slice(from, to);
         final UndefinedArrayFilter newFilter = new UndefinedArrayFilter(newArray);
         newFilter.getUndefined().copy(undefined);
-        newFilter.getUndefined().shiftLeft(from, newFilter.length);
+        newFilter.getUndefined().shiftLeft(from, newFilter.length());
 
         return newFilter;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RecompilationEvent.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RecompilationEvent.java	Mon Nov 17 09:36:40 2014 +0100
@@ -47,10 +47,9 @@
      * @param level            logging level
      * @param rewriteException rewriteException wrapped by this RuntimEvent
      * @param returnValue      rewriteException return value - as we don't want to make
-     *     {@link RewriteException#getReturnValueNonDestructive()} public, we pass it as
+     *     {@code RewriteException.getReturnValueNonDestructive()} public, we pass it as
      *     an extra parameter, rather than querying the getter from another package.
      */
-    @SuppressWarnings("javadoc")
     public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) {
         super(level, rewriteException);
         assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Mon Nov 17 09:36:40 2014 +0100
@@ -42,6 +42,8 @@
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.MethodTypeConversionStrategy;
+import jdk.internal.dynalink.support.TypeUtilities;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
@@ -106,6 +108,12 @@
                 return OptimisticReturnFilters.filterOptimisticReturnValue(inv, desc).asType(linkerServices, desc.getMethodType());
             }
         });
+        factory.setAutoConversionStrategy(new MethodTypeConversionStrategy() {
+            @Override
+            public MethodHandle asType(final MethodHandle target, final MethodType newType) {
+                return unboxReturnType(target, newType);
+            }
+        });
         final int relinkThreshold = Options.getIntProperty("nashorn.unstable.relink.threshold", NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD);
         if (relinkThreshold > -1) {
             factory.setUnstableRelinkThreshold(relinkThreshold);
@@ -420,4 +428,29 @@
     static GuardedInvocation asTypeSafeReturn(final GuardedInvocation inv, final LinkerServices linkerServices, final CallSiteDescriptor desc) {
         return inv == null ? null : inv.asTypeSafeReturn(linkerServices, desc.getMethodType());
     }
+
+    /**
+     * Adapts the return type of the method handle with {@code explicitCastArguments} when it is an unboxing
+     * conversion. This will ensure that nulls are unwrapped to false or 0.
+     * @param target the target method handle
+     * @param newType the desired new type. Note that this method does not adapt the method handle completely to the
+     * new type, it only adapts the return type; this is allowed as per
+     * {@link DynamicLinkerFactory#setAutoConversionStrategy(MethodTypeConversionStrategy)}, which is what this method
+     * is used for.
+     * @return the method handle with adapted return type, if it required an unboxing conversion.
+     */
+    private static MethodHandle unboxReturnType(final MethodHandle target, final MethodType newType) {
+        final MethodType targetType = target.type();
+        final Class<?> oldReturnType = targetType.returnType();
+        if (TypeUtilities.isWrapperType(oldReturnType)) {
+            final Class<?> newReturnType = newType.returnType();
+            if (newReturnType.isPrimitive()) {
+                // The contract of setAutoConversionStrategy is such that the difference between newType and targetType
+                // can only be JLS method invocation conversions.
+                assert TypeUtilities.isMethodInvocationConvertible(oldReturnType, newReturnType);
+                return MethodHandles.explicitCastArguments(target, targetType.changeReturnType(newReturnType));
+            }
+        }
+        return target;
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,8 +25,10 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
-import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.*;
-
+import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETMEMBER;
+import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETSLOT;
+import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETMEMBER;
+import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETSLOT;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import jdk.internal.dynalink.CallSiteDescriptor;
@@ -114,12 +116,10 @@
             case "getMethod":
                 if (c > 2) {
                     return findGetMethod(desc);
-                } else {
-                    // For indexed get, we want GuardedInvocation from beans linker and pass it.
-                    // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access.
-                    final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
-                    return findGetIndexMethod(beanInv);
                 }
+            // For indexed get, we want GuardedInvocation from beans linker and pass it.
+            // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access.
+            return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices));
             case "setProp":
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
@@ -166,9 +166,8 @@
             final String name = (String)key;
             if (name.indexOf('(') != -1) {
                 return fallback.invokeExact(jsobj, key);
-            } else {
-                return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key);
             }
+            return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key);
         }
         return null;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Mon Nov 17 09:36:40 2014 +0100
@@ -120,12 +120,10 @@
             case "getMethod":
                 if (c > 2) {
                     return findGetMethod(desc);
-                } else {
-                    // For indexed get, we want get GuardedInvocation beans linker and pass it.
-                    // JSObjectLinker.get uses this fallback getter for explicit signature method access.
-                    final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
-                    return findGetIndexMethod(beanInv);
                 }
+            // For indexed get, we want get GuardedInvocation beans linker and pass it.
+            // JSObjectLinker.get uses this fallback getter for explicit signature method access.
+            return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices));
             case "setProp":
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
@@ -192,9 +190,8 @@
             // get with method name and signature. delegate it to beans linker!
             if (name.indexOf('(') != -1) {
                 return fallback.invokeExact(jsobj, key);
-            } else {
-                return ((JSObject)jsobj).getMember(name);
             }
+            return ((JSObject)jsobj).getMember(name);
         }
         return null;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Mon Nov 17 09:36:40 2014 +0100
@@ -53,15 +53,34 @@
     // Object type arguments of Java method calls, field set and array set.
     private static final boolean MIRROR_ALWAYS = Options.getBooleanProperty("nashorn.mirror.always", true);
 
-    private static final MethodHandle EXPORT_ARGUMENT = new Lookup(MethodHandles.lookup()).findOwnStatic("exportArgument", Object.class, Object.class);
-    private static final MethodHandle EXPORT_NATIVE_ARRAY = new Lookup(MethodHandles.lookup()).findOwnStatic("exportNativeArray", Object.class, NativeArray.class);
-    private static final MethodHandle EXPORT_SCRIPT_OBJECT = new Lookup(MethodHandles.lookup()).findOwnStatic("exportScriptObject", Object.class, ScriptObject.class);
-    private static final MethodHandle IMPORT_RESULT = new Lookup(MethodHandles.lookup()).findOwnStatic("importResult", Object.class, Object.class);
+    private static final MethodHandle EXPORT_ARGUMENT;
+    private static final MethodHandle EXPORT_NATIVE_ARRAY;
+    private static final MethodHandle EXPORT_SCRIPT_OBJECT;
+    private static final MethodHandle IMPORT_RESULT;
+    private static final MethodHandle FILTER_CONSSTRING;
+
+    static {
+        final Lookup lookup  = new Lookup(MethodHandles.lookup());
+        EXPORT_ARGUMENT      = lookup.findOwnStatic("exportArgument", Object.class, Object.class);
+        EXPORT_NATIVE_ARRAY  = lookup.findOwnStatic("exportNativeArray", Object.class, NativeArray.class);
+        EXPORT_SCRIPT_OBJECT = lookup.findOwnStatic("exportScriptObject", Object.class, ScriptObject.class);
+        IMPORT_RESULT        = lookup.findOwnStatic("importResult", Object.class, Object.class);
+        FILTER_CONSSTRING    = lookup.findOwnStatic("consStringFilter", Object.class, Object.class);
+    }
 
     private final BeansLinker beansLinker = new BeansLinker();
 
     @Override
     public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+        if (linkRequest.getReceiver() instanceof ConsString) {
+            // In order to treat ConsString like a java.lang.String we need a link request with a string receiver.
+            final Object[] arguments = linkRequest.getArguments();
+            arguments[0] = "";
+            final LinkRequest forgedLinkRequest = linkRequest.replaceArguments(linkRequest.getCallSiteDescriptor(), arguments);
+            final GuardedInvocation invocation = getGuardedInvocation(beansLinker, forgedLinkRequest, linkerServices);
+            // If an invocation is found we add a filter that makes it work for both Strings and ConsStrings.
+            return invocation == null ? null : invocation.filterArguments(0, FILTER_CONSSTRING);
+        }
         return getGuardedInvocation(beansLinker, linkRequest, linkerServices);
     }
 
@@ -113,6 +132,11 @@
         return ScriptUtils.unwrap(arg);
     }
 
+    @SuppressWarnings("unused")
+    private static Object consStringFilter(final Object arg) {
+        return arg instanceof ConsString ? arg.toString() : arg;
+    }
+
     private static class NashornBeansLinkerServices implements LinkerServices {
         private final LinkerServices linkerServices;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode.newAltNode;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite;
-
 import java.util.HashSet;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
@@ -53,6 +52,7 @@
         super(env, chars, p, end);
     }
 
+    @SuppressWarnings("unused")
     protected final void compile() {
         if (Config.DEBUG) {
             Config.log.println(new String(chars, getBegin(), getEnd()));
@@ -76,7 +76,9 @@
 
         root = setupTree(root, 0);
         if (Config.DEBUG_PARSE_TREE) {
-            if (Config.DEBUG_PARSE_TREE_RAW) Config.log.println("<TREE>");
+            if (Config.DEBUG_PARSE_TREE_RAW) {
+                Config.log.println("<TREE>");
+            }
             root.verifyTree(new HashSet<Node>(), env.reg.warnings);
             Config.log.println(root + "\n");
         }
@@ -94,7 +96,9 @@
 
         regex.clearOptimizeInfo();
 
-        if (!Config.DONT_OPTIMIZE) setOptimizedInfoFromTree(root);
+        if (!Config.DONT_OPTIMIZE) {
+            setOptimizedInfoFromTree(root);
+        }
 
         env.memNodes = null;
 
@@ -110,7 +114,9 @@
 
         if (Config.DEBUG_COMPILE) {
             Config.log.println("stack used: " + regex.stackNeeded);
-            if (Config.USE_STRING_TEMPLATES) Config.log.print("templates: " + regex.templateNum + "\n");
+            if (Config.USE_STRING_TEMPLATES) {
+                Config.log.print("templates: " + regex.templateNum + "\n");
+            }
             Config.log.println(new ByteCodePrinter(regex).byteCodeListToString());
 
         } // DEBUG_COMPILE
@@ -136,7 +142,9 @@
             ConsAltNode can = (ConsAltNode)node;
             do {
                 final int v = quantifiersMemoryInfo(can.car);
-                if (v > info) info = v;
+                if (v > info) {
+                    info = v;
+                }
             } while ((can = can.cdr) != null);
             break;
 
@@ -182,7 +190,9 @@
         switch (node.getType()) {
         case NodeType.BREF:
             final BackRefNode br = (BackRefNode)node;
-            if (br.isRecursion()) break;
+            if (br.isRecursion()) {
+                break;
+            }
 
             if (br.backRef > env.numMem) {
                 throw new ValueException(ERR_INVALID_BACKREF);
@@ -249,6 +259,9 @@
             case EncloseType.STOP_BACKTRACK:
                 min = getMinMatchLength(en.target);
                 break;
+
+            default:
+                break;
             } // inner switch
             break;
 
@@ -276,7 +289,9 @@
             ConsAltNode an = (ConsAltNode)node;
             do {
                 final int tmax = getMaxMatchLength(an.car);
-                if (max < tmax) max = tmax;
+                if (max < tmax) {
+                    max = tmax;
+                }
             } while ((an = an.cdr) != null);
             break;
 
@@ -304,7 +319,9 @@
                 throw new ValueException(ERR_INVALID_BACKREF);
             }
             final int tmax = getMaxMatchLength(env.memNodes[br.backRef]);
-            if (max < tmax) max = tmax;
+            if (max < tmax) {
+                max = tmax;
+            }
             break;
 
         case NodeType.QTFR:
@@ -338,6 +355,9 @@
             case EncloseType.STOP_BACKTRACK:
                 max = getMaxMatchLength(en.target);
                 break;
+
+            default:
+                break;
             } // inner switch
             break;
 
@@ -355,8 +375,8 @@
         return getCharLengthTree(node, 0);
     }
 
-    private int getCharLengthTree(final Node node, int level) {
-        level++;
+    private int getCharLengthTree(final Node node, final int levelp) {
+        final int level = levelp + 1;
 
         int len = 0;
         returnCode = 0;
@@ -366,7 +386,9 @@
             ConsAltNode ln = (ConsAltNode)node;
             do {
                 final int tlen = getCharLengthTree(ln.car, level);
-                if (returnCode == 0) len = MinMaxLen.distanceAdd(len, tlen);
+                if (returnCode == 0) {
+                    len = MinMaxLen.distanceAdd(len, tlen);
+                }
             } while (returnCode == 0 && (ln = ln.cdr) != null);
             break;
 
@@ -378,7 +400,9 @@
             while (returnCode == 0 && (an = an.cdr) != null) {
                 final int tlen2 = getCharLengthTree(an.car, level);
                 if (returnCode == 0) {
-                    if (tlen != tlen2) varLen = true;
+                    if (tlen != tlen2) {
+                        varLen = true;
+                    }
                 }
             }
 
@@ -404,7 +428,9 @@
             final QuantifierNode qn = (QuantifierNode)node;
             if (qn.lower == qn.upper) {
                 tlen = getCharLengthTree(qn.target, level);
-                if (returnCode == 0) len = MinMaxLen.distanceMultiply(tlen, qn.lower);
+                if (returnCode == 0) {
+                    len = MinMaxLen.distanceMultiply(tlen, qn.lower);
+                }
             } else {
                 returnCode = GET_CHAR_LEN_VARLEN;
             }
@@ -435,6 +461,9 @@
             case EncloseType.STOP_BACKTRACK:
                 len = getCharLengthTree(en.target, level);
                 break;
+
+            default:
+                break;
             } // inner switch
             break;
 
@@ -448,7 +477,9 @@
     }
 
     /* x is not included y ==>  1 : 0 */
-    private boolean isNotIncluded(Node x, Node y) {
+    private static boolean isNotIncluded(final Node xn, final Node yn) {
+        Node x = xn;
+        Node y = yn;
         Node tmp;
 
         // !retry:!
@@ -492,10 +523,14 @@
                     boolean v = xc.bs.at(i);
                     if ((v && !xc.isNot()) || (!v && xc.isNot())) {
                         v = yc.bs.at(i);
-                        if ((v && !yc.isNot()) || (!v && yc.isNot())) return false;
+                        if ((v && !yc.isNot()) || (!v && yc.isNot())) {
+                            return false;
+                        }
                     }
                 }
-                if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) return true;
+                if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) {
+                    return true;
+                }
                 return false;
                 // break; not reached
 
@@ -514,7 +549,9 @@
 
         case NodeType.STR:
             final StringNode xs = (StringNode)x;
-            if (xs.length() == 0) break;
+            if (xs.length() == 0) {
+                break;
+            }
 
             switch (yType) {
 
@@ -526,13 +563,16 @@
             case NodeType.STR:
                 final StringNode ys = (StringNode)y;
                 int len = xs.length();
-                if (len > ys.length()) len = ys.length();
+                if (len > ys.length()) {
+                    len = ys.length();
+                }
                 if (xs.isAmbig() || ys.isAmbig()) {
                     /* tiny version */
                     return false;
-                } else {
-                    for (int i=0, p=ys.p, q=xs.p; i<len; i++, p++, q++) {
-                        if (ys.chars[p] != xs.chars[q]) return true;
+                }
+                for (int i=0, pt=ys.p, q=xs.p; i<len; i++, pt++, q++) {
+                    if (ys.chars[pt] != xs.chars[q]) {
+                        return true;
                     }
                 }
                 break;
@@ -542,6 +582,8 @@
             } // inner switch
 
             break; // case NodeType.STR
+        default:
+            break;
 
         } // switch
 
@@ -561,7 +603,9 @@
 
         case NodeType.CTYPE:
         case NodeType.CCLASS:
-            if (!exact) n = node;
+            if (!exact) {
+                n = node;
+            }
             break;
 
         case NodeType.LIST:
@@ -570,7 +614,10 @@
 
         case NodeType.STR:
             final StringNode sn = (StringNode)node;
-            if (sn.end <= sn.p) break; // ???
+            if (sn.end <= sn.p)
+             {
+                break; // ???
+            }
 
             if (exact && !sn.isRaw() && isIgnoreCase(regex.options)){
                 // nothing
@@ -605,12 +652,17 @@
             case EncloseType.STOP_BACKTRACK:
                 n = getHeadValueNode(en.target, exact);
                 break;
+
+            default:
+                break;
             } // inner switch
             break;
 
         case NodeType.ANCHOR:
             final AnchorNode an = (AnchorNode)node;
-            if (an.type == AnchorType.PREC_READ) n = getHeadValueNode(an.target, exact);
+            if (an.type == AnchorType.PREC_READ) {
+                n = getHeadValueNode(an.target, exact);
+            }
             break;
 
         default:
@@ -622,7 +674,9 @@
 
     // true: invalid
     private boolean checkTypeTree(final Node node, final int typeMask, final int encloseMask, final int anchorMask) {
-        if ((node.getType2Bit() & typeMask) == 0) return true;
+        if ((node.getType2Bit() & typeMask) == 0) {
+            return true;
+        }
 
         boolean invalid = false;
 
@@ -641,15 +695,21 @@
 
         case NodeType.ENCLOSE:
             final EncloseNode en = (EncloseNode)node;
-            if ((en.type & encloseMask) == 0) return true;
+            if ((en.type & encloseMask) == 0) {
+                return true;
+            }
             invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask);
             break;
 
         case NodeType.ANCHOR:
             final AnchorNode an = (AnchorNode)node;
-            if ((an.type & anchorMask) == 0) return true;
+            if ((an.type & anchorMask) == 0) {
+                return true;
+            }
 
-            if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask);
+            if (an.target != null) {
+                invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask);
+            }
             break;
 
         default:
@@ -664,7 +724,8 @@
     (?<=A|B) ==> (?<=A)|(?<=B)
     (?<!A|B) ==> (?<!A)(?<!B)
      */
-    private Node divideLookBehindAlternatives(Node node) {
+    private Node divideLookBehindAlternatives(final Node nodep) {
+        Node node = nodep;
         final AnchorNode an = (AnchorNode)node;
         final int anchorType = an.type;
         Node head = an.target;
@@ -699,7 +760,7 @@
     private Node setupLookBehind(final Node node) {
         final AnchorNode an = (AnchorNode)node;
         final int len = getCharLengthTree(an.target);
-        switch(returnCode) {
+        switch (returnCode) {
         case 0:
             an.charLength = len;
             break;
@@ -708,14 +769,17 @@
         case GET_CHAR_LEN_TOP_ALT_VARLEN:
             if (syntax.differentLengthAltLookBehind()) {
                 return divideLookBehindAlternatives(node);
-            } else {
-                throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
             }
+            throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
+        default:
+            break;
         }
         return node;
     }
 
-    private void nextSetup(Node node, final Node nextNode) {
+    private void nextSetup(final Node nodep, final Node nextNode) {
+        Node node = nodep;
+
         // retry:
         retry: while(true) {
 
@@ -762,7 +826,7 @@
     }
 
     private void updateStringNodeCaseFoldMultiByte(final StringNode sn) {
-        final char[] chars = sn.chars;
+        final char[] ch = sn.chars;
         final int end = sn.end;
         value = sn.p;
         int sp = 0;
@@ -770,15 +834,15 @@
 
         while (value < end) {
             final int ovalue = value;
-            buf = EncodingHelper.toLowerCase(chars[value++]);
+            buf = EncodingHelper.toLowerCase(ch[value++]);
 
-            if (chars[ovalue] != buf) {
+            if (ch[ovalue] != buf) {
 
                 char[] sbuf = new char[sn.length() << 1];
-                System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p);
+                System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p);
                 value = ovalue;
                 while (value < end) {
-                    buf = EncodingHelper.toLowerCase(chars[value++]);
+                    buf = EncodingHelper.toLowerCase(ch[value++]);
                     if (sp >= sbuf.length) {
                         final char[]tmp = new char[sbuf.length << 1];
                         System.arraycopy(sbuf, 0, tmp, 0, sbuf.length);
@@ -798,8 +862,8 @@
         updateStringNodeCaseFoldMultiByte(sn);
     }
 
-    private Node expandCaseFoldMakeRemString(final char[] chars, final int p, final int end) {
-        final StringNode node = new StringNode(chars, p, end);
+    private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) {
+        final StringNode node = new StringNode(ch, pp, end);
 
         updateStringNodeCaseFold(node);
         node.setAmbig();
@@ -807,7 +871,7 @@
         return node;
     }
 
-    private boolean expandCaseFoldStringAlt(final int itemNum, final char[] items,
+    private static boolean expandCaseFoldStringAlt(final int itemNum, final char[] items,
                                               final char[] chars, final int p, final int slen, final int end, final ObjPtr<Node> node) {
 
         ConsAltNode altNode;
@@ -833,59 +897,68 @@
     private Node expandCaseFoldString(final Node node) {
         final StringNode sn = (StringNode)node;
 
-        if (sn.isAmbig() || sn.length() <= 0) return node;
+        if (sn.isAmbig() || sn.length() <= 0) {
+            return node;
+        }
 
-        final char[] chars = sn.chars;
-        int p = sn.p;
+        final char[] chars1 = sn.chars;
+        int pt = sn.p;
         final int end = sn.end;
         int altNum = 1;
 
-        ConsAltNode topRoot = null, root = null;
+        ConsAltNode topRoot = null, r = null;
+        @SuppressWarnings("unused")
         final ObjPtr<Node> prevNode = new ObjPtr<Node>();
         StringNode stringNode = null;
 
-        while (p < end) {
-            final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars[p]);
+        while (pt < end) {
+            final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]);
 
             if (items.length == 0) {
                 if (stringNode == null) {
-                    if (root == null && prevNode.p != null) {
-                        topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
+                    if (r == null && prevNode.p != null) {
+                        topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
                     }
 
                     prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL);
 
-                    if (root != null) ConsAltNode.listAdd(root, stringNode);
+                    if (r != null) {
+                        ConsAltNode.listAdd(r, stringNode);
+                    }
 
                 }
 
-                stringNode.cat(chars, p, p + 1);
+                stringNode.cat(chars1, pt, pt + 1);
             } else {
                 altNum *= (items.length + 1);
-                if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break;
-
-                if (root == null && prevNode.p != null) {
-                    topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
+                if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) {
+                    break;
                 }
 
-                expandCaseFoldStringAlt(items.length, items, chars, p, 1, end, prevNode);
-                if (root != null) ConsAltNode.listAdd(root, prevNode.p);
+                if (r == null && prevNode.p != null) {
+                    topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
+                }
+
+                expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode);
+                if (r != null) {
+                    ConsAltNode.listAdd(r, prevNode.p);
+                }
                 stringNode = null;
             }
-            p++;
+            pt++;
         }
 
-        if (p < end) {
-            final Node srem = expandCaseFoldMakeRemString(chars, p, end);
+        if (pt < end) {
+            final Node srem = expandCaseFoldMakeRemString(chars1, pt, end);
 
-            if (prevNode.p != null && root == null) {
-                topRoot = root = ConsAltNode.listAdd(null, prevNode.p);
+            if (prevNode.p != null && r == null) {
+                topRoot = r = ConsAltNode.listAdd(null, prevNode.p);
             }
 
-            if (root == null) {
+            if (r == null) {
                 prevNode.p = srem;
             } else {
-                ConsAltNode.listAdd(root, srem);
+                ConsAltNode.listAdd(r, srem);
             }
         }
         /* ending */
@@ -909,7 +982,10 @@
     5. find invalid patterns in look-behind.
     6. expand repeated string.
     */
-    protected final Node setupTree(Node node, int state) {
+    protected final Node setupTree(final Node nodep, final int statep) {
+        Node node = nodep;
+        int state = statep;
+
         restart: while (true) {
         switch (node.getType()) {
         case NodeType.LIST:
@@ -958,7 +1034,9 @@
             final QuantifierNode qn = (QuantifierNode)node;
             Node target = qn.target;
 
-            if ((state & IN_REPEAT) != 0) qn.setInRepeat();
+            if ((state & IN_REPEAT) != 0) {
+                qn.setInRepeat();
+            }
 
             if (isRepeatInfinite(qn.upper) || qn.lower >= 1) {
                 final int d = getMinMatchLength(target);
@@ -966,14 +1044,18 @@
                     qn.targetEmptyInfo = TargetInfo.IS_EMPTY;
                     if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) {
                         final int info = quantifiersMemoryInfo(target);
-                        if (info > 0) qn.targetEmptyInfo = info;
+                        if (info > 0) {
+                            qn.targetEmptyInfo = info;
+                        }
                     } // USE_INFINITE_REPEAT_MONOMANIAC_MEM_STATUS_CHECK
                     // strange stuff here (turned off)
                 }
             }
 
             state |= IN_REPEAT;
-            if (qn.lower != qn.upper) state |= IN_VAR_REPEAT;
+            if (qn.lower != qn.upper) {
+                state |= IN_VAR_REPEAT;
+            }
 
             target = setupTree(target, state);
 
@@ -1035,11 +1117,16 @@
                     final QuantifierNode tqn = (QuantifierNode)en.target;
                     if (isRepeatInfinite(tqn.upper) && tqn.lower <= 1 && tqn.greedy) {
                         /* (?>a*), a*+ etc... */
-                        if (tqn.target.isSimple()) en.setStopBtSimpleRepeat();
+                        if (tqn.target.isSimple()) {
+                            en.setStopBtSimpleRepeat();
+                        }
                     }
                 }
                 break;
 
+            default:
+                break;
+
             } // inner switch
             break;
 
@@ -1059,7 +1146,9 @@
                     throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
                 }
                 node = setupLookBehind(node);
-                if (node.getType() != NodeType.ANCHOR) continue restart;
+                if (node.getType() != NodeType.ANCHOR) {
+                    continue restart;
+                }
                 setupTree(((AnchorNode)node).target, state);
                 break;
 
@@ -1068,12 +1157,19 @@
                     throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
                 }
                 node = setupLookBehind(node);
-                if (node.getType() != NodeType.ANCHOR) continue restart;
+                if (node.getType() != NodeType.ANCHOR) {
+                    continue restart;
+                }
                 setupTree(((AnchorNode)node).target, (state | IN_NOT));
                 break;
 
+            default:
+                break;
+
             } // inner switch
             break;
+        default:
+            break;
         } // switch
         return node;
         } // restart: while
@@ -1191,7 +1287,9 @@
                     opt.expr.copy(nopt.exm);
                 }
                 opt.expr.reachEnd = false;
-                if (nopt.map.value > 0) opt.map.copy(nopt.map);
+                if (nopt.map.value > 0) {
+                    opt.map.copy(nopt.map);
+                }
                 break;
 
             case AnchorType.PREC_READ_NOT:
@@ -1199,6 +1297,9 @@
             case AnchorType.LOOK_BEHIND_NOT:
                 break;
 
+            default:
+                break;
+
             } // inner switch
             break;
         }
@@ -1282,8 +1383,12 @@
                 if (++en.optCount > MAX_NODE_OPT_INFO_REF_COUNT) {
                     int min = 0;
                     int max = MinMaxLen.INFINITE_DISTANCE;
-                    if (en.isMinFixed()) min = en.minLength;
-                    if (en.isMaxFixed()) max = en.maxLength;
+                    if (en.isMinFixed()) {
+                        min = en.minLength;
+                    }
+                    if (en.isMaxFixed()) {
+                        max = en.maxLength;
+                    }
                     opt.length.set(min, max);
                 } else { // USE_SUBEXP_CALL
                     optimizeNodeLeft(en.target, opt, oenv);
@@ -1298,6 +1403,9 @@
             case EncloseType.STOP_BACKTRACK:
                 optimizeNodeLeft(en.target, opt, oenv);
                 break;
+
+            default:
+                break;
             } // inner switch
             break;
         }
@@ -1307,6 +1415,7 @@
         } // switch
     }
 
+    @SuppressWarnings("unused")
     protected final void setOptimizedInfoFromTree(final Node node) {
         final NodeOptInfo opt = new NodeOptInfo();
         final OptEnvironment oenv = new OptEnvironment();
@@ -1347,7 +1456,9 @@
             regex.setSubAnchor(opt.map.anchor);
         } else {
             regex.subAnchor |= opt.anchor.leftAnchor & AnchorType.BEGIN_LINE;
-            if (opt.length.max == 0) regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE;
+            if (opt.length.max == 0) {
+                regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE;
+            }
         }
 
         if (Config.DEBUG_COMPILE || Config.DEBUG_MATCH) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,7 +24,7 @@
 final class ApplyCaseFold {
 
     // i_apply_case_fold
-    public void apply(final int from, final int to, final Object o) {
+    public static void apply(final int from, final int to, final Object o) {
         final ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o;
 
         final ScanEnvironment env = arg.env;
@@ -45,7 +45,9 @@
         } else {
             if (inCC) {
                 if (to >= BitSet.SINGLE_BYTE_SIZE) {
-                    if (cc.isNot()) cc.clearNotFlag();
+                    if (cc.isNot()) {
+                        cc.clearNotFlag();
+                    }
                     cc.addCodeRange(env, to, to);
                 } else {
                     if (cc.isNot()) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,6 +22,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
 
+@SuppressWarnings("javadoc")
 public final class ApplyCaseFoldArg {
     final ScanEnvironment env;
     final CClassNode cc;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,7 +24,6 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite;
-
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
@@ -98,15 +97,15 @@
         } while ((aln = aln.cdr) != null);
     }
 
-    private boolean isNeedStrLenOpExact(final int op) {
+    private static boolean isNeedStrLenOpExact(final int op) {
         return  op == OPCode.EXACTN || op == OPCode.EXACTN_IC;
     }
 
-    private boolean opTemplated(final int op) {
+    private static boolean opTemplated(final int op) {
         return isNeedStrLenOpExact(op);
     }
 
-    private int selectStrOpcode(final int strLength, final boolean ignoreCase) {
+    private static int selectStrOpcode(final int strLength, final boolean ignoreCase) {
         int op;
 
         if (ignoreCase) {
@@ -139,7 +138,7 @@
         compileTree(node);
 
         if (emptyInfo != 0) {
-            switch(emptyInfo) {
+            switch (emptyInfo) {
             case TargetInfo.IS_EMPTY:
                 addOpcode(OPCode.NULL_CHECK_END);
                 break;
@@ -149,13 +148,15 @@
             case TargetInfo.IS_EMPTY_REC:
                 addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
                 break;
+            default:
+                break;
             } // switch
 
             addMemNum(savedNumNullCheck); /* NULL CHECK ID */
         }
     }
 
-    private int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
+    private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
         final int op = selectStrOpcode(strLength, ignoreCase);
         int len = OPSize.OPCODE;
 
@@ -163,7 +164,9 @@
             // string length, template index, template string pointer
             len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
         } else {
-            if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH;
+            if (isNeedStrLenOpExact(op)) {
+                len += OPSize.LENGTH;
+            }
             len += strLength;
         }
         return len;
@@ -187,9 +190,11 @@
         }
     }
 
-    private int compileLengthStringNode(final Node node) {
+    private static int compileLengthStringNode(final Node node) {
         final StringNode sn = (StringNode)node;
-        if (sn.length() <= 0) return 0;
+        if (sn.length() <= 0) {
+            return 0;
+        }
         final boolean ambig = sn.isAmbig();
 
         int p, prev;
@@ -210,8 +215,10 @@
         return rlen;
     }
 
-    private int compileLengthStringRawNode(final StringNode sn) {
-        if (sn.length() <= 0) return 0;
+    private static int compileLengthStringRawNode(final StringNode sn) {
+        if (sn.length() <= 0) {
+            return 0;
+        }
         return addCompileStringlength(sn.chars, sn.p, sn.length(), false);
     }
 
@@ -220,8 +227,10 @@
         addInts(mbuf.p, mbuf.used);
     }
 
-    private int compileLengthCClassNode(final CClassNode cc) {
-        if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;
+    private static int compileLengthCClassNode(final CClassNode cc) {
+        if (cc.isShare()) {
+            return OPSize.OPCODE + OPSize.POINTER;
+        }
 
         int len;
         if (cc.mbuf == null) {
@@ -360,9 +369,8 @@
             if (qn.greedy && infinite) {
                 if (qn.nextHeadExact != null) {
                     return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower;
-                } else {
-                    return OPSize.ANYCHAR_STAR + tlen * qn.lower;
                 }
+                return OPSize.ANYCHAR_STAR + tlen * qn.lower;
             }
         }
 
@@ -425,14 +433,13 @@
                 final StringNode sn = (StringNode)qn.nextHeadExact;
                 addChars(sn.chars, sn.p, 1);
                 return;
+            }
+            if (isMultiline(regex.options)) {
+                addOpcode(OPCode.ANYCHAR_ML_STAR);
             } else {
-                if (isMultiline(regex.options)) {
-                    addOpcode(OPCode.ANYCHAR_ML_STAR);
-                } else {
-                    addOpcode(OPCode.ANYCHAR_STAR);
-                }
-                return;
+                addOpcode(OPCode.ANYCHAR_STAR);
             }
+            return;
         }
 
         int modTLen;
@@ -510,9 +517,8 @@
 
         if (isDynamic(prev ^ node.option)) {
             return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
-        } else {
-            return tlen;
         }
+        return tlen;
     }
 
     @Override
@@ -675,13 +681,15 @@
             break;
 
         case AnchorType.WORD_BEGIN:
-            if (Config.USE_WORD_BEGIN_END)
+            if (Config.USE_WORD_BEGIN_END) {
                 addOpcode(OPCode.WORD_BEGIN);
+            }
             break;
 
         case AnchorType.WORD_END:
-            if (Config.USE_WORD_BEGIN_END)
+            if (Config.USE_WORD_BEGIN_END) {
                 addOpcode(OPCode.WORD_END);
+            }
             break;
 
         case AnchorType.PREC_READ:
@@ -701,7 +709,9 @@
             addOpcode(OPCode.LOOK_BEHIND);
             if (node.charLength < 0) {
                 n = analyser.getCharLengthTree(node.target);
-                if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
+                if (analyser.returnCode != 0) {
+                    newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
+                }
             } else {
                 n = node.charLength;
             }
@@ -714,7 +724,9 @@
             addOpcodeRelAddr(OPCode.PUSH_LOOK_BEHIND_NOT, len + OPSize.FAIL_LOOK_BEHIND_NOT);
             if (node.charLength < 0) {
                 n = analyser.getCharLengthTree(node.target);
-                if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
+                if (analyser.returnCode != 0) {
+                    newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
+                }
             } else {
                 n = node.charLength;
             }
@@ -796,7 +808,9 @@
     private void ensure(final int size) {
         if (size >= code.length) {
             int length = code.length << 1;
-            while (length <= size) length <<= 1;
+            while (length <= size) {
+                length <<= 1;
+            }
             final int[]tmp = new int[length];
             System.arraycopy(code, 0, tmp, 0, code.length);
             code = tmp;
@@ -829,11 +843,14 @@
         regex.operands[regex.operandLength++] = o;
     }
 
-    private void addChars(final char[] chars, int p ,final int length) {
+    private void addChars(final char[] chars, final int pp ,final int length) {
         ensure(codeLength + length);
+        int p = pp;
         final int end = p + length;
 
-        while (p < end) code[codeLength++] = chars[p++];
+        while (p < end) {
+            code[codeLength++] = chars[p++];
+        }
     }
 
     private void addInts(final int[]ints, final int length) {
@@ -876,6 +893,9 @@
         case OPCode.CALL:
         case OPCode.RETURN: // it will appear only with CALL though
             regex.stackNeeded = true;
+            break;
+        default:
+            break;
         }
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public final class BitSet {
     static final int BITS_PER_BYTE = 8;
     public static final int SINGLE_BYTE_SIZE = (1 << BITS_PER_BYTE);
@@ -34,7 +35,9 @@
         final StringBuilder buffer = new StringBuilder();
         buffer.append("BitSet");
         for (int i=0; i<SINGLE_BYTE_SIZE; i++) {
-            if ((i % (SINGLE_BYTE_SIZE / BITS_TO_STRING_WRAP)) == 0) buffer.append("\n  ");
+            if ((i % (SINGLE_BYTE_SIZE / BITS_TO_STRING_WRAP)) == 0) {
+                buffer.append("\n  ");
+            }
             buffer.append(at(i) ? "1" : "0");
         }
         return buffer.toString();
@@ -53,44 +56,62 @@
     }
 
     public void clear() {
-        for (int i=0; i<BITSET_SIZE; i++) bits[i]=0;
+        for (int i=0; i<BITSET_SIZE; i++) {
+            bits[i]=0;
+        }
     }
 
     public boolean isEmpty() {
         for (int i=0; i<BITSET_SIZE; i++) {
-            if (bits[i] != 0) return false;
+            if (bits[i] != 0) {
+                return false;
+            }
         }
         return true;
     }
 
     public void setRange(final int from, final int to) {
-        for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) set(i);
+        for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) {
+            set(i);
+        }
     }
 
     public void invert() {
-        for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~bits[i];
+        for (int i=0; i<BITSET_SIZE; i++) {
+            bits[i] = ~bits[i];
+        }
     }
 
     public void invertTo(final BitSet to) {
-        for (int i=0; i<BITSET_SIZE; i++) to.bits[i] = ~bits[i];
+        for (int i=0; i<BITSET_SIZE; i++) {
+            to.bits[i] = ~bits[i];
+        }
     }
 
     public void and(final BitSet other) {
-        for (int i=0; i<BITSET_SIZE; i++) bits[i] &= other.bits[i];
+        for (int i=0; i<BITSET_SIZE; i++) {
+            bits[i] &= other.bits[i];
+        }
     }
 
     public void or(final BitSet other) {
-        for (int i=0; i<BITSET_SIZE; i++) bits[i] |= other.bits[i];
+        for (int i=0; i<BITSET_SIZE; i++) {
+            bits[i] |= other.bits[i];
+        }
     }
 
     public void copy(final BitSet other) {
-        for (int i=0; i<BITSET_SIZE; i++) bits[i] = other.bits[i];
+        for (int i=0; i<BITSET_SIZE; i++) {
+            bits[i] = other.bits[i];
+        }
     }
 
     public int numOn() {
         int num = 0;
         for (int i=0; i<SINGLE_BYTE_SIZE; i++) {
-            if (at(i)) num++;
+            if (at(i)) {
+                num++;
+            }
         }
         return num;
     }
@@ -99,9 +120,12 @@
         return 1 << (pos % SINGLE_BYTE_SIZE);
     }
 
-    private static int log2(int n){
+    private static int log2(final int np) {
         int log = 0;
-        while ((n >>>= 1) != 0) log++;
+        int n = np;
+        while ((n >>>= 1) != 0) {
+            log++;
+        }
         return log;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,7 +34,8 @@
         return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0;
     }
 
-    public static int bsOnAt(int stats, final int n) {
+    public static int bsOnAt(final int statsp, final int n) {
+        int stats = statsp;
         if (n < BIT_STATUS_BITS_NUM) {
             stats |= (1 << n);
         } else {
@@ -43,12 +44,7 @@
         return stats;
     }
 
-    public static int bsOnOff(int v, final int f, final boolean negative) {
-        if (negative) {
-            v &= ~f;
-        } else {
-            v |= f;
-        }
-        return v;
+    public static int bsOnOff(final int v, final int f, final boolean negative) {
+        return negative ? (v & ~f) : (v | f);
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,10 +27,8 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotBol;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotEol;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isPosixRegion;
-
 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.OPCode;
-import jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize;
 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
@@ -52,8 +50,8 @@
         this.code = regex.code;
     }
 
-    private boolean stringCmpIC(final int caseFlodFlag, int s1, final IntHolder ps2, final int mbLen, final int textEnd) {
-
+    private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
+        int s1 = s1p;
         int s2 = ps2.value;
         final int end1 = s1 + mbLen;
 
@@ -83,12 +81,16 @@
             Config.log.printf("%4d", (s - str)).print("> \"");
             int q, i;
             for (i=0, q=s; i<7 && q<end && s>=0; i++) {
-                if (q < end) Config.log.print(new String(new char[]{chars[q++]}));
+                if (q < end) {
+                    Config.log.print(new String(new char[]{chars[q++]}));
+                }
             }
-            final String str = q < end ? "...\"" : "\"";
-            q += str.length();
-            Config.log.print(str);
-            for (i=0; i<20-(q-s);i++) Config.log.print(" ");
+            final String string = q < end ? "...\"" : "\"";
+            q += string.length();
+            Config.log.print(string);
+            for (i=0; i<20-(q-s);i++) {
+                Config.log.print(" ");
+            }
             final StringBuilder sb = new StringBuilder();
             new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip);
             Config.log.println(sb.toString());
@@ -96,28 +98,34 @@
     }
 
     @Override
-    protected final int matchAt(final int range, final int sstart, final int sprev) {
-        this.range = range;
-        this.sstart = sstart;
-        this.sprev = sprev;
+    protected final int matchAt(final int r, final int ss, final int sp) {
+        this.range = r;
+        this.sstart = ss;
+        this.sprev = sp;
 
         stk = 0;
         ip = 0;
 
-        if (Config.DEBUG_MATCH) debugMatchBegin();
+        if (Config.DEBUG_MATCH) {
+            debugMatchBegin();
+        }
 
         init();
 
         bestLen = -1;
-        s = sstart;
+        s = ss;
 
-        final int[]code = this.code;
+        final int[] c = this.code;
         while (true) {
-            if (Config.DEBUG_MATCH) debugMatchLoop();
+            if (Config.DEBUG_MATCH) {
+                debugMatchLoop();
+            }
 
             sbegin = s;
-            switch (code[ip++]) {
-                case OPCode.END:    if (opEnd()) return finish();                  break;
+            switch (c[ip++]) {
+                case OPCode.END:    if (opEnd()) {
+                    return finish();
+                }                  break;
                 case OPCode.EXACT1:                     opExact1();                break;
                 case OPCode.EXACT2:                     opExact2();                continue;
                 case OPCode.EXACT3:                     opExact3();                continue;
@@ -358,10 +366,14 @@
             final char[] bs = regex.templates[code[ip++]];
             int ps = code[ip++];
 
-            while (tlen-- > 0) if (bs[ps++] != chars[s++]) {opFail(); return;}
+            while (tlen-- > 0) {
+                if (bs[ps++] != chars[s++]) {opFail(); return;}
+            }
 
         } else {
-            while (tlen-- > 0) if (code[ip++] != chars[s++]) {opFail(); return;}
+            while (tlen-- > 0) {
+                if (code[ip++] != chars[s++]) {opFail(); return;}
+            }
         }
         sprev = s - 1;
     }
@@ -380,10 +392,14 @@
             final char[] bs = regex.templates[code[ip++]];
             int ps = code[ip++];
 
-            while (tlen-- > 0) if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
+            while (tlen-- > 0) {
+                if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
+            }
         } else {
 
-            while (tlen-- > 0) if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
+            while (tlen-- > 0) {
+                if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
+            }
         }
         sprev = s - 1;
     }
@@ -402,11 +418,15 @@
 
     private boolean isInClassMB() {
         final int tlen = code[ip++];
-        if (s >= range) return false;
+        if (s >= range) {
+            return false;
+        }
         final int ss = s;
         s++;
         final int c = chars[ss];
-        if (!EncodingHelper.isInCodeRange(code, ip, c)) return false;
+        if (!EncodingHelper.isInCodeRange(code, ip, c)) {
+            return false;
+        }
         ip += tlen;
         return true;
     }
@@ -444,7 +464,9 @@
         final int tlen = code[ip++];
 
         if (!(s + 1 <= range)) {
-            if (s >= range) return false;
+            if (s >= range) {
+                return false;
+            }
             s = end;
             ip += tlen;
             return true;
@@ -454,7 +476,9 @@
         s++;
         final int c = chars[ss];
 
-        if (EncodingHelper.isInCodeRange(code, ip, c)) return false;
+        if (EncodingHelper.isInCodeRange(code, ip, c)) {
+            return false;
+        }
         ip += tlen;
         return true;
     }
@@ -511,10 +535,10 @@
     }
 
     private void opAnyCharStar() {
-        final char[] chars = this.chars;
+        final char[] ch = this.chars;
         while (s < range) {
             pushAlt(ip, s, sprev);
-            if (isNewLine(chars, s, end)) {opFail(); return;}
+            if (isNewLine(ch, s, end)) {opFail(); return;}
             sprev = s;
             s++;
         }
@@ -532,11 +556,13 @@
 
     private void opAnyCharStarPeekNext() {
         final char c = (char)code[ip];
-        final char[] chars = this.chars;
+        final char[] ch = this.chars;
 
         while (s < range) {
-            final char b = chars[s];
-            if (c == b) pushAlt(ip + 1, s, sprev);
+            final char b = ch[s];
+            if (c == b) {
+                pushAlt(ip + 1, s, sprev);
+            }
             if (isNewLine(b)) {opFail(); return;}
             sprev = s;
             s++;
@@ -547,10 +573,12 @@
 
     private void opAnyCharMLStarPeekNext() {
         final char c = (char)code[ip];
-        final char[] chars = this.chars;
+        final char[] ch = this.chars;
 
         while (s < range) {
-            if (c == chars[s]) pushAlt(ip + 1, s, sprev);
+            if (c == ch[s]) {
+                pushAlt(ip + 1, s, sprev);
+            }
             sprev = s;
             s++;
         }
@@ -592,29 +620,39 @@
 
     private void opWordBegin() {
         if (s < range && EncodingHelper.isWord(chars[s])) {
-            if (s == str || !EncodingHelper.isWord(chars[sprev])) return;
+            if (s == str || !EncodingHelper.isWord(chars[sprev])) {
+                return;
+            }
         }
         opFail();
     }
 
     private void opWordEnd() {
         if (s != str && EncodingHelper.isWord(chars[sprev])) {
-            if (s == end || !EncodingHelper.isWord(chars[s])) return;
+            if (s == end || !EncodingHelper.isWord(chars[s])) {
+                return;
+            }
         }
         opFail();
     }
 
     private void opBeginBuf() {
-        if (s != str) opFail();
+        if (s != str) {
+            opFail();
+        }
     }
 
     private void opEndBuf() {
-        if (s != end) opFail();
+        if (s != end) {
+            opFail();
+        }
     }
 
     private void opBeginLine() {
         if (s == str) {
-            if (isNotBol(msaOptions)) opFail();
+            if (isNotBol(msaOptions)) {
+                opFail();
+            }
             return;
         } else if (isNewLine(chars, sprev, end) && s != end) {
             return;
@@ -626,13 +664,16 @@
         if (s == end) {
             if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
                 if (str == end || !isNewLine(chars, sprev, end)) {
-                    if (isNotEol(msaOptions)) opFail();
+                    if (isNotEol(msaOptions)) {
+                        opFail();
+                    }
                 }
                 return;
-            } else {
-                if (isNotEol(msaOptions)) opFail();
-                return;
             }
+            if (isNotEol(msaOptions)) {
+                opFail();
+            }
+            return;
         } else if (isNewLine(chars, s, end)) {
             return;
         }
@@ -643,13 +684,16 @@
         if (s == end) {
             if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
                 if (str == end || !isNewLine(chars, sprev, end)) {
-                    if (isNotEol(msaOptions)) opFail();
+                    if (isNotEol(msaOptions)) {
+                        opFail();
+                    }
                 }
                 return;
-            } else {
-                if (isNotEol(msaOptions)) opFail();
-                return;
             }
+            if (isNotEol(msaOptions)) {
+                opFail();
+            }
+            return;
         } else if (isNewLine(chars, s, end) && s + 1 == end) {
             return;
         }
@@ -657,7 +701,9 @@
     }
 
     private void opBeginPosition() {
-        if (s != msaStart) opFail();
+        if (s != msaStart) {
+            opFail();
+        }
     }
 
     private void opMemoryStartPush() {
@@ -726,11 +772,15 @@
         sprev = s;
 
         // STRING_CMP
-        while(n-- > 0) if (chars[pstart++] != chars[s++]) {opFail(); return;}
+        while(n-- > 0) {
+            if (chars[pstart++] != chars[s++]) {opFail(); return;}
+        }
 
         // beyond string check
         if (sprev < range) {
-            while (sprev + 1 < s) sprev++;
+            while (sprev + 1 < s) {
+                sprev++;
+            }
         }
     }
 
@@ -764,7 +814,9 @@
         s = value;
 
         // if (sprev < chars.length)
-        while (sprev + 1 < s) sprev++;
+        while (sprev + 1 < s) {
+            sprev++;
+        }
     }
 
     private void opBackRefMulti() {
@@ -773,7 +825,9 @@
         int i;
         loop:for (i=0; i<tlen; i++) {
             final int mem = code[ip++];
-            if (backrefInvalid(mem)) continue;
+            if (backrefInvalid(mem)) {
+                continue;
+            }
 
             int pstart = backrefStart(mem);
             final int pend = backrefEnd(mem);
@@ -785,14 +839,18 @@
             int swork = s;
 
             while (n-- > 0) {
-                if (chars[pstart++] != chars[swork++]) continue loop;
+                if (chars[pstart++] != chars[swork++]) {
+                    continue loop;
+                }
             }
 
             s = swork;
 
             // beyond string check
             if (sprev < range) {
-                while (sprev + 1 < s) sprev++;
+                while (sprev + 1 < s) {
+                    sprev++;
+                }
             }
 
             ip += tlen - i  - 1; // * SIZE_MEMNUM (1)
@@ -807,7 +865,9 @@
         int i;
         loop:for (i=0; i<tlen; i++) {
             final int mem = code[ip++];
-            if (backrefInvalid(mem)) continue;
+            if (backrefInvalid(mem)) {
+                continue;
+            }
 
             final int pstart = backrefStart(mem);
             final int pend = backrefEnd(mem);
@@ -818,11 +878,16 @@
             sprev = s;
 
             value = s;
-            if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC
+            if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end))
+             {
+                continue loop; // STRING_CMP_VALUE_IC
+            }
             s = value;
 
             // if (sprev < chars.length)
-            while (sprev + 1 < s) sprev++;
+            while (sprev + 1 < s) {
+                sprev++;
+            }
 
             ip += tlen - i  - 1; // * SIZE_MEMNUM (1)
             break;  /* success */
@@ -830,10 +895,12 @@
         if (i == tlen) {opFail(); return;}
     }
 
-    private boolean memIsInMemp(final int mem, final int num, int memp) {
-        for (int i=0; i<num; i++) {
+    private boolean memIsInMemp(final int mem, final int num, final int mempp) {
+        for (int i=0, memp = mempp; i<num; i++) {
             final int m = code[memp++];
-            if (mem == m) return true;
+            if (mem == m) {
+                return true;
+            }
         }
         return false;
     }
@@ -857,7 +924,9 @@
                     if (memIsInMemp(e.getMemNum(), memNum, memp)) {
                         final int pstart = e.getMemPStr();
                         if (pend != -1) {
-                            if (pend - pstart > end - s) return false; /* or goto next_mem; */
+                            if (pend - pstart > end - s) {
+                                return false; /* or goto next_mem; */
+                            }
                             int p = pstart;
 
                             value = s;
@@ -867,7 +936,9 @@
                                 }
                             } else {
                                 while (p < pend) {
-                                    if (chars[p++] != chars[value++]) return false; /* or goto next_mem; */
+                                    if (chars[p++] != chars[value++]) {
+                                        return false; /* or goto next_mem; */
+                                    }
                                 }
                             }
                             s = value;
@@ -893,24 +964,15 @@
 
         sprev = s;
         if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit
-            while (sprev + 1 < s) sprev++;
+            while (sprev + 1 < s) {
+                sprev++;
+            }
             ip += tlen; // * SIZE_MEMNUM
         } else {
             {opFail(); return;}
         }
     }
 
-    /* no need: IS_DYNAMIC_OPTION() == 0 */
-    private void opSetOptionPush() {
-        // option = code[ip++]; // final for now
-        pushAlt(ip, s, sprev);
-        ip += OPSize.SET_OPTION + OPSize.FAIL;
-    }
-
-    private void opSetOption() {
-        // option = code[ip++]; // final for now
-    }
-
     private void opNullCheckStart() {
         final int mem = code[ip++];
         pushNullCheckStart(mem, s);
@@ -1142,13 +1204,6 @@
         sprev = EncodingHelper.prevCharHead(str, s);
     }
 
-    private void opLookBehindSb() {
-        final int tlen = code[ip++];
-        s -= tlen;
-        if (s < str) {opFail(); return;}
-        sprev = s == str ? -1 : s - 1;
-    }
-
     private void opPushLookBehindNot() {
         final int addr = code[ip++];
         final int tlen = code[ip++];
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java	Mon Nov 17 09:36:40 2014 +0100
@@ -236,16 +236,17 @@
         sb.append(new String(code, s, len));
     }
 
-    private void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) {
+    private static void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) {
         sb.append(":T:").append(len).append(":");
         sb.append(tm, idx, len);
     }
 
-    public int compiledByteCodeToString(final StringBuilder sb, int bp) {
+    public int compiledByteCodeToString(final StringBuilder sb, final int bptr) {
         int len, n, mem, addr, scn, cod;
         BitSet bs;
         CClassNode cc;
         int tm, idx;
+        int bp = bptr;
 
         sb.append("[").append(OpCodeNames[code[bp]]);
         final int argType = OpCodeArgTypes[code[bp]];
@@ -253,6 +254,7 @@
         if (argType != Arguments.SPECIAL) {
             bp++;
             switch (argType) {
+            default:
             case Arguments.NON:
                 break;
 
@@ -410,7 +412,9 @@
                 for (int i=0; i<len; i++) {
                     mem = code[bp];
                     bp += OPSize.MEMNUM;
-                    if (i > 0) sb.append(", ");
+                    if (i > 0) {
+                        sb.append(", ");
+                    }
                     sb.append(mem);
                 }
                 break;
@@ -428,7 +432,9 @@
                 for (int i=0; i<len; i++) {
                     mem = code[bp];
                     bp += OPSize.MEMNUM;
-                    if (i > 0) sb.append(", ");
+                    if (i > 0) {
+                        sb.append(", ");
+                    }
                     sb.append(mem);
                 }
                 break;
@@ -501,7 +507,9 @@
         while (bp < end) {
             ncode++;
 
-            if (bp > 0) sb.append(ncode % 5 == 0 ? "\n" : " ");
+            if (bp > 0) {
+                sb.append(ncode % 5 == 0 ? "\n" : " ");
+            }
 
             bp = compiledByteCodeToString(sb, bp);
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,6 +22,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException;
 
+@SuppressWarnings("javadoc")
 public final class CodeRangeBuffer implements Cloneable {
     private static final int INIT_MULTI_BYTE_RANGE_SIZE = 5;
     private static final int ALL_MULTI_BYTE_RANGE = 0x7fffffff;
@@ -68,7 +69,9 @@
 
         for (int i=0; i<p[0]; i++) {
             buf.append("[").append(rangeNumToString(p[i * 2 + 1])).append("..").append(rangeNumToString(p[i * 2 + 2])).append("]");
-            if (i > 0 && i % 6 == 0) buf.append("\n          ");
+            if (i > 0 && i % 6 == 0) {
+                buf.append("\n          ");
+            }
         }
 
         return buf.toString();
@@ -97,9 +100,13 @@
     }
 
     private void moveRight(final int from, final int to, final int n) {
-        if (to + n > p.length) expand(to + n);
+        if (to + n > p.length) {
+            expand(to + n);
+        }
         System.arraycopy(p, from, p, to, n);
-        if (to + n > used) used = to + n;
+        if (to + n > used) {
+            used = to + n;
+        }
     }
 
     protected void moveLeft(final int from, final int to, final int n) {
@@ -113,9 +120,13 @@
 
     public void writeCodePoint(final int pos, final int b) {
         final int u = pos + 1;
-        if (p.length < u) expand(u);
+        if (p.length < u) {
+            expand(u);
+        }
         p[pos] = b;
-        if (used < u) used = u;
+        if (used < u) {
+            used = u;
+        }
     }
 
     @Override
@@ -125,14 +136,19 @@
 
     // ugly part: these methods should be made OO
     // add_code_range_to_buf
-    public static CodeRangeBuffer addCodeRangeToBuff(CodeRangeBuffer pbuf, int from, int to) {
+    public static CodeRangeBuffer addCodeRangeToBuff(final CodeRangeBuffer pbufp, final int fromp, final int top) {
+        int from = fromp, to = top;
+        CodeRangeBuffer pbuf = pbufp;
+
         if (from > to) {
             final int n = from;
             from = to;
             to = n;
         }
 
-        if (pbuf == null) pbuf = new CodeRangeBuffer(); // move to CClassNode
+        if (pbuf == null) {
+            pbuf = new CodeRangeBuffer(); // move to CClassNode
+        }
 
         final int[]p = pbuf.p;
         int n = p[0];
@@ -163,11 +179,17 @@
 
         final int incN = low + 1 - high;
 
-        if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES);
+        if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) {
+            throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES);
+        }
 
         if (incN != 1) {
-            if (from > p[low * 2 + 1]) from = p[low * 2 + 1];
-            if (to < p[(high - 1) * 2 + 2]) to = p[(high - 1) * 2 + 2];
+            if (from > p[low * 2 + 1]) {
+                from = p[low * 2 + 1];
+            }
+            if (to < p[(high - 1) * 2 + 2]) {
+                to = p[(high - 1) * 2 + 2];
+            }
         }
 
         if (incN != 0 && high < n) {
@@ -197,9 +219,8 @@
         if (from > to) {
             if (env.syntax.allowEmptyRangeInCC()) {
                 return pbuf;
-            } else {
-                throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
             }
+            throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
         }
         return addCodeRangeToBuff(pbuf, from, to);
     }
@@ -218,12 +239,16 @@
     public static CodeRangeBuffer notCodeRangeBuff(final CodeRangeBuffer bbuf) {
         CodeRangeBuffer pbuf = null;
 
-        if (bbuf == null) return setAllMultiByteRange(pbuf);
+        if (bbuf == null) {
+            return setAllMultiByteRange(pbuf);
+        }
 
         final int[]p = bbuf.p;
         final int n = p[0];
 
-        if (n <= 0) return setAllMultiByteRange(pbuf);
+        if (n <= 0) {
+            return setAllMultiByteRange(pbuf);
+        }
 
         int pre = EncodingHelper.mbcodeStartPosition();
 
@@ -235,18 +260,26 @@
             if (pre <= from - 1) {
                 pbuf = addCodeRangeToBuff(pbuf, pre, from - 1);
             }
-            if (to == ALL_MULTI_BYTE_RANGE) break;
+            if (to == ALL_MULTI_BYTE_RANGE) {
+                break;
+            }
             pre = to + 1;
         }
 
-        if (to < ALL_MULTI_BYTE_RANGE) pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE);
+        if (to < ALL_MULTI_BYTE_RANGE) {
+            pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE);
+        }
         return pbuf;
     }
 
     // or_code_range_buf
-    public static CodeRangeBuffer orCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1,
-                                                  CodeRangeBuffer bbuf2, boolean not2) {
+    public static CodeRangeBuffer orCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p,
+                                                  final CodeRangeBuffer bbuf2p, final boolean not2p) {
         CodeRangeBuffer pbuf = null;
+        CodeRangeBuffer bbuf1 = bbuf1p;
+        CodeRangeBuffer bbuf2 = bbuf2p;
+        boolean not1 = not1p;
+        boolean not2 = not2p;
 
         if (bbuf1 == null && bbuf2 == null) {
             if (not1 || not2) {
@@ -266,13 +299,11 @@
         if (bbuf1 == null) {
             if (not1) {
                 return setAllMultiByteRange(pbuf);
-            } else {
-                if (!not2) {
-                    return bbuf2.clone();
-                } else {
-                    return notCodeRangeBuff(bbuf2);
-                }
             }
+            if (!not2) {
+                return bbuf2.clone();
+            }
+            return notCodeRangeBuff(bbuf2);
         }
 
         if (not1) {
@@ -302,16 +333,18 @@
     }
 
     // and_code_range1
-    public static CodeRangeBuffer andCodeRange1(CodeRangeBuffer pbuf, int from1, int to1, final int[]data, final int n) {
+    public static CodeRangeBuffer andCodeRange1(final CodeRangeBuffer pbufp, final int from1p, final int to1p, final int[]data, final int n) {
+        CodeRangeBuffer pbuf = pbufp;
+        int from1 = from1p, to1 = to1p;
+
         for (int i=0; i<n; i++) {
             final int from2 = data[i * 2 + 1];
             final int to2 = data[i * 2 + 2];
             if (from2 < from1) {
                 if (to2 < from1) {
                     continue;
-                } else {
-                    from1 = to2 + 1;
                 }
+                from1 = to2 + 1;
             } else if (from2 <= to1) {
                 if (to2 < to1) {
                     if (from1 <= from2 - 1) {
@@ -324,7 +357,9 @@
             } else {
                 from1 = from2;
             }
-            if (from1 > to1) break;
+            if (from1 > to1) {
+                break;
+            }
         }
 
         if (from1 <= to1) {
@@ -335,15 +370,22 @@
     }
 
     // and_code_range_buf
-    public static CodeRangeBuffer andCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1,
-                                                   CodeRangeBuffer bbuf2, boolean not2) {
+    public static CodeRangeBuffer andCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p,
+                                                   final CodeRangeBuffer bbuf2p, final boolean not2p) {
         CodeRangeBuffer pbuf = null;
+        CodeRangeBuffer bbuf1 = bbuf1p;
+        CodeRangeBuffer bbuf2 = bbuf2p;
+        boolean not1 = not1p, not2 = not2p;
 
         if (bbuf1 == null) {
-            if (not1 && bbuf2 != null) return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */
+            if (not1 && bbuf2 != null) {
+                return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */
+            }
             return null;
         } else if (bbuf2 == null) {
-            if (not2) return bbuf1.clone();
+            if (not2) {
+                return bbuf1.clone();
+            }
             return null;
         }
 
@@ -369,8 +411,12 @@
                     final int from2 = p2[j * 2 + 1];
                     final int to2 = p2[j * 2 + 2];
 
-                    if (from2 > to1) break;
-                    if (to2 < from1) continue;
+                    if (from2 > to1) {
+                        break;
+                    }
+                    if (to2 < from1) {
+                        continue;
+                    }
                     final int from = from1 > from2 ? from1 : from2;
                     final int to = to1 < to2 ? to1 : to2;
                     pbuf = addCodeRangeToBuff(pbuf, from, to);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -53,13 +53,17 @@
     protected abstract void compileAltNode(ConsAltNode node);
 
     private void compileStringRawNode(final StringNode sn) {
-        if (sn.length() <= 0) return;
+        if (sn.length() <= 0) {
+            return;
+        }
         addCompileString(sn.chars, sn.p, sn.length(), false);
     }
 
     private void compileStringNode(final StringNode node) {
         final StringNode sn = node;
-        if (sn.length() <= 0) return;
+        if (sn.length() <= 0) {
+            return;
+        }
 
         final boolean ambig = sn.isAmbig();
 
@@ -145,7 +149,9 @@
     }
 
     protected final void compileTreeNTimes(final Node node, final int n) {
-        for (int i=0; i<n; i++) compileTree(node);
+        for (int i=0; i<n; i++) {
+            compileTree(node);
+        }
     }
 
     protected void newSyntaxException(final String message) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,6 +21,7 @@
 
 import java.io.PrintStream;
 
+@SuppressWarnings("javadoc")
 public interface Config {
     final int CHAR_TABLE_SIZE = 256;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -23,6 +23,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder;
 
+@SuppressWarnings("javadoc")
 public final class EncodingHelper {
 
     final static int NEW_LINE            = 0x000a;
@@ -79,14 +80,19 @@
 
     /* onigenc_get_right_adjust_char_head_with_prev */
     public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
-        if (prev != null) prev.value = -1; /* Sorry */
+        if (prev != null) {
+            prev.value = -1; /* Sorry */
+        }
         return s;
     }
 
     // Encoding.stepBack
-    public static int stepBack(final int p, int s, int n) {
-       while (s != -1 && n-- > 0) {
-           if (s <= p) return -1;
+    public static int stepBack(final int p, final int sp, final int np) {
+        int s = sp, n = np;
+        while (s != -1 && n-- > 0) {
+           if (s <= p) {
+            return -1;
+        }
            s--;
        }
        return s;
@@ -122,7 +128,7 @@
                 final int upper = toUpperCase(c);
 
                 if (upper != c) {
-                    fun.apply(c, upper, arg);
+                    ApplyCaseFold.apply(c, upper, arg);
                 }
             }
         }
@@ -133,7 +139,7 @@
                 final int upper = toUpperCase(c);
 
                 if (upper != c) {
-                    fun.apply(upper, c, arg);
+                    ApplyCaseFold.apply(upper, c, arg);
                 }
             }
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,7 +21,6 @@
 
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isSingleline;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite;
-
 import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar;
@@ -53,9 +52,8 @@
         if (!left()) {
             if (synAllow) {
                 return 1; /* "....{" : OK! */
-            } else {
-                throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE);
             }
+            throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE);
         }
 
         if (!synAllow) {
@@ -83,7 +81,9 @@
             }
         }
 
-        if (!left()) return invalidRangeQuantifier(synAllow);
+        if (!left()) {
+            return invalidRangeQuantifier(synAllow);
+        }
 
         fetch();
         int up;
@@ -99,25 +99,35 @@
             }
 
             if (p == prev) {
-                if (nonLow) return invalidRangeQuantifier(synAllow);
+                if (nonLow) {
+                    return invalidRangeQuantifier(synAllow);
+                }
                 up = QuantifierNode.REPEAT_INFINITE; /* {n,} : {n,infinite} */
             }
         } else {
-            if (nonLow) return invalidRangeQuantifier(synAllow);
+            if (nonLow) {
+                return invalidRangeQuantifier(synAllow);
+            }
             unfetch();
             up = low; /* {n} : exact n times */
             ret = 2; /* fixed */
         }
 
-        if (!left()) return invalidRangeQuantifier(synAllow);
+        if (!left()) {
+            return invalidRangeQuantifier(synAllow);
+        }
         fetch();
 
         if (syntax.opEscBraceInterval()) {
-            if (c != syntax.metaCharTable.esc) return invalidRangeQuantifier(synAllow);
+            if (c != syntax.metaCharTable.esc) {
+                return invalidRangeQuantifier(synAllow);
+            }
             fetch();
         }
 
-        if (c != '}') return invalidRangeQuantifier(synAllow);
+        if (c != '}') {
+            return invalidRangeQuantifier(synAllow);
+        }
 
         if (!isRepeatInfinite(up) && low > up) {
             throw new ValueException(ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE);
@@ -134,9 +144,8 @@
         if (synAllow) {
             restore();
             return 1;
-        } else {
-            throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN);
         }
+        throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN);
     }
 
     @SuppressWarnings("fallthrough")
@@ -218,17 +227,6 @@
         }
     }
 
-    private int nameEndCodePoint(final int start) {
-        switch(start) {
-        case '<':
-            return '>';
-        case '\'':
-            return '\'';
-        default:
-            return 0;
-        }
-    }
-
     private void fetchTokenInCCFor_charType(final boolean flag, final int type) {
         token.type = TokenType.CHAR_TYPE;
         token.setPropCType(type);
@@ -236,7 +234,9 @@
     }
 
     private void fetchTokenInCCFor_x() {
-        if (!left()) return;
+        if (!left()) {
+            return;
+        }
         final int last = p;
 
         if (peekIs('{') && syntax.opEscXBraceHex8()) {
@@ -274,7 +274,9 @@
     }
 
     private void fetchTokenInCCFor_u() {
-        if (!left()) return;
+        if (!left()) {
+            return;
+        }
         final int last = p;
 
         if (syntax.op2EscUHex4()) {
@@ -329,7 +331,9 @@
         } else if (c == '-') {
             token.type = TokenType.CC_RANGE;
         } else if (c == syntax.metaCharTable.esc) {
-            if (!syntax.backSlashEscapeInCC()) return token.type;
+            if (!syntax.backSlashEscapeInCC()) {
+                return token.type;
+            }
             if (!left()) {
                 throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
             }
@@ -357,10 +361,14 @@
                 fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
                 break;
             case 'h':
-                if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
+                if (syntax.op2EscHXDigit()) {
+                    fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
+                }
                 break;
             case 'H':
-                if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
+                if (syntax.op2EscHXDigit()) {
+                    fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
+                }
                 break;
             case 'x':
                 fetchTokenInCCFor_x();
@@ -424,7 +432,9 @@
     }
 
     private void fetchTokenFor_xBrace() {
-        if (!left()) return;
+        if (!left()) {
+            return;
+        }
 
         final int last = p;
         if (peekIs('{') && syntax.opEscXBraceHex8()) {
@@ -461,7 +471,9 @@
     }
 
     private void fetchTokenFor_uHex() {
-        if (!left()) return;
+        if (!left()) {
+            return;
+        }
         final int last = p;
 
         if (syntax.op2EscUHex4()) {
@@ -562,79 +574,129 @@
                 switch(c) {
 
                 case '*':
-                    if (syntax.opEscAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE);
+                    if (syntax.opEscAsteriskZeroInf()) {
+                        fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE);
+                    }
                     break;
                 case '+':
-                    if (syntax.opEscPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE);
+                    if (syntax.opEscPlusOneInf()) {
+                        fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE);
+                    }
                     break;
                 case '?':
-                    if (syntax.opEscQMarkZeroOne()) fetchTokenFor_repeat(0, 1);
+                    if (syntax.opEscQMarkZeroOne()) {
+                        fetchTokenFor_repeat(0, 1);
+                    }
                     break;
                 case '{':
-                    if (syntax.opEscBraceInterval()) fetchTokenFor_openBrace();
+                    if (syntax.opEscBraceInterval()) {
+                        fetchTokenFor_openBrace();
+                    }
                     break;
                 case '|':
-                    if (syntax.opEscVBarAlt()) token.type = TokenType.ALT;
+                    if (syntax.opEscVBarAlt()) {
+                        token.type = TokenType.ALT;
+                    }
                     break;
                 case '(':
-                    if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_OPEN;
+                    if (syntax.opEscLParenSubexp()) {
+                        token.type = TokenType.SUBEXP_OPEN;
+                    }
                     break;
                 case ')':
-                    if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE;
+                    if (syntax.opEscLParenSubexp()) {
+                        token.type = TokenType.SUBEXP_CLOSE;
+                    }
                     break;
                 case 'w':
-                    if (syntax.opEscWWord()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
+                    if (syntax.opEscWWord()) {
+                        fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
+                    }
                     break;
                 case 'W':
-                    if (syntax.opEscWWord()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
+                    if (syntax.opEscWWord()) {
+                        fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
+                    }
                     break;
                 case 'b':
-                    if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.WORD_BOUND);
+                    if (syntax.opEscBWordBound()) {
+                        fetchTokenFor_anchor(AnchorType.WORD_BOUND);
+                    }
                     break;
                 case 'B':
-                    if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND);
+                    if (syntax.opEscBWordBound()) {
+                        fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND);
+                    }
                     break;
                 case '<':
-                    if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_BEGIN);
+                    if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) {
+                        fetchTokenFor_anchor(AnchorType.WORD_BEGIN);
+                    }
                     break;
                 case '>':
-                    if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_END);
+                    if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) {
+                        fetchTokenFor_anchor(AnchorType.WORD_END);
+                    }
                     break;
                 case 's':
-                    if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
+                    if (syntax.opEscSWhiteSpace()) {
+                        fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
+                    }
                     break;
                 case 'S':
-                    if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
+                    if (syntax.opEscSWhiteSpace()) {
+                        fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
+                    }
                     break;
                 case 'd':
-                    if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
+                    if (syntax.opEscDDigit()) {
+                        fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
+                    }
                     break;
                 case 'D':
-                    if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
+                    if (syntax.opEscDDigit()) {
+                        fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
+                    }
                     break;
                 case 'h':
-                    if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
+                    if (syntax.op2EscHXDigit()) {
+                        fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
+                    }
                     break;
                 case 'H':
-                    if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
+                    if (syntax.op2EscHXDigit()) {
+                        fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
+                    }
                     break;
                 case 'A':
-                    if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF);
+                    if (syntax.opEscAZBufAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.BEGIN_BUF);
+                    }
                     break;
                 case 'Z':
-                    if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.SEMI_END_BUF);
+                    if (syntax.opEscAZBufAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.SEMI_END_BUF);
+                    }
                     break;
                 case 'z':
-                    if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF);
+                    if (syntax.opEscAZBufAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.END_BUF);
+                    }
                     break;
                 case 'G':
-                    if (syntax.opEscCapitalGBeginAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_POSITION);
+                    if (syntax.opEscCapitalGBeginAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.BEGIN_POSITION);
+                    }
                     break;
                 case '`':
-                    if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF);
+                    if (syntax.op2EscGnuBufAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.BEGIN_BUF);
+                    }
                     break;
                 case '\'':
-                    if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF);
+                    if (syntax.op2EscGnuBufAnchor()) {
+                        fetchTokenFor_anchor(AnchorType.END_BUF);
+                    }
                     break;
                 case 'x':
                     fetchTokenFor_xBrace();
@@ -684,22 +746,34 @@
                 {
                     switch(c) {
                     case '.':
-                        if (syntax.opDotAnyChar()) token.type = TokenType.ANYCHAR;
+                        if (syntax.opDotAnyChar()) {
+                            token.type = TokenType.ANYCHAR;
+                        }
                         break;
                     case '*':
-                        if (syntax.opAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE);
+                        if (syntax.opAsteriskZeroInf()) {
+                            fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE);
+                        }
                         break;
                     case '+':
-                        if (syntax.opPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE);
+                        if (syntax.opPlusOneInf()) {
+                            fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE);
+                        }
                         break;
                     case '?':
-                        if (syntax.opQMarkZeroOne()) fetchTokenFor_repeat(0, 1);
+                        if (syntax.opQMarkZeroOne()) {
+                            fetchTokenFor_repeat(0, 1);
+                        }
                         break;
                     case '{':
-                        if (syntax.opBraceInterval()) fetchTokenFor_openBrace();
+                        if (syntax.opBraceInterval()) {
+                            fetchTokenFor_openBrace();
+                        }
                         break;
                     case '|':
-                        if (syntax.opVBarAlt()) token.type = TokenType.ALT;
+                        if (syntax.opVBarAlt()) {
+                            token.type = TokenType.ALT;
+                        }
                         break;
 
                     case '(':
@@ -713,9 +787,13 @@
                                     }
                                     fetch();
                                     if (c == syntax.metaCharTable.esc) {
-                                        if (left()) fetch();
+                                        if (left()) {
+                                            fetch();
+                                        }
                                     } else {
-                                        if (c == ')') break;
+                                        if (c == ')') {
+                                            break;
+                                        }
                                     }
                                 }
                                 continue start; // goto start
@@ -723,19 +801,29 @@
                             unfetch();
                         }
 
-                        if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_OPEN;
+                        if (syntax.opLParenSubexp()) {
+                            token.type = TokenType.SUBEXP_OPEN;
+                        }
                         break;
                     case ')':
-                        if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE;
+                        if (syntax.opLParenSubexp()) {
+                            token.type = TokenType.SUBEXP_CLOSE;
+                        }
                         break;
                     case '^':
-                        if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE);
+                        if (syntax.opLineAnchor()) {
+                            fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE);
+                        }
                         break;
                     case '$':
-                        if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE);
+                        if (syntax.opLineAnchor()) {
+                            fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE);
+                        }
                         break;
                     case '[':
-                        if (syntax.opBracketCC()) token.type = TokenType.CC_CC_OPEN;
+                        if (syntax.opBracketCC()) {
+                            token.type = TokenType.CC_CC_OPEN;
+                        }
                         break;
                     case ']':
                         //if (*src > env->pattern)   /* /].../ is allowed. */
@@ -745,7 +833,9 @@
                         if (Option.isExtend(env.option)) {
                             while (left()) {
                                 fetch();
-                                if (EncodingHelper.isNewLine(c)) break;
+                                if (EncodingHelper.isNewLine(c)) {
+                                    break;
+                                }
                             }
                             continue start; // goto start
                         }
@@ -756,7 +846,10 @@
                     case '\n':
                     case '\r':
                     case '\f':
-                        if (Option.isExtend(env.option)) continue start; // goto start
+                        if (Option.isExtend(env.option))
+                         {
+                            continue start; // goto start
+                        }
                         break;
 
                     default: // string
@@ -798,8 +891,8 @@
         }
     }
 
-    protected final void syntaxWarn(final String message, final char c) {
-        syntaxWarn(message.replace("<%n>", Character.toString(c)));
+    protected final void syntaxWarn(final String message, final char ch) {
+        syntaxWarn(message.replace("<%n>", Character.toString(ch)));
     }
 
     protected final void syntaxWarn(final String message) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,10 +21,10 @@
 package jdk.nashorn.internal.runtime.regexp.joni;
 
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isFindLongest;
-
 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder;
 
+@SuppressWarnings("javadoc")
 public abstract class Matcher extends IntHolder {
     protected final Regex regex;
 
@@ -73,7 +73,9 @@
     protected final void msaInit(final int option, final int start) {
         msaOptions = option;
         msaStart = start;
-        if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) msaBestLen = -1;
+        if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
+            msaBestLen = -1;
+        }
     }
 
     public final int match(final int at, final int range, final int option) {
@@ -83,20 +85,19 @@
 
         if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) {
             return matchAt(end /*range*/, at, prev);
-        } else {
-            return matchAt(range /*range*/, at, prev);
         }
+        return matchAt(range /*range*/, at, prev);
     }
 
     int low, high; // these are the return values
-    private boolean forwardSearchRange(final char[] chars, final int str, final int end, final int s, final int range, final IntHolder lowPrev) {
+    private boolean forwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final IntHolder lowPrev) {
         int pprev = -1;
         int p = s;
 
         if (Config.DEBUG_SEARCH) {
             Config.log.println("forward_search_range: "+
-                                "str: " + str +
-                                ", end: " + end +
+                                "str: " + string +
+                                ", end: " + e +
                                 ", s: " + s +
                                 ", range: " + range);
         }
@@ -106,7 +107,7 @@
         }
 
         retry:while (true) {
-            p = regex.searchAlgorithm.search(regex, chars, p, end, range);
+            p = regex.searchAlgorithm.search(regex, ch, p, e, range);
 
             if (p != -1 && p < range) {
                 if (p - regex.dMin < s) {
@@ -119,9 +120,9 @@
                 if (regex.subAnchor != 0) {
                     switch (regex.subAnchor) {
                     case AnchorType.BEGIN_LINE:
-                        if (p != str) {
-                            final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p);
-                            if (!EncodingHelper.isNewLine(chars, prev, end)) {
+                        if (p != string) {
+                            final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p);
+                            if (!EncodingHelper.isNewLine(ch, prev, e)) {
                                 // goto retry_gate;
                                 pprev = p;
                                 p++;
@@ -131,17 +132,17 @@
                         break;
 
                     case AnchorType.END_LINE:
-                        if (p == end) {
+                        if (p == e) {
                             if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
-                                final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p);
-                                if (prev != -1 && EncodingHelper.isNewLine(chars, prev, end)) {
+                                final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p);
+                                if (prev != -1 && EncodingHelper.isNewLine(ch, prev, e)) {
                                     // goto retry_gate;
                                     pprev = p;
                                     p++;
                                     continue retry;
                                 }
                             }
-                        } else if (!EncodingHelper.isNewLine(chars, p, end)) {
+                        } else if (!EncodingHelper.isNewLine(ch, p, e)) {
                             //if () break;
                             // goto retry_gate;
                             pprev = p;
@@ -149,6 +150,9 @@
                             continue retry;
                         }
                         break;
+
+                    default:
+                        break;
                     } // switch
                 }
 
@@ -158,7 +162,7 @@
                         if (low > s) {
                             lowPrev.value = EncodingHelper.prevCharHead(s, p);
                         } else {
-                            lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p);
+                            lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p);
                         }
                     }
                 } else {
@@ -172,7 +176,7 @@
                             }
                         } else {
                             if (lowPrev != null) {
-                                lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, low);
+                                lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, low);
                             }
                         }
                     }
@@ -182,8 +186,8 @@
 
                 if (Config.DEBUG_SEARCH) {
                     Config.log.println("forward_search_range success: "+
-                                        "low: " + (low - str) +
-                                        ", high: " + (high - str) +
+                                        "low: " + (low - string) +
+                                        ", high: " + (high - string) +
                                         ", dmin: " + regex.dMin +
                                         ", dmax: " + regex.dMax);
                 }
@@ -196,20 +200,21 @@
     }
 
     // low, high
-    private boolean backwardSearchRange(final char[] chars, final int str, final int end, final int s, int range, final int adjrange) {
-        range += regex.dMin;
+    private boolean backwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final int adjrange) {
+        int r = range;
+        r += regex.dMin;
         int p = s;
 
         retry:while (true) {
-            p = regex.searchAlgorithm.searchBackward(regex, chars, range, adjrange, end, p, s, range);
+            p = regex.searchAlgorithm.searchBackward(regex, ch, r, adjrange, e, p, s, r);
 
             if (p != -1) {
                 if (regex.subAnchor != 0) {
                     switch (regex.subAnchor) {
                     case AnchorType.BEGIN_LINE:
-                        if (p != str) {
-                            final int prev = EncodingHelper.prevCharHead(str, p);
-                            if (!EncodingHelper.isNewLine(chars, prev, end)) {
+                        if (p != string) {
+                            final int prev = EncodingHelper.prevCharHead(string, p);
+                            if (!EncodingHelper.isNewLine(ch, prev, e)) {
                                 p = prev;
                                 continue retry;
                             }
@@ -217,21 +222,28 @@
                         break;
 
                     case AnchorType.END_LINE:
-                        if (p == end) {
+                        if (p == e) {
                             if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
                                 final int prev = EncodingHelper.prevCharHead(adjrange, p);
-                                if (prev == -1) return false;
-                                if (EncodingHelper.isNewLine(chars, prev, end)) {
+                                if (prev == -1) {
+                                    return false;
+                                }
+                                if (EncodingHelper.isNewLine(ch, prev, e)) {
                                     p = prev;
                                     continue retry;
                                 }
                             }
-                        } else if (!EncodingHelper.isNewLine(chars, p, end)) {
+                        } else if (!EncodingHelper.isNewLine(ch, p, e)) {
                             p = EncodingHelper.prevCharHead(adjrange, p);
-                            if (p == -1) return false;
+                            if (p == -1) {
+                                return false;
+                            }
                             continue retry;
                         }
                         break;
+
+                    default:
+                        break;
                     } // switch
                 }
 
@@ -243,14 +255,16 @@
 
                 if (Config.DEBUG_SEARCH) {
                     Config.log.println("backward_search_range: "+
-                                        "low: " + (low - str) +
-                                        ", high: " + (high - str));
+                                        "low: " + (low - string) +
+                                        ", high: " + (high - string));
                 }
 
                 return true;
             }
 
-            if (Config.DEBUG_SEARCH) Config.log.println("backward_search_range: fail.");
+            if (Config.DEBUG_SEARCH) {
+                Config.log.println("backward_search_range: fail.");
+            }
             return false;
         } // while
     }
@@ -261,27 +275,36 @@
             if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
                 //range = upperRange;
                 if (matchAt(upperRange, s, prev) != -1) {
-                    if (!isFindLongest(regex.options)) return true;
+                    if (!isFindLongest(regex.options)) {
+                        return true;
+                    }
                 }
             } else {
                 //range = upperRange;
-                if (matchAt(upperRange, s, prev) != -1) return true;
+                if (matchAt(upperRange, s, prev) != -1) {
+                    return true;
+                }
             }
         } else {
             if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
                 if (matchAt(end, s, prev) != -1) {
                     //range = upperRange;
-                    if (!isFindLongest(regex.options)) return true;
+                    if (!isFindLongest(regex.options)) {
+                        return true;
+                    }
                 }
             } else {
                 //range = upperRange;
-                if (matchAt(end, s, prev) != -1) return true;
+                if (matchAt(end, s, prev) != -1) {
+                    return true;
+                }
             }
         }
         return false;
     }
 
-    public final int search(int start, int range, final int option) {
+    public final int search(final int startp, final int rangep, final int option) {
+        int start = startp, range = rangep;
         int s, prev;
         int origStart = start;
         final int origRange = range;
@@ -294,7 +317,9 @@
                     ", range " + (range - str));
         }
 
-        if (start > end || start < str) return -1;
+        if (start > end || start < str) {
+            return -1;
+        }
 
         /* anchor optimize: resume search range */
         if (regex.anchor != 0 && str < end) {
@@ -311,7 +336,10 @@
             } else if ((regex.anchor & AnchorType.BEGIN_BUF) != 0) {
                 /* search str-position only */
                 if (range > start) {
-                    if (start != str) return -1; // mismatch_no_msa;
+                    if (start != str)
+                     {
+                        return -1; // mismatch_no_msa;
+                    }
                     range = str + 1;
                 } else {
                     if (range <= str) {
@@ -324,7 +352,10 @@
             } else if ((regex.anchor & AnchorType.END_BUF) != 0) {
                 minSemiEnd = maxSemiEnd = end;
                 // !end_buf:!
-                if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa;
+                if (endBuf(start, range, minSemiEnd, maxSemiEnd))
+                 {
+                    return -1; // mismatch_no_msa;
+                }
             } else if ((regex.anchor & AnchorType.SEMI_END_BUF) != 0) {
                 final int preEnd = EncodingHelper.stepBack(str, end, 1);
                 maxSemiEnd = end;
@@ -332,12 +363,18 @@
                     minSemiEnd = preEnd;
                     if (minSemiEnd > str && start <= minSemiEnd) {
                         // !goto end_buf;!
-                        if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa;
+                        if (endBuf(start, range, minSemiEnd, maxSemiEnd))
+                         {
+                            return -1; // mismatch_no_msa;
+                        }
                     }
                 } else {
                     minSemiEnd = end;
                     // !goto end_buf;!
-                    if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa;
+                    if (endBuf(start, range, minSemiEnd, maxSemiEnd))
+                     {
+                        return -1; // mismatch_no_msa;
+                    }
                 }
             } else if ((regex.anchor & AnchorType.ANYCHAR_STAR_ML) != 0) {
                 // goto !begin_position;!
@@ -359,7 +396,9 @@
                 prev = -1;
                 msaInit(option, start);
 
-                if (matchCheck(end, s, prev)) return match(s);
+                if (matchCheck(end, s, prev)) {
+                    return match(s);
+                }
                 return mismatch();
             }
             return -1; // goto mismatch_no_msa;
@@ -389,49 +428,62 @@
                         schRange = end;
                     } else {
                         schRange += regex.dMax;
-                        if (schRange > end) schRange = end;
+                        if (schRange > end) {
+                            schRange = end;
+                        }
                     }
                 }
-                if ((end - start) < regex.thresholdLength) return mismatch();
+                if ((end - start) < regex.thresholdLength) {
+                    return mismatch();
+                }
 
                 if (regex.dMax != MinMaxLen.INFINITE_DISTANCE) {
                     do {
-                        if (!forwardSearchRange(chars, str, end, s, schRange, this)) return mismatch(); // low, high, lowPrev
+                        if (!forwardSearchRange(chars, str, end, s, schRange, this)) {
+                            return mismatch(); // low, high, lowPrev
+                        }
                         if (s < low) {
                             s = low;
                             prev = value;
                         }
                         while (s <= high) {
-                            if (matchCheck(origRange, s, prev)) return match(s); // ???
+                            if (matchCheck(origRange, s, prev)) {
+                                return match(s); // ???
+                            }
                             prev = s;
                             s++;
                         }
                     } while (s < range);
+                }
+                /* check only. */
+                if (!forwardSearchRange(chars, str, end, s, schRange, null)) {
                     return mismatch();
-
-                } else { /* check only. */
-                    if (!forwardSearchRange(chars, str, end, s, schRange, null)) return mismatch();
+                }
 
-                    if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) {
-                        do {
-                            if (matchCheck(origRange, s, prev)) return match(s);
-                            prev = s;
-                            s++;
-                        } while (s < range);
-                        return mismatch();
-                    }
-
+                if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) {
+                    do {
+                        if (matchCheck(origRange, s, prev)) {
+                            return match(s);
+                        }
+                        prev = s;
+                        s++;
+                    } while (s < range);
+                    return mismatch();
                 }
             }
 
             do {
-                if (matchCheck(origRange, s, prev)) return match(s);
+                if (matchCheck(origRange, s, prev)) {
+                    return match(s);
+                }
                 prev = s;
                 s++;
             } while (s < range);
 
             if (s == range) { /* because empty match with /$/. */
-                if (matchCheck(origRange, s, prev)) return match(s);
+                if (matchCheck(origRange, s, prev)) {
+                    return match(s);
+                }
             }
         } else { /* backward search */
             if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) {
@@ -450,37 +502,51 @@
                 if (regex.dMax != MinMaxLen.INFINITE_DISTANCE && (end - range) >= regex.thresholdLength) {
                     do {
                         int schStart = s + regex.dMax;
-                        if (schStart > end) schStart = end;
-                        if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch(); // low, high
-                        if (s > high) s = high;
+                        if (schStart > end) {
+                            schStart = end;
+                        }
+                        if (!backwardSearchRange(chars, str, end, schStart, range, adjrange))
+                         {
+                            return mismatch(); // low, high
+                        }
+                        if (s > high) {
+                            s = high;
+                        }
                         while (s != -1 && s >= low) {
                             prev = EncodingHelper.prevCharHead(str, s);
-                            if (matchCheck(origStart, s, prev)) return match(s);
+                            if (matchCheck(origStart, s, prev)) {
+                                return match(s);
+                            }
                             s = prev;
                         }
                     } while (s >= range);
                     return mismatch();
-                } else { /* check only. */
-                    if ((end - range) < regex.thresholdLength) return mismatch();
+                }
+                if ((end - range) < regex.thresholdLength) {
+                    return mismatch();
+                }
 
-                    int schStart = s;
-                    if (regex.dMax != 0) {
-                        if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) {
+                int schStart = s;
+                if (regex.dMax != 0) {
+                    if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) {
+                        schStart = end;
+                    } else {
+                        schStart += regex.dMax;
+                        if (schStart > end) {
                             schStart = end;
-                        } else {
-                            schStart += regex.dMax;
-                            if (schStart > end) {
-                                schStart = end;
-                            }
                         }
                     }
-                    if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch();
+                }
+                if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) {
+                    return mismatch();
                 }
             }
 
             do {
                 prev = EncodingHelper.prevCharHead(str, s);
-                if (matchCheck(origStart, s, prev)) return match(s);
+                if (matchCheck(origStart, s, prev)) {
+                    return match(s);
+                }
                 s = prev;
             } while (s >= range);
 
@@ -488,8 +554,13 @@
         return mismatch();
     }
 
-    private boolean endBuf(int start, int range, final int minSemiEnd, final int maxSemiEnd) {
-        if ((maxSemiEnd - str) < regex.anchorDmin) return true; // mismatch_no_msa;
+    private boolean endBuf(final int startp, final int rangep, final int minSemiEnd, final int maxSemiEnd) {
+        int start = startp;
+        int range = rangep;
+
+        if ((maxSemiEnd - str) < regex.anchorDmin) {
+            return true; // mismatch_no_msa;
+        }
 
         if (range > start) {
             if ((minSemiEnd - start) > regex.anchorDmax) {
@@ -502,7 +573,10 @@
             if ((maxSemiEnd - (range - 1)) < regex.anchorDmin) {
                 range = maxSemiEnd - regex.anchorDmin + 1;
             }
-            if (start >= range) return true; // mismatch_no_msa;
+            if (start >= range)
+             {
+                return true; // mismatch_no_msa;
+            }
         } else {
             if ((minSemiEnd - range) > regex.anchorDmax) {
                 range = minSemiEnd - regex.anchorDmax;
@@ -510,7 +584,10 @@
             if ((maxSemiEnd - start) < regex.anchorDmin) {
                 start = maxSemiEnd - regex.anchorDmin;
             }
-            if (range > start) return true; // mismatch_no_msa;
+            if (range > start)
+             {
+                return true; // mismatch_no_msa;
+            }
         }
         return false;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public abstract class MatcherFactory {
     public abstract Matcher create(Regex regex, char[] chars, int p, int end);
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java	Mon Nov 17 09:36:40 2014 +0100
@@ -46,24 +46,40 @@
     };
 
     int distanceValue() {
-        if (max == INFINITE_DISTANCE) return 0;
+        if (max == INFINITE_DISTANCE) {
+            return 0;
+        }
         final int d = max - min;
         /* return dist_vals[d] * 16 / (mm->min + 12); */
         return d < distValues.length ? distValues[d] : 1;
     }
 
-    int compareDistanceValue(final MinMaxLen other, int v1, int v2) {
-        if (v2 <= 0) return -1;
-        if (v1 <= 0) return 1;
+    int compareDistanceValue(final MinMaxLen other, final int v1p, final int v2p) {
+        int v1 = v1p, v2 = v2p;
+
+        if (v2 <= 0) {
+            return -1;
+        }
+        if (v1 <= 0) {
+            return 1;
+        }
 
         v1 *= distanceValue();
         v2 *= other.distanceValue();
 
-        if (v2 > v1) return 1;
-        if (v2 < v1) return -1;
+        if (v2 > v1) {
+            return 1;
+        }
+        if (v2 < v1) {
+            return -1;
+        }
 
-        if (other.min < min) return 1;
-        if (other.min > min) return -1;
+        if (other.min < min) {
+            return 1;
+        }
+        if (other.min > min) {
+            return -1;
+        }
         return 0;
     }
 
@@ -96,27 +112,33 @@
     }
 
     void altMerge(final MinMaxLen other) {
-        if (min > other.min) min = other.min;
-        if (max < other.max) max = other.max;
+        if (min > other.min) {
+            min = other.min;
+        }
+        if (max < other.max) {
+            max = other.max;
+        }
     }
 
     static final int INFINITE_DISTANCE = 0x7FFFFFFF;
     static int distanceAdd(final int d1, final int d2) {
         if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) {
             return INFINITE_DISTANCE;
-        } else {
-            if (d1 <= INFINITE_DISTANCE - d2) return d1 + d2;
-            else return INFINITE_DISTANCE;
         }
+        if (d1 <= INFINITE_DISTANCE - d2) {
+            return d1 + d2;
+        }
+        return INFINITE_DISTANCE;
     }
 
     static int distanceMultiply(final int d, final int m) {
-        if (m == 0) return 0;
+        if (m == 0) {
+            return 0;
+        }
         if (d < INFINITE_DISTANCE / m) {
             return d * m;
-        } else {
-            return INFINITE_DISTANCE;
         }
+        return INFINITE_DISTANCE;
     }
 
     static String distanceRangeToString(final int a, final int b) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public final class NodeOptInfo {
     final MinMaxLen length = new  MinMaxLen();
     final OptAnchorInfo anchor = new OptAnchorInfo();
@@ -91,8 +92,12 @@
             if (other.length.max > 0) {
                 // TODO: make sure it is not an Oniguruma bug (casting unsigned int to int for arithmetic comparison)
                 int otherLengthMax = other.length.max;
-                if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) otherLengthMax = -1;
-                if (expr.length > otherLengthMax) expr.length = otherLengthMax;
+                if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) {
+                    otherLengthMax = -1;
+                }
+                if (expr.length > otherLengthMax) {
+                    expr.length = otherLengthMax;
+                }
                 if (expr.mmd.max == 0) {
                     exb.select(expr);
                 } else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java	Mon Nov 17 09:36:40 2014 +0100
@@ -36,14 +36,20 @@
 
     void concat(final OptAnchorInfo left, final OptAnchorInfo right, final int leftLength, final int rightLength) {
         leftAnchor = left.leftAnchor;
-        if (leftLength == 0) leftAnchor |= right.leftAnchor;
+        if (leftLength == 0) {
+            leftAnchor |= right.leftAnchor;
+        }
 
         rightAnchor = right.rightAnchor;
-        if (rightLength == 0) rightAnchor |= left.rightAnchor;
+        if (rightLength == 0) {
+            rightAnchor |= left.rightAnchor;
+        }
     }
 
     boolean isSet(final int anchor) {
-        if ((leftAnchor & anchor) != 0) return true;
+        if ((leftAnchor & anchor) != 0) {
+            return true;
+        }
         return (rightAnchor & anchor) != 0;
     }
 
@@ -77,14 +83,30 @@
     static String anchorToString(final int anchor) {
         final StringBuffer s = new StringBuffer("[");
 
-        if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf ");
-        if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line ");
-        if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos ");
-        if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf ");
-        if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf ");
-        if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line ");
-        if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star ");
-        if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl ");
+        if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
+            s.append("begin-buf ");
+        }
+        if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
+            s.append("begin-line ");
+        }
+        if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
+            s.append("begin-pos ");
+        }
+        if ((anchor & AnchorType.END_BUF) !=0 ) {
+            s.append("end-buf ");
+        }
+        if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
+            s.append("semi-end-buf ");
+        }
+        if ((anchor & AnchorType.END_LINE) !=0 ) {
+            s.append("end-line ");
+        }
+        if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
+            s.append("anychar-star ");
+        }
+        if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
+            s.append("anychar-star-pl ");
+        }
         s.append("]");
 
         return s.toString();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java	Mon Nov 17 09:36:40 2014 +0100
@@ -56,7 +56,9 @@
 
     void concat(final OptExactInfo other) {
         if (!ignoreCase && other.ignoreCase) {
-            if (length >= other.length) return; /* avoid */
+            if (length >= other.length) {
+                return; /* avoid */
+            }
             ignoreCase = true;
         }
 
@@ -65,7 +67,9 @@
 
         int i;
         for (i = length; p < end;) {
-            if (i + 1 > OPT_EXACT_MAXLEN) break;
+            if (i + 1 > OPT_EXACT_MAXLEN) {
+                break;
+            }
             chars[i++] = other.chars[p++];
         }
 
@@ -74,15 +78,20 @@
 
         final OptAnchorInfo tmp = new OptAnchorInfo();
         tmp.concat(anchor, other.anchor, 1, 1);
-        if (!other.reachEnd) tmp.rightAnchor = 0;
+        if (!other.reachEnd) {
+            tmp.rightAnchor = 0;
+        }
         anchor.copy(tmp);
     }
 
     // ?? raw is not used here
-    void concatStr(final char[] lchars, int p, final int end, final boolean raw) {
+    void concatStr(final char[] lchars, final int pp, final int end, final boolean raw) {
         int i;
+        int p = pp;
         for (i = length; p < end && i < OPT_EXACT_MAXLEN;) {
-            if (i + 1 > OPT_EXACT_MAXLEN) break;
+            if (i + 1 > OPT_EXACT_MAXLEN) {
+                break;
+            }
             chars[i++] = lchars[p++];
         }
 
@@ -102,17 +111,23 @@
 
         int i;
         for (i = 0; i < length && i < other.length; i++) {
-            if (chars[i] != other.chars[i]) break;
+            if (chars[i] != other.chars[i]) {
+                break;
+            }
         }
 
-        if (!other.reachEnd || i<other.length || i<length) reachEnd = false;
+        if (!other.reachEnd || i<other.length || i<length) {
+            reachEnd = false;
+        }
 
         length = i;
         ignoreCase |= other.ignoreCase;
 
         anchor.altMerge(other.anchor);
 
-        if (!reachEnd) anchor.rightAnchor = 0;
+        if (!reachEnd) {
+            anchor.rightAnchor = 0;
+        }
     }
 
 
@@ -130,20 +145,32 @@
             v2 = OptMapInfo.positionValue(chars[0] & 0xff);
             v1 = OptMapInfo.positionValue(alt.chars[0] & 0xff);
 
-            if (length > 1) v1 += 5;
-            if (alt.length > 1) v2 += 5;
+            if (length > 1) {
+                v1 += 5;
+            }
+            if (alt.length > 1) {
+                v2 += 5;
+            }
         }
 
-        if (!ignoreCase) v1 *= 2;
-        if (!alt.ignoreCase) v2 *= 2;
+        if (!ignoreCase) {
+            v1 *= 2;
+        }
+        if (!alt.ignoreCase) {
+            v2 *= 2;
+        }
 
-        if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt);
+        if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) {
+            copy(alt);
+        }
     }
 
     // comp_opt_exact_or_map_info
     private static final int COMP_EM_BASE   = 20;
     int compare(final OptMapInfo m) {
-        if (m.value <= 0) return -1;
+        if (m.value <= 0) {
+            return -1;
+        }
 
         final int ve = COMP_EM_BASE * length * (ignoreCase ? 1 : 2);
         final int vm = COMP_EM_BASE * 5 * 2 / m.value;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java	Mon Nov 17 09:36:40 2014 +0100
@@ -31,7 +31,9 @@
         mmd.clear();
         anchor.clear();
         value = 0;
-        for (int i=0; i<map.length; i++) map[i] = 0;
+        for (int i=0; i<map.length; i++) {
+            map[i] = 0;
+        }
     }
 
     void copy(final OptMapInfo other) {
@@ -50,11 +52,10 @@
         }
     }
 
-    void addCharAmb(final char[] chars, final int p, final int end, int caseFoldFlag) {
+    void addCharAmb(final char[] chars, final int p, final int end, final int caseFoldFlag) {
         addChar(chars[p]);
 
-        caseFoldFlag &= ~Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR;
-        final char[]items = EncodingHelper.caseFoldCodesByString(caseFoldFlag, chars[p]);
+        final char[]items = EncodingHelper.caseFoldCodesByString(caseFoldFlag & ~Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR, chars[p]);
 
         for (int i=0; i<items.length; i++) {
             addChar(items[i]);
@@ -64,7 +65,9 @@
     // select_opt_map_info
     private static final int z = 1<<15; /* 32768: something big value */
     void select(final OptMapInfo alt) {
-        if (alt.value == 0) return;
+        if (alt.value == 0) {
+            return;
+        }
         if (value == 0) {
             copy(alt);
             return;
@@ -73,13 +76,17 @@
         final int v1 = z / value;
         final int v2 = z /alt.value;
 
-        if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt);
+        if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) {
+            copy(alt);
+        }
     }
 
     // alt_merge_opt_map_info
     void altMerge(final OptMapInfo other) {
         /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */
-        if (value == 0) return;
+        if (value == 0) {
+            return;
+        }
         if (other.value == 0 || mmd.max < other.mmd.max) {
             clear();
             return;
@@ -89,8 +96,12 @@
 
         int val = 0;
         for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) {
-            if (other.map[i] != 0) map[i] = 1;
-            if (map[i] != 0) val += positionValue(i);
+            if (other.map[i] != 0) {
+                map[i] = 1;
+            }
+            if (map[i] != 0) {
+                val += positionValue(i);
+            }
         }
 
         value = val;
@@ -112,9 +123,8 @@
     static int positionValue(final int i) {
         if (i < ByteValTable.length) {
             return ByteValTable[i];
-        } else {
-            return 4; /* Take it easy. */
         }
+        return 4; /* Take it easy. */
     }
 
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Option.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Option.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public class Option {
 
     /* options */
@@ -43,19 +44,43 @@
 
     public static String toString(final int option) {
         String options = "";
-        if (isIgnoreCase(option)) options += "IGNORECASE ";
-        if (isExtend(option)) options += "EXTEND ";
-        if (isMultiline(option)) options += "MULTILINE ";
-        if (isSingleline(option)) options += "SINGLELINE ";
-        if (isFindLongest(option)) options += "FIND_LONGEST ";
-        if (isFindNotEmpty(option)) options += "FIND_NOT_EMPTY  ";
-        if (isNegateSingleline(option)) options += "NEGATE_SINGLELINE ";
-        if (isDontCaptureGroup(option)) options += "DONT_CAPTURE_GROUP ";
-        if (isCaptureGroup(option)) options += "CAPTURE_GROUP ";
+        if (isIgnoreCase(option)) {
+            options += "IGNORECASE ";
+        }
+        if (isExtend(option)) {
+            options += "EXTEND ";
+        }
+        if (isMultiline(option)) {
+            options += "MULTILINE ";
+        }
+        if (isSingleline(option)) {
+            options += "SINGLELINE ";
+        }
+        if (isFindLongest(option)) {
+            options += "FIND_LONGEST ";
+        }
+        if (isFindNotEmpty(option)) {
+            options += "FIND_NOT_EMPTY  ";
+        }
+        if (isNegateSingleline(option)) {
+            options += "NEGATE_SINGLELINE ";
+        }
+        if (isDontCaptureGroup(option)) {
+            options += "DONT_CAPTURE_GROUP ";
+        }
+        if (isCaptureGroup(option)) {
+            options += "CAPTURE_GROUP ";
+        }
 
-        if (isNotBol(option)) options += "NOTBOL ";
-        if (isNotEol(option)) options += "NOTEOL ";
-        if (isPosixRegion(option)) options += "POSIX_REGION ";
+        if (isNotBol(option)) {
+            options += "NOTBOL ";
+        }
+        if (isNotEol(option)) {
+            options += "NOTEOL ";
+        }
+        if (isPosixRegion(option)) {
+            options += "POSIX_REGION ";
+        }
 
         return options;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,7 +22,6 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnOff;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup;
 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
-
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnyCharNode;
 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
@@ -77,7 +76,9 @@
                     restore();
                     return true;
                 }
-                if (c == syntax.metaCharTable.esc) inEsc = true;
+                if (c == syntax.metaCharTable.esc) {
+                    inEsc = true;
+                }
             }
         }
 
@@ -165,7 +166,9 @@
                     arg.vIsRaw = false;
                     fetchTokenInCC();
                     fetched = true;
-                    if (token.type == TokenType.CC_RANGE || andStart) env.ccEscWarn("-"); /* [--x] or [a&&-x] is warned. */
+                    if (token.type == TokenType.CC_RANGE || andStart) {
+                        env.ccEscWarn("-"); /* [--x] or [a&&-x] is warned. */
+                    }
                     parseCharClassValEntry(cc, arg); // goto val_entry
                     break;
                 } else if (arg.state == CCSTATE.RANGE) {
@@ -214,7 +217,9 @@
                     prevCC.and(cc);
                 } else {
                     prevCC = cc;
-                    if (workCC == null) workCC = new CClassNode();
+                    if (workCC == null) {
+                        workCC = new CClassNode();
+                    }
                     cc = workCC;
                 }
                 cc.clear();
@@ -227,7 +232,9 @@
                 throw new InternalException(ERR_PARSER_BUG);
             } // switch
 
-            if (!fetched) fetchTokenInCC();
+            if (!fetched) {
+                fetchTokenInCC();
+            }
 
         } // while
 
@@ -443,7 +450,10 @@
     }
 
     private Node parseExp(final TokenType term) {
-        if (token.type == term) return StringNode.EMPTY; // goto end_of_token
+        if (token.type == term)
+         {
+            return StringNode.EMPTY; // goto end_of_token
+        }
 
         Node node = null;
         boolean group = false;
@@ -474,9 +484,8 @@
             }
             if (token.escaped) {
                 return parseExpTkRawByte(group); // goto tk_raw_byte
-            } else {
-                return parseExpTkByte(group); // goto tk_byte
             }
+            return parseExpTkByte(group); // goto tk_byte
         case STRING:
             return parseExpTkByte(group); // tk_byte:
 
@@ -496,7 +505,9 @@
                 if (Config.NON_UNICODE_SDW) {
                     final CClassNode cc = new CClassNode();
                     cc.addCType(token.getPropCType(), false, env, this);
-                    if (token.getPropNot()) cc.setNot();
+                    if (token.getPropNot()) {
+                        cc.setNot();
+                    }
                     node = cc;
                 }
                 break;
@@ -507,7 +518,9 @@
                 // #ifdef USE_SHARED_CCLASS_TABLE ... #endif
                 final CClassNode ccn = new CClassNode();
                 ccn.addCType(token.getPropCType(), false, env, this);
-                if (token.getPropNot()) ccn.setNot();
+                if (token.getPropNot()) {
+                    ccn.setNot();
+                }
                 node = ccn;
                 break;
 
@@ -555,9 +568,8 @@
             if (syntax.contextIndepRepeatOps()) {
                 if (syntax.contextInvalidRepeatOps()) {
                     throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED);
-                } else {
-                    node = StringNode.EMPTY; // node_new_empty
                 }
+                node = StringNode.EMPTY; // node_new_empty
             } else {
                 return parseExpTkByte(group); // goto tk_byte
             }
@@ -578,7 +590,9 @@
         final StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
         while (true) {
             fetchToken();
-            if (token.type != TokenType.STRING) break;
+            if (token.type != TokenType.STRING) {
+                break;
+            }
 
             if (token.backP == node.end) {
                 node.end = p; // non escaped character, remain shared, just increase shared range
@@ -605,7 +619,8 @@
         return parseExpRepeat(node, group);
     }
 
-    private Node parseExpRepeat(Node target, final boolean group) {
+    private Node parseExpRepeat(final Node targetp, final boolean group) {
+        Node target = targetp;
         while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat:
             if (target.isInvalidQuantifier()) {
                 throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID);
@@ -674,24 +689,25 @@
 
         if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
             return node;
-        } else {
-            final ConsAltNode top = ConsAltNode.newListNode(node, null);
-            ConsAltNode t = top;
+        }
+        final ConsAltNode top = ConsAltNode.newListNode(node, null);
+        ConsAltNode t = top;
 
-            while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
-                node = parseExp(term);
-                if (node.getType() == NodeType.LIST) {
-                    t.setCdr((ConsAltNode)node);
-                    while (((ConsAltNode)node).cdr != null ) node = ((ConsAltNode)node).cdr;
+        while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
+            node = parseExp(term);
+            if (node.getType() == NodeType.LIST) {
+                t.setCdr((ConsAltNode)node);
+                while (((ConsAltNode)node).cdr != null ) {
+                    node = ((ConsAltNode)node).cdr;
+                }
 
-                    t = ((ConsAltNode)node);
-                } else {
-                    t.setCdr(ConsAltNode.newListNode(node, null));
-                    t = t.cdr;
-                }
+                t = ((ConsAltNode)node);
+            } else {
+                t.setCdr(ConsAltNode.newListNode(node, null));
+                t = t.cdr;
             }
-            return top;
         }
+        return top;
     }
 
     /* term_tok: TK_EOT or TK_SUBEXP_CLOSE */
@@ -711,7 +727,9 @@
                 t = t.cdr;
             }
 
-            if (token.type != term) parseSubExpError(term);
+            if (token.type != term) {
+                parseSubExpError(term);
+            }
             return top;
         } else {
             parseSubExpError(term);
@@ -719,12 +737,11 @@
         }
     }
 
-    private void parseSubExpError(final TokenType term) {
+    private static void parseSubExpError(final TokenType term) {
         if (term == TokenType.SUBEXP_CLOSE) {
             throw new SyntaxException(ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS);
-        } else {
-            throw new InternalException(ERR_PARSER_BUG);
         }
+        throw new InternalException(ERR_PARSER_BUG);
     }
 
     private Node parseRegexp() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException;
 
+@SuppressWarnings("javadoc")
 public final class Regex implements RegexState {
 
     int[] code;             /* compiled pattern */
@@ -107,7 +108,8 @@
     }
 
     // onig_alloc_init
-    public Regex(final char[] chars, final int p, final int end, int option, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
+    public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
+        int option = optionp;
 
         if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
             (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
@@ -169,19 +171,33 @@
 
         if (len < Config.CHAR_TABLE_SIZE) {
             // map/skip
-            if (map == null) map = new byte[Config.CHAR_TABLE_SIZE];
+            if (map == null) {
+                map = new byte[Config.CHAR_TABLE_SIZE];
+            }
 
-            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) map[i] = (byte)len;
-            for (int i=0; i<len-1; i++) map[chars[p + i] & 0xff] = (byte)(len - 1 -i); // oxff ??
+            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) {
+                map[i] = (byte)len;
+            }
+            for (int i=0; i<len-1; i++)
+             {
+                map[chars[p + i] & 0xff] = (byte)(len - 1 -i); // oxff ??
+            }
         } else {
-            if (intMap == null) intMap = new int[Config.CHAR_TABLE_SIZE];
+            if (intMap == null) {
+                intMap = new int[Config.CHAR_TABLE_SIZE];
+            }
 
-            for (int i=0; i<len-1; i++) intMap[chars[p + i] & 0xff] = len - 1 - i; // oxff ??
+            for (int i=0; i<len-1; i++)
+             {
+                intMap[chars[p + i] & 0xff] = len - 1 - i; // oxff ??
+            }
         }
     }
 
     void setExactInfo(final OptExactInfo e) {
-        if (e.length == 0) return;
+        if (e.length == 0) {
+            return;
+        }
 
         // shall we copy that ?
         exact = e.chars;
@@ -257,7 +273,11 @@
             s.append("exact: [").append(exact, exactP, exactEnd - exactP).append("]: length: ").append(exactEnd - exactP).append("\n");
         } else if (searchAlgorithm == SearchAlgorithm.MAP) {
             int n=0;
-            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) if (map[i] != 0) n++;
+            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) {
+                if (map[i] != 0) {
+                    n++;
+                }
+            }
 
             s.append("map: n = ").append(n).append("\n");
             if (n > 0) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public final class Region {
     static final int REGION_NOTPOS = -1;
 
@@ -36,7 +37,9 @@
     public String toString() {
         final StringBuilder sb = new StringBuilder();
         sb.append("Region: \n");
-        for (int i=0; i<beg.length; i++) sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")");
+        for (int i=0; i<beg.length; i++) {
+            sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")");
+        }
         return sb.toString();
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Mon Nov 17 09:36:40 2014 +0100
@@ -20,11 +20,11 @@
 package jdk.nashorn.internal.runtime.regexp.joni;
 
 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsClear;
-
 import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
 
+@SuppressWarnings("javadoc")
 public final class ScanEnvironment {
 
     private static final int SCANENV_MEMNODES_SIZE = 8;
@@ -92,7 +92,10 @@
             case 'b': return '\010';
             case 'e': return '\033';
             case 'v':
-                if (syntax.op2EscVVtab()) return 11; // ???
+                if (syntax.op2EscVVtab())
+                 {
+                    return 11; // ???
+                }
                 break;
             default:
                 break;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java	Mon Nov 17 09:36:40 2014 +0100
@@ -60,7 +60,9 @@
             if (Character.isDigit(c)) {
                 final int onum = num;
                 num = num * 10 + EncodingHelper.digitVal(c);
-                if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1;
+                if (((onum ^ num) & INT_SIGN_BIT) != 0) {
+                    return -1;
+                }
             } else {
                 unfetch();
                 break;
@@ -70,16 +72,19 @@
         return num;
     }
 
-    protected final int scanUnsignedHexadecimalNumber(int maxLength) {
+    protected final int scanUnsignedHexadecimalNumber(final int maxLength) {
         final int last = c;
         int num = 0;
-        while(left() && maxLength-- != 0) {
+        int ml = maxLength;
+        while(left() && ml-- != 0) {
             fetch();
             if (EncodingHelper.isXDigit(c)) {
                 final int onum = num;
                 final int val = EncodingHelper.xdigitVal(c);
                 num = (num << 4) + val;
-                if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1;
+                if (((onum ^ num) & INT_SIGN_BIT) != 0) {
+                    return -1;
+                }
             } else {
                 unfetch();
                 break;
@@ -89,16 +94,19 @@
         return num;
     }
 
-    protected final int scanUnsignedOctalNumber(int maxLength) {
+    protected final int scanUnsignedOctalNumber(final int maxLength) {
         final int last = c;
         int num = 0;
-        while(left() && maxLength-- != 0) {
+        int ml = maxLength;
+        while(left() && ml-- != 0) {
             fetch();
             if (Character.isDigit(c) && c < '8') {
                 final int onum = num;
                 final int val = EncodingHelper.odigitVal(c);
                 num = (num << 3) + val;
-                if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1;
+                if (((onum ^ num) & INT_SIGN_BIT) != 0) {
+                    return -1;
+                }
             } else {
                 unfetch();
                 break;
@@ -144,8 +152,8 @@
         return p < stop ? chars[p] : 0;
     }
 
-    protected final boolean peekIs(final int c) {
-        return peek() == c;
+    protected final boolean peekIs(final int ch) {
+        return peek() == ch;
     }
 
     protected final boolean left() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public abstract class SearchAlgorithm {
 
     public abstract String getName();
@@ -62,7 +63,9 @@
             int end = textEnd;
             end -= targetEnd - targetP - 1;
 
-            if (end > textRange) end = textRange;
+            if (end > textRange) {
+                end = textRange;
+            }
 
             int s = textP;
 
@@ -71,11 +74,15 @@
                     int p = s + 1;
                     int t = targetP + 1;
                     while (t < targetEnd) {
-                        if (target[t] != text[p++]) break;
+                        if (target[t] != text[p++]) {
+                            break;
+                        }
                         t++;
                     }
 
-                    if (t == targetEnd) return s;
+                    if (t == targetEnd) {
+                        return s;
+                    }
                 }
                 s++;
             }
@@ -101,10 +108,14 @@
                     int p = s + 1;
                     int t = targetP + 1;
                     while (t < targetEnd) {
-                        if (target[t] != text[p++]) break;
+                        if (target[t] != text[p++]) {
+                            break;
+                        }
                         t++;
                     }
-                    if (t == targetEnd) return s;
+                    if (t == targetEnd) {
+                        return s;
+                    }
                 }
                 // s = enc.prevCharHead or s = s <= adjustText ? -1 : s - 1;
                 s--;
@@ -114,10 +125,8 @@
     };
 
     public static final class SLOW_IC extends SearchAlgorithm {
-        private final int caseFoldFlag;
-
         public SLOW_IC(final Regex regex) {
-            this.caseFoldFlag = regex.caseFoldFlag;
+            //empty
         }
 
         @Override
@@ -134,11 +143,15 @@
             int end = textEnd;
             end -= targetEnd - targetP - 1;
 
-            if (end > textRange) end = textRange;
+            if (end > textRange) {
+                end = textRange;
+            }
             int s = textP;
 
             while (s < end) {
-                if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s;
+                if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) {
+                    return s;
+                }
                 s++;
             }
             return -1;
@@ -158,17 +171,21 @@
             }
 
             while (s >= textP) {
-                if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s;
+                if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) {
+                    return s;
+                }
                 s = EncodingHelper.prevCharHead(adjustText, s);
             }
             return -1;
         }
 
-        private boolean lowerCaseMatch(final char[] t, int tP, final int tEnd,
-                                       final char[] chars, int p, final int end) {
+        private static boolean lowerCaseMatch(final char[] t, final int tPp, final int tEnd,
+                                       final char[] chars, final int pp, final int end) {
 
-            while (tP < tEnd) {
-                if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) return false;
+            for (int tP = tPp, p = pp; tP < tEnd; ) {
+                if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) {
+                    return false;
+                }
             }
             return true;
         }
@@ -188,7 +205,9 @@
             final int targetEnd = regex.exactEnd;
 
             int end = textRange + (targetEnd - targetP) - 1;
-            if (end > textEnd) end = textEnd;
+            if (end > textEnd) {
+                end = textEnd;
+            }
 
             final int tail = targetEnd - 1;
             int s = textP + (targetEnd - targetP) - 1;
@@ -199,7 +218,9 @@
                     int t = tail;
 
                     while (text[p] == target[t]) {
-                        if (t == targetP) return p;
+                        if (t == targetP) {
+                            return p;
+                        }
                         p--; t--;
                     }
 
@@ -211,7 +232,9 @@
                     int t = tail;
 
                     while (text[p] == target[t]) {
-                        if (t == targetP) return p;
+                        if (t == targetP) {
+                            return p;
+                        }
                         p--; t--;
                     }
 
@@ -249,7 +272,9 @@
                 while (t < targetEnd && text[p] == target[t]) {
                     p++; t++;
                 }
-                if (t == targetEnd) return s;
+                if (t == targetEnd) {
+                    return s;
+                }
 
                 s -= regex.intMapBackward[text[s] & 0xff];
             }
@@ -268,8 +293,12 @@
 
             final int len = end - p;
 
-            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) skip[i] = len;
-            for (int i=len-1; i>0; i--) skip[chars[i] & 0xff] = i;
+            for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) {
+                skip[i] = len;
+            }
+            for (int i=len-1; i>0; i--) {
+                skip[chars[i] & 0xff] = i;
+            }
         }
     };
 
@@ -286,7 +315,9 @@
             int s = textP;
 
             while (s < textRange) {
-                if (text[s] > 0xff || map[text[s]] != 0) return s;
+                if (text[s] > 0xff || map[text[s]] != 0) {
+                    return s;
+                }
                 s++;
             }
             return -1;
@@ -297,9 +328,13 @@
             final byte[] map = regex.map;
             int s = textStart;
 
-            if (s >= textEnd) s = textEnd - 1;
+            if (s >= textEnd) {
+                s = textEnd - 1;
+            }
             while (s >= textP) {
-                if (text[s] > 0xff || map[text[s]] != 0) return s;
+                if (text[s] > 0xff || map[text[s]] != 0) {
+                    return s;
+                }
                 s--;
             }
             return -1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Mon Nov 17 09:36:40 2014 +0100
@@ -20,7 +20,6 @@
 package jdk.nashorn.internal.runtime.regexp.joni;
 
 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt;
-
 import java.lang.ref.WeakReference;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType;
@@ -61,12 +60,14 @@
 
     static final ThreadLocal<WeakReference<StackEntry[]>> stacks
             = new ThreadLocal<WeakReference<StackEntry[]>>() {
+        @SuppressWarnings("unused")
         @Override
         protected WeakReference<StackEntry[]> initialValue() {
             return new WeakReference<StackEntry[]>(allocateStack());
         }
     };
 
+    @SuppressWarnings("unused")
     private static StackEntry[] fetchStack() {
         WeakReference<StackEntry[]> ref = stacks.get();
         StackEntry[] stack = ref.get();
@@ -78,7 +79,9 @@
     }
 
     protected final void init() {
-        if (stack != null) pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */
+        if (stack != null) {
+            pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */
+        }
         if (repeatStk != null) {
             for (int i=1; i<=regex.numMem; i++) {
                 repeatStk[i + memStartStk] = repeatStk[i + memEndStk] = INVALID_INDEX;
@@ -87,9 +90,13 @@
     }
 
     protected final StackEntry ensure1() {
-        if (stk >= stack.length) doubleStack();
+        if (stk >= stack.length) {
+            doubleStack();
+        }
         StackEntry e = stack[stk];
-        if (e == null) stack[stk] = e = new StackEntry();
+        if (e == null) {
+            stack[stk] = e = new StackEntry();
+        }
         return e;
     }
 
@@ -190,7 +197,9 @@
             if ((e.type & MASK_MEM_END_OR_MARK) != 0 && e.getMemNum() == mnum) {
                 level++;
             } else if (e.type == MEM_START && e.getMemNum() == mnum) {
-                if (level == 0) break;
+                if (level == 0) {
+                    break;
+                }
                 level--;
             }
         }
@@ -371,9 +380,8 @@
                 if (e.getNullCheckNum() == id) {
                     if (level == 0) {
                         return e.getNullCheckPStr() == s ? 1 : 0;
-                    } else {
-                        level--;
                     }
+                    level--;
                 }
             } else if (e.type == NULL_CHECK_END) {
                 level++;
@@ -393,7 +401,52 @@
                     if (e.getNullCheckPStr() != s) {
                         isNull = 0;
                         break;
-                    } else {
+                    }
+                    int endp;
+                    isNull = 1;
+                    while (k < stk) {
+                        if (e.type == MEM_START) {
+                            if (e.getMemEnd() == INVALID_INDEX) {
+                                isNull = 0;
+                                break;
+                            }
+                            if (bsAt(regex.btMemEnd, e.getMemNum())) {
+                                endp = stack[e.getMemEnd()].getMemPStr();
+                            } else {
+                                endp = e.getMemEnd();
+                            }
+                            if (stack[e.getMemStart()].getMemPStr() != endp) {
+                                isNull = 0;
+                                break;
+                            } else if (endp != s) {
+                                isNull = -1; /* empty, but position changed */
+                            }
+                        }
+                        k++;
+                        e = stack[k]; // !!
+                    }
+                    break;
+                }
+            }
+        }
+        return isNull;
+    }
+
+    protected final int nullCheckMemStRec(final int id, final int s) {
+        int level = 0;
+        int k = stk;
+        int isNull;
+        while (true) {
+            k--;
+            StackEntry e = stack[k];
+
+            if (e.type == NULL_CHECK_START) {
+                if (e.getNullCheckNum() == id) {
+                    if (level == 0) {
+                        if (e.getNullCheckPStr() != s) {
+                            isNull = 0;
+                            break;
+                        }
                         int endp;
                         isNull = 1;
                         while (k < stk) {
@@ -415,62 +468,16 @@
                                 }
                             }
                             k++;
-                            e = stack[k]; // !!
+                            e = stack[k];
                         }
                         break;
                     }
-                }
-            }
-        }
-        return isNull;
-    }
-
-    protected final int nullCheckMemStRec(final int id, final int s) {
-        int level = 0;
-        int k = stk;
-        int isNull;
-        while (true) {
-            k--;
-            StackEntry e = stack[k];
-
-            if (e.type == NULL_CHECK_START) {
-                if (e.getNullCheckNum() == id) {
-                    if (level == 0) {
-                        if (e.getNullCheckPStr() != s) {
-                            isNull = 0;
-                            break;
-                        } else {
-                            int endp;
-                            isNull = 1;
-                            while (k < stk) {
-                                if (e.type == MEM_START) {
-                                    if (e.getMemEnd() == INVALID_INDEX) {
-                                        isNull = 0;
-                                        break;
-                                    }
-                                    if (bsAt(regex.btMemEnd, e.getMemNum())) {
-                                        endp = stack[e.getMemEnd()].getMemPStr();
-                                    } else {
-                                        endp = e.getMemEnd();
-                                    }
-                                    if (stack[e.getMemStart()].getMemPStr() != endp) {
-                                        isNull = 0;
-                                        break;
-                                    } else if (endp != s) {
-                                        isNull = -1; /* empty, but position changed */
-                                    }
-                                }
-                                k++;
-                                e = stack[k];
-                            }
-                            break;
-                        }
-                    } else {
-                        level--;
-                    }
+                    level--;
                 }
             } else if (e.type == NULL_CHECK_END) {
-                if (e.getNullCheckNum() == id) level++;
+                if (e.getNullCheckNum() == id) {
+                    level++;
+                }
             }
         }
         return isNull;
@@ -485,7 +492,9 @@
 
             if (e.type == REPEAT) {
                 if (level == 0) {
-                    if (e.getRepeatNum() == id) return k;
+                    if (e.getRepeatNum() == id) {
+                        return k;
+                    }
                 }
             } else if (e.type == CALL_FRAME) {
                 level--;
@@ -505,9 +514,8 @@
             if (e.type == CALL_FRAME) {
                 if (level == 0) {
                     return e.getCallFrameRetAddr();
-                } else {
-                    level--;
                 }
+                level--;
             } else if (e.type == RETURN) {
                 level++;
             }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java	Mon Nov 17 09:36:40 2014 +0100
@@ -20,10 +20,10 @@
 package jdk.nashorn.internal.runtime.regexp.joni;
 
 import static jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar.INEFFECTIVE_META_CHAR;
-
 import jdk.nashorn.internal.runtime.regexp.joni.constants.SyntaxProperties;
 
-public final class Syntax implements SyntaxProperties{
+@SuppressWarnings("javadoc")
+public final class Syntax implements SyntaxProperties {
     private final int op;
     private final int op2;
     private final int behavior;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,6 +22,7 @@
 /**
  * @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a>
  */
+@SuppressWarnings("javadoc")
 public interface WarnCallback {
     WarnCallback DEFAULT = new WarnCallback() {
         @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
+@SuppressWarnings("javadoc")
 public interface Warnings {
     final String INVALID_BACKREFERENCE =            "invalid back reference";
     final String INVALID_SUBEXP_CALL =              "invalid subexp call";
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,6 +21,7 @@
 
 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
 
+@SuppressWarnings("javadoc")
 public final class AnchorNode extends Node implements AnchorType {
     public int type;
     public Node target;
@@ -65,28 +66,60 @@
     }
 
     public String typeToString() {
-        final StringBuilder type = new StringBuilder();
-        if (isType(BEGIN_BUF)) type.append("BEGIN_BUF ");
-        if (isType(BEGIN_LINE)) type.append("BEGIN_LINE ");
-        if (isType(BEGIN_POSITION)) type.append("BEGIN_POSITION ");
-        if (isType(END_BUF)) type.append("END_BUF ");
-        if (isType(SEMI_END_BUF)) type.append("SEMI_END_BUF ");
-        if (isType(END_LINE)) type.append("END_LINE ");
-        if (isType(WORD_BOUND)) type.append("WORD_BOUND ");
-        if (isType(NOT_WORD_BOUND)) type.append("NOT_WORD_BOUND ");
-        if (isType(WORD_BEGIN)) type.append("WORD_BEGIN ");
-        if (isType(WORD_END)) type.append("WORD_END ");
-        if (isType(PREC_READ)) type.append("PREC_READ ");
-        if (isType(PREC_READ_NOT)) type.append("PREC_READ_NOT ");
-        if (isType(LOOK_BEHIND)) type.append("LOOK_BEHIND ");
-        if (isType(LOOK_BEHIND_NOT)) type.append("LOOK_BEHIND_NOT ");
-        if (isType(ANYCHAR_STAR)) type.append("ANYCHAR_STAR ");
-        if (isType(ANYCHAR_STAR_ML)) type.append("ANYCHAR_STAR_ML ");
-        return type.toString();
+        final StringBuilder sb = new StringBuilder();
+        if (isType(BEGIN_BUF)) {
+            sb.append("BEGIN_BUF ");
+        }
+        if (isType(BEGIN_LINE)) {
+            sb.append("BEGIN_LINE ");
+        }
+        if (isType(BEGIN_POSITION)) {
+            sb.append("BEGIN_POSITION ");
+        }
+        if (isType(END_BUF)) {
+            sb.append("END_BUF ");
+        }
+        if (isType(SEMI_END_BUF)) {
+            sb.append("SEMI_END_BUF ");
+        }
+        if (isType(END_LINE)) {
+            sb.append("END_LINE ");
+        }
+        if (isType(WORD_BOUND)) {
+            sb.append("WORD_BOUND ");
+        }
+        if (isType(NOT_WORD_BOUND)) {
+            sb.append("NOT_WORD_BOUND ");
+        }
+        if (isType(WORD_BEGIN)) {
+            sb.append("WORD_BEGIN ");
+        }
+        if (isType(WORD_END)) {
+            sb.append("WORD_END ");
+        }
+        if (isType(PREC_READ)) {
+            sb.append("PREC_READ ");
+        }
+        if (isType(PREC_READ_NOT)) {
+            sb.append("PREC_READ_NOT ");
+        }
+        if (isType(LOOK_BEHIND)) {
+            sb.append("LOOK_BEHIND ");
+        }
+        if (isType(LOOK_BEHIND_NOT)) {
+            sb.append("LOOK_BEHIND_NOT ");
+        }
+        if (isType(ANYCHAR_STAR)) {
+            sb.append("ANYCHAR_STAR ");
+        }
+        if (isType(ANYCHAR_STAR_ML)) {
+            sb.append("ANYCHAR_STAR_ML ");
+        }
+        return sb.toString();
     }
 
-    private boolean isType(final int type) {
-        return (this.type & type) != 0;
+    private boolean isType(final int t) {
+        return (this.type & t) != 0;
     }
 
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.ast;
 
+@SuppressWarnings("javadoc")
 public final class AnyCharNode extends Node {
     public AnyCharNode(){}
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,6 +21,7 @@
 
 import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment;
 
+@SuppressWarnings("javadoc")
 public final class BackRefNode extends StateNode {
     public final int backRef;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,6 +34,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.exception.SyntaxException;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException;
 
+@SuppressWarnings("javadoc")
 public final class CClassNode extends Node {
     private static final int FLAG_NCCLASS_NOT = 1<<0;
     private static final int FLAG_NCCLASS_SHARE = 1<<1;
@@ -100,7 +101,9 @@
 
     @Override
     public boolean equals(final Object other) {
-        if (!(other instanceof CClassNode)) return false;
+        if (!(other instanceof CClassNode)) {
+            return false;
+        }
         final CClassNode cc = (CClassNode)other;
         return ctype == cc.ctype && isNot() == cc.isNot();
     }
@@ -110,11 +113,12 @@
         if (Config.USE_SHARED_CCLASS_TABLE) {
             int hash = 0;
             hash += ctype;
-            if (isNot()) hash++;
+            if (isNot()) {
+                hash++;
+            }
             return hash + (hash >> 5);
-        } else {
-            return super.hashCode();
         }
+        return super.hashCode();
     }
 
     @Override
@@ -128,10 +132,14 @@
     }
 
     public String flagsToString() {
-        final StringBuilder flags = new StringBuilder();
-        if (isNot()) flags.append("NOT ");
-        if (isShare()) flags.append("SHARE ");
-        return flags.toString();
+        final StringBuilder f = new StringBuilder();
+        if (isNot()) {
+            f.append("NOT ");
+        }
+        if (isShare()) {
+            f.append("SHARE ");
+        }
+        return f.toString();
     }
 
     public boolean isEmpty() {
@@ -251,7 +259,7 @@
     }
 
     // add_ctype_to_cc_by_range // Encoding out!
-    public void addCTypeByRange(final int ctype, final boolean not, final int sbOut, final int mbr[]) {
+    public void addCTypeByRange(final int ct, final boolean not, final int sbOut, final int mbr[]) {
         final int n = mbr[0];
 
         if (!not) {
@@ -294,10 +302,14 @@
                         // !goto sb_end2!, remove duplication
                         prev = sbOut;
                         for (i=0; i<n; i++) {
-                            if (prev < mbr[2 * i + 1]) addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
+                            if (prev < mbr[2 * i + 1]) {
+                                addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
+                            }
                             prev = mbr[i * 2 + 2] + 1;
                         }
-                        if (prev < 0x7fffffff/*!!!*/) addCodeRangeToBuf(prev, 0x7fffffff);
+                        if (prev < 0x7fffffff/*!!!*/) {
+                            addCodeRangeToBuf(prev, 0x7fffffff);
+                        }
                         return;
                     }
                     bs.set(j);
@@ -312,22 +324,27 @@
             // !sb_end2:!
             prev = sbOut;
             for (int i=0; i<n; i++) {
-                if (prev < mbr[2 * i + 1]) addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
+                if (prev < mbr[2 * i + 1]) {
+                    addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1);
+                }
                 prev = mbr[i * 2 + 2] + 1;
             }
-            if (prev < 0x7fffffff/*!!!*/) addCodeRangeToBuf(prev, 0x7fffffff);
+            if (prev < 0x7fffffff/*!!!*/) {
+                addCodeRangeToBuf(prev, 0x7fffffff);
+            }
         }
     }
 
-    public void addCType(int ctype, final boolean not, final ScanEnvironment env, final IntHolder sbOut) {
+    public void addCType(final int ctp, final boolean not, final ScanEnvironment env, final IntHolder sbOut) {
+        int ct = ctp;
         if (Config.NON_UNICODE_SDW) {
-            switch(ctype) {
+            switch (ct) {
             case CharacterType.D:
             case CharacterType.S:
             case CharacterType.W:
-                ctype ^= CharacterType.SPECIAL_MASK;
+                ct ^= CharacterType.SPECIAL_MASK;
 
-                if (env.syntax == Syntax.JAVASCRIPT && ctype == CharacterType.SPACE) {
+                if (env.syntax == Syntax.JAVASCRIPT && ct == CharacterType.SPACE) {
                     // \s in JavaScript includes unicode characters.
                     break;
                 }
@@ -335,26 +352,32 @@
                 if (not) {
                     for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                         // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
-                        if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
+                        if ((AsciiCtypeTable[c] & (1 << ct)) == 0) {
+                            bs.set(c);
+                        }
                     }
                     addAllMultiByteRange();
                 } else {
                     for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                         // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
-                        if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
+                        if ((AsciiCtypeTable[c] & (1 << ct)) != 0) {
+                            bs.set(c);
+                        }
                     }
                 }
                 return;
+            default:
+                break;
             }
         }
 
-        final int[] ranges = EncodingHelper.ctypeCodeRange(ctype, sbOut);
+        final int[] ranges = EncodingHelper.ctypeCodeRange(ct, sbOut);
         if (ranges != null) {
-            addCTypeByRange(ctype, not, sbOut.value, ranges);
+            addCTypeByRange(ct, not, sbOut.value, ranges);
             return;
         }
 
-        switch(ctype) {
+        switch(ct) {
         case CharacterType.ALPHA:
         case CharacterType.BLANK:
         case CharacterType.CNTRL:
@@ -368,12 +391,16 @@
         case CharacterType.ALNUM:
             if (not) {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
+                    if (!EncodingHelper.isCodeCType(c, ct)) {
+                        bs.set(c);
+                    }
                 }
                 addAllMultiByteRange();
             } else {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
+                    if (EncodingHelper.isCodeCType(c, ct)) {
+                        bs.set(c);
+                    }
                 }
             }
             break;
@@ -382,11 +409,15 @@
         case CharacterType.PRINT:
             if (not) {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
+                    if (!EncodingHelper.isCodeCType(c, ct)) {
+                        bs.set(c);
+                    }
                 }
             } else {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
+                    if (EncodingHelper.isCodeCType(c, ct)) {
+                        bs.set(c);
+                    }
                 }
                 addAllMultiByteRange();
             }
@@ -395,13 +426,17 @@
         case CharacterType.WORD:
             if (!not) {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (EncodingHelper.isWord(c)) bs.set(c);
+                    if (EncodingHelper.isWord(c)) {
+                        bs.set(c);
+                    }
                 }
 
                 addAllMultiByteRange();
             } else {
                 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
-                    if (!EncodingHelper.isWord(c)) bs.set(c);
+                    if (!EncodingHelper.isWord(c)) {
+                        bs.set(c);
+                    }
                 }
             }
             break;
@@ -422,7 +457,9 @@
     }
 
     public void nextStateClass(final CCStateArg arg, final ScanEnvironment env) {
-        if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE);
+        if (arg.state == CCSTATE.RANGE) {
+            throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE);
+        }
 
         if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) {
             if (arg.type == CCVALTYPE.SB) {
@@ -440,7 +477,9 @@
         switch(arg.state) {
         case VALUE:
             if (arg.type == CCVALTYPE.SB) {
-                if (arg.vs > 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE);
+                if (arg.vs > 0xff) {
+                    throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE);
+                }
                 bs.set(arg.vs);
             } else if (arg.type == CCVALTYPE.CODE_POINT) {
                 addCodeRange(env, arg.vs, arg.vs);
@@ -450,16 +489,17 @@
         case RANGE:
             if (arg.inType == arg.type) {
                 if (arg.inType == CCVALTYPE.SB) {
-                    if (arg.vs > 0xff || arg.v > 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE);
+                    if (arg.vs > 0xff || arg.v > 0xff) {
+                        throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE);
+                    }
 
                     if (arg.vs > arg.v) {
                         if (env.syntax.allowEmptyRangeInCC()) {
                             // goto ccs_range_end
                             arg.state = CCSTATE.COMPLETE;
                             break;
-                        } else {
-                            throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
                         }
+                        throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
                     }
                     bs.setRange(arg.vs, arg.v);
                 } else {
@@ -471,9 +511,8 @@
                         // goto ccs_range_end
                         arg.state = CCSTATE.COMPLETE;
                         break;
-                    } else {
-                        throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
                     }
+                    throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
                 }
                 bs.setRange(arg.vs, arg.v < 0xff ? arg.v : 0xff);
                 addCodeRange(env, arg.vs, arg.v);
@@ -509,9 +548,8 @@
 
         if (isNot()) {
             return !found;
-        } else {
-            return found;
         }
+        return found;
     }
 
     // onig_is_code_in_cc
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
 
+@SuppressWarnings("javadoc")
 public final class ConsAltNode extends Node {
     public Node car;
     public ConsAltNode cdr;
@@ -31,9 +32,13 @@
 
     private ConsAltNode(final Node car, final ConsAltNode cdr, final int type) {
         this.car = car;
-        if (car != null) car.parent = this;
+        if (car != null) {
+            car.parent = this;
+        }
         this.cdr = cdr;
-        if (cdr != null) cdr.parent = this;
+        if (cdr != null) {
+            cdr.parent = this;
+        }
 
         this.type = type;
     }
@@ -46,8 +51,9 @@
         return new ConsAltNode(left, right, LIST);
     }
 
-    public static ConsAltNode listAdd(ConsAltNode list, final Node x) {
+    public static ConsAltNode listAdd(final ConsAltNode listp, final Node x) {
         final ConsAltNode n = newListNode(x, null);
+        ConsAltNode list = listp;
 
         if (list != null) {
             while (list.cdr != null) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,6 +22,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.Option;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType;
 
+@SuppressWarnings("javadoc")
 public final class EncloseNode extends StateNode implements EncloseType {
 
     public final int type;                // enclose type
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.WarnCallback;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType;
 
+@SuppressWarnings("javadoc")
 public abstract class Node implements NodeType {
     public Node parent;
 
@@ -33,8 +34,12 @@
         return 1 << getType();
     }
 
-    protected void setChild(final Node tgt){}         // default definition
-    protected Node getChild(){return null;}     // default definition
+    protected void setChild(final Node tgt) {
+        //empty, default definition
+    }
+    protected Node getChild() {
+        return null; // default definition
+        }
 
     public void swap(final Node with) {
         Node tmp;
@@ -46,9 +51,13 @@
         //setChild(with.getChild());
         //with.setChild(tmp);
 
-        if (parent != null) parent.setChild(with);
+        if (parent != null) {
+            parent.setChild(with);
+        }
 
-        if (with.parent != null) with.parent.setChild(this);
+        if (with.parent != null) {
+            with.parent.setChild(this);
+        }
 
         tmp = parent;
         parent = with.parent;
@@ -81,16 +90,22 @@
     }
 
     protected static String pad(final Object value, final int level) {
-        if (value == null) return "NULL";
+        if (value == null) {
+            return "NULL";
+        }
 
         final StringBuilder pad = new StringBuilder("  ");
-        for (int i=0; i<level; i++) pad.append(pad);
+        for (int i=0; i<level; i++) {
+            pad.append(pad);
+        }
 
         return value.toString().replace("\n",  "\n" + pad);
     }
 
     public final boolean isInvalidQuantifier() {
-        if (!Config.VANILLA) return false;
+        if (!Config.VANILLA) {
+            return false;
+        }
 
         ConsAltNode node;
 
@@ -107,14 +122,18 @@
         case LIST:
             node = (ConsAltNode)this;
             do {
-                if (!node.car.isInvalidQuantifier()) return false;
+                if (!node.car.isInvalidQuantifier()) {
+                    return false;
+                }
             } while ((node = node.cdr) != null);
             return false;
 
         case ALT:
             node = (ConsAltNode)this;
             do {
-                if (node.car.isInvalidQuantifier()) return true;
+                if (node.car.isInvalidQuantifier()) {
+                    return true;
+                }
             } while ((node = node.cdr) != null);
             break;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,11 +26,11 @@
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.PQ_Q;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.P_QQ;
 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.QQ;
-
 import jdk.nashorn.internal.runtime.regexp.joni.Config;
 import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo;
 
+@SuppressWarnings("javadoc")
 public final class QuantifierNode extends StateNode {
 
     public Node target;
@@ -78,7 +78,9 @@
         greedy = true;
         targetEmptyInfo = TargetInfo.ISNOT_EMPTY;
 
-        if (byNumber) setByNumber();
+        if (byNumber) {
+            setByNumber();
+        }
     }
 
     @Override
@@ -136,17 +138,27 @@
     protected int popularNum() {
         if (greedy) {
             if (lower == 0) {
-                if (upper == 1) return 0;
-                else if (isRepeatInfinite(upper)) return 1;
+                if (upper == 1) {
+                    return 0;
+                } else if (isRepeatInfinite(upper)) {
+                    return 1;
+                }
             } else if (lower == 1) {
-                if (isRepeatInfinite(upper)) return 2;
+                if (isRepeatInfinite(upper)) {
+                    return 2;
+                }
             }
         } else {
             if (lower == 0) {
-                if (upper == 1) return 3;
-                else if (isRepeatInfinite(upper)) return 4;
+                if (upper == 1) {
+                    return 3;
+                } else if (isRepeatInfinite(upper)) {
+                    return 4;
+                }
             } else if (lower == 1) {
-                if (isRepeatInfinite(upper)) return 5;
+                if (isRepeatInfinite(upper)) {
+                    return 5;
+                }
             }
         }
         return -1;
@@ -171,7 +183,9 @@
         final int pnum = popularNum();
         final int cnum = other.popularNum();
 
-        if (pnum < 0 || cnum < 0) return;
+        if (pnum < 0 || cnum < 0) {
+            return;
+        }
 
         switch(REDUCE_TABLE[cnum][pnum]) {
         case DEL:
@@ -224,6 +238,9 @@
         case ASIS:
             setTarget(other);
             return;
+
+        default:
+            break;
         }
         // ??? remove the parent from target ???
         other.target = null; // remove target from reduced quantifier
@@ -231,7 +248,9 @@
 
     @SuppressWarnings("fallthrough")
     public int setQuantifier(final Node tgt, final boolean group, final ScanEnvironment env, final char[] chars, final int p, final int end) {
-        if (lower == 1 && upper == 1) return 1;
+        if (lower == 1 && upper == 1) {
+            return 1;
+        }
 
         switch(tgt.getType()) {
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -21,6 +21,7 @@
 
 import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeStatus;
 
+@SuppressWarnings("javadoc")
 public abstract class StateNode extends Node implements NodeStatus {
     protected int state;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -22,6 +22,7 @@
 import jdk.nashorn.internal.runtime.regexp.joni.EncodingHelper;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.StringType;
 
+@SuppressWarnings("javadoc")
 public final class StringNode extends Node implements StringType {
 
     private static final int NODE_STR_MARGIN = 16;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface AnchorType {
     final int BEGIN_BUF         = (1<<0);
     final int BEGIN_LINE        = (1<<1);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface Arguments {
     final int SPECIAL       = -1;
     final int NON           = 0;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface AsmConstants {
     final int THIS = 0;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public enum CCSTATE {
     VALUE,
     RANGE,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public enum CCVALTYPE {
     SB,
     CODE_POINT,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface EncloseType {
     final int MEMORY                = 1<<0;
     final int OPTION                = 1<<1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface MetaChar {
     final int ESCAPE            = 0;
     final int ANYCHAR           = 1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface NodeStatus {
     /* status bits */
     final int NST_MIN_FIXED            = (1<<0);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface NodeType {
     /* node type */
     final int  STR        = 0;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface OPCode {
     final int FINISH                        = 0;            /* matching process terminator (no more alternative) */
     final int END                           = 1;            /* pattern code terminator (success end) */
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface OPSize {
 
     // this might be helpful for potential byte[] migration
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java	Mon Nov 17 09:36:40 2014 +0100
@@ -20,6 +20,7 @@
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
 // we dont need this ATM
+@SuppressWarnings("javadoc")
 public interface RegexState {
     final int NORMAL          = 0;
     final int SEARCHING       = 1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface StackPopLevel {
     final int FREE      = 0;
     final int MEM_START = 1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface StackType {
     /** stack **/
     final int INVALID_STACK_INDEX           = -1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface StringType {
     final int NSTR_RAW               = 1<<0;
     final int NSTR_AMBIG             = 1<<1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface SyntaxProperties {
     /* syntax (operators); */
     final int OP_VARIABLE_META_CHARACTERS    = (1<<0);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface TargetInfo {
     final int ISNOT_EMPTY   = 0;
     final int IS_EMPTY      = 1;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public enum TokenType {
       EOT,            /* end of token */
       RAW_BYTE,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.constants;
 
+@SuppressWarnings("javadoc")
 public interface Traverse {
     final int TRAVERSE_CALLBACK_AT_FIRST = 1;
     final int TRAVERSE_CALLBACK_AT_LAST = 2;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.encoding;
 
+@SuppressWarnings("javadoc")
 public interface CharacterType {
 
     final int NEWLINE   = 0;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.encoding;
 
+@SuppressWarnings("javadoc")
 public class IntHolder {
     public int value;
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.encoding;
 
+@SuppressWarnings("javadoc")
 public final class ObjPtr<T> {
     public ObjPtr() {
         this(null);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.exception;
 
+@SuppressWarnings("javadoc")
 public interface ErrorMessages {
 
     /* from jcodings */
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.exception;
 
+@SuppressWarnings("javadoc")
 public class InternalException extends JOniException{
     private static final long serialVersionUID = -3871816465397927992L;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.exception;
 
+@SuppressWarnings("javadoc")
 public class JOniException extends RuntimeException{
     private static final long serialVersionUID = -6027192180014164667L;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,6 +19,7 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.exception;
 
+@SuppressWarnings("javadoc")
 public class SyntaxException extends JOniException{
     private static final long serialVersionUID = 7862720128961874288L;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java	Mon Nov 17 09:36:40 2014 +0100
@@ -19,7 +19,8 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni.exception;
 
-public class ValueException extends SyntaxException{
+@SuppressWarnings("javadoc")
+public class ValueException extends SyntaxException {
     private static final long serialVersionUID = -196013852479929134L;
 
     public ValueException(final String message) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8035312 push to frozen array must not increase length property
+ *
+ * @test
+ * @run
+ * @fork
+ * @option -Dnashorn.debug=true
+ */
+
+function printArrayDataClass(x) {
+    if (typeof Debug !== 'undefined') {
+	print(Debug.getArrayDataClass(x));
+    }
+}
+
+function gpush(x, elem) {
+    try {
+	print("Pushing " + elem + " to " + x);
+	x.push(elem);
+    } catch (e) {
+	print("caught error" + e);
+    }
+    print("\tarray is now [" + x + "] length is = " + x.length);
+    print();
+    printArrayDataClass(x);
+}
+
+function gpop(x) {
+    try {
+	print("Popping from " + x);
+	x.pop();
+    } catch (e) {
+	if (!(e instanceof TypeError)) {
+	    print("e of wrong type " + e);
+	}
+    }
+    print("\tarray is now [" + x + "] length is = " + x.length);
+    print();
+    printArrayDataClass(x);
+}
+
+function checkArray(x) {
+    print();
+    print(">>> Push test");
+
+    var olen = x.length;
+    gpush(x, 0);
+
+    print("x.length === " + x.length + " (should be " + olen + ")");
+    print("x[3] === " + x[3] + " (should be 0)");
+    print("x[4] === " + x[4] + " (should be undefined)");
+
+    print();
+    print(">>> Pop test");
+    gpop(x);
+    gpop(x);
+    print("x.length === " + x.length + " (should be " + olen + ")");
+    print("x === " + x);
+
+    for (var i = 0 ; i < 5; i++) {
+	gpop(x);
+    }
+
+    print("x.length === " + x.length + " (should be " + olen + ")");
+    print("x === " + x);
+}
+
+print("*** Freezing");
+var frozen = [1,2,3];
+Object.freeze(frozen);
+checkArray(frozen);
+printArrayDataClass(frozen);
+
+//so far so good
+
+print();
+print("*** Other length not writable issues");
+var lengthNotWritable = [1,2,3];
+Object.defineProperty(lengthNotWritable, "length", { writable: false });
+checkArray(lengthNotWritable);
+printArrayDataClass(lengthNotWritable);
+
+function set(array, from, to, stride) {
+    //add three elements
+    for (var i = from; i < to; i+=stride) {
+	try {
+	    print("Writing " + i);
+	    array[i] = i;
+	    printArrayDataClass(array);
+	} catch (e) {
+	    print(e instanceof TypeError);
+	}
+    }
+}
+
+//define empty array with non writable length
+var arr = [1];
+Object.defineProperty(arr, "length", { writable: false });
+
+var olen2 = arr.length;
+
+set(arr, 0, 3, 1);
+
+if (arr.length != olen2) {
+    throw new ("error: " +  arr.length + " != " + olen2);
+}
+
+print();
+print("array writing 0-3, with 1 stride, array = " + arr);
+print("length = " + arr.length + ", but elements are: " + arr[0] + " " + arr[1] + " " + arr[2]);
+print();
+
+//do the same but sparse/deleted range
+var arr2 = [1];
+Object.defineProperty(arr2, "length", { writable: false });
+
+print("initial length = " + arr2.length);
+var olen3 = arr2.length;
+
+set(arr2, 0, 30, 3);
+
+if (arr2.length != olen3) {
+    throw new ("error: " +  arr2.length + " != " + olen3);
+}
+
+print();
+var larger = 20;
+print("array writing 0-" + larger + ", with 3 stride, array = " + arr2);
+print("length = " + arr2.length + ", but elements are: " + arr2[0] + " " + arr2[1] + " " + arr2[2]);
+
+for (var i = 0; i < larger; i++) {
+    if (arr2[i] === undefined) {
+	continue;
+    }
+    print(arr2[i] + " has length " + arr2.length);
+}
+
+print();
+var elem = 0x7fffffff - 10;
+printArrayDataClass(arr2);
+print("adding a new element high up in the array");
+print("length before element was added " + arr2.length);
+print("putting sparse at " + elem);
+arr2[elem] = "sparse";
+print("length after element was added " + arr2.length + " should be the same");
+printArrayDataClass(arr2);
+
+print();
+print("Printing arr2 - this will fail if length is > 28 and it is " + arr2.length);
+print("arr2 = [" + arr2 + "]");
+print("new length that should not be writable = " + arr2.length);
+print(arr2[elem] === "sparse");
+print(arr2[elem]);
+for (var i = 0; i < larger; i++) {
+    print(arr2[i]);
+}
+for (var key in arr2) {
+    print(key + ":" + arr2[key]);
+}
+
+//issues reported by sundar - generic setter doesn't go through push/pop bulkable
+
+function sundarExample2(arr, _writable) {
+    print("Checking if push works for bulkable non bulkable arrays - Setting length property not allowed");
+    arr[0] = "bar";
+    print(arr.length + " should be 1"); // should be 1
+    print(arr[0] + " should be bar");
+    print("["+ arr + "] should be [bar]");
+
+    //    Object.defineProperty(arr, "length", { configurable: _writable });
+    Object.defineProperty(arr, "length", { writable: _writable });
+    arr[1] = "baz";
+
+    if (_writable) {
+	print(arr.length + " should be 2");
+	print(arr[0] + " should be bar");
+	print(arr[1] + " should be baz");
+	print("["+ arr + "] should be [bar,baz]");
+    } else {
+	print(arr.length + " should STILL be 1");
+	print(arr[0] + " should be bar");
+	print(arr[1] + " should be baz");
+	print("["+ arr + "] should be [bar]");
+    }
+}
+
+var newArr1 = [];
+sundarExample2(newArr1, false);
+print();
+try {
+    sundarExample2(newArr1, true);
+    print("should not get here");
+} catch (e) {
+    if (!(e instanceof TypeError)) {
+	print("Wrong exception");
+    }
+    print("got TypeError when redefining length, as expected")
+}
+print();
+
+sundarExample2([], true);
+print("Done");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,186 @@
+*** Freezing
+
+>>> Push test
+Pushing 0 to 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+x.length === 3 (should be 3)
+x[3] === undefined (should be 0)
+x[4] === undefined (should be undefined)
+
+>>> Pop test
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+x.length === 3 (should be 3)
+x === 1,2,3
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+x.length === 3 (should be 3)
+x === 1,2,3
+class jdk.nashorn.internal.runtime.arrays.FrozenArrayFilter
+
+*** Other length not writable issues
+
+>>> Push test
+Pushing 0 to 1,2,3
+caught errorTypeError: "length" is not a writable property of [object Array]
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+x.length === 3 (should be 3)
+x[3] === 0 (should be 0)
+x[4] === undefined (should be undefined)
+
+>>> Pop test
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+x.length === 3 (should be 3)
+x === 1,2,3
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Popping from 1,2,3
+	array is now [1,2,3] length is = 3
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+x.length === 3 (should be 3)
+x === 1,2,3
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 0
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 1
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 2
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+
+array writing 0-3, with 1 stride, array = 0
+length = 1, but elements are: 0 undefined 2
+
+initial length = 1
+Writing 0
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 3
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 6
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 9
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 12
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 15
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 18
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 21
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 24
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+Writing 27
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+
+array writing 0-20, with 3 stride, array = 0
+length = 1, but elements are: 0 undefined undefined
+0 has length 1
+
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+adding a new element high up in the array
+length before element was added 1
+putting sparse at 2147483637
+length after element was added 1 should be the same
+class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
+
+Printing arr2 - this will fail if length is > 28 and it is 1
+arr2 = [0]
+new length that should not be writable = 1
+true
+sparse
+0
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
+0:0
+2147483637:sparse
+Checking if push works for bulkable non bulkable arrays - Setting length property not allowed
+1 should be 1
+bar should be bar
+[bar] should be [bar]
+1 should STILL be 1
+bar should be bar
+baz should be baz
+[bar] should be [bar]
+
+Checking if push works for bulkable non bulkable arrays - Setting length property not allowed
+1 should be 1
+bar should be bar
+[bar] should be [bar]
+got TypeError when redefining length, as expected
+
+Checking if push works for bulkable non bulkable arrays - Setting length property not allowed
+1 should be 1
+bar should be bar
+[bar] should be [bar]
+2 should be 2
+bar should be bar
+baz should be baz
+[bar,baz] should be [bar,baz]
+Done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_2.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8035312_2 - length setter and iterators
+ *
+ * @test
+ * @run
+ */
+
+"use strict"
+
+function printArray(a,n) {
+    print("PRINT_ARRAY CALLED: length = " + a.length);
+    print();
+
+    print("INDEXED");
+    for (var x = 0; x<n; x++) {
+	print("\t" + x + ":"+a[x]);
+    }
+    print("KEYS");
+    for (var key in a) {
+	print("\t" + key + ";" + a[key]);
+    }
+}
+
+var b = [1,2,3];
+
+Object.defineProperty(b, "length", { writable: false });
+var high = 8;
+b[high] = high;
+
+printArray(b, high + 5);
+
+var c = [1,2,3];
+c[high] = high;
+print();
+print("element[" + high + "]: " + c.length + " " + c[high]);
+print("Resetting length");
+c.length = 3;
+print("element[" + high + "]: " + c.length + " " + c[high]);
+print();
+
+printArray(c, high + 5);
+print();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_2.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,47 @@
+PRINT_ARRAY CALLED: length = 3
+
+INDEXED
+	0:1
+	1:2
+	2:3
+	3:undefined
+	4:undefined
+	5:undefined
+	6:undefined
+	7:undefined
+	8:8
+	9:undefined
+	10:undefined
+	11:undefined
+	12:undefined
+KEYS
+	0;1
+	1;2
+	2;3
+	8;8
+
+element[8]: 9 8
+Resetting length
+element[8]: 3 undefined
+
+PRINT_ARRAY CALLED: length = 3
+
+INDEXED
+	0:1
+	1:2
+	2:3
+	3:undefined
+	4:undefined
+	5:undefined
+	6:undefined
+	7:undefined
+	8:undefined
+	9:undefined
+	10:undefined
+	11:undefined
+	12:undefined
+KEYS
+	0;1
+	1;2
+	2;3
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_3.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8035312_3 - sparse array, non writable length
+ *
+ * @test
+ * @run
+ */
+
+var b = [1,2,3];
+
+Object.defineProperty(b, "length", { writable: false });
+var high = 23534343;
+b[high-10] = high-10;
+
+print(b[high-10]);
+
+var c = [1,2,3];
+c[high-10] = high-10;
+c.length = 3;
+print(c);
+print(c[high-10]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_3.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,3 @@
+23534333
+1,2,3
+undefined
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_4.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8035312_4 - pushes and pops for non writable length
+ *
+ * @test
+ * @run
+ */
+
+var b = [1,2,3];
+Object.defineProperty(b, "length", { writable: false });
+
+try {
+    b.push(4);
+} catch (e) {
+    print("length = " + b.length);
+    print("i caught an error");
+}
+print(b);
+print(b[3]);
+print("length = " + b.length);
+
+var c = [1,2,3];
+Object.defineProperty(c, "length", { writable: false });
+
+for (var i = 0; i < 5; i++) {
+    try {
+	c.pop();
+    } catch (e) {
+	print("length = " + c.length);
+	print("I caught an error");
+	print(c);
+    }
+}
+
+print(c);
+print(c[3]);
+print("length = " + b.length);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_4.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,23 @@
+length = 3
+i caught an error
+1,2,3
+4
+length = 3
+length = 3
+I caught an error
+1,2,
+length = 3
+I caught an error
+1,2,
+length = 3
+I caught an error
+1,2,
+length = 3
+I caught an error
+1,2,
+length = 3
+I caught an error
+1,2,
+1,2,
+undefined
+length = 3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_5.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8035312_5 - pushes and pops for frozen array
+ *
+ * @test
+ * @run
+ */
+
+var b = [1,2,3];
+Object.freeze(b);
+
+try {
+    b.push(4);
+} catch (e) {
+    print("length = " + b.length);
+    print("i caught an error"); 
+}
+print(b);
+print(b[3]);
+print("length = " + b.length);
+
+var c = [1,2,3];
+Object.freeze(c);
+
+for (var i = 0; i < 5; i++) {
+    try { 
+	c.pop();
+    } catch (e) { 
+	print("length = " + c.length);
+	print("I caught an error");
+	print(c);
+    }
+}
+
+print(c);
+print(c[3]);
+print("length = " + b.length);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8035312_5.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+1,2,3
+undefined
+length = 3
+1,2,3
+undefined
+length = 3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8047365.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8047365: Very long function names break codegen
+ *
+ * @test
+ * @run
+ */
+
+// string of length 131071, twice the limit of UTF8 strings in ASM
+var longId = Array(0x20000).join("a");
+print(longId.length);
+
+eval("function " + longId + "(){ print('hello world'); }");
+eval("print(typeof " + longId + ")");
+eval("print(" + longId + ".name === longId)");
+eval("print(/a+/.exec(" + longId + ".toString())[0] === longId)");
+eval(longId + "()");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8047365.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,5 @@
+131071
+function
+true
+true
+hello world
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8057825.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8057825 : A failed apply to call generation should NOT reuse the 
+ * best apply to call generation so far - because it may not fit!!!
+ *
+ * @test
+ * @run
+ */
+
+function createApplier(f) { 
+    function applier() { 
+        f.apply(this, arguments); // no transform applied here 
+    } 
+    return applier; 
+} 
+
+function printer(x,y) { 
+    print(x + " and " + y);
+} 
+
+var printerApplier = createApplier(printer); 
+printerApplier();
+printerApplier.apply(this, ["foo", "bar"]); 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8057825.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,2 @@
+undefined and undefined
+foo and bar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8059443.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8059443: NPE when unboxing return values
+ * 
+ * NOTE: this test can only pass when running with a JDK where 
+ * JDK-8060483 is also fixed (9b37 or later).
+ *
+ * @test
+ * @run
+ */
+
+var NullProvider = Java.type("jdk.nashorn.test.models.NullProvider");
+
+if (!NullProvider.getBoolean()) { print("yay"); }
+print(NullProvider.getLong() * (1 << 33));
+print(NullProvider.getDouble() / 2.5);
+print(NullProvider.getInteger() << 1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8059443.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,4 @@
+yay
+0
+0
+0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8061959.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * Checks for the existence of ArrayBufferView
+ *
+ * @test
+ * @run
+ */
+
+print(ArrayBuffer.isView(new Int8Array(4)));
+print(ArrayBuffer.isView("gorilla"));
+print(ArrayBuffer.isView());
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8061959.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,3 @@
+true
+false
+false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062132.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * 8062132: Nashorn incorrectly binds "this" for constructor created by another function
+ *
+ * @test
+ * @run
+ */
+
+function subclass(parentCtor, proto) {
+    function C() {
+        parentCtor.call(this);
+    }
+
+    C.prototype = Object.create(parentCtor.prototype);
+
+    for (var prop in proto) {
+        if (proto.hasOwnProperty(prop)) {
+            C.prototype[prop] = proto[prop];
+        }
+    }
+
+    return C;
+}
+
+var Parent = function() {
+    this.init();
+};
+
+Parent.prototype = {
+    init: null
+};
+
+var Child1 = subclass(Parent, {
+    prop1: 1,
+    init: function() {
+        print('child 1');
+    }
+});
+
+var Child2 = subclass(Parent, {
+    init: function() {
+        print('child 2');
+    }
+});
+
+var Child3 = subclass(Parent, {
+    prop1: 1,
+    init: function() {
+        print('child 3');
+    }
+});
+
+new Child1();
+new Child2();
+new Child3();
+new Child1();
+new Child2();
+new Child3();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062132.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,6 @@
+child 1
+child 2
+child 3
+child 1
+child 2
+child 3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062381.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8062381 wrong argument chosen for charCodeAt in linker logic
+ *
+ * @test
+ * @run
+ */
+
+var s = "abcdef";
+var len = s.length + 1;
+
+function f1() {
+    for (var i = 0; i < len; i++) {
+	print(s.charCodeAt(i));
+    }
+    print(s.charCodeAt());
+}
+
+function f2() {    
+    for (var i = 0; i < len; i++) {
+	print(s.charCodeAt("" + i));
+    }
+    print(s.charCodeAt());
+}
+
+f1();
+f2();
+f1();
+f2();
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062381.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,32 @@
+97
+98
+99
+100
+101
+102
+NaN
+97
+97
+98
+99
+100
+101
+102
+NaN
+97
+97
+98
+99
+100
+101
+102
+NaN
+97
+97
+98
+99
+100
+101
+102
+NaN
+97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062583.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8062583: Throwing object with error prototype causes error proto to be caught
+ *
+ * @test
+ * @run
+ */
+
+function CustomError() {
+    this.name = "CustomError";
+}
+
+CustomError.prototype = new Error();
+
+var c1 = new CustomError();
+
+try {
+    throw c1;
+} catch (e) {
+    print(e === c1);
+    print(e === CustomError.prototype);
+    print(e.stack.replace(/\\/g, '/'));
+    print(e.nashornException.toString().replace(/\\/g, '/'));
+}
+
+var c2 = new CustomError();
+Error.captureStackTrace(c2);
+print(c2.stack.replace(/\\/g, '/'));
+print(c2.nashornException.toString().replace(/\\/g, '/'));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062583.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,8 @@
+true
+false
+CustomError
+	at <program> (test/script/basic/JDK-8062583.js:40)
+test/script/basic/JDK-8062583.js:40:4 CustomError
+CustomError
+	at <program> (test/script/basic/JDK-8062583.js:49)
+test/script/basic/JDK-8062583.js:49 CustomError
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062624.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8062624: java.lang.String methods not available on concatenated strings
+ *
+ * @test
+ * @run
+ */
+
+function testStringMethods(s) {
+    print(s.startsWith("f"));
+    print(s.endsWith("r"));
+    print(Java.from(s.getBytes()));
+    print(Java.from(s.bytes));
+}
+
+var s = "f";
+testStringMethods(s);
+s = s + "oo";
+testStringMethods(s);
+testStringMethods("abc");
+s += "bar";
+s = "baz" + s;
+testStringMethods(s);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062624.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,16 @@
+true
+false
+102
+102
+true
+false
+102,111,111
+102,111,111
+false
+false
+97,98,99
+97,98,99
+false
+true
+98,97,122,102,111,111,98,97,114
+98,97,122,102,111,111,98,97,114
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062799.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8062799: Binary logical expressions can have numeric types
+ *
+ * @test
+ * @run
+ */
+
+(function() {
+    var inspect = Java.type("jdk.nashorn.test.tools.StaticTypeInspector").inspect;
+    
+    var b = true;
+    var i = 1;
+    var l = 4294967296;
+    var d = 2.1;
+    var o = "foo";
+
+    print(inspect(b || b, "b || b"));
+    print(inspect(b || i, "b || i"));
+    print(inspect(b || l, "b || l"));
+    print(inspect(b || d, "b || d"));
+    print(inspect(b || o, "b || o"));
+        
+    print(inspect(i || b, "i || b"));
+    print(inspect(i || i, "i || i"));
+    print(inspect(i || l, "i || l"));
+    print(inspect(i || d, "i || d"));
+    print(inspect(i || o, "i || o"));
+
+    print(inspect(l || b, "l || b"));
+    print(inspect(l || i, "l || i"));
+    print(inspect(l || l, "l || l"));
+    print(inspect(l || d, "l || d"));
+    print(inspect(l || o, "l || o"));
+
+    print(inspect(d || b, "d || b"));
+    print(inspect(d || i, "d || i"));
+    print(inspect(d || l, "d || l"));
+    print(inspect(d || d, "d || d"));
+    print(inspect(d || o, "d || o"));
+
+    print(inspect(o || b, "o || b"));
+    print(inspect(o || i, "o || i"));
+    print(inspect(o || l, "o || l"));
+    print(inspect(o || d, "o || d"));
+    print(inspect(o || o, "o || o"));
+
+    print(inspect(b && b, "b && b"));
+    print(inspect(b && i, "b && i"));
+    print(inspect(b && l, "b && l"));
+    print(inspect(b && d, "b && d"));
+    print(inspect(b && o, "b && o"));
+        
+    print(inspect(i && b, "i && b"));
+    print(inspect(i && i, "i && i"));
+    print(inspect(i && l, "i && l"));
+    print(inspect(i && d, "i && d"));
+    print(inspect(i && o, "i && o"));
+
+    print(inspect(l && b, "l && b"));
+    print(inspect(l && i, "l && i"));
+    print(inspect(l && l, "l && l"));
+    print(inspect(l && d, "l && d"));
+    print(inspect(l && o, "l && o"));
+
+    print(inspect(d && b, "d && b"));
+    print(inspect(d && i, "d && i"));
+    print(inspect(d && l, "d && l"));
+    print(inspect(d && d, "d && d"));
+    print(inspect(d && o, "d && o"));
+
+    print(inspect(o && b, "o && b"));
+    print(inspect(o && i, "o && i"));
+    print(inspect(o && l, "o && l"));
+    print(inspect(o && d, "o && d"));
+    print(inspect(o && o, "o && o"));
+})();
+
+    
+    
+        
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062799.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,50 @@
+b || b: boolean
+b || i: boolean
+b || l: boolean
+b || d: boolean
+b || o: boolean
+i || b: int
+i || i: int
+i || l: long
+i || d: double
+i || o: int
+l || b: long
+l || i: long
+l || l: long
+l || d: double
+l || o: long
+d || b: double
+d || i: double
+d || l: double
+d || d: double
+d || o: double
+o || b: object
+o || i: object
+o || l: object
+o || d: object
+o || o: object
+b && b: boolean
+b && i: int
+b && l: long
+b && d: double
+b && o: object
+i && b: boolean
+i && i: int
+i && l: long
+i && d: double
+i && o: object
+l && b: boolean
+l && i: long
+l && l: long
+l && d: double
+l && o: object
+d && b: boolean
+d && i: double
+d && l: double
+d && d: double
+d && o: object
+o && b: boolean
+o && i: int
+o && l: long
+o && d: double
+o && o: object
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062937.js	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8062937 - GlobalConstants produces wrong result with defineProperty and index setters
+ *
+ * @test
+ * @run
+ */
+
+var x = 1;
+for (var i = 2; i < 5; i++) {
+    print(x);
+    Object.defineProperty(this, "x", {value: i});
+}
+print(x);
+
+print();
+
+var name = "y";
+var y = 1;
+for (var i = 2; i < 5; i++) {
+    print(y);
+    this[name] = i;
+}
+print(y);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8062937.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,9 @@
+1
+2
+3
+4
+
+1
+2
+3
+4
--- a/nashorn/test/script/basic/fastpushpop.js.EXPECTED	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/script/basic/fastpushpop.js.EXPECTED	Mon Nov 17 09:36:40 2014 +0100
@@ -1,6 +1,6 @@
 1,2,3,4,5,6
 first: true
-1,2,3,4,5,6,7
+1,2,3,4,5,6
 1,2,3,,,,4711.17,dingo!,4,5,6
 second: true
-1,2,3,,,,4711.17,dingo!,4,5,6,7
+1,2,3,,,,4711.17,dingo!,4,5,6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.internal.dynalink.beans;
+
+import jdk.nashorn.test.models.ClassLoaderAware;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+public class CallerSensitiveTest {
+    @Test
+    public void testCallerSensitive() {
+        BeansLinker.getLinkerForClass(ClassLoaderAware.class);
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,6 @@
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertTrue;
-
 import java.util.Arrays;
 import java.util.List;
 import javax.script.ScriptContext;
@@ -41,6 +40,7 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+@SuppressWarnings("javadoc")
 public class ArrayConversionTest {
     private static ScriptEngine e = null;
 
@@ -49,7 +49,7 @@
     }
 
     @BeforeClass
-    public static void setUpClass() throws ScriptException {
+    public static void setUpClass() {
         e = new ScriptEngineManager().getEngineByName("nashorn");
     }
 
@@ -205,7 +205,7 @@
         assertEquals(Arrays.asList("apple", "orange"), array[1]);
     }
 
-    public static void assertVarArg_42_17(final Object... args) throws ScriptException {
+    public static void assertVarArg_42_17(final Object... args) {
         assertEquals(2, args.length);
         assertEquals(42, ((Number)args[0]).intValue());
         assertEquals(17, ((Number)args[1]).intValue());
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
-
 import java.util.Arrays;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
@@ -42,6 +41,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
  */
+@SuppressWarnings("javadoc")
 public class BooleanAccessTest {
 
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 package jdk.nashorn.api.javaaccess;
 
 import static org.testng.AssertJUnit.assertEquals;
-
 import java.util.HashMap;
 import java.util.Map;
 import javax.script.Bindings;
@@ -40,6 +39,7 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+@SuppressWarnings("javadoc")
 public class ConsStringTest {
     private static ScriptEngine e = null;
 
@@ -48,7 +48,7 @@
     }
 
     @BeforeClass
-    public static void setUpClass() throws ScriptException {
+    public static void setUpClass() {
         e = new ScriptEngineManager().getEngineByName("nashorn");
     }
 
@@ -69,7 +69,7 @@
     @Test
     public void testConsStringFromMirror() throws ScriptException {
         final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
-        final Map<Object, Object> m = new HashMap<>();
+        //final Map<Object, Object> m = new HashMap<>();
         e.eval("var x = 'f'; x += 'oo'; var obj = {x: x};");
         assertEquals("foo", ((JSObject)b.get("obj")).getMember("x"));
     }
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 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;
@@ -45,6 +44,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
  */
+@SuppressWarnings("javadoc")
 public class MethodAccessTest {
 
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 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;
@@ -42,6 +41,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
  */
+@SuppressWarnings("javadoc")
 public class NumberAccessTest {
 
     private static ScriptEngine e;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
-
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
@@ -41,6 +40,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
  */
+@SuppressWarnings("javadoc")
 public class NumberBoxingTest {
 
     private static ScriptEngine e;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 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;
@@ -41,6 +40,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
  */
+@SuppressWarnings("javadoc")
 public class ObjectAccessTest {
 
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.api.javaaccess;
 
+@SuppressWarnings("javadoc")
 public class Person {
 
     public int id = 0;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,6 +29,7 @@
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
 
+@SuppressWarnings("javadoc")
 public class SharedObject {
 
     // Public fields
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 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;
@@ -41,6 +40,7 @@
  * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
  * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
  */
+@SuppressWarnings("javadoc")
 public class StringAccessTest {
 
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
-
 import java.util.Objects;
 import java.util.function.Function;
 import javax.script.Invocable;
@@ -42,9 +41,10 @@
 /**
  * Tests for javax.script.Invocable implementation of nashorn.
  */
+@SuppressWarnings("javadoc")
 public class InvocableTest {
 
-    private void log(final String msg) {
+    private static void log(final String msg) {
         org.testng.Reporter.log(msg, true);
     }
 
@@ -100,7 +100,7 @@
 
         try {
             final Object obj = e.eval("({})");
-            final Object res = ((Invocable) e).invokeMethod(obj, null);
+            ((Invocable) e).invokeMethod(obj, null);
             fail("should have thrown NPE");
         } catch (final Exception exp) {
             if (!(exp instanceof NullPointerException)) {
@@ -120,7 +120,7 @@
 
         try {
             final Object obj = e.eval("({})");
-            final Object res = ((Invocable) e).invokeMethod(obj, "nonExistentMethod");
+            ((Invocable) e).invokeMethod(obj, "nonExistentMethod");
             fail("should have thrown NoSuchMethodException");
         } catch (final Exception exp) {
             if (!(exp instanceof NoSuchMethodException)) {
@@ -398,7 +398,7 @@
         final ScriptEngine e = m.getEngineByName("nashorn");
 
         try {
-            final Object res = ((Invocable) e).invokeFunction(null);
+            ((Invocable)e).invokeFunction(null);
             fail("should have thrown NPE");
         } catch (final Exception exp) {
             if (!(exp instanceof NullPointerException)) {
@@ -418,7 +418,7 @@
         final ScriptEngine e = m.getEngineByName("nashorn");
 
         try {
-            final Object res = ((Invocable) e).invokeFunction("NonExistentFunc");
+            ((Invocable)e).invokeFunction("NonExistentFunc");
             fail("should have thrown NoSuchMethodException");
         } catch (final Exception exp) {
             if (!(exp instanceof NoSuchMethodException)) {
@@ -439,7 +439,7 @@
 
         try {
             // define an object with method on it
-            final Object obj = e.eval("function hello() { return 'Hello World!'; }");
+            e.eval("function hello() { return 'Hello World!'; }");
             final ScriptContext ctxt = new SimpleScriptContext();
             ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
             // change engine's current context
@@ -526,13 +526,13 @@
     }
 
     @Test
-    @SuppressWarnings("unchecked")
     public void defaultMethodTest() throws ScriptException {
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");
         final Invocable inv = (Invocable) e;
 
         final Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})");
+        @SuppressWarnings("unchecked")
         final Function<String, String> func = inv.getInterface(obj, Function.class);
         assertEquals(func.apply("hello"), "HELLO");
     }
--- a/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -37,7 +37,7 @@
  * @test
  * @run testng jdk.nashorn.api.scripting.MultipleEngineTest
  */
-
+@SuppressWarnings("javadoc")
 public class MultipleEngineTest {
     @Test
     public void createAndUseManyEngine() throws ScriptException {
--- a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -44,6 +44,7 @@
  * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
  * JSObject implementations.
  */
+@SuppressWarnings("javadoc")
 public class PluggableJSObjectTest {
     public static class MapWrapperObject extends AbstractJSObject {
         private final HashMap<String, Object> map = new LinkedHashMap<>();
@@ -202,6 +203,7 @@
     }
 
     public static class Factory extends AbstractJSObject {
+        @SuppressWarnings("unused")
         @Override
         public Object newObject(final Object... args) {
             return new HashMap<Object, Object>();
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-
 import javax.script.Bindings;
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
@@ -42,6 +41,7 @@
 /**
  * Tests for jsr223 Bindings "scope" (engine, global scopes)
  */
+@SuppressWarnings("javadoc")
 public class ScopeTest {
 
     @Test
@@ -655,6 +655,8 @@
 
     /**
      * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals.
+     * @throws ScriptException
+     * @throws InterruptedException
      */
     @Test
     public static void testSlowScope() throws ScriptException, InterruptedException {
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,12 +26,9 @@
 package jdk.nashorn.api.scripting;
 
 import static org.testng.Assert.fail;
-
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.util.Objects;
-import javax.script.Invocable;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
@@ -40,9 +37,10 @@
 /**
  * jsr223 tests for security access checks.
  */
+@SuppressWarnings("javadoc")
 public class ScriptEngineSecurityTest {
 
-    private void log(final String msg) {
+    private static void log(final String msg) {
         org.testng.Reporter.log(msg, true);
     }
 
@@ -169,6 +167,7 @@
     }
 
     // @bug 8032948: Nashorn linkages awry
+    @SuppressWarnings("serial")
     public static class FakeProxy extends Proxy {
         public FakeProxy(final InvocationHandler ih) {
             super(ih);
@@ -180,7 +179,7 @@
     }
 
     @Test
-    public void fakeProxySubclassAccessCheckTest() throws ScriptException {
+    public void fakeProxySubclassAccessCheckTest() {
         if (System.getSecurityManager() == null) {
             // pass vacuously
             return;
@@ -197,7 +196,7 @@
 
         // Should not be able to call static methods of Proxy via fake subclass
         try {
-            final Class<?> c = (Class<?>)e.eval(getClass);
+            e.eval(getClass);
             fail("should have thrown SecurityException");
         } catch (final Exception exp) {
             if (! (exp instanceof SecurityException)) {
@@ -207,7 +206,7 @@
     }
 
     @Test
-    public void fakeProxySubclassAccessCheckTest2() throws ScriptException {
+    public void fakeProxySubclassAccessCheckTest2() {
         if (System.getSecurityManager() == null) {
             // pass vacuously
             return;
@@ -224,7 +223,7 @@
 
         // Should not be able to call static methods of Proxy via fake subclass
         try {
-            final Class<?> c = (Class<?>)e.eval(getClass);
+            e.eval(getClass);
             fail("should have thrown SecurityException");
         } catch (final Exception exp) {
             if (! (exp instanceof SecurityException)) {
@@ -234,7 +233,7 @@
     }
 
     @Test
-    public static void proxyStaticAccessCheckTest() throws ScriptException {
+    public static void proxyStaticAccessCheckTest() {
         if (System.getSecurityManager() == null) {
             // pass vacuously
             return;
@@ -247,7 +246,7 @@
             new Class[] { Runnable.class },
             new InvocationHandler() {
                 @Override
-                public Object invoke(final Object p, final Method m, final Object[] a) {
+                public Object invoke(final Object p, final Method mtd, final Object[] a) {
                     return null;
                 }
             });
@@ -284,7 +283,9 @@
                }
             });
             fail("SecurityException should have been thrown");
-        } catch (final SecurityException exp) {}
+        } catch (final SecurityException e) {
+            //empty
+        }
     }
 
     @Test
@@ -303,6 +304,8 @@
                }
             });
             fail("SecurityException should have been thrown");
-        } catch (final SecurityException exp) {}
+        } catch (final SecurityException e) {
+            //empty
+        }
     }
 }
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,6 @@
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.lang.reflect.InvocationHandler;
@@ -54,9 +53,10 @@
  * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
  * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest
  */
+@SuppressWarnings("javadoc")
 public class ScriptEngineTest {
 
-    private void log(final String msg) {
+    private static void log(final String msg) {
         org.testng.Reporter.log(msg, true);
     }
 
@@ -145,6 +145,8 @@
                 case "nashorn": seenNashorn = true; break;
                 case "javascript": seenJavaScript = true; break;
                 case "ECMAScript": seenECMAScript = true; break;
+            default:
+                break;
             }
         }
 
@@ -159,6 +161,8 @@
                 case "application/ecmascript": seenAppECMA = true; break;
                 case "text/javascript": seenTextJS = true; break;
                 case "text/ecmascript": seenTextECMA = true; break;
+            default:
+                break;
             }
         }
 
@@ -548,7 +552,7 @@
             new Class[] { Runnable.class },
             new InvocationHandler() {
                 @Override
-                public Object invoke(final Object p, final Method m, final Object[] a) {
+                public Object invoke(final Object p, final Method mtd, final Object[] a) {
                     reached[0] = true;
                     return null;
                 }
@@ -633,7 +637,7 @@
     public static class Context {
         private Object myobj;
 
-        public void set(Object o) {
+        public void set(final Object o) {
             myobj = o;
         }
 
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -46,6 +46,7 @@
 /**
  * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API.
  */
+@SuppressWarnings("javadoc")
 public class ScriptObjectMirrorTest {
 
     @SuppressWarnings("unchecked")
@@ -343,14 +344,13 @@
         assertEquals(ScriptObjectMirror.class, value3.getClass());
         assertEquals(ScriptObjectMirror.class, value4.getClass());
         assertTrue((boolean)invocable.invokeFunction("compare", value1, value1));
-        assertTrue((boolean)example.compare(value1, value1));
+        assertTrue(example.compare(value1, value1));
         assertTrue((boolean)invocable.invokeFunction("compare", value3, value4));
-        assertTrue((boolean)example.compare(value3, value4));
+        assertTrue(example.compare(value3, value4));
     }
 
     // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface
     @Test
-    @SuppressWarnings("unchecked")
     public void mirrorUnwrapInterfaceMethod() throws Exception {
         final ScriptEngineManager engineManager = new ScriptEngineManager();
         final ScriptEngine engine = engineManager.getEngineByName("nashorn");
@@ -358,6 +358,7 @@
         engine.eval("function apply(obj) { " +
             " return obj instanceof Packages.jdk.nashorn.api.scripting.ScriptObjectMirror; " +
             "}");
+        @SuppressWarnings("unchecked")
         final Function<Object,Object> func = invocable.getInterface(Function.class);
         assertFalse((boolean)func.apply(engine.eval("({ x: 2 })")));
     }
--- a/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.api.scripting;
 
+@SuppressWarnings("javadoc")
 public interface VariableArityTestInterface {
     public String test1(int i, String... strings);
     public String test2(int i, String... strings);
--- a/nashorn/test/src/jdk/nashorn/api/scripting/Window.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/Window.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,6 +28,7 @@
 import java.util.Map;
 import javax.script.Bindings;
 
+@SuppressWarnings("javadoc")
 public class Window {
 
     private String location = "http://localhost:8080/window";
--- a/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,8 +25,7 @@
 
 package jdk.nashorn.api.scripting;
 
+@SuppressWarnings("javadoc")
 public interface WindowEventHandler {
-
     public boolean loaded();
-
 }
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.runtime.Source.readFully;
 import static jdk.nashorn.internal.runtime.Source.sourceFor;
-
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -45,6 +44,7 @@
 /**
  * Tests to check Nashorn JS compiler - just compiler and not execution of scripts.
  */
+@SuppressWarnings("javadoc")
 public class CompilerTest {
     private static final boolean VERBOSE  = Boolean.valueOf(System.getProperty("compilertest.verbose"));
     private static final boolean TEST262  = Boolean.valueOf(System.getProperty("compilertest.test262"));
@@ -56,7 +56,7 @@
         public boolean exclude(File file, String content);
     }
 
-    private void log(final String msg) {
+    private static void log(final String msg) {
         org.testng.Reporter.log(msg, true);
     }
 
--- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.runtime.Source.readFully;
 import static jdk.nashorn.internal.runtime.Source.sourceFor;
-
 import java.io.File;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
@@ -41,6 +40,7 @@
 /**
  * Run tests to check Nashorn's parser.
  */
+@SuppressWarnings("javadoc")
 public class ParserTest {
     private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parsertest.verbose"));
     private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parsertest.test262"));
--- a/nashorn/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -43,6 +43,7 @@
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
+@SuppressWarnings("javadoc")
 public class AuroraWrapper {
 
     public static String fileName = "report.xml";
--- a/nashorn/test/src/jdk/nashorn/internal/performance/OctaneTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/OctaneTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -40,6 +40,7 @@
 import java.util.List;
 import org.testng.annotations.Test;
 
+@SuppressWarnings("javadoc")
 public class OctaneTest {
 
     @Test
@@ -72,7 +73,7 @@
         genericTest("GBEMU");
     }
 
-    /*    @Test
+/*    @Test
     public void mandreelTest() {
         genericTest("Mandreel");
     }*/
@@ -107,10 +108,20 @@
         genericTest("Splay");
     }
 
+    @Test
+/*    public void typeScriptTest() {
+        genericTest("TypeScript");
+    }
+
+    @Test
+    public void zlibTest() {
+        genericTest("zlib");
+    }/*/
+
     public void genericTest(final String benchmark) {
         try {
             final String mainScript      = "test/script/basic/run-octane.js";
-            final String benchmarkScript = "test/script/external/octane/benchmarks/"+benchmark.toLowerCase() + ".js";
+            final String benchmarkScript = "test/script/external/octane/benchmarks/" + benchmark.toLowerCase() + ".js";
             final String[] args = {
                 "--",
                 benchmarkScript,
--- a/nashorn/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -36,10 +36,7 @@
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
-/**
- *
- * @author Pavel Stepanov
- */
+@SuppressWarnings("javadoc")
 public class PerformanceWrapper extends jdk.nashorn.tools.Shell {
 
     int _numberOfIterations;
--- a/nashorn/test/src/jdk/nashorn/internal/performance/SplayTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/SplayTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,10 +27,7 @@
 
 import org.testng.annotations.Test;
 
-/**
- *
- * @author Pavel Stepanov
- */
+@SuppressWarnings("javadoc")
 public class SplayTest {
 
     @Test
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,18 +25,17 @@
 
 package jdk.nashorn.internal.runtime;
 
+import static org.testng.Assert.fail;
+import java.io.File;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
 import jdk.nashorn.api.scripting.ClassFilter;
 import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
 import jdk.nashorn.api.scripting.URLReader;
 import jdk.nashorn.internal.test.framework.TestFinder;
 import org.testng.annotations.Test;
 
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import java.io.File;
-
-import static org.testng.Assert.fail;
-
+@SuppressWarnings("javadoc")
 public class ClassFilterTest {
     private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache";
     private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache";
@@ -48,7 +47,7 @@
     // test contributes much. We need faster "ant clean test" cycle for
     // developers.
     public void runExternalJsTest() {
-        String[] paths = new String[]{
+        final String[] paths = new String[]{
                 "test/script/basic/compile-octane.js",
                 "test/script/basic/jquery.js",
                 "test/script/basic/prototype.js",
@@ -57,12 +56,12 @@
                 "test/script/basic/yui.js",
                 "test/script/basic/run-octane.js"
         };
-        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        for (String path : paths) {
-            ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter());
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        for (final String path : paths) {
+            final ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter());
             try {
                 engine.eval(new URLReader(new File(path).toURI().toURL()));
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 fail("Script " + path + " fails with exception :" + e.getMessage());
             }
         }
@@ -70,12 +69,13 @@
 
     @Test
     public void noJavaOptionTest() {
-        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter());
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter());
         try {
             engine.eval("var str = Java.type('java.lang.String');");
             fail("TypeError should have been thrown");
-        } catch (ScriptException exc) {
+        } catch (final ScriptException e) {
+            //emtpy
         }
     }
 
@@ -85,27 +85,31 @@
             return;
         }
 
-        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        ScriptEngine engine = factory.getScriptEngine(getClassFilter());
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(getClassFilter());
         try {
             engine.eval("var thread = Java.type('sun.misc.Unsafe')");
             fail("SecurityException should have been thrown");
-        } catch (final Exception exc) {
+        } catch (final Exception e) {
+            //empty
         }
         try {
             engine.eval("var thread = new sun.misc.Unsafe()");
             fail("SecurityException should have been thrown");
-        } catch (final Exception exc) {
+        } catch (final Exception e) {
+            //empty
         }
         try {
             engine.eval("var thread = Java.extend(sun.misc.Unsafe, {})");
             fail("TypeError should have been thrown");
-        } catch (final Exception exc) {
+        } catch (final Exception e) {
+            //empty
         }
         try {
             engine.eval("java.lang.System.exit(0)");
             fail("SecurityException should have been thrown");
-        } catch (final Exception exc) {
+        } catch (final Exception e) {
+            //empty
         }
 
     }
@@ -124,24 +128,24 @@
     }
 
     private void persistentCacheTestImpl() {
-        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        ScriptEngine engine = factory.getScriptEngine(
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(
               TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
                   getClass().getClassLoader(),
                   getClassFilter()
         );
-        String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore();
+        final String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore();
         try {
             engine.eval(testScript);
         } catch (final ScriptException exc) {
             fail(exc.getMessage());
         }
-        ScriptEngine engineSafe = factory.getScriptEngine(
+        final ScriptEngine engineSafe = factory.getScriptEngine(
                 TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
                 getClass().getClassLoader(),
                 new ClassFilter() {
                     @Override
-                    public boolean exposeToScripts(String s) {
+                    public boolean exposeToScripts(final String s) {
                         return false;
                     }
                 }
@@ -156,8 +160,8 @@
         }
     }
 
-    private String generateCodeForPersistentStore() {
-        StringBuilder stringBuilder = new StringBuilder();
+    private static String generateCodeForPersistentStore() {
+        final StringBuilder stringBuilder = new StringBuilder();
         for (int i=0; i < 100; i++) {
             stringBuilder.append("function i")
                     .append(i)
@@ -170,10 +174,10 @@
         return stringBuilder.toString();
     }
 
-    private ClassFilter getClassFilter() {
+    private static ClassFilter getClassFilter() {
         return new ClassFilter() {
             @Override
-            public boolean exposeToScripts(String s) {
+            public boolean exposeToScripts(final String s) {
                 return true;
             }
         };
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
-
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.DirectoryStream;
@@ -44,7 +43,7 @@
  * @summary  Test for persistent code cache and path handling
  * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest
  */
-
+@SuppressWarnings("javadoc")
 public class CodeStoreAndPathTest {
 
     final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; "
@@ -96,21 +95,16 @@
     final String codeCache = "build/nashorn_code_cache";
     final String oldUserDir = System.getProperty("user.dir");
 
-    private static final String[] ENGINE_OPTIONS = new String[]{"--persistent-code-cache", "--optimistic-types=false", "--lazy-compilation=false"};
-
-    public void checkCompiledScripts(final DirectoryStream<Path> stream, int numberOfScripts) throws IOException {
-        for (final Path file : stream) {
-            numberOfScripts--;
-        }
-        stream.close();
-        assertEquals(numberOfScripts,0);
-    }
+    private static final String[] ENGINE_OPTIONS_OPT   = new String[]{"--persistent-code-cache", "--optimistic-types=true"};
+    private static final String[] ENGINE_OPTIONS_NOOPT = new String[]{"--persistent-code-cache", "--optimistic-types=false"};
 
     @Test
-    public void pathHandlingTest() throws ScriptException, IOException {
+    public void pathHandlingTest() {
         System.setProperty("nashorn.persistent.code.cache", codeCache);
         final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS);
+
+        fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+
         final Path expectedCodeCachePath = FileSystems.getDefault().getPath(oldUserDir + File.separator + codeCache);
         final Path actualCodeCachePath = FileSystems.getDefault().getPath(System.getProperty(
                             "nashorn.persistent.code.cache")).toAbsolutePath();
@@ -126,9 +120,8 @@
     public void changeUserDirTest() throws ScriptException, IOException {
         System.setProperty("nashorn.persistent.code.cache", codeCache);
         final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS);
-        final Path codeCachePath = FileSystems.getDefault().getPath(System.getProperty(
-                            "nashorn.persistent.code.cache")).toAbsolutePath();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+        final Path codeCachePath = getCodeCachePath(false);
         final String newUserDir = "build/newUserDir";
         // Now changing current working directory
         System.setProperty("user.dir", System.getProperty("user.dir") + File.separator + newUserDir);
@@ -147,9 +140,22 @@
     public void codeCacheTest() throws ScriptException, IOException {
         System.setProperty("nashorn.persistent.code.cache", codeCache);
         final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS);
-        final Path codeCachePath = FileSystems.getDefault().getPath(System.getProperty(
-                            "nashorn.persistent.code.cache")).toAbsolutePath();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+        final Path codeCachePath = getCodeCachePath(false);
+        e.eval(code1);
+        e.eval(code2);
+        e.eval(code3);// less than minimum size for storing
+        // adding code1 and code2.
+        final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
+        checkCompiledScripts(stream, 2);
+    }
+
+    @Test
+    public void codeCacheTestOpt() throws ScriptException, IOException {
+        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_OPT);
+        final Path codeCachePath = getCodeCachePath(true);
         e.eval(code1);
         e.eval(code2);
         e.eval(code3);// less than minimum size for storing
@@ -157,4 +163,26 @@
         final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
         checkCompiledScripts(stream, 2);
     }
+
+    private static Path getCodeCachePath(final boolean optimistic) {
+        final String codeCache = System.getProperty("nashorn.persistent.code.cache");
+        final Path codeCachePath = FileSystems.getDefault().getPath(codeCache).toAbsolutePath();
+        final String[] files = codeCachePath.toFile().list();
+        for (final String file : files) {
+            if (file.endsWith("_opt") == optimistic) {
+                return codeCachePath.resolve(file);
+            }
+        }
+        throw new AssertionError("Code cache path not found");
+    }
+
+    private static void checkCompiledScripts(final DirectoryStream<Path> stream, final int numberOfScripts) throws IOException {
+        int n = numberOfScripts;
+        for (@SuppressWarnings("unused") final Path file : stream) {
+            n--;
+        }
+        stream.close();
+        assertEquals(n, 0);
+    }
+
 }
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-
 import java.util.Map;
 import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.options.Options;
@@ -41,6 +40,7 @@
  * @test
  * @run testng jdk.nashorn.internal.runtime.ContextTest
  */
+@SuppressWarnings("javadoc")
 public class ContextTest {
     // basic context eval test
     @Test
@@ -96,7 +96,7 @@
             final String code = "var obj = { x: 344, y: 42 }";
             eval(cx, "<reflectionTest>", code);
 
-            final Object obj = cx.getGlobal().get("obj");
+            final Object obj = Context.getGlobal().get("obj");
 
             assertTrue(obj instanceof ScriptObject);
 
@@ -129,7 +129,7 @@
         }
     }
 
-    private Object eval(final Context cx, final String name, final String code) {
+    private static Object eval(final Context cx, final String name, final String code) {
         final Source source = sourceFor(name, code);
         final ScriptObject global = Context.getGlobal();
         final ScriptFunction func = cx.compileScript(source, global);
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,7 +27,6 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.NotSerializableException;
@@ -43,6 +42,7 @@
  * @test
  * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable
  */
+@SuppressWarnings("javadoc")
 public class ExceptionsNotSerializable {
     @Test
     public void rewriteExceptionNotSerializable() throws ScriptException {
@@ -59,7 +59,7 @@
     }
 
     @Test
-    public void unwarrantedOptimismExceptionNotSerializable() throws IOException {
+    public void unwarrantedOptimismExceptionNotSerializable() {
         tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128));
     }
 
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,7 +25,6 @@
 package jdk.nashorn.internal.runtime;
 
 import static org.testng.Assert.fail;
-
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.util.regex.Matcher;
@@ -46,6 +45,7 @@
  * @summary Sanity tests for no persistence caching
  * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest
  */
+@SuppressWarnings("javadoc")
 public class NoPersistenceCachingTest {
 
    private ScriptEngine engine;
@@ -102,6 +102,8 @@
             engine.eval(scriptThreeContexts, context2);
             engine.eval(scriptThreeContexts, context3);
             break;
+        default:
+            break;
          }
       } catch (final Exception se) {
          se.printStackTrace();
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -29,7 +29,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -42,6 +41,7 @@
 /**
  * Tests different Source representations.
  */
+@SuppressWarnings("javadoc")
 public class SourceTest {
 
     final private static String SOURCE_NAME = "source.js";
@@ -104,11 +104,11 @@
         }
     }
 
-    private Reader getReader(final String path) {
+    private static Reader getReader(final String path) {
         return new InputStreamReader(SourceTest.class.getResourceAsStream(path));
     }
 
-    private void testSources(final Source source1, final Source source2) {
+    private static void testSources(final Source source1, final Source source2) {
         final char[] chars1 = source1.getContent();
         final char[] chars2 = source2.getContent();
         final String str1 = source1.getString();
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,7 +28,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineFactory;
@@ -42,6 +41,7 @@
 /**
  * Tests for trusted client usage of nashorn script engine factory extension API
  */
+@SuppressWarnings("javadoc")
 public class TrustedScriptEngineTest {
     @Test
     public void versionTest() {
@@ -64,7 +64,7 @@
         public boolean reached() {
             return reached[0];
         }
-    };
+    }
 
     // These are for "private" extension API of NashornScriptEngineFactory that
     // accepts a ClassLoader and/or command line options.
@@ -140,7 +140,8 @@
                     // try nashorn specific extension
                     e.eval("var f = funtion(x) 2*x;");
                     fail("should have thrown exception!");
-                } catch (final ScriptException se) {
+                } catch (final Exception ex) {
+                    //empty
                 }
                 return;
             }
@@ -276,7 +277,9 @@
         try {
             fac.getScriptEngine((ClassFilter)null);
             fail("should have thrown NPE");
-        } catch (NullPointerException npe) {}
+        } catch (final NullPointerException e) {
+            //empty
+        }
     }
 
     @Test
@@ -285,7 +288,9 @@
         try {
             fac.getScriptEngine(new String[0], null, null);
             fail("should have thrown NPE");
-        } catch (NullPointerException npe) {}
+        } catch (final NullPointerException e) {
+            //empty
+        }
     }
 
     @Test
@@ -294,7 +299,9 @@
         try {
             fac.getScriptEngine((String[])null);
             fail("should have thrown NPE");
-        } catch (NullPointerException npe) {}
+        } catch (final NullPointerException e) {
+            //empty
+        }
     }
 
     @Test
@@ -308,7 +315,9 @@
                 }
             });
             fail("should have thrown NPE");
-        } catch (NullPointerException npe) {}
+        } catch (final NullPointerException e) {
+            //empty
+        }
     }
 
     @Test
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -33,6 +33,7 @@
  * @test
  * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest
  */
+@SuppressWarnings("javadoc")
 public class JoniTest {
 
     @Test
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,7 +34,6 @@
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FAIL_LIST;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_SHARED_CONTEXT;
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -50,6 +49,7 @@
 /**
  * Abstract class to compile and run one .js script file.
  */
+@SuppressWarnings("javadoc")
 public abstract class AbstractScriptRunnable {
     // some test scripts need a "framework" script - whose features are used
     // in the test script. This optional framework script can be null.
@@ -274,14 +274,14 @@
     // compile and run this script
     protected abstract void execute();
 
-    private boolean equalsCompilerMsgs(final String es, final String as) {
+    private static boolean equalsCompilerMsgs(final String es, final String as) {
         final int split = es.indexOf(':');
         // Replace both types of separators ('/' and '\') with the one from
         // current environment
         return (split >= 0) && as.equals(es.substring(0, split).replaceAll("[/\\\\]", Matcher.quoteReplacement(File.separator)) + es.substring(split));
     }
 
-    private void escape(final String value, final StringBuilder out) {
+    private static void escape(final String value, final StringBuilder out) {
         final int len = value.length();
         for (int i = 0; i < len; i++) {
             final char ch = value.charAt(i);
@@ -297,7 +297,7 @@
         }
     }
 
-    private String escape(final String value) {
+    private static String escape(final String value) {
         final StringBuilder sb = new StringBuilder();
         escape(value, sb);
         return sb.toString();
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,6 +34,7 @@
  * Test case used by JSCompilerTest to complain if test files are marked as
  * neither test nor subtest.
  */
+@SuppressWarnings("javadoc")
 public final class OrphanTestFinder implements ITest {
     private final Set<String> orphanFiles;
 
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java	Mon Nov 17 09:36:40 2014 +0100
@@ -31,7 +31,6 @@
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_EXCLUDE_LIST;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FRAMEWORK;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS;
-
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -73,6 +72,7 @@
  * Parallel test runner runs tests in multiple threads - but avoids any dependency
  * on third-party test framework library such as TestNG.
  */
+@SuppressWarnings("javadoc")
 public class ParallelTestRunner {
 
     // ParallelTestRunner-specific
@@ -247,7 +247,7 @@
             }
         }
 
-        private void compare(final String outputFileName, final String expected, final boolean compareCompilerMsg) throws IOException {
+        private void compare(final String fileName, final String expected, final boolean compareCompilerMsg) throws IOException {
             final File expectedFile = new File(expected);
 
             BufferedReader expectedReader;
@@ -257,7 +257,7 @@
                 expectedReader = new BufferedReader(new StringReader(""));
             }
 
-            final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(outputFileName)));
+            final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
 
             compare(actual, expectedReader, compareCompilerMsg);
         }
@@ -434,8 +434,8 @@
     public static void main(final String[] args) throws Exception {
         parseArgs(args);
 
-        while(new ParallelTestRunner().run()) {
-            ;
+        while (new ParallelTestRunner().run()) {
+            //empty
         }
     }
 
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -52,6 +52,7 @@
  * class. Optionally, output from running the script is compared against the
  * corresponding .EXPECTED file.
  */
+@SuppressWarnings("javadoc")
 public final class ScriptRunnable extends AbstractScriptRunnable implements ITest {
     public ScriptRunnable(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions,  final List<String> scriptArguments) {
         super(framework, testFile, engineOptions, testOptions, scriptArguments);
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,7 +26,6 @@
 package jdk.nashorn.internal.test.framework;
 
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_INCLUDES;
-
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
@@ -48,7 +47,9 @@
      * Creates a test factory for the set of .js source tests.
      *
      * @return a Object[] of test objects.
+     * @throws Exception upon failure
      */
+    @SuppressWarnings("static-method")
     @Factory
     public Object[] suite() throws Exception {
         Locale.setDefault(new Locale(""));
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,6 +28,7 @@
 /**
  * Configuration info for script tests.
  */
+@SuppressWarnings("javadoc")
 public interface TestConfig {
     // Test options inferred from various test @foo tags and passed to test factory.
     public static final String   OPTIONS_RUN                 = "run";
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java	Mon Nov 17 09:36:40 2014 +0100
@@ -42,7 +42,6 @@
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_LIST;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_UNCHECKED_DIR;
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -76,6 +75,7 @@
  * Utility class to find/parse script test files and to create 'test' instances.
  * Actual 'test' object type is decided by clients of this class.
  */
+@SuppressWarnings("javadoc")
 public final class TestFinder {
     private TestFinder() {}
 
@@ -299,6 +299,8 @@
                 case "@fork":
                     fork = true;
                     break;
+                default:
+                    break;
                 }
 
                 // negative tests are expected to fail at runtime only
@@ -377,7 +379,7 @@
      *
      * @args new argument list array
      */
-    public static String[] addExplicitOptimisticTypes(String[] args) {
+    public static String[] addExplicitOptimisticTypes(final String[] args) {
         if (hasOptimisticOverride()) {
             final List<String> newList = new ArrayList<>(Arrays.asList(args));
             newList.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE));
@@ -392,7 +394,7 @@
      *
      * @args argument list
      */
-    public static void addExplicitOptimisticTypes(List<String> args) {
+    public static void addExplicitOptimisticTypes(final List<String> args) {
         if (hasOptimisticOverride()) {
             args.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE));
         }
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -36,6 +36,7 @@
 /**
  * Simple utilities to deal with build-dir, read/dump files etc.
  */
+@SuppressWarnings("javadoc")
 public abstract class TestHelper {
 
     public static final String TEST_ROOT   = "test";
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java	Mon Nov 17 09:36:40 2014 +0100
@@ -47,10 +47,9 @@
                 final Object o2 = mi2.getInstance();
                 if (o1 instanceof ITest && o2 instanceof ITest) {
                     return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
-                } else {
-                    // something else, don't care about the order
-                    return 0;
                 }
+                // something else, don't care about the order
+                return 0;
             }
         });
 
--- a/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -28,6 +28,7 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 
+@SuppressWarnings("javadoc")
 public class InternalRunnable implements Runnable, RestrictedRunnable {
 
     // This is a public field in a restricted class; scripts should not see it.
--- a/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,8 +27,8 @@
 
 /**
  * Acts as a restricted interface implemented by a restricted class.
- *
  */
+@SuppressWarnings("javadoc")
 public interface RestrictedRunnable {
     public void restrictedRun();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassLoaderAware.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, 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.test.models;
+
+@SuppressWarnings("javadoc")
+public interface ClassLoaderAware {
+    public ClassLoader getContextClassLoader();
+    public void checkMemberAccess(Class<?> clazz, int which);
+}
--- a/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,7 +25,10 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class ClassWithFinalFinalizer {
+    @Override
     protected final void finalize() {
+        //empty
     }
 }
--- a/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,5 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class ClassWithInheritedFinalFinalizer extends ClassWithFinalFinalizer {
+    //empty
 }
--- a/nashorn/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public abstract class ConstructorWithArgument {
     private final String token;
 
--- a/nashorn/test/src/jdk/nashorn/test/models/DessertTopping.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/DessertTopping.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public interface DessertTopping {
     public String pourOnDessert();
 }
--- a/nashorn/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class DessertToppingFloorWaxDriver {
     public void decorateDessert(final DessertTopping dt) {
         dt.pourOnDessert();
--- a/nashorn/test/src/jdk/nashorn/test/models/FinalClass.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/FinalClass.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public final class FinalClass {
     //empty
 }
--- a/nashorn/test/src/jdk/nashorn/test/models/FloorWax.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/FloorWax.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public interface FloorWax {
     public String shineUpTheFloor();
 }
--- a/nashorn/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java	Mon Nov 17 09:36:40 2014 +0100
@@ -24,6 +24,7 @@
  */
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class IntFloatOverloadSelection {
 
     public static String overloadedMethod(final int i) {
--- a/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java	Mon Nov 17 09:36:40 2014 +0100
@@ -30,8 +30,9 @@
 
 /**
  * Acts as a non-restricted superclass for a restricted class.
- *
  */
+
+@SuppressWarnings("javadoc")
 public class InternalRunnableSuperclass {
     public final int canSeeThisField = 19;
 
--- a/nashorn/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,8 +26,9 @@
 package jdk.nashorn.test.models;
 
 /**
- * Test class used by JDK-8011362.js.
+ * Test class used by JDK-8011362.js
  */
+@SuppressWarnings("javadoc")
 public class Jdk8011362TestSubject {
     // This is selected for overloaded("", null)
     public String overloaded(final String a, final String b) {
--- a/nashorn/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class Nashorn401TestSubject {
     public String method2(final int arg) {
         return "int method 2";
--- a/nashorn/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class NoAccessibleConstructorClass {
     NoAccessibleConstructorClass() { }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/NullProvider.java	Mon Nov 17 09:36:40 2014 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 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.test.models;
+
+@SuppressWarnings("javadoc")
+public class NullProvider {
+    public static Integer getInteger() { return null; }
+    public static Long getLong() { return null; }
+    public static Double getDouble() { return null; }
+    public static Boolean getBoolean() { return null; }
+}
--- a/nashorn/test/src/jdk/nashorn/test/models/OuterClass.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/OuterClass.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class OuterClass {
     private final String value;
 
@@ -35,6 +36,7 @@
     public static class InnerStaticClass {
 
         public static class InnerInnerStaticClass {
+            //empty
         }
 
         private final String value;
@@ -50,15 +52,15 @@
     }
 
     public class InnerNonStaticClass {
-        private final String value;
+        private final String val;
 
         public InnerNonStaticClass(final String value) {
-            this.value = value;
+            this.val = value;
         }
 
         @Override
         public String toString() {
-            return "InnerNonStaticClass[value=" + value + ", outer=" + OuterClass.this + "]";
+            return "InnerNonStaticClass[value=" + val + ", outer=" + OuterClass.this + "]";
         }
     }
 
--- a/nashorn/test/src/jdk/nashorn/test/models/OverloadedSam.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/OverloadedSam.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public interface OverloadedSam {
     public void sam(String s);
     public void sam(String s1, String s2);
--- a/nashorn/test/src/jdk/nashorn/test/models/OverrideObject.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/OverrideObject.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class OverrideObject {
     @Override
     public int hashCode() {
--- a/nashorn/test/src/jdk/nashorn/test/models/PropertyBind.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/PropertyBind.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public class PropertyBind {
     public static int publicStaticInt;
     public static final int publicStaticFinalInt = 2112;
--- a/nashorn/test/src/jdk/nashorn/test/models/SourceHelper.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/SourceHelper.java	Mon Nov 17 09:36:40 2014 +0100
@@ -34,6 +34,7 @@
 /**
  * Helper class to facilitate script access of nashorn Source class.
  */
+@SuppressWarnings("javadoc")
 public final class SourceHelper {
     private SourceHelper() {}
 
--- a/nashorn/test/src/jdk/nashorn/test/models/StringArgs.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/StringArgs.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,6 +27,7 @@
 
 import java.util.List;
 
+@SuppressWarnings("javadoc")
 public class StringArgs {
 
     public static void checkString(final List<?> list) {
--- a/nashorn/test/src/jdk/nashorn/test/models/Toothpaste.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/Toothpaste.java	Mon Nov 17 09:36:40 2014 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.test.models;
 
+@SuppressWarnings("javadoc")
 public abstract class Toothpaste {
     public void applyToBrush() {
         applyToBrushImpl();
--- a/nashorn/test/src/jdk/nashorn/test/models/VarArgConstructor.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/VarArgConstructor.java	Mon Nov 17 09:36:40 2014 +0100
@@ -27,6 +27,7 @@
 
 import java.util.List;
 
+@SuppressWarnings("javadoc")
 public class VarArgConstructor {
     private final String indicator;
 
--- a/nashorn/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java	Sat Nov 15 02:51:48 2014 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java	Mon Nov 17 09:36:40 2014 +0100
@@ -26,6 +26,7 @@
 
 import jdk.nashorn.internal.runtime.Undefined;
 
+@SuppressWarnings("javadoc")
 public class StaticTypeInspector {
 
     public static String inspect(final boolean x, final String w) {