Merge
authordrchase
Fri, 07 Nov 2014 13:58:52 -0500
changeset 27639 82ad16896cef
parent 27638 1142a24d73eb (current diff)
parent 27481 e5814e373085 (diff)
child 27640 3eab5c5bf81a
Merge
common/autoconf/config.h.in
common/autoconf/spec.sh.in
common/bin/boot_cycle.sh
common/bin/compare-objects.sh
hotspot/test/runtime/NMT/UnsafeMallocLimit.java
hotspot/test/runtime/NMT/UnsafeMallocLimit2.java
langtools/test/com/sun/javadoc/testJavaFX/C.java
langtools/test/com/sun/javadoc/testJavaFX/D.java
--- a/.hgtags	Wed Nov 05 16:28:11 2014 +0100
+++ b/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 a137992d750c72f6f944f341aa19b0d0d96afe0c jdk9-b35
 41df50e7303daf73c0d661ef601c4fe250915de5 jdk9-b36
 b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
+948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
--- a/.hgtags-top-repo	Wed Nov 05 16:28:11 2014 +0100
+++ b/.hgtags-top-repo	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
 201d4e235d597a25a2d3ee1404394789ba386119 jdk9-b36
 723a67b0c442391447b1d8aad8b249d06d1032e8 jdk9-b37
+d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
--- a/common/autoconf/basics.m4	Wed Nov 05 16:28:11 2014 +0100
+++ b/common/autoconf/basics.m4	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/common/autoconf/help.m4	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/common/autoconf/libraries.m4	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ b/corba/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 9bc2dbd3dfb8c9fa88e00056b8b93a81ee6d306e jdk9-b35
 ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
 7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
+8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
--- a/hotspot/.hgtags	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -440,3 +440,4 @@
 438cb613151c4bd290bb732697517cba1cafcb04 jdk9-b35
 464ab653fbb17eb518d8ef60f8df301de7ef00d0 jdk9-b36
 b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
+c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java	Fri Nov 07 13:58:52 2014 -0500
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2000, 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.jvm.hotspot.runtime;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.types.*;
+
+public class CodeCacheSweeperThread extends JavaThread {
+  public CodeCacheSweeperThread(Address addr) {
+    super(addr);
+  }
+
+  public boolean isJavaThread() { return false; }
+  public boolean isHiddenFromExternalView() { return true; }
+  public boolean isCodeCacheSweeperThread() { return true; }
+
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java	Fri Nov 07 13:58:52 2014 -0500
@@ -118,9 +118,10 @@
     return VM.getVM().getThreads().createJavaThreadWrapper(threadAddr);
   }
 
-  /** NOTE: for convenience, this differs in definition from the
-      underlying VM. Only "pure" JavaThreads return true;
-      CompilerThreads and JVMDIDebuggerThreads return false. FIXME:
+  /** NOTE: for convenience, this differs in definition from the underlying VM.
+      Only "pure" JavaThreads return true; CompilerThreads, the CodeCacheSweeperThread,
+      JVMDIDebuggerThreads return false.
+      FIXME:
       consider encapsulating platform-specific functionality in an
       object instead of using inheritance (which is the primary reason
       we can't traverse CompilerThreads, etc; didn't want to have, for
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Fri Nov 07 13:58:52 2014 -0500
@@ -111,14 +111,15 @@
     return allocatedBytesField.getValue(addr);
   }
 
-  public boolean   isVMThread()                { return false; }
-  public boolean   isJavaThread()              { return false; }
-  public boolean   isCompilerThread()          { return false; }
-  public boolean   isHiddenFromExternalView()  { return false; }
-  public boolean   isJvmtiAgentThread()        { return false; }
-  public boolean   isWatcherThread()           { return false; }
+  public boolean   isVMThread()                  { return false; }
+  public boolean   isJavaThread()                { return false; }
+  public boolean   isCompilerThread()            { return false; }
+  public boolean   isCodeCacheSweeperThread()    { return false; }
+  public boolean   isHiddenFromExternalView()    { return false; }
+  public boolean   isJvmtiAgentThread()          { return false; }
+  public boolean   isWatcherThread()             { return false; }
   public boolean   isConcurrentMarkSweepThread() { return false; }
-  public boolean   isServiceThread()           { return false; }
+  public boolean   isServiceThread()             { return false; }
 
   /** Memory operations */
   public void oopsDo(AddressVisitor oopVisitor) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Fri Nov 07 13:58:52 2014 -0500
@@ -120,6 +120,7 @@
         virtualConstructor.addMapping("JavaThread", JavaThread.class);
         if (!VM.getVM().isCore()) {
             virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
+            virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class);
         }
         // for now, use JavaThread itself. fix it later with appropriate class if needed
         virtualConstructor.addMapping("SurrogateLockerThread", JavaThread.class);
@@ -164,7 +165,7 @@
             return thread;
         } catch (Exception e) {
             throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
-            " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)", e);
+            " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, SurrogateLockerThread, or CodeCacheSweeperThread)", e);
         }
     }
 
@@ -201,7 +202,7 @@
     public List getPendingThreads(ObjectMonitor monitor) {
         List pendingThreads = new ArrayList();
         for (JavaThread thread = first(); thread != null; thread = thread.next()) {
-            if (thread.isCompilerThread()) {
+            if (thread.isCompilerThread() || thread.isCodeCacheSweeperThread()) {
                 continue;
             }
             ObjectMonitor pending = thread.getCurrentPendingMonitor();
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Fri Nov 07 13:58:52 2014 -0500
@@ -836,6 +836,7 @@
 // Java Threads
 vmType2Class["JavaThread"] = sapkg.runtime.JavaThread;
 vmType2Class["CompilerThread"] = sapkg.runtime.CompilerThread;
+vmType2Class["CodeCacheSweeperThread"] = sapkg.runtime.CodeCacheSweeperThread;
 vmType2Class["SurrogateLockerThread"] = sapkg.runtime.JavaThread;
 vmType2Class["DebuggerThread"] = sapkg.runtime.DebuggerThread;
 
--- a/hotspot/make/windows/makefiles/compile.make	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/make/windows/makefiles/compile.make	Fri Nov 07 13:58:52 2014 -0500
@@ -158,7 +158,7 @@
 !endif
 LD_FLAGS= $(LD_FLAGS) kernel32.lib user32.lib gdi32.lib winspool.lib \
  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
- uuid.lib Wsock32.lib winmm.lib /nologo /machine:$(MACHINE) /opt:REF \
+ uuid.lib Wsock32.lib winmm.lib version.lib /nologo /machine:$(MACHINE) /opt:REF \
  /opt:ICF,8
 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
 LD_FLAGS= $(LD_FLAGS) /map /debug
--- a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -237,7 +237,7 @@
   // handle arguments
   // Warning: We use reg arg slot 00 temporarily to return the RegArgSignature
   // back to the code that pops the arguments into the CPU registers
-  SlowSignatureHandler(m, (address)from, m->is_static() ? to+2 : to+1, to).iterate(UCONST64(-1));
+  SlowSignatureHandler(m, (address)from, m->is_static() ? to+2 : to+1, to).iterate((uint64_t)CONST64(-1));
   // return result handler
   return Interpreter::result_handler(m->result_type());
 IRT_END
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -60,10 +60,10 @@
 static jlong fp_signmask_pool[(4+1)*2]; // 4*128bits(data) + 128bits(alignment)
 
 // Static initialization during VM startup.
-static jlong *float_signmask_pool  = double_quadword(&fp_signmask_pool[1*2], CONST64(0x7FFFFFFF7FFFFFFF), CONST64(0x7FFFFFFF7FFFFFFF));
-static jlong *double_signmask_pool = double_quadword(&fp_signmask_pool[2*2], CONST64(0x7FFFFFFFFFFFFFFF), CONST64(0x7FFFFFFFFFFFFFFF));
-static jlong *float_signflip_pool  = double_quadword(&fp_signmask_pool[3*2], CONST64(0x8000000080000000), CONST64(0x8000000080000000));
-static jlong *double_signflip_pool = double_quadword(&fp_signmask_pool[4*2], CONST64(0x8000000000000000), CONST64(0x8000000000000000));
+static jlong *float_signmask_pool  = double_quadword(&fp_signmask_pool[1*2],         CONST64(0x7FFFFFFF7FFFFFFF),         CONST64(0x7FFFFFFF7FFFFFFF));
+static jlong *double_signmask_pool = double_quadword(&fp_signmask_pool[2*2],         CONST64(0x7FFFFFFFFFFFFFFF),         CONST64(0x7FFFFFFFFFFFFFFF));
+static jlong *float_signflip_pool  = double_quadword(&fp_signmask_pool[3*2], (jlong)UCONST64(0x8000000080000000), (jlong)UCONST64(0x8000000080000000));
+static jlong *double_signflip_pool = double_quadword(&fp_signmask_pool[4*2], (jlong)UCONST64(0x8000000000000000), (jlong)UCONST64(0x8000000000000000));
 
 
 
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1597,7 +1597,7 @@
         __ movl(rdx, 0x80000000);
         __ xorl(rax, rax);
 #else
-        __ mov64(rax, CONST64(0x8000000000000000));
+        __ mov64(rax, UCONST64(0x8000000000000000));
 #endif // _LP64
         __ jmp(do_return);
 
--- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -135,7 +135,7 @@
   methodHandle m(thread, (Method*)method);
   assert(m->is_native(), "sanity check");
   // handle arguments
-  SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1));
+  SlowSignatureHandler(m, (address)from, to + 1).iterate((uint64_t)CONST64(-1));
   // return result handler
   return Interpreter::result_handler(m->result_type());
 IRT_END
--- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -487,7 +487,7 @@
   assert(m->is_native(), "sanity check");
 
   // handle arguments
-  SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1));
+  SlowSignatureHandler(m, (address)from, to + 1).iterate((uint64_t)CONST64(-1));
 
   // return result handler
   return Interpreter::result_handler(m->result_type());
--- a/hotspot/src/cpu/zero/vm/interpreterRT_zero.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/cpu/zero/vm/interpreterRT_zero.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -155,7 +155,7 @@
 
   intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize);
   SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf);
-  sshg.generate(UCONST64(-1));
+  sshg.generate((uint64_t)CONST64(-1));
 
   SignatureHandler *handler = sshg.handler();
   handler->finalize();
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1641,7 +1641,8 @@
   char* rp = realpath((char *)dlinfo.dli_fname, buf);
   assert(rp != NULL, "error in realpath(): maybe the 'path' argument is too long?");
 
-  strcpy(saved_jvm_path, buf);
+  strncpy(saved_jvm_path, buf, sizeof(saved_jvm_path));
+  saved_jvm_path[sizeof(saved_jvm_path) - 1] = '\0';
 }
 
 void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
@@ -3829,11 +3830,6 @@
   return JNI_OK;
 }
 
-// this is called at the end of vm_initialization
-void os::init_3(void) {
-  return;
-}
-
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   if (!guard_memory((char*)_polling_page, Aix::page_size())) {
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -506,6 +506,7 @@
 
   if (!is_directory_secure(dirname)) {
     // the directory is not a secure directory
+    os::closedir(dirp);
     return;
   }
 
@@ -853,6 +854,9 @@
   //
   if (!is_directory_secure(dirname)) {
     FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    if (luser != user) {
+      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+    }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1875,6 +1875,7 @@
   }
 
   strncpy(saved_jvm_path, buf, MAXPATHLEN);
+  saved_jvm_path[MAXPATHLEN - 1] = '\0';
 }
 
 void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
@@ -3635,9 +3636,6 @@
   return JNI_OK;
 }
 
-// this is called at the end of vm_initialization
-void os::init_3(void) { }
-
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   if (!guard_memory((char*)_polling_page, Bsd::page_size())) {
@@ -4118,7 +4116,18 @@
 }
 
 
-// Refer to the comments in os_solaris.cpp park-unpark.
+// Refer to the comments in os_solaris.cpp park-unpark. The next two
+// comment paragraphs are worth repeating here:
+//
+// Assumption:
+//    Only one parker can exist on an event, which is why we allocate
+//    them per-thread. Multiple unparkers can coexist.
+//
+// _Event serves as a restricted-range semaphore.
+//   -1 : thread is blocked, i.e. there is a waiter
+//    0 : neutral: thread is running or ready,
+//        could have been signaled after a wait started
+//    1 : signaled - thread is running or ready
 //
 // Beware -- Some versions of NPTL embody a flaw where pthread_cond_timedwait() can
 // hang indefinitely.  For instance NPTL 0.60 on 2.4.21-4ELsmp is vulnerable.
@@ -4203,6 +4212,11 @@
 }
 
 void os::PlatformEvent::park() {       // AKA "down()"
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
@@ -4240,6 +4254,11 @@
 }
 
 int os::PlatformEvent::park(jlong millis) {
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   guarantee(_nParked == 0, "invariant");
 
   int v;
@@ -4303,11 +4322,11 @@
 
 void os::PlatformEvent::unpark() {
   // Transitions for _Event:
-  //    0 :=> 1
-  //    1 :=> 1
-  //   -1 :=> either 0 or 1; must signal target thread
-  //          That is, we can safely transition _Event from -1 to either
-  //          0 or 1.
+  //    0 => 1 : just return
+  //    1 => 1 : just return
+  //   -1 => either 0 or 1; must signal target thread
+  //         That is, we can safely transition _Event from -1 to either
+  //         0 or 1.
   // See also: "Semaphores in Plan 9" by Mullender & Cox
   //
   // Note: Forcing a transition from "-1" to "1" on an unpark() means
@@ -4330,15 +4349,16 @@
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   if (AnyWaiters != 0) {
+    // Note that we signal() *after* dropping the lock for "immortal" Events.
+    // This is safe and avoids a common class of  futile wakeups.  In rare
+    // circumstances this can cause a thread to return prematurely from
+    // cond_{timed}wait() but the spurious wakeup is benign and the victim
+    // will simply re-test the condition and re-park itself.
+    // This provides particular benefit if the underlying platform does not
+    // provide wait morphing.
     status = pthread_cond_signal(_cond);
     assert_status(status == 0, status, "cond_signal");
   }
-
-  // Note that we signal() _after dropping the lock for "immortal" Events.
-  // This is safe and avoids a common class of  futile wakeups.  In rare
-  // circumstances this can cause a thread to return prematurely from
-  // cond_{timed}wait() but the spurious wakeup is benign and the victim will
-  // simply re-test the condition and re-park itself.
 }
 
 
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -506,6 +506,7 @@
 
   if (!is_directory_secure(dirname)) {
     // the directory is not a secure directory
+    os::closedir(dirp);
     return;
   }
 
@@ -872,6 +873,9 @@
   //
   if (!is_directory_secure(dirname)) {
     FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    if (luser != user) {
+      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+    }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -163,35 +163,6 @@
 // Declarations
 static void unpackTime(timespec* absTime, bool isAbsolute, jlong time);
 
-#ifdef JAVASE_EMBEDDED
-class MemNotifyThread: public Thread {
-  friend class VMStructs;
- public:
-  virtual void run();
-
- private:
-  static MemNotifyThread* _memnotify_thread;
-  int _fd;
-
- public:
-
-  // Constructor
-  MemNotifyThread(int fd);
-
-  // Tester
-  bool is_memnotify_thread() const { return true; }
-
-  // Printing
-  char* name() const { return (char*)"Linux MemNotify Thread"; }
-
-  // Returns the single instance of the MemNotifyThread
-  static MemNotifyThread* memnotify_thread() { return _memnotify_thread; }
-
-  // Create and start the single instance of MemNotifyThread
-  static void start();
-};
-#endif // JAVASE_EMBEDDED
-
 // utility functions
 
 static int SR_initialize();
@@ -384,7 +355,10 @@
 
     // Found the full path to libjvm.so.
     // Now cut the path to <java_home>/jre if we can.
-    *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
+    pslash = strrchr(buf, '/');
+    if (pslash != NULL) {
+      *pslash = '\0';            // Get rid of /libjvm.so.
+    }
     pslash = strrchr(buf, '/');
     if (pslash != NULL) {
       *pslash = '\0';            // Get rid of /{client|server|hotspot}.
@@ -1223,7 +1197,7 @@
       i = 0;
       if (s) {
         // Skip blank chars
-        do s++; while (isspace(*s));
+        do { s++; } while (s && isspace(*s));
 
 #define _UFM UINTX_FORMAT
 #define _DFM INTX_FORMAT
@@ -2372,6 +2346,9 @@
 
         // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
+        if (p == NULL) {
+          return;
+        }
         assert(strstr(p, "/libjvm") == p, "invalid library name");
 
         rp = realpath(java_home_var, buf);
@@ -2405,6 +2382,7 @@
   }
 
   strncpy(saved_jvm_path, buf, MAXPATHLEN);
+  saved_jvm_path[MAXPATHLEN - 1] = '\0';
 }
 
 void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
@@ -4866,17 +4844,6 @@
   return JNI_OK;
 }
 
-// this is called at the end of vm_initialization
-void os::init_3(void) {
-#ifdef JAVASE_EMBEDDED
-  // Start the MemNotifyThread
-  if (LowMemoryProtection) {
-    MemNotifyThread::start();
-  }
-  return;
-#endif
-}
-
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   if (!guard_memory((char*)_polling_page, Linux::page_size())) {
@@ -5103,9 +5070,38 @@
     errno = ENAMETOOLONG;
     return -1;
   }
-  int fd;
-
-  fd = ::open64(path, oflag, mode);
+
+  // All file descriptors that are opened in the Java process and not
+  // specifically destined for a subprocess should have the close-on-exec
+  // flag set.  If we don't set it, then careless 3rd party native code
+  // might fork and exec without closing all appropriate file descriptors
+  // (e.g. as we do in closeDescriptors in UNIXProcess.c), and this in
+  // turn might:
+  //
+  // - cause end-of-file to fail to be detected on some file
+  //   descriptors, resulting in mysterious hangs, or
+  //
+  // - might cause an fopen in the subprocess to fail on a system
+  //   suffering from bug 1085341.
+  //
+  // (Yes, the default setting of the close-on-exec flag is a Unix
+  // design flaw)
+  //
+  // See:
+  // 1085341: 32-bit stdio routines should support file descriptors >255
+  // 4843136: (process) pipe file descriptor from Runtime.exec not being closed
+  // 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
+  //
+  // Modern Linux kernels (after 2.6.23 2007) support O_CLOEXEC with open().
+  // O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor
+  // because it saves a system call and removes a small window where the flag
+  // is unset.  On ancient Linux kernels the O_CLOEXEC flag will be ignored
+  // and we fall back to using FD_CLOEXEC (see below).
+#ifdef O_CLOEXEC
+  oflag |= O_CLOEXEC;
+#endif
+
+  int fd = ::open64(path, oflag, mode);
   if (fd == -1) return -1;
 
   //If the open succeeded, the file might still be a directory
@@ -5126,32 +5122,17 @@
     }
   }
 
-  // All file descriptors that are opened in the JVM and not
-  // specifically destined for a subprocess should have the
-  // close-on-exec flag set.  If we don't set it, then careless 3rd
-  // party native code might fork and exec without closing all
-  // appropriate file descriptors (e.g. as we do in closeDescriptors in
-  // UNIXProcess.c), and this in turn might:
-  //
-  // - cause end-of-file to fail to be detected on some file
-  //   descriptors, resulting in mysterious hangs, or
-  //
-  // - might cause an fopen in the subprocess to fail on a system
-  //   suffering from bug 1085341.
-  //
-  // (Yes, the default setting of the close-on-exec flag is a Unix
-  // design flaw)
-  //
-  // See:
-  // 1085341: 32-bit stdio routines should support file descriptors >255
-  // 4843136: (process) pipe file descriptor from Runtime.exec not being closed
-  // 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
-  //
 #ifdef FD_CLOEXEC
-  {
+  // Validate that the use of the O_CLOEXEC flag on open above worked.
+  // With recent kernels, we will perform this check exactly once.
+  static sig_atomic_t O_CLOEXEC_is_known_to_work = 0;
+  if (!O_CLOEXEC_is_known_to_work) {
     int flags = ::fcntl(fd, F_GETFD);
     if (flags != -1) {
-      ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+      if ((flags & FD_CLOEXEC) != 0)
+        O_CLOEXEC_is_known_to_work = 1;
+      else
+        ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
     }
   }
 #endif
@@ -5340,7 +5321,7 @@
   if (s == NULL) return -1;
 
   // Skip blank chars
-  do s++; while (isspace(*s));
+  do { s++; } while (s && isspace(*s));
 
   count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
                  &cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
@@ -5401,7 +5382,18 @@
 }
 
 
-// Refer to the comments in os_solaris.cpp park-unpark.
+// Refer to the comments in os_solaris.cpp park-unpark. The next two
+// comment paragraphs are worth repeating here:
+//
+// Assumption:
+//    Only one parker can exist on an event, which is why we allocate
+//    them per-thread. Multiple unparkers can coexist.
+//
+// _Event serves as a restricted-range semaphore.
+//   -1 : thread is blocked, i.e. there is a waiter
+//    0 : neutral: thread is running or ready,
+//        could have been signaled after a wait started
+//    1 : signaled - thread is running or ready
 //
 // Beware -- Some versions of NPTL embody a flaw where pthread_cond_timedwait() can
 // hang indefinitely.  For instance NPTL 0.60 on 2.4.21-4ELsmp is vulnerable.
@@ -5500,6 +5492,11 @@
 }
 
 void os::PlatformEvent::park() {       // AKA "down()"
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
@@ -5537,6 +5534,11 @@
 }
 
 int os::PlatformEvent::park(jlong millis) {
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   guarantee(_nParked == 0, "invariant");
 
   int v;
@@ -5600,11 +5602,11 @@
 
 void os::PlatformEvent::unpark() {
   // Transitions for _Event:
-  //    0 :=> 1
-  //    1 :=> 1
-  //   -1 :=> either 0 or 1; must signal target thread
-  //          That is, we can safely transition _Event from -1 to either
-  //          0 or 1.
+  //    0 => 1 : just return
+  //    1 => 1 : just return
+  //   -1 => either 0 or 1; must signal target thread
+  //         That is, we can safely transition _Event from -1 to either
+  //         0 or 1.
   // See also: "Semaphores in Plan 9" by Mullender & Cox
   //
   // Note: Forcing a transition from "-1" to "1" on an unpark() means
@@ -5627,15 +5629,16 @@
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   if (AnyWaiters != 0) {
+    // Note that we signal() *after* dropping the lock for "immortal" Events.
+    // This is safe and avoids a common class of  futile wakeups.  In rare
+    // circumstances this can cause a thread to return prematurely from
+    // cond_{timed}wait() but the spurious wakeup is benign and the victim
+    // will simply re-test the condition and re-park itself.
+    // This provides particular benefit if the underlying platform does not
+    // provide wait morphing.
     status = pthread_cond_signal(_cond);
     assert_status(status == 0, status, "cond_signal");
   }
-
-  // Note that we signal() _after dropping the lock for "immortal" Events.
-  // This is safe and avoids a common class of  futile wakeups.  In rare
-  // circumstances this can cause a thread to return prematurely from
-  // cond_{timed}wait() but the spurious wakeup is benign and the victim will
-  // simply re-test the condition and re-park itself.
 }
 
 
@@ -5997,82 +6000,6 @@
   return strlen(buffer);
 }
 
-#ifdef JAVASE_EMBEDDED
-//
-// A thread to watch the '/dev/mem_notify' device, which will tell us when the OS is running low on memory.
-//
-MemNotifyThread* MemNotifyThread::_memnotify_thread = NULL;
-
-// ctor
-//
-MemNotifyThread::MemNotifyThread(int fd): Thread() {
-  assert(memnotify_thread() == NULL, "we can only allocate one MemNotifyThread");
-  _fd = fd;
-
-  if (os::create_thread(this, os::os_thread)) {
-    _memnotify_thread = this;
-    os::set_priority(this, NearMaxPriority);
-    os::start_thread(this);
-  }
-}
-
-// Where all the work gets done
-//
-void MemNotifyThread::run() {
-  assert(this == memnotify_thread(), "expected the singleton MemNotifyThread");
-
-  // Set up the select arguments
-  fd_set rfds;
-  if (_fd != -1) {
-    FD_ZERO(&rfds);
-    FD_SET(_fd, &rfds);
-  }
-
-  // Now wait for the mem_notify device to wake up
-  while (1) {
-    // Wait for the mem_notify device to signal us..
-    int rc = select(_fd+1, _fd != -1 ? &rfds : NULL, NULL, NULL, NULL);
-    if (rc == -1) {
-      perror("select!\n");
-      break;
-    } else if (rc) {
-      //ssize_t free_before = os::available_memory();
-      //tty->print ("Notified: Free: %dK \n",os::available_memory()/1024);
-
-      // The kernel is telling us there is not much memory left...
-      // try to do something about that
-
-      // If we are not already in a GC, try one.
-      if (!Universe::heap()->is_gc_active()) {
-        Universe::heap()->collect(GCCause::_allocation_failure);
-
-        //ssize_t free_after = os::available_memory();
-        //tty->print ("Post-Notify: Free: %dK\n",free_after/1024);
-        //tty->print ("GC freed: %dK\n", (free_after - free_before)/1024);
-      }
-      // We might want to do something like the following if we find the GC's are not helping...
-      // Universe::heap()->size_policy()->set_gc_time_limit_exceeded(true);
-    }
-  }
-}
-
-// See if the /dev/mem_notify device exists, and if so, start a thread to monitor it.
-//
-void MemNotifyThread::start() {
-  int fd;
-  fd = open("/dev/mem_notify", O_RDONLY, 0);
-  if (fd < 0) {
-    return;
-  }
-
-  if (memnotify_thread() == NULL) {
-    new MemNotifyThread(fd);
-  }
-}
-
-#endif // JAVASE_EMBEDDED
-
-
 /////////////// Unit tests ///////////////
 
 #ifndef PRODUCT
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -506,6 +506,7 @@
 
   if (!is_directory_secure(dirname)) {
     // the directory is not a secure directory
+    os::closedir(dirp);
     return;
   }
 
@@ -872,6 +873,9 @@
   //
   if (!is_directory_secure(dirname)) {
     FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    if (luser != user) {
+      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+    }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -663,7 +663,10 @@
     }
   }
 
-  jio_snprintf(out, outlen, ret);
+  if (out && outlen > 0) {
+    strncpy(out, ret, outlen);
+    out[outlen - 1] = '\0';
+  }
   return out;
 }
 
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -2221,6 +2221,7 @@
   }
 
   strncpy(saved_jvm_path, buf, MAXPATHLEN);
+  saved_jvm_path[MAXPATHLEN - 1] = '\0';
 }
 
 
@@ -4761,10 +4762,6 @@
   return JNI_OK;
 }
 
-void os::init_3(void) {
-  return;
-}
-
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0) {
@@ -5372,31 +5369,32 @@
 // to immediately return 0 your code should still work,
 // albeit degenerating to a spin loop.
 //
-// An interesting optimization for park() is to use a trylock()
-// to attempt to acquire the mutex.  If the trylock() fails
-// then we know that a concurrent unpark() operation is in-progress.
-// in that case the park() code could simply set _count to 0
-// and return immediately.  The subsequent park() operation *might*
-// return immediately.  That's harmless as the caller of park() is
-// expected to loop.  By using trylock() we will have avoided a
-// avoided a context switch caused by contention on the per-thread mutex.
+// In a sense, park()-unpark() just provides more polite spinning
+// and polling with the key difference over naive spinning being
+// that a parked thread needs to be explicitly unparked() in order
+// to wake up and to poll the underlying condition.
 //
-// TODO-FIXME:
-// 1.  Reconcile Doug's JSR166 j.u.c park-unpark with the
-//     objectmonitor implementation.
-// 2.  Collapse the JSR166 parker event, and the
-//     objectmonitor ParkEvent into a single "Event" construct.
-// 3.  In park() and unpark() add:
-//     assert (Thread::current() == AssociatedWith).
-// 4.  add spurious wakeup injection on a -XX:EarlyParkReturn=N switch.
-//     1-out-of-N park() operations will return immediately.
+// Assumption:
+//    Only one parker can exist on an event, which is why we allocate
+//    them per-thread. Multiple unparkers can coexist.
 //
 // _Event transitions in park()
 //   -1 => -1 : illegal
 //    1 =>  0 : pass - return immediately
-//    0 => -1 : block
+//    0 => -1 : block; then set _Event to 0 before returning
+//
+// _Event transitions in unpark()
+//    0 => 1 : just return
+//    1 => 1 : just return
+//   -1 => either 0 or 1; must signal target thread
+//         That is, we can safely transition _Event from -1 to either
+//         0 or 1.
 //
 // _Event serves as a restricted-range semaphore.
+//   -1 : thread is blocked, i.e. there is a waiter
+//    0 : neutral: thread is running or ready,
+//        could have been signaled after a wait started
+//    1 : signaled - thread is running or ready
 //
 // Another possible encoding of _Event would be with
 // explicit "PARKED" == 01b and "SIGNALED" == 10b bits.
@@ -5456,6 +5454,11 @@
 }
 
 void os::PlatformEvent::park() {           // AKA: down()
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   assert(_nParked == 0, "invariant");
@@ -5497,6 +5500,11 @@
 }
 
 int os::PlatformEvent::park(jlong millis) {
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   guarantee(_nParked == 0, "invariant");
   int v;
   for (;;) {
@@ -5542,11 +5550,11 @@
 
 void os::PlatformEvent::unpark() {
   // Transitions for _Event:
-  //    0 :=> 1
-  //    1 :=> 1
-  //   -1 :=> either 0 or 1; must signal target thread
-  //          That is, we can safely transition _Event from -1 to either
-  //          0 or 1.
+  //    0 => 1 : just return
+  //    1 => 1 : just return
+  //   -1 => either 0 or 1; must signal target thread
+  //         That is, we can safely transition _Event from -1 to either
+  //         0 or 1.
   // See also: "Semaphores in Plan 9" by Mullender & Cox
   //
   // Note: Forcing a transition from "-1" to "1" on an unpark() means
@@ -5566,8 +5574,13 @@
   assert_status(status == 0, status, "mutex_unlock");
   guarantee(AnyWaiters == 0 || AnyWaiters == 1, "invariant");
   if (AnyWaiters != 0) {
-    // We intentional signal *after* dropping the lock
-    // to avoid a common class of futile wakeups.
+    // Note that we signal() *after* dropping the lock for "immortal" Events.
+    // This is safe and avoids a common class of  futile wakeups.  In rare
+    // circumstances this can cause a thread to return prematurely from
+    // cond_{timed}wait() but the spurious wakeup is benign and the victim
+    // will simply re-test the condition and re-park itself.
+    // This provides particular benefit if the underlying platform does not
+    // provide wait morphing.
     status = os::Solaris::cond_signal(_cond);
     assert_status(status == 0, status, "cond_signal");
   }
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -545,6 +545,7 @@
 
   if (!is_directory_secure(dirname)) {
     // the directory is not a secure directory
+    os::closedir(dirp);
     return;
   }
 
@@ -890,6 +891,9 @@
   //
   if (!is_directory_secure(dirname)) {
     FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    if (luser != user) {
+      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+    }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
--- a/hotspot/src/os/windows/vm/attachListener_windows.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/windows/vm/attachListener_windows.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -30,6 +30,7 @@
 
 #include <windows.h>
 #include <signal.h>             // SIGBREAK
+#include <stdio.h>
 
 // The AttachListener thread services a queue of operations. It blocks in the dequeue
 // function until an operation is enqueued. A client enqueues an operation by creating
@@ -269,6 +270,7 @@
   if (hPipe != INVALID_HANDLE_VALUE) {
     // shouldn't happen as there is a pipe created per operation
     if (::GetLastError() == ERROR_PIPE_BUSY) {
+      ::CloseHandle(hPipe);
       return INVALID_HANDLE_VALUE;
     }
   }
@@ -313,7 +315,8 @@
     BOOL fSuccess;
 
     char msg[32];
-    sprintf(msg, "%d\n", result);
+    _snprintf(msg, sizeof(msg), "%d\n", result);
+    msg[sizeof(msg) - 1] = '\0';
 
     fSuccess = write_pipe(hPipe, msg, (int)strlen(msg));
     if (fSuccess) {
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -96,7 +96,7 @@
 #include <vdmdbg.h>
 
 // for timer info max values which include all bits
-#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
+#define ALL_64_BITS CONST64(-1)
 
 // For DLL loading/load error detection
 // Values of PE COFF
@@ -211,6 +211,7 @@
     }
     strcpy(home_path, home_dir);
     Arguments::set_java_home(home_path);
+    FREE_C_HEAP_ARRAY(char, home_path, mtInternal);
 
     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
                                 mtInternal);
@@ -220,6 +221,7 @@
     strcpy(dll_path, home_dir);
     strcat(dll_path, bin);
     Arguments::set_dll_dir(dll_path);
+    FREE_C_HEAP_ARRAY(char, dll_path, mtInternal);
 
     if (!set_boot_path('\\', ';')) {
       return;
@@ -297,6 +299,9 @@
     char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
     sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
     Arguments::set_endorsed_dirs(buf);
+    // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
+    //  duplicates the input.)
+    FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 #undef ENDORSED_DIR
   }
 
@@ -436,9 +441,9 @@
   }
 
   // Diagnostic code to investigate JDK-6573254
-  int res = 90115;  // non-java thread
+  int res = 50115;  // non-java thread
   if (thread->is_Java_thread()) {
-    res = 60115;    // java thread
+    res = 40115;    // java thread
   }
 
   // Install a win32 structured exception handler around every thread created
@@ -1610,96 +1615,123 @@
 
 void os::win32::print_windows_version(outputStream* st) {
   OSVERSIONINFOEX osvi;
-  SYSTEM_INFO si;
-
+  VS_FIXEDFILEINFO *file_info;
+  TCHAR kernel32_path[MAX_PATH];
+  UINT len, ret;
+
+  // Use the GetVersionEx information to see if we're on a server or
+  // workstation edition of Windows. Starting with Windows 8.1 we can't
+  // trust the OS version information returned by this API.
   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
   if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
-    st->print_cr("N/A");
+    st->print_cr("Call to GetVersionEx failed");
+    return;
+  }
+  bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION);
+
+  // Get the full path to \Windows\System32\kernel32.dll and use that for
+  // determining what version of Windows we're running on.
+  len = MAX_PATH - (UINT)strlen("\\kernel32.dll") - 1;
+  ret = GetSystemDirectory(kernel32_path, len);
+  if (ret == 0 || ret > len) {
+    st->print_cr("Call to GetSystemDirectory failed");
+    return;
+  }
+  strncat(kernel32_path, "\\kernel32.dll", MAX_PATH - ret);
+
+  DWORD version_size = GetFileVersionInfoSize(kernel32_path, NULL);
+  if (version_size == 0) {
+    st->print_cr("Call to GetFileVersionInfoSize failed");
+    return;
+  }
+
+  LPTSTR version_info = (LPTSTR)os::malloc(version_size, mtInternal);
+  if (version_info == NULL) {
+    st->print_cr("Failed to allocate version_info");
     return;
   }
 
-  int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion;
-
-  ZeroMemory(&si, sizeof(SYSTEM_INFO));
-  if (os_vers >= 5002) {
-    // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
-    // find out whether we are running on 64 bit processor or not.
-    if (os::Kernel32Dll::GetNativeSystemInfoAvailable()) {
-      os::Kernel32Dll::GetNativeSystemInfo(&si);
+  if (!GetFileVersionInfo(kernel32_path, NULL, version_size, version_info)) {
+    os::free(version_info);
+    st->print_cr("Call to GetFileVersionInfo failed");
+    return;
+  }
+
+  if (!VerQueryValue(version_info, TEXT("\\"), (LPVOID*)&file_info, &len)) {
+    os::free(version_info);
+    st->print_cr("Call to VerQueryValue failed");
+    return;
+  }
+
+  int major_version = HIWORD(file_info->dwProductVersionMS);
+  int minor_version = LOWORD(file_info->dwProductVersionMS);
+  int build_number = HIWORD(file_info->dwProductVersionLS);
+  int build_minor = LOWORD(file_info->dwProductVersionLS);
+  int os_vers = major_version * 1000 + minor_version;
+  os::free(version_info);
+
+  st->print(" Windows ");
+  switch (os_vers) {
+
+  case 6000:
+    if (is_workstation) {
+      st->print("Vista");
     } else {
-      GetSystemInfo(&si);
+      st->print("Server 2008");
     }
-  }
-
-  if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-    switch (os_vers) {
-    case 3051: st->print(" Windows NT 3.51"); break;
-    case 4000: st->print(" Windows NT 4.0"); break;
-    case 5000: st->print(" Windows 2000"); break;
-    case 5001: st->print(" Windows XP"); break;
-    case 5002:
-      if (osvi.wProductType == VER_NT_WORKSTATION &&
-          si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
-        st->print(" Windows XP x64 Edition");
-      } else {
-        st->print(" Windows Server 2003 family");
-      }
-      break;
-
-    case 6000:
-      if (osvi.wProductType == VER_NT_WORKSTATION) {
-        st->print(" Windows Vista");
-      } else {
-        st->print(" Windows Server 2008");
-      }
-      break;
-
-    case 6001:
-      if (osvi.wProductType == VER_NT_WORKSTATION) {
-        st->print(" Windows 7");
-      } else {
-        st->print(" Windows Server 2008 R2");
-      }
-      break;
-
-    case 6002:
-      if (osvi.wProductType == VER_NT_WORKSTATION) {
-        st->print(" Windows 8");
-      } else {
-        st->print(" Windows Server 2012");
-      }
-      break;
-
-    case 6003:
-      if (osvi.wProductType == VER_NT_WORKSTATION) {
-        st->print(" Windows 8.1");
-      } else {
-        st->print(" Windows Server 2012 R2");
-      }
-      break;
-
-    default: // future os
-      // Unrecognized windows, print out its major and minor versions
-      st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
+    break;
+
+  case 6001:
+    if (is_workstation) {
+      st->print("7");
+    } else {
+      st->print("Server 2008 R2");
+    }
+    break;
+
+  case 6002:
+    if (is_workstation) {
+      st->print("8");
+    } else {
+      st->print("Server 2012");
+    }
+    break;
+
+  case 6003:
+    if (is_workstation) {
+      st->print("8.1");
+    } else {
+      st->print("Server 2012 R2");
     }
-  } else {
-    switch (os_vers) {
-    case 4000: st->print(" Windows 95"); break;
-    case 4010: st->print(" Windows 98"); break;
-    case 4090: st->print(" Windows Me"); break;
-    default: // future windows, print out its major and minor versions
-      st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
+    break;
+
+  case 6004:
+    if (is_workstation) {
+      st->print("10");
+    } else {
+      // The server version name of Windows 10 is not known at this time
+      st->print("%d.%d", major_version, minor_version);
     }
-  }
-
-  if (os_vers >= 6000 && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
+    break;
+
+  default:
+    // Unrecognized windows, print out its major and minor versions
+    st->print("%d.%d", major_version, minor_version);
+    break;
+  }
+
+  // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
+  // find out whether we are running on 64 bit processor or not
+  SYSTEM_INFO si;
+  ZeroMemory(&si, sizeof(SYSTEM_INFO));
+  os::Kernel32Dll::GetNativeSystemInfo(&si);
+  if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
     st->print(" , 64 bit");
   }
 
-  st->print(" Build %d", osvi.dwBuildNumber);
-  st->print(" %s", osvi.szCSDVersion);           // service pack
+  st->print(" Build %d", build_number);
+  st->print(" (%d.%d.%d.%d)", major_version, minor_version, build_number, build_minor);
   st->cr();
 }
 
@@ -1807,6 +1839,7 @@
     GetModuleFileName(vm_lib_handle, buf, buflen);
   }
   strncpy(saved_jvm_path, buf, MAX_PATH);
+  saved_jvm_path[MAX_PATH - 1] = '\0';
 }
 
 
@@ -3719,8 +3752,12 @@
 
   // search system directory
   if ((size = GetSystemDirectory(path, pathLen)) > 0) {
-    strcat(path, "\\");
-    strcat(path, name);
+    if (size >= pathLen) {
+      return NULL; // truncated
+    }
+    if (jio_snprintf(path + size, pathLen - size, "\\%s", name) == -1) {
+      return NULL; // truncated
+    }
     if ((result = (HINSTANCE)os::dll_load(path, ebuf, ebuflen)) != NULL) {
       return result;
     }
@@ -3728,8 +3765,12 @@
 
   // try Windows directory
   if ((size = GetWindowsDirectory(path, pathLen)) > 0) {
-    strcat(path, "\\");
-    strcat(path, name);
+    if (size >= pathLen) {
+      return NULL; // truncated
+    }
+    if (jio_snprintf(path + size, pathLen - size, "\\%s", name) == -1) {
+      return NULL; // truncated
+    }
     if ((result = (HINSTANCE)os::dll_load(path, ebuf, ebuflen)) != NULL) {
       return result;
     }
@@ -3740,68 +3781,134 @@
   return NULL;
 }
 
-#define MIN_EXIT_MUTEXES 1
-#define MAX_EXIT_MUTEXES 16
-
-struct ExitMutexes {
-  DWORD count;
-  HANDLE handles[MAX_EXIT_MUTEXES];
-};
-
-static BOOL CALLBACK init_muts_call(PINIT_ONCE, PVOID ppmuts, PVOID*) {
-  static ExitMutexes muts;
-
-  muts.count = os::processor_count();
-  if (muts.count < MIN_EXIT_MUTEXES) {
-    muts.count = MIN_EXIT_MUTEXES;
-  } else if (muts.count > MAX_EXIT_MUTEXES) {
-    muts.count = MAX_EXIT_MUTEXES;
-  }
-
-  for (DWORD i = 0; i < muts.count; ++i) {
-    muts.handles[i] = CreateMutex(NULL, FALSE, NULL);
-    if (muts.handles[i] == NULL) {
-      return FALSE;
-    }
-  }
-  *((ExitMutexes**)ppmuts) = &muts;
+#define MAX_EXIT_HANDLES    16
+#define EXIT_TIMEOUT      1000 /* 1 sec */
+
+static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) {
+  InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect);
   return TRUE;
 }
 
 int os::win32::exit_process_or_thread(Ept what, int exit_code) {
+  // Basic approach:
+  //  - Each exiting thread registers its intent to exit and then does so.
+  //  - A thread trying to terminate the process must wait for all
+  //    threads currently exiting to complete their exit.
+
   if (os::win32::has_exit_bug()) {
-    static INIT_ONCE init_once_muts = INIT_ONCE_STATIC_INIT;
-    static ExitMutexes* pmuts;
-
-    if (!InitOnceExecuteOnce(&init_once_muts, init_muts_call, &pmuts, NULL)) {
-      warning("ExitMutex initialization failed in %s: %d\n", __FILE__, __LINE__);
-    } else if (WaitForMultipleObjects(pmuts->count, pmuts->handles,
-                                      (what != EPT_THREAD), // exiting process waits for all mutexes
-                                      INFINITE) == WAIT_FAILED) {
-      warning("ExitMutex acquisition failed in %s: %d\n", __FILE__, __LINE__);
+    // The array holds handles of the threads that have started exiting by calling
+    // _endthreadex().
+    // Should be large enough to avoid blocking the exiting thread due to lack of
+    // a free slot.
+    static HANDLE handles[MAX_EXIT_HANDLES];
+    static int handle_count = 0;
+
+    static INIT_ONCE init_once_crit_sect = INIT_ONCE_STATIC_INIT;
+    static CRITICAL_SECTION crit_sect;
+    int i, j;
+    DWORD res;
+    HANDLE hproc, hthr;
+
+    // The first thread that reached this point, initializes the critical section.
+    if (!InitOnceExecuteOnce(&init_once_crit_sect, init_crit_sect_call, &crit_sect, NULL)) {
+      warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__);
+    } else {
+      EnterCriticalSection(&crit_sect);
+
+      if (what == EPT_THREAD) {
+        // Remove from the array those handles of the threads that have completed exiting.
+        for (i = 0, j = 0; i < handle_count; ++i) {
+          res = WaitForSingleObject(handles[i], 0 /* don't wait */);
+          if (res == WAIT_TIMEOUT) {
+            handles[j++] = handles[i];
+          } else {
+            if (res != WAIT_OBJECT_0) {
+              warning("WaitForSingleObject failed in %s: %d\n", __FILE__, __LINE__);
+              // Don't keep the handle, if we failed waiting for it.
+            }
+            CloseHandle(handles[i]);
+          }
+        }
+
+        // If there's no free slot in the array of the kept handles, we'll have to
+        // wait until at least one thread completes exiting.
+        if ((handle_count = j) == MAX_EXIT_HANDLES) {
+          res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT);
+          if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
+            i = (res - WAIT_OBJECT_0);
+            handle_count = MAX_EXIT_HANDLES - 1;
+            for (; i < handle_count; ++i) {
+              handles[i] = handles[i + 1];
+            }
+          } else {
+            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+            // Don't keep handles, if we failed waiting for them.
+            for (i = 0; i < MAX_EXIT_HANDLES; ++i) {
+              CloseHandle(handles[i]);
+            }
+            handle_count = 0;
+          }
+        }
+
+        // Store a duplicate of the current thread handle in the array of handles.
+        hproc = GetCurrentProcess();
+        hthr = GetCurrentThread();
+        if (!DuplicateHandle(hproc, hthr, hproc, &handles[handle_count],
+                             0, FALSE, DUPLICATE_SAME_ACCESS)) {
+          warning("DuplicateHandle failed in %s: %d\n", __FILE__, __LINE__);
+        } else {
+          ++handle_count;
+        }
+
+        // The current exiting thread has stored its handle in the array, and now
+        // should leave the critical section before calling _endthreadex().
+
+      } else { // what != EPT_THREAD
+        if (handle_count > 0) {
+          // Before ending the process, make sure all the threads that had called
+          // _endthreadex() completed.
+          res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT);
+          if (res == WAIT_FAILED) {
+            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+          }
+          for (i = 0; i < handle_count; ++i) {
+            CloseHandle(handles[i]);
+          }
+          handle_count = 0;
+        }
+
+        // End the process, not leaving critical section.
+        // This makes sure no other thread executes exit-related code at the same
+        // time, thus a race is avoided.
+        if (what == EPT_PROCESS) {
+          ::exit(exit_code);
+        } else {
+          _exit(exit_code);
+        }
+      }
+
+      LeaveCriticalSection(&crit_sect);
     }
   }
 
-  switch (what) {
-  case EPT_THREAD:
+  // We are here if either
+  // - there's no 'race at exit' bug on this OS release;
+  // - initialization of the critical section failed (unlikely);
+  // - the current thread has stored its handle and left the critical section.
+  if (what == EPT_THREAD) {
     _endthreadex((unsigned)exit_code);
-    break;
-
-  case EPT_PROCESS:
+  } else if (what == EPT_PROCESS) {
     ::exit(exit_code);
-    break;
-
-  case EPT_PROCESS_DIE:
+  } else {
     _exit(exit_code);
-    break;
-  }
-
-  // should not reach here
+  }
+
+  // Should not reach here
   return exit_code;
 }
 
-#undef MIN_EXIT_MUTEXES
-#undef MAX_EXIT_MUTEXES
+#undef MAX_EXIT_HANDLES
+#undef EXIT_TIMEOUT
 
 void os::win32::setmode_streams() {
   _setmode(_fileno(stdin), _O_BINARY);
@@ -4047,10 +4154,6 @@
   return JNI_OK;
 }
 
-void os::init_3(void) {
-  return;
-}
-
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   DWORD old_status;
@@ -4792,27 +4895,46 @@
 // 3.  Collapse the interrupt_event, the JSR166 parker event, and the objectmonitor ParkEvent
 //     into a single win32 CreateEvent() handle.
 //
+// Assumption:
+//    Only one parker can exist on an event, which is why we allocate
+//    them per-thread. Multiple unparkers can coexist.
+//
 // _Event transitions in park()
 //   -1 => -1 : illegal
 //    1 =>  0 : pass - return immediately
-//    0 => -1 : block
+//    0 => -1 : block; then set _Event to 0 before returning
+//
+// _Event transitions in unpark()
+//    0 => 1 : just return
+//    1 => 1 : just return
+//   -1 => either 0 or 1; must signal target thread
+//         That is, we can safely transition _Event from -1 to either
+//         0 or 1.
 //
-// _Event serves as a restricted-range semaphore :
-//    -1 : thread is blocked
-//     0 : neutral  - thread is running or ready
-//     1 : signaled - thread is running or ready
+// _Event serves as a restricted-range semaphore.
+//   -1 : thread is blocked, i.e. there is a waiter
+//    0 : neutral: thread is running or ready,
+//        could have been signaled after a wait started
+//    1 : signaled - thread is running or ready
 //
-// Another possible encoding of _Event would be
-// with explicit "PARKED" and "SIGNALED" bits.
+// Another possible encoding of _Event would be with
+// explicit "PARKED" == 01b and "SIGNALED" == 10b bits.
+//
 
 int os::PlatformEvent::park(jlong Millis) {
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   guarantee(_ParkHandle != NULL , "Invariant");
   guarantee(Millis > 0          , "Invariant");
-  int v;
 
   // CONSIDER: defer assigning a CreateEvent() handle to the Event until
   // the initial park() operation.
-
+  // Consider: use atomic decrement instead of CAS-loop
+
+  int v;
   for (;;) {
     v = _Event;
     if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
@@ -4860,9 +4982,15 @@
 }
 
 void os::PlatformEvent::park() {
+  // Transitions for _Event:
+  //   -1 => -1 : illegal
+  //    1 =>  0 : pass - return immediately
+  //    0 => -1 : block; then set _Event to 0 before returning
+
   guarantee(_ParkHandle != NULL, "Invariant");
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
+  // Consider: use atomic decrement instead of CAS-loop
   int v;
   for (;;) {
     v = _Event;
@@ -4891,11 +5019,11 @@
   guarantee(_ParkHandle != NULL, "Invariant");
 
   // Transitions for _Event:
-  //    0 :=> 1
-  //    1 :=> 1
-  //   -1 :=> either 0 or 1; must signal target thread
-  //          That is, we can safely transition _Event from -1 to either
-  //          0 or 1.
+  //    0 => 1 : just return
+  //    1 => 1 : just return
+  //   -1 => either 0 or 1; must signal target thread
+  //         That is, we can safely transition _Event from -1 to either
+  //         0 or 1.
   // See also: "Semaphores in Plan 9" by Mullender & Cox
   //
   // Note: Forcing a transition from "-1" to "1" on an unpark() means
@@ -5303,11 +5431,6 @@
   return ::Module32Next(hSnapshot, lpme);
 }
 
-
-inline BOOL os::Kernel32Dll::GetNativeSystemInfoAvailable() {
-  return true;
-}
-
 inline void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) {
   ::GetNativeSystemInfo(lpSystemInfo);
 }
--- a/hotspot/src/os/windows/vm/os_windows.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -210,7 +210,6 @@
   static BOOL Module32First(HANDLE,LPMODULEENTRY32);
   static BOOL Module32Next(HANDLE,LPMODULEENTRY32);
 
-  static BOOL GetNativeSystemInfoAvailable();
   static void GetNativeSystemInfo(LPSYSTEM_INFO);
 
   // NUMA calls
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -910,7 +910,7 @@
    */
   char* hint = (char*) (Linux::initial_thread_stack_bottom() -
                         ((StackYellowPages + StackRedPages + 1) * page_size));
-  char* codebuf = os::reserve_memory(page_size, hint);
+  char* codebuf = os::attempt_reserve_memory_at(page_size, hint);
   if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) {
     return; // No matter, we tried, best effort.
   }
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Fri Nov 07 13:58:52 2014 -0500
@@ -411,7 +411,7 @@
                 "/export:jio_vsnprintf "+
                 "/export:JVM_GetVersionInfo "+
                 "/export:JVM_InitAgentProperties");
-        addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib");
+        addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib");
         addAttr(rv, "OutputFile", outDll);
         addAttr(rv, "SuppressStartupBanner", "true");
         addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -553,6 +553,7 @@
 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
 
 bool ClassLoaderDataGraph::_should_purge = false;
+bool ClassLoaderDataGraph::_metaspace_oom = false;
 
 // Add a new class loader data node to the list.  Assign the newly created
 // ClassLoaderData into the java/lang/ClassLoader object as a hidden field
@@ -804,12 +805,17 @@
   ClassLoaderData* list = _unloading;
   _unloading = NULL;
   ClassLoaderData* next = list;
+  bool classes_unloaded = false;
   while (next != NULL) {
     ClassLoaderData* purge_me = next;
     next = purge_me->next();
     delete purge_me;
+    classes_unloaded = true;
   }
-  Metaspace::purge();
+  if (classes_unloaded) {
+    Metaspace::purge();
+    set_metaspace_oom(false);
+  }
 }
 
 void ClassLoaderDataGraph::post_class_unload_events(void) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -68,6 +68,9 @@
   static ClassLoaderData* _saved_head;
   static ClassLoaderData* _saved_unloading;
   static bool _should_purge;
+  // OOM has been seen in metaspace allocation. Used to prevent some
+  // allocations until class unloading
+  static bool _metaspace_oom;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
   static void post_class_unload_events(void);
@@ -107,6 +110,9 @@
     }
   }
 
+  static bool has_metaspace_oom()           { return _metaspace_oom; }
+  static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
+
   static void free_deallocate_lists();
 
   static void dump_on(outputStream * const out) PRODUCT_RETURN;
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -185,6 +185,14 @@
     lm.print("\n");
     log(thread, "%s", (const char*)lm);
   }
+
+  void log_metaspace_failure(const char* reason) {
+    ResourceMark rm;
+    StringLogMessage lm;
+    lm.print("%4d   COMPILE PROFILING SKIPPED: %s", -1, reason);
+    lm.print("\n");
+    log(JavaThread::current(), "%s", (const char*)lm);
+  }
 };
 
 static CompilationLog* _compilation_log = NULL;
@@ -1817,6 +1825,18 @@
     warning("Cannot open log file: %s", file_name);
 }
 
+void CompileBroker::log_metaspace_failure() {
+  const char* message = "some methods may not be compiled because metaspace "
+                        "is out of memory";
+  if (_compilation_log != NULL) {
+    _compilation_log->log_metaspace_failure(message);
+  }
+  if (PrintCompilation) {
+    tty->print_cr("COMPILE PROFILING SKIPPED: %s", message);
+  }
+}
+
+
 // ------------------------------------------------------------------
 // CompileBroker::set_should_block
 //
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -471,6 +471,9 @@
   static int get_sum_nmethod_code_size() {        return _sum_nmethod_code_size; }
   static long get_peak_compilation_time() {       return _peak_compilation_time; }
   static long get_total_compilation_time() {      return _t_total_compilation.milliseconds(); }
+
+  // Log that compilation profiling is skipped because metaspace is full.
+  static void log_metaspace_failure();
 };
 
 #endif // SHARE_VM_COMPILER_COMPILEBROKER_HPP
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -714,12 +714,17 @@
     int class_list_path_len = (int)strlen(class_list_path_str);
     if (class_list_path_len >= 3) {
       if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
-        strcat(class_list_path_str, os::file_separator());
-        strcat(class_list_path_str, "lib");
+        if (class_list_path_len < JVM_MAXPATHLEN - 4) {
+          strncat(class_list_path_str, os::file_separator(), 1);
+          strncat(class_list_path_str, "lib", 3);
+        }
       }
     }
-    strcat(class_list_path_str, os::file_separator());
-    strcat(class_list_path_str, "classlist");
+    class_list_path_len = (int)strlen(class_list_path_str);
+    if (class_list_path_len < JVM_MAXPATHLEN - 10) {
+      strncat(class_list_path_str, os::file_separator(), 1);
+      strncat(class_list_path_str, "classlist", 9);
+    }
     class_list_path = class_list_path_str;
   } else {
     class_list_path = SharedClassListFile;
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -277,7 +277,7 @@
   bool has_stackmap_table() const { return _stackmap_data != NULL; }
 
   void init_fingerprint() {
-    const uint64_t initval = CONST64(0x8000000000000000);
+    const uint64_t initval = UCONST64(0x8000000000000000);
     _fingerprint = initval;
   }
 
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1730,6 +1730,25 @@
   return id;
 }
 
+// Figure out how many jmethodIDs haven't been allocated, and make
+// sure space for them is pre-allocated.  This makes getting all
+// method ids much, much faster with classes with more than 8
+// methods, and has a *substantial* effect on performance with jvmti
+// code that loads all jmethodIDs for all classes.
+void InstanceKlass::ensure_space_for_methodids(int start_offset) {
+  int new_jmeths = 0;
+  int length = methods()->length();
+  for (int index = start_offset; index < length; index++) {
+    Method* m = methods()->at(index);
+    jmethodID id = m->find_jmethod_id_or_null();
+    if (id == NULL) {
+      new_jmeths++;
+    }
+  }
+  if (new_jmeths != 0) {
+    Method::ensure_jmethod_ids(class_loader_data(), new_jmeths);
+  }
+}
 
 // Common code to fetch the jmethodID from the cache or update the
 // cache with the new jmethodID. This function should never do anything
@@ -2499,7 +2518,7 @@
   // If this is an anonymous class, append a hash to make the name unique
   if (is_anonymous()) {
     intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
-    sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
+    jio_snprintf(hash_buf, sizeof(hash_buf), "/" UINTX_FORMAT, (uintx)hash);
     hash_len = (int)strlen(hash_buf);
   }
 
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -698,6 +698,7 @@
                      jmethodID** to_dealloc_jmeths_p);
   static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
                 size_t *length_p, jmethodID* id_p);
+  void ensure_space_for_methodids(int start_offset = 0);
   jmethodID jmethod_id_or_null(Method* method);
 
   // annotations support
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -368,6 +368,13 @@
 // Build a MethodData* object to hold information about this method
 // collected in the interpreter.
 void Method::build_interpreter_method_data(methodHandle method, TRAPS) {
+  // Do not profile the method if metaspace has hit an OOM previously
+  // allocating profiling data. Callers clear pending exception so don't
+  // add one here.
+  if (ClassLoaderDataGraph::has_metaspace_oom()) {
+    return;
+  }
+
   // Do not profile method if current thread holds the pending list lock,
   // which avoids deadlock for acquiring the MethodData_lock.
   if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
@@ -379,7 +386,13 @@
   MutexLocker ml(MethodData_lock, THREAD);
   if (method->method_data() == NULL) {
     ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
-    MethodData* method_data = MethodData::allocate(loader_data, method, CHECK);
+    MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      CompileBroker::log_metaspace_failure();
+      ClassLoaderDataGraph::set_metaspace_oom(true);
+      return;   // return the exception (which is cleared)
+    }
+
     method->set_method_data(method_data);
     if (PrintMethodData && (Verbose || WizardMode)) {
       ResourceMark rm(THREAD);
@@ -392,9 +405,19 @@
 }
 
 MethodCounters* Method::build_method_counters(Method* m, TRAPS) {
+  // Do not profile the method if metaspace has hit an OOM previously
+  if (ClassLoaderDataGraph::has_metaspace_oom()) {
+    return NULL;
+  }
+
   methodHandle mh(m);
   ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
-  MethodCounters* counters = MethodCounters::allocate(loader_data, CHECK_NULL);
+  MethodCounters* counters = MethodCounters::allocate(loader_data, THREAD);
+  if (HAS_PENDING_EXCEPTION) {
+    CompileBroker::log_metaspace_failure();
+    ClassLoaderDataGraph::set_metaspace_oom(true);
+    return NULL;   // return the exception (which is cleared)
+  }
   if (!mh->init_method_counters(counters)) {
     MetadataFactory::free_metadata(loader_data, counters);
   }
@@ -1708,59 +1731,98 @@
 // jmethodID handling
 
 // This is a block allocating object, sort of like JNIHandleBlock, only a
-// lot simpler.  There aren't many of these, they aren't long, they are rarely
-// deleted and so we can do some suboptimal things.
+// lot simpler.
 // It's allocated on the CHeap because once we allocate a jmethodID, we can
 // never get rid of it.
-// It would be nice to be able to parameterize the number of methods for
-// the null_class_loader but then we'd have to turn this and ClassLoaderData
-// into templates.
+
+static const int min_block_size = 8;
+
+class JNIMethodBlockNode : public CHeapObj<mtClass> {
+  friend class JNIMethodBlock;
+  Method**        _methods;
+  int             _number_of_methods;
+  int             _top;
+  JNIMethodBlockNode* _next;
+
+ public:
+
+  JNIMethodBlockNode(int num_methods = min_block_size);
 
-// I feel like this brain dead class should exist somewhere in the STL
+  ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods, mtInternal); }
+
+  void ensure_methods(int num_addl_methods) {
+    if (_top < _number_of_methods) {
+      num_addl_methods -= _number_of_methods - _top;
+      if (num_addl_methods <= 0) {
+        return;
+      }
+    }
+    if (_next == NULL) {
+      _next = new JNIMethodBlockNode(MAX2(num_addl_methods, min_block_size));
+    } else {
+      _next->ensure_methods(num_addl_methods);
+    }
+  }
+};
 
 class JNIMethodBlock : public CHeapObj<mtClass> {
-  enum { number_of_methods = 8 };
-
-  Method*         _methods[number_of_methods];
-  int             _top;
-  JNIMethodBlock* _next;
+  JNIMethodBlockNode _head;
+  JNIMethodBlockNode *_last_free;
  public:
   static Method* const _free_method;
 
-  JNIMethodBlock() : _next(NULL), _top(0) {
-    for (int i = 0; i< number_of_methods; i++) _methods[i] = _free_method;
+  JNIMethodBlock(int initial_capacity = min_block_size)
+      : _head(initial_capacity), _last_free(&_head) {}
+
+  void ensure_methods(int num_addl_methods) {
+    _last_free->ensure_methods(num_addl_methods);
   }
 
   Method** add_method(Method* m) {
-    if (_top < number_of_methods) {
-      // top points to the next free entry.
-      int i = _top;
-      _methods[i] = m;
-      _top++;
-      return &_methods[i];
-    } else if (_top == number_of_methods) {
-      // if the next free entry ran off the block see if there's a free entry
-      for (int i = 0; i< number_of_methods; i++) {
-        if (_methods[i] == _free_method) {
-          _methods[i] = m;
-          return &_methods[i];
+    for (JNIMethodBlockNode* b = _last_free; b != NULL; b = b->_next) {
+      if (b->_top < b->_number_of_methods) {
+        // top points to the next free entry.
+        int i = b->_top;
+        b->_methods[i] = m;
+        b->_top++;
+        _last_free = b;
+        return &(b->_methods[i]);
+      } else if (b->_top == b->_number_of_methods) {
+        // if the next free entry ran off the block see if there's a free entry
+        for (int i = 0; i < b->_number_of_methods; i++) {
+          if (b->_methods[i] == _free_method) {
+            b->_methods[i] = m;
+            _last_free = b;
+            return &(b->_methods[i]);
+          }
         }
+        // Only check each block once for frees.  They're very unlikely.
+        // Increment top past the end of the block.
+        b->_top++;
       }
-      // Only check each block once for frees.  They're very unlikely.
-      // Increment top past the end of the block.
-      _top++;
+      // need to allocate a next block.
+      if (b->_next == NULL) {
+        b->_next = _last_free = new JNIMethodBlockNode();
+      }
     }
-    // need to allocate a next block.
-    if (_next == NULL) {
-      _next = new JNIMethodBlock();
-    }
-    return _next->add_method(m);
+    guarantee(false, "Should always allocate a free block");
+    return NULL;
   }
 
   bool contains(Method** m) {
-    for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
-      for (int i = 0; i< number_of_methods; i++) {
-        if (&(b->_methods[i]) == m) {
+    if (m == NULL) return false;
+    for (JNIMethodBlockNode* b = &_head; b != NULL; b = b->_next) {
+      if (b->_methods <= m && m < b->_methods + b->_number_of_methods) {
+        // This is a bit of extra checking, for two reasons.  One is
+        // that contains() deals with pointers that are passed in by
+        // JNI code, so making sure that the pointer is aligned
+        // correctly is valuable.  The other is that <= and > are
+        // technically not defined on pointers, so the if guard can
+        // pass spuriously; no modern compiler is likely to make that
+        // a problem, though (and if one did, the guard could also
+        // fail spuriously, which would be bad).
+        ptrdiff_t idx = m - b->_methods;
+        if (b->_methods + idx == m) {
           return true;
         }
       }
@@ -1779,9 +1841,9 @@
   // During class unloading the methods are cleared, which is different
   // than freed.
   void clear_all_methods() {
-    for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
-      for (int i = 0; i< number_of_methods; i++) {
-        _methods[i] = NULL;
+    for (JNIMethodBlockNode* b = &_head; b != NULL; b = b->_next) {
+      for (int i = 0; i< b->_number_of_methods; i++) {
+        b->_methods[i] = NULL;
       }
     }
   }
@@ -1789,9 +1851,9 @@
   int count_methods() {
     // count all allocated methods
     int count = 0;
-    for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
-      for (int i = 0; i< number_of_methods; i++) {
-        if (_methods[i] != _free_method) count++;
+    for (JNIMethodBlockNode* b = &_head; b != NULL; b = b->_next) {
+      for (int i = 0; i< b->_number_of_methods; i++) {
+        if (b->_methods[i] != _free_method) count++;
       }
     }
     return count;
@@ -1802,6 +1864,36 @@
 // Something that can't be mistaken for an address or a markOop
 Method* const JNIMethodBlock::_free_method = (Method*)55;
 
+JNIMethodBlockNode::JNIMethodBlockNode(int num_methods) : _next(NULL), _top(0) {
+  _number_of_methods = MAX2(num_methods, min_block_size);
+  _methods = NEW_C_HEAP_ARRAY(Method*, _number_of_methods, mtInternal);
+  for (int i = 0; i < _number_of_methods; i++) {
+    _methods[i] = JNIMethodBlock::_free_method;
+  }
+}
+
+void Method::ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity) {
+  ClassLoaderData* cld = loader_data;
+  if (!SafepointSynchronize::is_at_safepoint()) {
+    // Have to add jmethod_ids() to class loader data thread-safely.
+    // Also have to add the method to the list safely, which the cld lock
+    // protects as well.
+    MutexLockerEx ml(cld->metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+    if (cld->jmethod_ids() == NULL) {
+      cld->set_jmethod_ids(new JNIMethodBlock(capacity));
+    } else {
+      cld->jmethod_ids()->ensure_methods(capacity);
+    }
+  } else {
+    // At safepoint, we are single threaded and can set this.
+    if (cld->jmethod_ids() == NULL) {
+      cld->set_jmethod_ids(new JNIMethodBlock(capacity));
+    } else {
+      cld->jmethod_ids()->ensure_methods(capacity);
+    }
+  }
+}
+
 // Add a method id to the jmethod_ids
 jmethodID Method::make_jmethod_id(ClassLoaderData* loader_data, Method* m) {
   ClassLoaderData* cld = loader_data;
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/oops/method.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -729,6 +729,11 @@
   static jmethodID make_jmethod_id(ClassLoaderData* loader_data, Method* mh);
   static void destroy_jmethod_id(ClassLoaderData* loader_data, jmethodID mid);
 
+  // Ensure there is enough capacity in the internal tracking data
+  // structures to hold the number of jmethodIDs you plan to generate.
+  // This saves substantial time doing allocations.
+  static void ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity);
+
   // Use resolve_jmethod_id() in situations where the caller is expected
   // to provide a valid jmethodID; the only sanity checks are in asserts;
   // result guaranteed not to be NULL.
--- a/hotspot/src/share/vm/opto/mulnode.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/opto/mulnode.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -610,7 +610,7 @@
   // convert masks which would cause a sign extension of the integer
   // value.  This check includes UI2L masks (0x00000000FFFFFFFF) which
   // would be optimized away later in Identity.
-  if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF80000000)) == 0) {
+  if (op == Op_ConvI2L && (mask & UCONST64(0xFFFFFFFF80000000)) == 0) {
     Node* andi = new AndINode(in1->in(1), phase->intcon(mask));
     andi = phase->transform(andi);
     return new ConvI2LNode(andi);
--- a/hotspot/src/share/vm/prims/jni.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/prims/jni.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -951,8 +951,9 @@
 
   // Optimized path if we have the bitvector form of signature
   void iterate( uint64_t fingerprint ) {
-    if ( fingerprint == UCONST64(-1) ) SignatureIterator::iterate();// Must be too many arguments
-    else {
+    if (fingerprint == (uint64_t)CONST64(-1)) {
+      SignatureIterator::iterate(); // Must be too many arguments
+    } else {
       _return_type = (BasicType)((fingerprint >> static_feature_size) &
                                   result_feature_mask);
 
@@ -1022,8 +1023,9 @@
 
   // Optimized path if we have the bitvector form of signature
   void iterate( uint64_t fingerprint ) {
-    if ( fingerprint == UCONST64(-1) ) SignatureIterator::iterate(); // Must be too many arguments
-    else {
+    if (fingerprint == (uint64_t)CONST64(-1)) {
+      SignatureIterator::iterate(); // Must be too many arguments
+    } else {
       _return_type = (BasicType)((fingerprint >> static_feature_size) &
                                   result_feature_mask);
       assert(fingerprint, "Fingerprint should not be 0");
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -2583,7 +2583,14 @@
 int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
   // see bug 4399518, 4417214
   if ((intptr_t)count <= 0) return -1;
-  return vsnprintf(str, count, fmt, args);
+
+  int result = vsnprintf(str, count, fmt, args);
+  if ((result > 0 && (size_t)result >= count) || result == -1) {
+    str[count - 1] = '\0';
+    result = -1;
+  }
+
+  return result;
 }
 
 ATTRIBUTE_PRINTF(3, 0)
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -2263,6 +2263,8 @@
   int result_length = instanceK_h->methods()->length();
   jmethodID* result_list = (jmethodID*)jvmtiMalloc(result_length * sizeof(jmethodID));
   int index;
+  bool jmethodids_found = true;
+
   if (JvmtiExport::can_maintain_original_method_order()) {
     // Use the original method ordering indices stored in the class, so we can emit
     // jmethodIDs in the order they appeared in the class file
@@ -2270,14 +2272,40 @@
       Method* m = instanceK_h->methods()->at(index);
       int original_index = instanceK_h->method_ordering()->at(index);
       assert(original_index >= 0 && original_index < result_length, "invalid original method index");
-      jmethodID id = m->jmethod_id();
+      jmethodID id;
+      if (jmethodids_found) {
+        id = m->find_jmethod_id_or_null();
+        if (id == NULL) {
+          // If we find an uninitialized value, make sure there is
+          // enough space for all the uninitialized values we might
+          // find.
+          instanceK_h->ensure_space_for_methodids(index);
+          jmethodids_found = false;
+          id = m->jmethod_id();
+        }
+      } else {
+        id = m->jmethod_id();
+      }
       result_list[original_index] = id;
     }
   } else {
     // otherwise just copy in any order
     for (index = 0; index < result_length; index++) {
       Method* m = instanceK_h->methods()->at(index);
-      jmethodID id = m->jmethod_id();
+      jmethodID id;
+      if (jmethodids_found) {
+        id = m->find_jmethod_id_or_null();
+        if (id == NULL) {
+          // If we find an uninitialized value, make sure there is
+          // enough space for all the uninitialized values we might
+          // find.
+          instanceK_h->ensure_space_for_methodids(index);
+          jmethodids_found = false;
+          id = m->jmethod_id();
+        }
+      } else {
+        id = m->jmethod_id();
+      }
       result_list[index] = id;
     }
   }
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -802,8 +802,7 @@
 
 static inline void throw_new(JNIEnv *env, const char *ename) {
   char buf[100];
-  strcpy(buf, "java/lang/");
-  strcat(buf, ename);
+  jio_snprintf(buf, 100, "%s%s", "java/lang/", ename);
   jclass cls = env->FindClass(buf);
   if (env->ExceptionCheck()) {
     env->ExceptionClear();
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -282,7 +282,7 @@
 // NMT picks it up correctly
 WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size))
   jlong addr = 0;
-    addr = (jlong)(uintptr_t)os::malloc(size, mtTest);
+  addr = (jlong)(uintptr_t)os::malloc(size, mtTest);
   return addr;
 WB_END
 
@@ -291,7 +291,7 @@
 WB_ENTRY(jlong, WB_NMTMallocWithPseudoStack(JNIEnv* env, jobject o, jlong size, jint pseudo_stack))
   address pc = (address)(size_t)pseudo_stack;
   NativeCallStack stack(&pc, 1);
-  return (jlong)os::malloc(size, mtTest, stack);
+  return (jlong)(uintptr_t)os::malloc(size, mtTest, stack);
 WB_END
 
 // Free the memory allocated by NMTAllocTest
@@ -326,15 +326,6 @@
   return MemTracker::tracking_level() == NMT_detail;
 WB_END
 
-WB_ENTRY(void, WB_NMTOverflowHashBucket(JNIEnv* env, jobject o, jlong num))
-  address pc = (address)1;
-  for (jlong index = 0; index < num; index ++) {
-    NativeCallStack stack(&pc, 1);
-    os::malloc(0, mtTest, stack);
-    pc += MallocSiteTable::hash_buckets();
-  }
-WB_END
-
 WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env))
   // Test that we can downgrade NMT levels but not upgrade them.
   if (MemTracker::tracking_level() == NMT_off) {
@@ -365,6 +356,12 @@
     return MemTracker::tracking_level() == NMT_minimal;
   }
 WB_END
+
+WB_ENTRY(jint, WB_NMTGetHashSize(JNIEnv* env, jobject o))
+  int hash_size = MallocSiteTable::hash_buckets();
+  assert(hash_size > 0, "NMT hash_size should be > 0");
+  return (jint)hash_size;
+WB_END
 #endif // INCLUDE_NMT
 
 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
@@ -992,9 +989,9 @@
   {CC"NMTCommitMemory",     CC"(JJ)V",                (void*)&WB_NMTCommitMemory    },
   {CC"NMTUncommitMemory",   CC"(JJ)V",                (void*)&WB_NMTUncommitMemory  },
   {CC"NMTReleaseMemory",    CC"(JJ)V",                (void*)&WB_NMTReleaseMemory   },
-  {CC"NMTOverflowHashBucket", CC"(J)V",               (void*)&WB_NMTOverflowHashBucket},
   {CC"NMTIsDetailSupported",CC"()Z",                  (void*)&WB_NMTIsDetailSupported},
   {CC"NMTChangeTrackingLevel", CC"()Z",               (void*)&WB_NMTChangeTrackingLevel},
+  {CC"NMTGetHashSize",      CC"()I",                  (void*)&WB_NMTGetHashSize     },
 #endif // INCLUDE_NMT
   {CC"deoptimizeAll",      CC"()V",                   (void*)&WB_DeoptimizeAll     },
   {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Executable;Z)I",
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -54,7 +54,7 @@
 #endif // INCLUDE_ALL_GCS
 
 // Note: This is a special bug reporting site for the JVM
-#define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
+#define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
 #define DEFAULT_JAVA_LAUNCHER  "generic"
 
 // Disable options not supported in this release, with a warning if they
--- a/hotspot/src/share/vm/runtime/globals.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -28,6 +28,7 @@
 #include "runtime/arguments.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/globals_extension.hpp"
+#include "runtime/os.hpp"
 #include "utilities/ostream.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/top.hpp"
@@ -818,15 +819,12 @@
   trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin);
   char* new_value = NULL;
   if (*value != NULL) {
-    new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1, mtInternal);
-    strcpy(new_value, *value);
+    new_value = os::strdup_check_oom(*value);
   }
   result->set_ccstr(new_value);
   if (result->is_default() && old_value != NULL) {
     // Prior value is NOT heap allocated, but was a literal constant.
-    char* old_value_to_free = NEW_C_HEAP_ARRAY(char, strlen(old_value)+1, mtInternal);
-    strcpy(old_value_to_free, old_value);
-    old_value = old_value_to_free;
+    old_value = os::strdup_check_oom(old_value);
   }
   *value = old_value;
   result->set_origin(origin);
@@ -838,8 +836,7 @@
   guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
   ccstr old_value = faddr->get_ccstr();
   trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin);
-  char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal);
-  strcpy(new_value, value);
+  char* new_value = os::strdup_check_oom(value);
   faddr->set_ccstr(new_value);
   if (!faddr->is_default() && old_value != NULL) {
     // Prior value is heap allocated so free it.
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -2066,9 +2066,6 @@
           "Provide more detailed and expensive TLAB statistics "            \
           "(with PrintTLAB)")                                               \
                                                                             \
-  EMBEDDED_ONLY(product(bool, LowMemoryProtection, true,                    \
-          "Enable LowMemoryProtection"))                                    \
-                                                                            \
   product_pd(bool, NeverActAsServerClassMachine,                            \
           "Never act like a server-class machine")                          \
                                                                             \
--- a/hotspot/src/share/vm/runtime/java.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -705,25 +705,35 @@
 }
 
 void JDK_Version::to_string(char* buffer, size_t buflen) const {
+  assert(buffer && buflen > 0, "call with useful buffer");
   size_t index = 0;
+
   if (!is_valid()) {
     jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
   } else if (is_partially_initialized()) {
     jio_snprintf(buffer, buflen, "%s", "(uninitialized) pre-1.6.0");
   } else {
-    index += jio_snprintf(
+    int rc = jio_snprintf(
         &buffer[index], buflen - index, "%d.%d", _major, _minor);
+    if (rc == -1) return;
+    index += rc;
     if (_micro > 0) {
-      index += jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
+      rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
     }
     if (_update > 0) {
-      index += jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
+      rc = jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
+      if (rc == -1) return;
+      index += rc;
     }
     if (_special > 0) {
-      index += jio_snprintf(&buffer[index], buflen - index, "%c", _special);
+      rc = jio_snprintf(&buffer[index], buflen - index, "%c", _special);
+      if (rc == -1) return;
+      index += rc;
     }
     if (_build > 0) {
-      index += jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
+      rc = jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
+      if (rc == -1) return;
+      index += rc;
     }
   }
 }
--- a/hotspot/src/share/vm/runtime/os.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/os.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -571,17 +571,6 @@
   NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
   NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
 
-#if INCLUDE_NMT
-  // NMT can not track malloc allocation size > MAX_MALLOC_SIZE, which is
-  // (1GB - 1) on 32-bit system. It is not an issue on 64-bit system, where
-  // MAX_MALLOC_SIZE = ((1 << 62) - 1).
-  // VM code does not have such large malloc allocation. However, it can come
-  // Unsafe call.
-  if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) {
-    return NULL;
-  }
-#endif
-
 #ifdef ASSERT
   // checking for the WatcherThread and crash_protection first
   // since os::malloc can be called when the libjvm.{dll,so} is
@@ -652,12 +641,6 @@
 }
 
 void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
-#if INCLUDE_NMT
-  // See comments in os::malloc() above
-  if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) {
-    return NULL;
-  }
-#endif
 
 #ifndef ASSERT
   NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
--- a/hotspot/src/share/vm/runtime/os.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -158,7 +158,6 @@
   static void init_globals(void) {             // Called from init_globals() in init.cpp
     init_globals_ext();
   }
-  static void init_3(void);                    // Called at the end of vm init
 
   // File names are case-insensitive on windows only
   // Override me as needed
--- a/hotspot/src/share/vm/runtime/signature.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/signature.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -158,7 +158,7 @@
   uint64_t saved_fingerprint = fingerprint;
 
   // Check for too many arguments
-  if ( fingerprint == UCONST64(-1) ) {
+  if (fingerprint == (uint64_t)CONST64(-1)) {
     SignatureIterator::iterate_parameters();
     return;
   }
--- a/hotspot/src/share/vm/runtime/signature.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/signature.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -243,7 +243,7 @@
     }
 
     if (mh->size_of_parameters() > max_size_of_parameters ) {
-      _fingerprint = UCONST64(-1);
+      _fingerprint = (uint64_t)CONST64(-1);
       mh->constMethod()->set_fingerprint(_fingerprint);
       return _fingerprint;
     }
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -3617,9 +3617,6 @@
     }
   }
 
-  // Give os specific code one last chance to start
-  os::init_3();
-
   create_vm_timer.end();
 #ifdef ASSERT
   _vm_complete = true;
@@ -3642,7 +3639,7 @@
 
   if (!agent->valid()) {
     char buffer[JVM_MAXPATHLEN];
-    char ebuf[1024];
+    char ebuf[1024] = "";
     const char *name = agent->name();
     const char *msg = "Could not find agent library ";
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1594,6 +1594,7 @@
            declare_type(JvmtiAgentThread, JavaThread)                     \
            declare_type(ServiceThread, JavaThread)                        \
   declare_type(CompilerThread, JavaThread)                                \
+  declare_type(CodeCacheSweeperThread, JavaThread)                        \
   declare_toplevel_type(OSThread)                                         \
   declare_toplevel_type(JavaFrameAnchor)                                  \
                                                                           \
--- a/hotspot/src/share/vm/services/jmm.h	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/jmm.h	Fri Nov 07 13:58:52 2014 -0500
@@ -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/hotspot/src/share/vm/services/mallocTracker.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/mallocTracker.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -72,7 +72,7 @@
 
   MallocMemorySummary::record_free(size(), flags());
   MallocMemorySummary::record_free_malloc_header(sizeof(MallocHeader));
-  if (tracking_level() == NMT_detail) {
+  if (MemTracker::tracking_level() == NMT_detail) {
     MallocSiteTable::deallocation_at(size(), _bucket_idx, _pos_idx);
   }
 }
@@ -128,36 +128,18 @@
   }
 
   // Uses placement global new operator to initialize malloc header
-  switch(level) {
-    case NMT_off:
-      return malloc_base;
-    case NMT_minimal: {
-      MallocHeader* hdr = ::new (malloc_base) MallocHeader();
-      break;
-    }
-    case NMT_summary: {
-      assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
-      header = ::new (malloc_base) MallocHeader(size, flags);
-      break;
-    }
-    case NMT_detail: {
-      assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
-      header = ::new (malloc_base) MallocHeader(size, flags, stack);
-      break;
-    }
-    default:
-      ShouldNotReachHere();
+
+  if (level == NMT_off) {
+    return malloc_base;
   }
+
+  header = ::new (malloc_base)MallocHeader(size, flags, stack, level);
   memblock = (void*)((char*)malloc_base + sizeof(MallocHeader));
 
   // The alignment check: 8 bytes alignment for 32 bit systems.
   //                      16 bytes alignment for 64-bit systems.
   assert(((size_t)memblock & (sizeof(size_t) * 2 - 1)) == 0, "Alignment check");
 
-  // Sanity check
-  assert(get_memory_tracking_level(memblock) == level,
-    "Wrong tracking level");
-
 #ifdef ASSERT
   if (level > NMT_minimal) {
     // Read back
--- a/hotspot/src/share/vm/services/mallocTracker.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/mallocTracker.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -239,68 +239,46 @@
 
 class MallocHeader VALUE_OBJ_CLASS_SPEC {
 #ifdef _LP64
-  size_t           _size      : 62;
-  size_t           _level     : 2;
+  size_t           _size      : 64;
   size_t           _flags     : 8;
   size_t           _pos_idx   : 16;
   size_t           _bucket_idx: 40;
 #define MAX_MALLOCSITE_TABLE_SIZE ((size_t)1 << 40)
 #define MAX_BUCKET_LENGTH         ((size_t)(1 << 16))
-#define MAX_MALLOC_SIZE           (((size_t)1 << 62) - 1)
 #else
-  size_t           _size      : 30;
-  size_t           _level     : 2;
+  size_t           _size      : 32;
   size_t           _flags     : 8;
   size_t           _pos_idx   : 8;
   size_t           _bucket_idx: 16;
 #define MAX_MALLOCSITE_TABLE_SIZE  ((size_t)(1 << 16))
 #define MAX_BUCKET_LENGTH          ((size_t)(1 << 8))
-// Max malloc size = 1GB - 1 on 32 bit system, such has total 4GB memory
-#define MAX_MALLOC_SIZE            ((size_t)(1 << 30) - 1)
 #endif  // _LP64
 
  public:
-  // Summary tracking header
-  MallocHeader(size_t size, MEMFLAGS flags) {
-    assert(sizeof(MallocHeader) == sizeof(void*) * 2,
-      "Wrong header size");
-
-    _level = NMT_summary;
-    _flags = flags;
-    set_size(size);
-    MallocMemorySummary::record_malloc(size, flags);
-    MallocMemorySummary::record_new_malloc_header(sizeof(MallocHeader));
-  }
-  // Detail tracking header
-  MallocHeader(size_t size, MEMFLAGS flags, const NativeCallStack& stack) {
+  MallocHeader(size_t size, MEMFLAGS flags, const NativeCallStack& stack, NMT_TrackingLevel level) {
     assert(sizeof(MallocHeader) == sizeof(void*) * 2,
       "Wrong header size");
 
-    _level = NMT_detail;
+    if (level == NMT_minimal) {
+      return;
+    }
+
     _flags = flags;
     set_size(size);
-    size_t bucket_idx;
-    size_t pos_idx;
-    if (record_malloc_site(stack, size, &bucket_idx, &pos_idx)) {
-      assert(bucket_idx <= MAX_MALLOCSITE_TABLE_SIZE, "Overflow bucket index");
-      assert(pos_idx <= MAX_BUCKET_LENGTH, "Overflow bucket position index");
-      _bucket_idx = bucket_idx;
-      _pos_idx = pos_idx;
+    if (level == NMT_detail) {
+      size_t bucket_idx;
+      size_t pos_idx;
+      if (record_malloc_site(stack, size, &bucket_idx, &pos_idx)) {
+        assert(bucket_idx <= MAX_MALLOCSITE_TABLE_SIZE, "Overflow bucket index");
+        assert(pos_idx <= MAX_BUCKET_LENGTH, "Overflow bucket position index");
+        _bucket_idx = bucket_idx;
+        _pos_idx = pos_idx;
+      }
     }
+
     MallocMemorySummary::record_malloc(size, flags);
     MallocMemorySummary::record_new_malloc_header(sizeof(MallocHeader));
   }
-  // Minimal tracking header
-  MallocHeader() {
-    assert(sizeof(MallocHeader) == sizeof(void*) * 2,
-      "Wrong header size");
-
-    _level = (unsigned short)NMT_minimal;
-  }
-
-  inline NMT_TrackingLevel tracking_level() const {
-    return (NMT_TrackingLevel)_level;
-  }
 
   inline size_t   size()  const { return _size; }
   inline MEMFLAGS flags() const { return (MEMFLAGS)_flags; }
@@ -311,7 +289,6 @@
 
  private:
   inline void set_size(size_t size) {
-    assert(size <= MAX_MALLOC_SIZE, "Malloc size too large, should use virtual memory?");
     _size = size;
   }
   bool record_malloc_site(const NativeCallStack& stack, size_t size,
@@ -347,10 +324,6 @@
   // Record free on specified memory block
   static void* record_free(void* memblock);
 
-  // Get tracking level of specified memory block
-  static inline NMT_TrackingLevel get_memory_tracking_level(void* memblock);
-
-
   // Offset memory address to header address
   static inline void* get_base(void* memblock);
   static inline void* get_base(void* memblock, NMT_TrackingLevel level) {
@@ -361,16 +334,12 @@
   // Get memory size
   static inline size_t get_size(void* memblock) {
     MallocHeader* header = malloc_header(memblock);
-    assert(header->tracking_level() >= NMT_summary,
-      "Wrong tracking level");
     return header->size();
   }
 
   // Get memory type
   static inline MEMFLAGS get_flags(void* memblock) {
     MallocHeader* header = malloc_header(memblock);
-    assert(header->tracking_level() >= NMT_summary,
-      "Wrong tracking level");
     return header->flags();
   }
 
@@ -394,7 +363,6 @@
   static inline MallocHeader* malloc_header(void *memblock) {
     assert(memblock != NULL, "NULL pointer");
     MallocHeader* header = (MallocHeader*)((char*)memblock - sizeof(MallocHeader));
-    assert(header->tracking_level() >= NMT_minimal, "Bad header");
     return header;
   }
 };
--- a/hotspot/src/share/vm/services/mallocTracker.inline.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/mallocTracker.inline.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -28,13 +28,6 @@
 #include "services/mallocTracker.hpp"
 #include "services/memTracker.hpp"
 
-inline NMT_TrackingLevel MallocTracker::get_memory_tracking_level(void* memblock) {
-  assert(memblock != NULL, "Sanity check");
-  if (MemTracker::tracking_level() == NMT_off) return NMT_off;
-  MallocHeader* header = malloc_header(memblock);
-  return header->tracking_level();
-}
-
 inline void* MallocTracker::get_base(void* memblock){
   return get_base(memblock, MemTracker::tracking_level());
 }
--- a/hotspot/src/share/vm/services/management.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/management.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1333,7 +1333,7 @@
         GrowableArray<oop>* locked_monitors = frame->locked_monitors();
         for (j = 0; j < len; j++) {
           oop monitor = locked_monitors->at(j);
-          assert(monitor != NULL && monitor->is_instance(), "must be a Java object");
+          assert(monitor != NULL, "must be a Java object");
           monitors_array->obj_at_put(count, monitor);
           depths_array->int_at_put(count, depth);
           count++;
@@ -1343,7 +1343,7 @@
       GrowableArray<oop>* jni_locked_monitors = stacktrace->jni_locked_monitors();
       for (j = 0; j < jni_locked_monitors->length(); j++) {
         oop object = jni_locked_monitors->at(j);
-        assert(object != NULL && object->is_instance(), "must be a Java object");
+        assert(object != NULL, "must be a Java object");
         monitors_array->obj_at_put(count, object);
         // Monitor locked via JNI MonitorEnter call doesn't have stack depth info
         depths_array->int_at_put(count, -1);
@@ -1572,6 +1572,9 @@
   } else if (flag->is_uint64_t()) {
     global->value.j = (jlong)flag->get_uint64_t();
     global->type = JMM_VMGLOBAL_TYPE_JLONG;
+  } else if (flag->is_double()) {
+    global->value.d = (jdouble)flag->get_double();
+    global->type = JMM_VMGLOBAL_TYPE_JDOUBLE;
   } else if (flag->is_size_t()) {
     global->value.j = (jlong)flag->get_size_t();
     global->type = JMM_VMGLOBAL_TYPE_JLONG;
--- a/hotspot/src/share/vm/services/runtimeService.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/runtimeService.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -38,6 +38,7 @@
 PerfCounter*  RuntimeService::_total_safepoints = NULL;
 PerfCounter*  RuntimeService::_safepoint_time_ticks = NULL;
 PerfCounter*  RuntimeService::_application_time_ticks = NULL;
+double RuntimeService::_last_safepoint_sync_time_sec = 0.0;
 
 void RuntimeService::init() {
   // Make sure the VM version is initialized
@@ -96,6 +97,7 @@
 
   // update the time stamp to begin recording safepoint time
   _safepoint_timer.update();
+  _last_safepoint_sync_time_sec = 0.0;
   if (UsePerfData) {
     _total_safepoints->inc();
     if (_app_timer.is_updated()) {
@@ -108,6 +110,9 @@
   if (UsePerfData) {
     _sync_time_ticks->inc(_safepoint_timer.ticks_since_update());
   }
+  if (PrintGCApplicationStoppedTime) {
+    _last_safepoint_sync_time_sec = last_safepoint_time_sec();
+  }
 }
 
 void RuntimeService::record_safepoint_end() {
@@ -119,8 +124,10 @@
     gclog_or_tty->date_stamp(PrintGCDateStamps);
     gclog_or_tty->stamp(PrintGCTimeStamps);
     gclog_or_tty->print_cr("Total time for which application threads "
-                           "were stopped: %3.7f seconds",
-                           last_safepoint_time_sec());
+                           "were stopped: %3.7f seconds, "
+                           "Stopping threads took: %3.7f seconds",
+                           last_safepoint_time_sec(),
+                           _last_safepoint_sync_time_sec);
   }
 
   // update the time stamp to begin recording app time
--- a/hotspot/src/share/vm/services/runtimeService.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/runtimeService.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -37,6 +37,7 @@
 
   static TimeStamp _safepoint_timer;
   static TimeStamp _app_timer;
+  static double _last_safepoint_sync_time_sec;
 
 public:
   static void init();
--- a/hotspot/src/share/vm/services/threadService.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/services/threadService.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -597,7 +597,7 @@
     GrowableArray<oop>* locked_monitors = frame->locked_monitors();
     for (int j = 0; j < len; j++) {
       oop monitor = locked_monitors->at(j);
-      assert(monitor != NULL && monitor->is_instance(), "must be a Java object");
+      assert(monitor != NULL, "must be a Java object");
       if (monitor == object) {
         found = true;
         break;
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -1048,7 +1048,7 @@
 const int      badResourceValue = 0xAB;                     // value used to zap resource area
 const int      freeBlockPad     = 0xBA;                     // value used to pad freed blocks.
 const int      uninitBlockPad   = 0xF1;                     // value used to zap newly malloc'd blocks.
-const intptr_t badJNIHandleVal  = (intptr_t) CONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
+const intptr_t badJNIHandleVal  = (intptr_t) UCONST64(0xFEFEFEFEFEFEFEFE); // value used to zap jni handle area
 const juint    badHeapWordVal   = 0xBAADBABE;               // value used to zap heap after GC
 const juint    badMetaWordVal   = 0xBAADFADE;               // value used to zap metadata heap after GC
 const int      badCodeHeapNewVal= 0xCC;                     // value used to zap Code heap at allocation
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Fri Nov 07 13:58:52 2014 -0500
@@ -151,11 +151,11 @@
 // Constant for jlong (specifying an long long constant is C++ compiler specific)
 
 // Build a 64bit integer constant on with Visual C++
-#define CONST64(x)  (x ## i64)
-#define UCONST64(x) ((uint64_t)CONST64(x))
+#define  CONST64(x) (x ##  i64)
+#define UCONST64(x) (x ## ui64)
 
-const jlong min_jlong = CONST64(0x8000000000000000);
-const jlong max_jlong = CONST64(0x7fffffffffffffff);
+const jlong min_jlong = (jlong)UCONST64(0x8000000000000000);
+const jlong max_jlong =         CONST64(0x7fffffffffffffff);
 
 //----------------------------------------------------------------------------------------------------
 // Miscellaneous
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -76,6 +76,8 @@
                                        const char* format, va_list ap,
                                        bool add_cr,
                                        size_t& result_len) {
+  assert(buflen >= 2, "buffer too small");
+
   const char* result;
   if (add_cr)  buflen--;
   if (!strchr(format, '%')) {
@@ -88,14 +90,21 @@
     result = va_arg(ap, const char*);
     result_len = strlen(result);
     if (add_cr && result_len >= buflen)  result_len = buflen-1;  // truncate
-  } else if (vsnprintf(buffer, buflen, format, ap) >= 0) {
+  } else {
+    // Handle truncation:
+    // posix: upon truncation, vsnprintf returns number of bytes which
+    //   would have been written (excluding terminating zero) had the buffer
+    //   been large enough
+    // windows: upon truncation, vsnprintf returns -1
+    const int written = vsnprintf(buffer, buflen, format, ap);
     result = buffer;
-    result_len = strlen(result);
-  } else {
-    DEBUG_ONLY(warning("increase O_BUFLEN in ostream.hpp -- output truncated");)
-    result = buffer;
-    result_len = buflen - 1;
-    buffer[result_len] = 0;
+    if (written < (int) buflen && written >= 0) {
+      result_len = written;
+    } else {
+      DEBUG_ONLY(warning("increase O_BUFLEN in ostream.hpp -- output truncated");)
+      result_len = buflen - 1;
+      buffer[result_len] = 0;
+    }
   }
   if (add_cr) {
     if (result != buffer) {
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Fri Nov 07 13:58:52 2014 -0500
@@ -975,11 +975,13 @@
     // Run error reporting to determine whether or not to report the crash.
     if (!transmit_report_done && should_report_bug(first_error->_id)) {
       transmit_report_done = true;
-      FILE* hs_err = os::open(log.fd(), "r");
+      const int fd2 = ::dup(log.fd());
+      FILE* const hs_err = ::fdopen(fd2, "r");
       if (NULL != hs_err) {
         ErrorReporter er;
         er.call(hs_err, buffer, O_BUFLEN);
       }
+      ::fclose(hs_err);
     }
 
     if (log.fd() != defaultStream::output_fd()) {
--- a/hotspot/test/TEST.ROOT	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/TEST.ROOT	Fri Nov 07 13:58:52 2014 -0500
@@ -30,3 +30,4 @@
 keys=cte_test jcmd nmt regression gc stress
 
 groups=TEST.groups [closed/TEST.groups]
+requires.properties=sun.arch.data.model
--- a/hotspot/test/TEST.groups	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/TEST.groups	Fri Nov 07 13:58:52 2014 -0500
@@ -87,7 +87,6 @@
   runtime/NMT/SummarySanityCheck.java \
   runtime/NMT/ThreadedMallocTestType.java \
   runtime/NMT/ThreadedVirtualAllocTestType.java \
-  runtime/NMT/UnsafeMallocLimit.java \
   runtime/NMT/VirtualAllocCommitUncommitRecommit.java \
   runtime/NMT/VirtualAllocTestType.java \
   runtime/RedefineObject/TestRedefineObject.java \
--- a/hotspot/test/runtime/7194254/Test7194254.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/runtime/7194254/Test7194254.java	Fri Nov 07 13:58:52 2014 -0500
@@ -27,6 +27,7 @@
  * @summary Creates several threads with different java priorities and checks
  *      whether jstack reports correct priorities for them.
  *
+ * @ignore 8060219
  * @run main Test7194254
  */
 
--- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java	Fri Nov 07 13:58:52 2014 -0500
@@ -24,41 +24,56 @@
 /*
  * @test
  * @summary Test corner case that overflows malloc site hashtable bucket
+ * @requires sun.arch.data.model == "32"
  * @key nmt jcmd stress
  * @library /testlibrary /testlibrary/whitebox
- * @ignore - This test is disabled since it will stress NMT and timeout during normal testing
+ * @ignore 8062870
  * @build MallocSiteHashOverflow
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=480 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
  */
 
 import com.oracle.java.testlibrary.*;
 import sun.hotspot.WhiteBox;
 
 public class MallocSiteHashOverflow {
-    private static long K = 1024;
+
     public static void main(String args[]) throws Exception {
-        String vm_name = System.getProperty("java.vm.name");
 
+        // Size of entries based on malloc tracking header defined in mallocTracker.hpp
         // For 32-bit systems, create 257 malloc sites with the same hash bucket to overflow a hash bucket
-        // For 64-bit systems, create 64K + 1 malloc sites with the same hash bucket to overflow a hash bucket
         long entries = 257;
-        if (Platform.is64bit()) {
-            entries = 64 * K + 1;
-        }
 
         OutputAnalyzer output;
         WhiteBox wb = WhiteBox.getWhiteBox();
+        int MAX_HASH_SIZE = wb.NMTGetHashSize();
 
         // Grab my own PID
         String pid = Integer.toString(ProcessTools.getProcessId());
         ProcessBuilder pb = new ProcessBuilder();
 
-        wb.NMTOverflowHashBucket(entries);
-
-        // Run 'jcmd <pid> VM.native_memory summary'
+        // Verify that current tracking level is "detail"
         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "statistics"});
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Tracking level has been downgraded due to lack of resources");
+        output.shouldContain("Native Memory Tracking Statistics");
+
+        // Attempt to cause NMT to downgrade tracking level by allocating small amounts
+        // of memory with random pseudo call stack
+        int pc = 1;
+        for (int i = 0; i < entries; i++) {
+            long addr = wb.NMTMallocWithPseudoStack(1, pc);
+            if (addr == 0) {
+                throw new RuntimeException("NMTMallocWithPseudoStack: out of memory");
+            }
+            // We free memory here since it doesn't affect pseudo malloc alloc site hash table entries
+            wb.NMTFree(addr);
+            pc += MAX_HASH_SIZE;
+            if (i == entries) {
+                // Verify that tracking has been downgraded
+                pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "statistics"});
+                output = new OutputAnalyzer(pb.start());
+                output.shouldContain("Tracking level has been downgraded due to lack of resources");
+            }
+        }
     }
 }
--- a/hotspot/test/runtime/NMT/UnsafeMallocLimit.java	Wed Nov 05 16:28:11 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * 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 8055289
- * @library /testlibrary
- * @build UnsafeMallocLimit
- * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=summary UnsafeMallocLimit
- */
-
-import com.oracle.java.testlibrary.*;
-import sun.misc.Unsafe;
-
-public class UnsafeMallocLimit {
-
-    public static void main(String args[]) throws Exception {
-        if (Platform.is32bit()) {
-            Unsafe unsafe = Utils.getUnsafe();
-            try {
-                unsafe.allocateMemory(1 << 30);
-                throw new RuntimeException("Did not get expected OOME");
-            } catch (OutOfMemoryError e) {
-                // Expected exception
-            }
-        } else {
-            System.out.println("Test only valid on 32-bit platforms");
-        }
-    }
-}
--- a/hotspot/test/runtime/NMT/UnsafeMallocLimit2.java	Wed Nov 05 16:28:11 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * 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 8058818
- * @library /testlibrary
- * @build UnsafeMallocLimit2
- * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2
- */
-
-import com.oracle.java.testlibrary.*;
-import sun.misc.Unsafe;
-
-public class UnsafeMallocLimit2 {
-
-    public static void main(String args[]) throws Exception {
-        if (Platform.is32bit()) {
-            Unsafe unsafe = Utils.getUnsafe();
-            try {
-                // Allocate greater than MALLOC_MAX and likely won't fail to allocate,
-                // so it hits the NMT code that asserted.
-                // Test that this doesn't cause an assertion with NMT off.
-                // The option above overrides if all the tests are run with NMT on.
-                unsafe.allocateMemory(0x40000000);
-                System.out.println("Allocation succeeded");
-            } catch (OutOfMemoryError e) {
-                System.out.println("Allocation failed");
-            }
-        } else {
-            System.out.println("Test only valid on 32-bit platforms");
-        }
-    }
-}
--- a/hotspot/test/serviceability/threads/TestFalseDeadLock.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/serviceability/threads/TestFalseDeadLock.java	Fri Nov 07 13:58:52 2014 -0500
@@ -28,6 +28,7 @@
 
 /*
  * @test
+ * @ignore 8061157
  * @bug 8016304
  * @summary Make sure no deadlock is reported for this program which has no deadlocks.
  * @library /testlibrary
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Fri Nov 07 13:58:52 2014 -0500
@@ -98,10 +98,10 @@
   public native void NMTCommitMemory(long addr, long size);
   public native void NMTUncommitMemory(long addr, long size);
   public native void NMTReleaseMemory(long addr, long size);
-  public native void NMTOverflowHashBucket(long num);
   public native long NMTMallocWithPseudoStack(long size, int index);
   public native boolean NMTIsDetailSupported();
   public native boolean NMTChangeTrackingLevel();
+  public native int NMTGetHashSize();
 
   // Compiler
   public native void    deoptimizeAll();
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -34,7 +34,7 @@
  */
 
 public class DoubleTest {
-    private static final String FLAG_NAME = null;
+    private static final String FLAG_NAME = "CompileThresholdScaling";
     private static final Double[] TESTS = {0d, -0d, -1d, 1d,
             Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN,
             Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY};
--- a/jaxp/.hgtags	Wed Nov 05 16:28:11 2014 +0100
+++ b/jaxp/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
 61b4c9acaa58e482db6601ec5dc4fc3d2d8dbb55 jdk9-b36
 48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
+6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/jaxws/.hgtags	Wed Nov 05 16:28:11 2014 +0100
+++ b/jaxws/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -283,3 +283,4 @@
 afe0c89e2edbdfb1a7ceff3d9b3ff46c4186202f jdk9-b35
 84803c3be7f79d29c7dc40749d7743675f64107a jdk9-b36
 90de6ecbff46386a3f9d6f7ca876e7aa6381f50a jdk9-b37
+dd4ba422dba858b1c3c4b38f49a3e514be4e2790 jdk9-b38
--- a/jdk/.hgtags	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 e549291a0227031310fa91c574891f892d27f959 jdk9-b35
 cdcf2e599e42935c2d1d19a24bb19e808aeb43b5 jdk9-b36
 27c3345d6dce39a22c262f30bb1f0e0b00c3709e jdk9-b37
+d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/net/SocketImpl.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/file/package-info.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/security/tools/keytool/Main.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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.management/share/classes/com/sun/jmx/defaults/JmxProperties.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/test/ProblemList.txt	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/ProblemList.txt	Fri Nov 07 13:58:52 2014 -0500
@@ -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
+
 ############################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/GetSystemPackage.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/finalization/FinInterrupt.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/java/lang/Thread/ThreadStateController.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/java/lang/Thread/ThreadStateTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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.");
--- a/jdk/test/java/sql/testng/util/TestPolicy.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/java/sql/testng/util/TestPolicy.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/javax/naming/spi/providers/InitialContextTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/spi/SyncFactoryExceptionTests.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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/StubContext.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/StubSyncProvider.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/parse/EntityCharacterEventOrder.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/jdk/net/Sockets/SupportedOptions.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/autotest.sh	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/sun/security/tools/keytool/autotest.sh	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/jdk/test/sun/security/tools/keytool/standard.sh	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -280,3 +280,4 @@
 b8e7bbdd806465a916e64413c283075ceb0a782c jdk9-b35
 c536541235e566701ff772700c15de14b75e2979 jdk9-b36
 478972d90f7bf5002615c5b2fb1ec3e0338fcadd jdk9-b37
+5ad591bc3ef6d1b30b215cb9c228bf94aac6dc7c jdk9-b38
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/Types.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/Infer.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/Resolve.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/javap/JavapTask.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/SjavacClient.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFileMonitor.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/ServerMain.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/Makefile	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ /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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/lib/combo/tools/javac/combo/JavacTemplateTestBase.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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;
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TypeVarShadow.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/annotations/neg/8022765/VerifyErroneousAnnotationsAttributed.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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,
--- a/langtools/test/tools/javac/api/TestContainTypes.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/api/TestContainTypes.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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));
--- a/langtools/test/tools/javac/diags/ArgTypeCompilerFactory.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/diags/ArgTypeCompilerFactory.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/diags/Example.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/PluginNotFound.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -0,0 +1,2 @@
+error: plug-in not found: MissingPlugin
+1 error
--- a/langtools/test/tools/javac/plugin/showtype/Test.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/plugin/showtype/Test.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/tree/TypeAnnotationsPretty.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/javac/tree/TypeAnnotationsPretty.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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);
+            }
         }
     }
 
--- a/langtools/test/tools/lib/ToolBox.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/lib/ToolBox.java	Fri Nov 07 13:58:52 2014 -0500
@@ -1475,7 +1475,11 @@
                         @Override
                         public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
                             try {
-                                JarEntry e = new JarEntry(base.relativize(file).toString());
+                                String p = base.relativize(file)
+                                        .normalize()
+                                        .toString()
+                                        .replace(File.separatorChar, '/');
+                                JarEntry e = new JarEntry(p);
                                 jos.putNextEntry(e);
                                 jos.write(Files.readAllBytes(file));
                                 jos.closeEntry();
--- a/langtools/test/tools/sjavac/DependencyCollection.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/langtools/test/tools/sjavac/DependencyCollection.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/Javadoc.gmk	Wed Nov 05 16:28:11 2014 +0100
+++ b/make/Javadoc.gmk	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/make/Main.gmk	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/modules.xml	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/.hgtags	Fri Nov 07 13:58:52 2014 -0500
@@ -271,3 +271,4 @@
 63b8da4c958c3bbadfff082c547983f5daa50c0f jdk9-b35
 10fe62bc188476abb025e55f55128cbfecf24584 jdk9-b36
 dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
+365f55e7b3c45637bf912c88d31b32a127ad7429 jdk9-b38
--- a/nashorn/docs/source/EvalFile.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/EvalFile.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/EvalScript.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/InvokeScriptFunction.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/InvokeScriptMethod.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/MultiScopes.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/RunnableImpl.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/RunnableImplObject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/docs/source/ScriptVars.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/AssertsEnabled.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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,108 @@
         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 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 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 +249,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 +264,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 +291,8 @@
             }
         }
 
+        callSiteTypes.push(actualCallSiteType);
         explodedArguments.push(newParams);
-        return true;
     }
 
     @Override
@@ -288,11 +315,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 +346,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 +356,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 +378,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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Fri Nov 07 13:58:52 2014 -0500
@@ -323,9 +323,11 @@
      * 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 {
+    public static String getVersionDirName() throws Exception {
         final URL url = OptimisticTypesPersistence.class.getResource("");
         final String protocol = url.getProtocol();
         if (protocol.equals("jar")) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/objects/ArrayBufferView.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/NativeArrayBuffer.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/NativeString.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/parser/ParserContext.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContext.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextBaseNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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;
@@ -102,7 +103,7 @@
         } catch (final AccessControlException e) {
             context.getLogger(CodeStore.class).warning("failed to load code store provider ", e);
         }
-        final CodeStore store = new DirectoryCodeStore();
+        final CodeStore store = new DirectoryCodeStore(context);
         store.initLogger(context);
         return store;
     }
@@ -210,32 +211,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 +260,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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Fri Nov 07 13:58:52 2014 -0500
@@ -27,7 +27,6 @@
 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;
@@ -777,7 +776,7 @@
 
         // 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,29 +787,29 @@
         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");
 
         // 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);
@@ -871,6 +870,7 @@
         private SwitchPoint optimisticAssumptions;
         private final DebugLogger log;
 
+        @SuppressWarnings("unused")
         OptimismInfo(final RecompilableScriptFunctionData data, final Map<Integer, Type> invalidatedProgramPoints) {
             this.data = data;
             this.log  = data.getLogger();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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);
     }
@@ -529,6 +538,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 +1034,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 +1098,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,9 +1198,8 @@
 
         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.
+        // 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 = env._persistent_cache && !env._parse_only && !env._optimistic_types;
         final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Fri Nov 07 13:58:52 2014 -0500
@@ -475,6 +475,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) {
@@ -727,7 +728,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 +737,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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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/ScriptObject.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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;
@@ -922,7 +923,10 @@
                 if (property instanceof UserAccessorProperty) {
                     ((UserAccessorProperty)property).setAccessors(this, getMap(), null);
                 }
-                Global.getConstants().delete(property.getKey());
+                final GlobalConstants globalConstants = getGlobalConstants();
+                if (globalConstants != null) {
+                    globalConstants.delete(property.getKey());
+                }
                 return true;
             }
         }
@@ -1983,9 +1987,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 +2190,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)) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Fri Nov 07 13:58:52 2014 -0500
@@ -98,6 +98,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;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RecompilationEvent.java	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RecompilationEvent.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Option.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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-8047365.js	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/Window.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/OctaneTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/SplayTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/DessertTopping.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/FinalClass.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/FloorWax.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/OuterClass.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/OverloadedSam.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/OverrideObject.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/PropertyBind.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/SourceHelper.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/StringArgs.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/Toothpaste.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/models/VarArgConstructor.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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	Wed Nov 05 16:28:11 2014 +0100
+++ b/nashorn/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java	Fri Nov 07 13:58:52 2014 -0500
@@ -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) {