Merge
authorthartmann
Tue, 26 Jan 2016 09:11:58 +0100
changeset 35599 cc774aa3d2fe
parent 35598 8d7bc466f490 (current diff)
parent 35454 25ce76c109ab (diff)
child 35601 42c6406c3146
child 35602 1513b6586d6d
Merge
hotspot/src/share/vm/utilities/vmError.cpp
jdk/src/java.base/share/classes/java/lang/invoke/DontInline.java
jdk/src/java.base/share/classes/java/lang/invoke/ForceInline.java
jdk/src/java.base/share/classes/java/lang/invoke/Stable.java
jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java
jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java
jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java
jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolVisitor.java
jdk/src/java.base/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java
jdk/src/java.base/share/classes/sun/misc/ClassFileTransformer.java
jdk/test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java
--- a/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
 4379223f8806626852c46c52d4e7a27a584b406e jdk-9+100
 80f67512daa15cf37b4825c1c62a675d524d7c49 jdk-9+101
+2dc4c11fe48831854916d53c3913bdb7d49023ea jdk-9+102
--- a/.hgtags-top-repo	Mon Jan 25 14:09:28 2016 -1000
+++ b/.hgtags-top-repo	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
 c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
 c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
+6406ecf5d39482623225bb1b3098c2cac6f7d450 jdk-9+102
--- a/common/autoconf/build-performance.m4	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/build-performance.m4	Tue Jan 26 09:11:58 2016 +0100
@@ -37,9 +37,9 @@
     # Looks like a Solaris system
     NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
     FOUND_CORES=yes
-  elif test -x /usr/sbin/system_profiler; then
+  elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
-    NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
+    NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
     FOUND_CORES=yes
   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
     NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
@@ -74,10 +74,10 @@
     # Looks like a Solaris or AIX system
     MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
     FOUND_MEM=yes
-  elif test -x /usr/sbin/system_profiler; then
+  elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
-    MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
-    MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
+    MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
+    MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
     FOUND_MEM=yes
   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
     # Windows, but without cygwin
--- a/common/autoconf/flags.m4	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/flags.m4	Tue Jan 26 09:11:58 2016 +0100
@@ -403,7 +403,7 @@
     CXXFLAGS_DEBUG_SYMBOLS="-g"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     CFLAGS_DEBUG_SYMBOLS="-g -xs"
-    # FIXME: likely a bug, this disables debug symbols rather than enables them
+    # -g0 enables debug symbols without disabling inlining.
     CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     CFLAGS_DEBUG_SYMBOLS="-g"
@@ -501,7 +501,7 @@
       C_O_FLAG_HI="-O3 -qstrict"
       C_O_FLAG_NORM="-O2"
       C_O_FLAG_DEBUG="-qnoopt"
-      C_O_FLAG_NONE="-qnoop"
+      C_O_FLAG_NONE="-qnoopt"
     elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
       C_O_FLAG_HIGHEST="-O2"
       C_O_FLAG_HI="-O1"
--- a/common/autoconf/generated-configure.sh	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/generated-configure.sh	Tue Jan 26 09:11:58 2016 +0100
@@ -688,11 +688,11 @@
 FIXPATH_DETACH_FLAG
 FIXPATH
 GCOV_ENABLED
-ZIP_DEBUGINFO_FILES
-ENABLE_DEBUG_SYMBOLS
 STRIP_POLICY
 DEBUG_BINARIES
-NATIVE_DEBUG_SYMBOLS
+ZIP_EXTERNAL_DEBUG_SYMBOLS
+COPY_DEBUG_SYMBOLS
+COMPILE_WITH_DEBUG_SYMBOLS
 CFLAGS_WARNINGS_ARE_ERRORS
 DISABLE_WARNING_PREFIX
 HOTSPOT_SET_WARNINGS_AS_ERRORS
@@ -4119,6 +4119,16 @@
 
 
 
+    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+    # will basically do slowdebug builds when DEBUG_BINARIES is set for
+    # fastdebug builds
+    DEBUG_BINARIES=false
+    # Fastdebug builds with this setting will essentially be slowdebug
+    # in hotspot.
+    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+    # will basically do slowdebug builds when DEBUG_BINARIES is set for
+    # fastdebug builds
+    DEBUG_BINARIES=false
 #
 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4839,7 +4849,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1452780299
+DATE_WHEN_GENERATED=1453385294
 
 ###############################################################################
 #
@@ -14818,7 +14828,7 @@
       VAR_CPU_ENDIAN=big
       ;;
     powerpc64le)
-      VAR_CPU=ppc64
+      VAR_CPU=ppc64le
       VAR_CPU_ARCH=ppc
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=little
@@ -14957,7 +14967,7 @@
       VAR_CPU_ENDIAN=big
       ;;
     powerpc64le)
-      VAR_CPU=ppc64
+      VAR_CPU=ppc64le
       VAR_CPU_ARCH=ppc
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=little
@@ -47031,7 +47041,7 @@
     CXXFLAGS_DEBUG_SYMBOLS="-g"
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     CFLAGS_DEBUG_SYMBOLS="-g -xs"
-    # FIXME: likely a bug, this disables debug symbols rather than enables them
+    # -g0 enables debug symbols without disabling inlining.
     CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     CFLAGS_DEBUG_SYMBOLS="-g"
@@ -47249,7 +47259,7 @@
       C_O_FLAG_HI="-O3 -qstrict"
       C_O_FLAG_NORM="-O2"
       C_O_FLAG_DEBUG="-qnoopt"
-      C_O_FLAG_NONE="-qnoop"
+      C_O_FLAG_NONE="-qnoopt"
     elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
       C_O_FLAG_HIGHEST="-O2"
       C_O_FLAG_HI="-O1"
@@ -48271,21 +48281,31 @@
       fi
     fi
 
-    ENABLE_DEBUG_SYMBOLS=true
-    ZIP_DEBUGINFO_FILES=true
-    DEBUG_BINARIES=true
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=true
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=true
+
+    # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+    DEBUG_BINARIES=false
     STRIP_POLICY=min_strip
+
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
-    ENABLE_DEBUG_SYMBOLS=false
-    ZIP_DEBUGINFO_FILES=false
+    COMPILE_WITH_DEBUG_SYMBOLS=false
+    COPY_DEBUG_SYMBOLS=false
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
     DEBUG_BINARIES=false
     STRIP_POLICY=no_strip
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
-    ENABLE_DEBUG_SYMBOLS=false  # -g option only
-    ZIP_DEBUGINFO_FILES=false
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=false
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+    # Hotspot legacy support, will turn on -g when COPY_DEBUG_SYMBOLS=false
     DEBUG_BINARIES=true
     STRIP_POLICY=no_strip
     STRIP=""
+
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
 
     if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -48296,9 +48316,12 @@
       fi
     fi
 
-    ENABLE_DEBUG_SYMBOLS=true
-    ZIP_DEBUGINFO_FILES=false
-    DEBUG_BINARIES=true
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=true
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+    # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+    DEBUG_BINARIES=false
     STRIP_POLICY=min_strip
   else
     as_fn_error $? "Allowed native debug symbols are: none, internal, external, zipped" "$LINENO" 5
@@ -48348,6 +48371,8 @@
 
 
 
+  # Legacy values
+
 
 
 
@@ -59224,9 +59249,9 @@
     # Looks like a Solaris system
     NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
     FOUND_CORES=yes
-  elif test -x /usr/sbin/system_profiler; then
+  elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
-    NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print $5}'`
+    NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
     FOUND_CORES=yes
   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
     NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print $4 }'`
@@ -59278,10 +59303,10 @@
     # Looks like a Solaris or AIX system
     MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [Ss]ize" | awk '{ print $3 }'`
     FOUND_MEM=yes
-  elif test -x /usr/sbin/system_profiler; then
+  elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
-    MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print $2}'`
-    MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
+    MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
+    MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
     FOUND_MEM=yes
   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
     # Windows, but without cygwin
--- a/common/autoconf/hotspot-spec.gmk.in	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/hotspot-spec.gmk.in	Tue Jan 26 09:11:58 2016 +0100
@@ -118,7 +118,7 @@
 
 # Hotspot expects the variable FULL_DEBUG_SYMBOLS=1/0 to control debug symbols
 # creation.
-ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ifeq ($(COPY_DEBUG_SYMBOLS), true)
   FULL_DEBUG_SYMBOLS=1
   # Ensure hotspot uses the objcopy that configure located
   ALT_OBJCOPY:=$(OBJCOPY)
@@ -127,12 +127,15 @@
 endif
 
 # Hotspot expects the variable ZIP_DEBUGINFO_FILES=1/0 and not true/false.
-ifeq ($(ZIP_DEBUGINFO_FILES)$(ENABLE_DEBUG_SYMBOLS), truetrue)
+ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
   ZIP_DEBUGINFO_FILES:=1
 else
   ZIP_DEBUGINFO_FILES:=0
 endif
 
+DEBUG_BINARIES := @DEBUG_BINARIES@
+STRIP_POLICY := @STRIP_POLICY@
+
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # On Windows, the Visual Studio toolchain needs the LIB and INCLUDE
   # environment variables (in Windows path style).
--- a/common/autoconf/hotspot.m4	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/hotspot.m4	Tue Jan 26 09:11:58 2016 +0100
@@ -266,3 +266,14 @@
   HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
   AC_SUBST(HOTSPOT_MAKE_ARGS)
 ])
+
+    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+    # will basically do slowdebug builds when DEBUG_BINARIES is set for
+    # fastdebug builds
+    DEBUG_BINARIES=false
+    # Fastdebug builds with this setting will essentially be slowdebug
+    # in hotspot.
+    # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+    # will basically do slowdebug builds when DEBUG_BINARIES is set for
+    # fastdebug builds
+    DEBUG_BINARIES=false
\ No newline at end of file
--- a/common/autoconf/jdk-options.m4	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/jdk-options.m4	Tue Jan 26 09:11:58 2016 +0100
@@ -251,21 +251,31 @@
       fi
     fi
 
-    ENABLE_DEBUG_SYMBOLS=true
-    ZIP_DEBUGINFO_FILES=true
-    DEBUG_BINARIES=true
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=true
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=true
+
+    # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+    DEBUG_BINARIES=false
     STRIP_POLICY=min_strip
+    
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
-    ENABLE_DEBUG_SYMBOLS=false
-    ZIP_DEBUGINFO_FILES=false
+    COMPILE_WITH_DEBUG_SYMBOLS=false
+    COPY_DEBUG_SYMBOLS=false
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
     DEBUG_BINARIES=false
     STRIP_POLICY=no_strip
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
-    ENABLE_DEBUG_SYMBOLS=false  # -g option only
-    ZIP_DEBUGINFO_FILES=false
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=false
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+    # Hotspot legacy support, will turn on -g when COPY_DEBUG_SYMBOLS=false
     DEBUG_BINARIES=true
     STRIP_POLICY=no_strip
     STRIP=""
+    
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
 
     if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -276,9 +286,12 @@
       fi
     fi
 
-    ENABLE_DEBUG_SYMBOLS=true
-    ZIP_DEBUGINFO_FILES=false
-    DEBUG_BINARIES=true
+    COMPILE_WITH_DEBUG_SYMBOLS=true
+    COPY_DEBUG_SYMBOLS=true
+    ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+    # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+    DEBUG_BINARIES=false
     STRIP_POLICY=min_strip
   else
     AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
@@ -294,11 +307,13 @@
   BASIC_DEPRECATED_ARG_ENABLE(zip-debug-info, zip_debug_info,
                               [Please use --with-native-debug-symbols=zipped .])
 
-  AC_SUBST(NATIVE_DEBUG_SYMBOLS)
+  AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
+  AC_SUBST(COPY_DEBUG_SYMBOLS)
+  AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
+
+  # Legacy values
   AC_SUBST(DEBUG_BINARIES)
   AC_SUBST(STRIP_POLICY)
-  AC_SUBST(ENABLE_DEBUG_SYMBOLS)
-  AC_SUBST(ZIP_DEBUGINFO_FILES)
 ])
 
 ################################################################################
--- a/common/autoconf/platform.m4	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/platform.m4	Tue Jan 26 09:11:58 2016 +0100
@@ -67,7 +67,7 @@
       VAR_CPU_ENDIAN=big
       ;;
     powerpc64le)
-      VAR_CPU=ppc64
+      VAR_CPU=ppc64le
       VAR_CPU_ARCH=ppc
       VAR_CPU_BITS=64
       VAR_CPU_ENDIAN=little
--- a/common/autoconf/spec.gmk.in	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/autoconf/spec.gmk.in	Tue Jan 26 09:11:58 2016 +0100
@@ -424,13 +424,12 @@
 
 #
 # Options for generating debug symbols
-ENABLE_DEBUG_SYMBOLS:=@ENABLE_DEBUG_SYMBOLS@
+COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@
+COPY_DEBUG_SYMBOLS := @COPY_DEBUG_SYMBOLS@
+ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@
+
 CFLAGS_DEBUG_SYMBOLS:=@CFLAGS_DEBUG_SYMBOLS@
 CXXFLAGS_DEBUG_SYMBOLS:=@CXXFLAGS_DEBUG_SYMBOLS@
-ZIP_DEBUGINFO_FILES:=@ZIP_DEBUGINFO_FILES@
-NATIVE_DEBUG_SYMBOLS:=@NATIVE_DEBUG_SYMBOLS@
-DEBUG_BINARIES:=@DEBUG_BINARIES@
-STRIP_POLICY:=@STRIP_POLICY@
 
 #
 # Compress (or not) jars
--- a/common/bin/unshuffle_list.txt	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/bin/unshuffle_list.txt	Tue Jan 26 09:11:58 2016 +0100
@@ -378,6 +378,7 @@
 jdk/src/java.base/unix/conf/i586/jvm.cfg : jdk/src/solaris/bin/i586/jvm.cfg
 jdk/src/java.base/unix/conf/ia64/jvm.cfg : jdk/src/solaris/bin/ia64/jvm.cfg
 jdk/src/java.base/unix/conf/ppc64/jvm.cfg : jdk/src/solaris/bin/ppc64/jvm.cfg
+jdk/src/java.base/unix/conf/ppc64le/jvm.cfg : jdk/src/solaris/bin/ppc64le/jvm.cfg
 jdk/src/java.base/unix/conf/ppc/jvm.cfg : jdk/src/solaris/bin/ppc/jvm.cfg
 jdk/src/java.base/unix/conf/sdp/sdp.conf.template : jdk/src/solaris/lib/sdp/sdp.conf.template
 jdk/src/java.base/unix/conf/sparc/jvm.cfg : jdk/src/solaris/bin/sparc/jvm.cfg
--- a/common/conf/jib-profiles.js	Mon Jan 25 14:09:28 2016 -1000
+++ b/common/conf/jib-profiles.js	Tue Jan 26 09:11:58 2016 +0100
@@ -257,7 +257,7 @@
             target_os: "macosx",
             target_cpu: "x64",
             dependencies: concat(common.dependencies, "devkit"),
-            configure_args: concat(common.configure_args, "--with-sdk-name=macosx10.9"),
+            configure_args: common.configure_args,
             make_args: common.make_args
         },
 
--- a/corba/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/corba/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
 791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
 30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
+9c4662334d933d299928d1f599d02ff50777cbf8 jdk-9+102
--- a/corba/make/gensrc/Gensrc-java.corba.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/corba/make/gensrc/Gensrc-java.corba.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -62,9 +62,9 @@
 $(EXCEPTION_DIR)/%SystemException.java: \
     $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
     $(BUILD_TOOLS_CORBA)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating class file from $*.mc)
+	$(call MakeDir, $(@D))
 	$(RM) -f $(@D)/_the_wrappers.d
-	$(ECHO) $(LOG_INFO) Generating class file from $*.mc
 	$(TOOL_LOGUTIL_CMD) make-class $< $(@D)
 
 # Generate LogWrapper properties file by concatening resource files
@@ -77,17 +77,17 @@
     $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
     $(LOGWRAPPER_DIR)/POASystemException.resource \
     $(LOGWRAPPER_DIR)/UtilSystemException.resource
-	$(MKDIR) -p $(@D)
-	$(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
+	$(call LogInfo, Concatenating 8 resource files into $(@F))
+	$(call MakeDir, $(@D))
 	$(CAT) $^ > $@
 
 # The resources files are generated from lisp-like .mc files.
 $(LOGWRAPPER_DIR)/%SystemException.resource: \
     $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
     $(BUILD_TOOLS_CORBA)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating resource file from $*.mc)
+	$(call MakeDir, $(@D))
 	$(RM) -f $(@D)/_the_wrappers.d
-	$(ECHO) $(LOG_INFO) Generating resource file from $*.mc
 	$(TOOL_LOGUTIL_CMD) make-resource $< $(@D)
 
 
@@ -240,4 +240,3 @@
 
 all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
     $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
-
--- a/hotspot/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/hotspot/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -504,3 +504,4 @@
 f008e8cc10d5b3212fb22d58c96fa01d38654f19 jdk-9+99
 bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
 9f45d3d57d6948cf526fbc2e2891a9a74ac6941a jdk-9+101
+d5239fc1b69749ae50793c61b899fcdacf3df857 jdk-9+102
--- a/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -110,7 +110,6 @@
     LIBS := $(SA_LIBS), \
     MAPFILE := $(SA_MAPFILE), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsa, \
-    DEBUG_SYMBOLS := true, \
     STRIP_SYMBOLS := true, \
 ))
 
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -238,9 +238,14 @@
     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   #endif
 
-  return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
-         " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__
-         " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
+  #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+         " for " OS "-" CPU FLOAT_ARCH_STR \
+         " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+         " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+  return strcmp(DEBUG_LEVEL, "release") == 0
+      ? VMNAME " (" INTERNAL_VERSION_SUFFIX
+      : VMNAME " (" DEBUG_LEVEL " " INTERNAL_VERSION_SUFFIX;
 }
 
 const char *Abstract_VM_Version::vm_build_user() {
@@ -251,6 +256,11 @@
   return DEBUG_LEVEL;
 }
 
+const char *Abstract_VM_Version::printable_jdk_debug_level() {
+  // Debug level is not printed for "release" builds
+  return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
+}
+
 unsigned int Abstract_VM_Version::jvm_version() {
   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
--- a/hotspot/src/share/vm/runtime/vm_version.hpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -106,6 +106,7 @@
   static const char* internal_vm_info_string();
   static const char* jre_release_version();
   static const char* jdk_debug_level();
+  static const char* printable_jdk_debug_level();
 
   static uint64_t features() {
     return _features;
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -232,11 +232,17 @@
    const char* runtime_name = JDK_Version::runtime_name() != NULL ?
                                 JDK_Version::runtime_name() : "";
    const char* runtime_version = JDK_Version::runtime_version() != NULL ?
-                                JDK_Version::runtime_version() : "";
-   st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version);
+                                   JDK_Version::runtime_version() : "";
+   const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ?
+                                   Abstract_VM_Version::printable_jdk_debug_level() : "";
+
+   st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf,
+                 jdk_debug_level, runtime_version);
+
    // This is the long version with some default settings added
-   st->print_cr("# Java VM: %s (%s, %s%s%s%s%s, %s, %s)",
+   st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)",
                  Abstract_VM_Version::vm_name(),
+                 jdk_debug_level,
                  Abstract_VM_Version::vm_release(),
                  Abstract_VM_Version::vm_info_string(),
                  TieredCompilation ? ", tiered" : "",
--- a/jaxp/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 52774b544850c791f1d1c67db2601b33739b18c9 jdk-9+99
 d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
 d3e834ff74e724a2b92a558e18e8cbf81c6dbc59 jdk-9+101
+9dcf193c0b6cf22c0e89e2dc705a2c0f520ae064 jdk-9+102
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Tue Jan 26 09:11:58 2016 +0100
@@ -932,9 +932,9 @@
                     //Check if FSP and SM - only then process with loading
                     if (namespace != null && isSecureProcessing
                             && isExtensionFunctionEnabled
-                            && (namespace.equals(JAVA_EXT_XALAN)
-                            || namespace.equals(JAVA_EXT_XSLTC)
-                            || namespace.equals(JAVA_EXT_XALAN_OLD)
+                            && (namespace.startsWith(JAVA_EXT_XALAN)
+                            || namespace.startsWith(JAVA_EXT_XSLTC)
+                            || namespace.startsWith(JAVA_EXT_XALAN_OLD)
                             || namespace.startsWith(XALAN_CLASSPACKAGE_NAMESPACE))) {
                         _clazz = getXSLTC().loadExternalFunction(_className);
                     } else {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,6 +36,7 @@
 import com.sun.org.apache.xml.internal.serializer.ToHTMLStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -104,9 +105,9 @@
             }
         }
 
-        // Check if we have any declared namesaces
+        // Check if we have any declared namespaces
         if (_accessedPrefixes == null) {
-            _accessedPrefixes = new HashMap<>();
+            _accessedPrefixes = new Hashtable<>();
         }
         else {
             if (!declared) {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11DocumentScannerImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11DocumentScannerImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -331,7 +331,7 @@
                                                          new Object[]{entityName});
                                     }
                                 }
-                                fEntityManager.startEntity(false, entityName, true);
+                                fEntityManager.startEntity(true, entityName, true);
                             }
                         }
                     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Tue Jan 26 09:11:58 2016 +0100
@@ -904,7 +904,7 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
-        if (fCurrentEntity.reference) {
+        if (fCurrentEntity.isGE) {
             checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
         }
         content.setValues(fCurrentEntity.ch, offset, length);
@@ -1051,6 +1051,9 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
+        if (fCurrentEntity.isGE) {
+            checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
+        }
         content.setValues(fCurrentEntity.ch, offset, length);
 
         // return next character
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1155,7 +1155,7 @@
                             StaxXMLInputSource staxInputSource =  fEntityManager.resolveEntityAsPerStax(resourceIdentifier);
 
                             // Check access permission. If the source is resolved by a resolver, the check is skipped.
-                            if (!staxInputSource.hasResolver()) {
+                            if (!staxInputSource.isCreatedByResolver()) {
                                 String accessError = checkAccess(fDoctypeSystemId, fAccessExternalDTD);
                                 if (accessError != null) {
                                     reportFatalError("AccessExternalDTD", new Object[]{ SecuritySupport.sanitizePath(fDoctypeSystemId), accessError });
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1008,12 +1008,14 @@
         }
 
         // do default resolution
-        //this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
+        //this works for both stax & Xerces, if staxInputSource is null,
+        //it means parser need to revert to default resolution
         if (staxInputSource == null) {
             // REVISIT: when systemId is null, I think we should return null.
             //          is this the right solution? -SG
             //if (systemId != null)
-            staxInputSource = new StaxXMLInputSource(new XMLInputSource(publicId, literalSystemId, baseSystemId));
+            staxInputSource = new StaxXMLInputSource(
+                    new XMLInputSource(publicId, literalSystemId, baseSystemId), false);
         }else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
             //Waiting for the clarification from EG. - nb
         }
@@ -1108,7 +1110,7 @@
     /**
      * Starts a named entity.
      *
-     * @param reference flag to indicate whether the entity is an Entity Reference.
+     * @param isGE flag to indicate whether the entity is a General Entity
      * @param entityName The name of the entity to start.
      * @param literal    True if this entity is started within a literal
      *                   value.
@@ -1116,7 +1118,7 @@
      * @throws IOException  Thrown on i/o error.
      * @throws XNIException Thrown by entity handler to signal an error.
      */
-    public void startEntity(boolean reference, String entityName, boolean literal)
+    public void startEntity(boolean isGE, String entityName, boolean literal)
     throws IOException, XNIException {
 
         // was entity declared?
@@ -1240,7 +1242,7 @@
         }
 
         // start the entity
-        startEntity(reference, entityName, xmlInputSource, literal, external);
+        startEntity(isGE, entityName, xmlInputSource, literal, external);
 
     } // startEntity(String,boolean)
 
@@ -1289,7 +1291,7 @@
      * This method can be used to insert an application defined XML
      * entity stream into the parsing stream.
      *
-     * @param reference flag to indicate whether the entity is an Entity Reference.
+     * @param isGE flag to indicate whether the entity is a General Entity
      * @param name           The name of the entity.
      * @param xmlInputSource The input source of the entity.
      * @param literal        True if this entity is started within a
@@ -1299,12 +1301,12 @@
      * @throws IOException  Thrown on i/o error.
      * @throws XNIException Thrown by entity handler to signal an error.
      */
-    public void startEntity(boolean reference, String name,
+    public void startEntity(boolean isGE, String name,
             XMLInputSource xmlInputSource,
             boolean literal, boolean isExternal)
             throws IOException, XNIException {
 
-        String encoding = setupCurrentEntity(reference, name, xmlInputSource, literal, isExternal);
+        String encoding = setupCurrentEntity(isGE, name, xmlInputSource, literal, isExternal);
 
         //when entity expansion limit is set by the Application, we need to
         //check for the entity expansion limit set by the parser, if number of entity
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1038,7 +1038,7 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
-        if (fCurrentEntity.reference) {
+        if (fCurrentEntity.isGE) {
             checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
         }
 
@@ -1205,6 +1205,9 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
+        if (fCurrentEntity.isGE) {
+            checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
+        }
         content.setValues(fCurrentEntity.ch, offset, length);
 
         // return next character
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Tue Jan 26 09:11:58 2016 +0100
@@ -946,7 +946,7 @@
                                                 new Object[]{entityName});
                                     }
                                 }
-                                fEntityManager.startEntity(false, entityName, true);
+                                fEntityManager.startEntity(true, entityName, true);
                             }
                         }
                     }
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/Entity.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/Entity.java	Tue Jan 26 09:11:58 2016 +0100
@@ -344,8 +344,8 @@
         // to know that prolog is read
         public boolean xmlDeclChunkRead = false;
 
-        // flag to indicate whether the Entity is an Entity Reference
-        public boolean reference = false;
+        // flag to indicate whether the Entity is a General Entity
+        public boolean isGE = false;
 
         /** returns the name of the current encoding
          *  @return current encoding name
@@ -391,11 +391,11 @@
         //
 
         /** Constructs a scanned entity. */
-        public ScannedEntity(boolean reference, String name,
+        public ScannedEntity(boolean isGE, String name,
                 XMLResourceIdentifier entityLocation,
                 InputStream stream, Reader reader,
                 String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
-            this.reference = reference;
+            this.isGE = isGE;
             this.name = name ;
             this.entityLocation = entityLocation;
             this.stream = stream;
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Tue Jan 26 09:11:58 2016 +0100
@@ -71,12 +71,12 @@
         if(object == null) return null ;
 
         if(object  instanceof java.io.InputStream){
-            return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null));
+            return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null), true);
         }
         else if(object instanceof XMLStreamReader){
-            return new StaxXMLInputSource((XMLStreamReader)object) ;
+            return new StaxXMLInputSource((XMLStreamReader)object, true) ;
         }else if(object instanceof XMLEventReader){
-            return new StaxXMLInputSource((XMLEventReader)object) ;
+            return new StaxXMLInputSource((XMLEventReader)object, true) ;
         }
 
         return null ;
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,27 +43,22 @@
     XMLEventReader fEventReader ;
     XMLInputSource fInputSource ;
 
-    //indicate if the source is resolved by a resolver
-    boolean fHasResolver = false;
+    //indicates if the source is created by a resolver
+    boolean fIsCreatedByResolver = false;
 
     /** Creates a new instance of StaxXMLInputSource */
-    public StaxXMLInputSource(XMLStreamReader streamReader) {
+    public StaxXMLInputSource(XMLStreamReader streamReader, boolean byResolver) {
         fStreamReader = streamReader ;
     }
 
     /** Creates a new instance of StaxXMLInputSource */
-    public StaxXMLInputSource(XMLEventReader eventReader) {
+    public StaxXMLInputSource(XMLEventReader eventReader, boolean byResolver) {
         fEventReader = eventReader ;
     }
 
-    public StaxXMLInputSource(XMLInputSource inputSource){
+    public StaxXMLInputSource(XMLInputSource inputSource, boolean byResolver){
         fInputSource = inputSource ;
-
-    }
-
-    public StaxXMLInputSource(XMLInputSource inputSource, boolean hasResolver){
-        fInputSource = inputSource ;
-        fHasResolver = hasResolver;
+        fIsCreatedByResolver = byResolver;
     }
 
     public XMLStreamReader getXMLStreamReader(){
@@ -82,7 +77,7 @@
         return (fStreamReader == null) && (fEventReader == null) ? false : true ;
     }
 
-    public boolean hasResolver() {
-        return fHasResolver;
+    public boolean isCreatedByResolver() {
+        return fIsCreatedByResolver;
     }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java	Tue Jan 26 09:11:58 2016 +0100
@@ -351,7 +351,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code expression or type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(String expression, Object item, Class<T> type)
         throws XPathExpressionException {
@@ -399,7 +399,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code expression} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(String expression, Object item)
         throws XPathExpressionException
@@ -445,7 +445,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code expression, source or type}is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(String expression, InputSource source, Class<T> type)
         throws XPathExpressionException
@@ -486,7 +486,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code expression or source} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(String expression, InputSource source)
         throws XPathExpressionException
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathEvaluationResult.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathEvaluationResult.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  * @see <a href="http://www.w3.org/TR/xpath">XML Path Language (XPath) Version
  * 1.0</a>
  *
- * @since 1.9
+ * @since 9
  */
 public interface XPathEvaluationResult<T> {
 
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java	Tue Jan 26 09:11:58 2016 +0100
@@ -246,7 +246,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(Object item, Class<T> type)
         throws XPathExpressionException
@@ -292,7 +292,7 @@
      * does not support the
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(Object item)
         throws XPathExpressionException
@@ -338,7 +338,7 @@
      * is not available.
      * @throws NullPointerException If {@code source or type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(InputSource source, Class<T> type)
         throws XPathExpressionException
@@ -377,7 +377,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code source} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(InputSource source)
         throws XPathExpressionException
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathNodes.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathNodes.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  * in <a href="http://www.w3.org/TR/xpath/#node-sets">XML Path Language (XPath)
  * Version 1.0, 3.3 Node-sets</a>.
  *
- * @since 1.9
+ * @since 9
  */
 public interface XPathNodes extends Iterable<Node> {
 
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/DocumentRange.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/DocumentRange.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,7 +43,7 @@
 
 /**
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface DocumentRange {
     /**
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/Range.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/Range.java	Tue Jan 26 09:11:58 2016 +0100
@@ -47,7 +47,7 @@
 
 /**
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface Range {
     /**
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/RangeException.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/RangeException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -45,7 +45,7 @@
  * Range operations may throw a <code>RangeException</code> as specified in
  * their method descriptions.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public class RangeException extends RuntimeException {
     public RangeException(short code, String message) {
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/DocumentTraversal.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/DocumentTraversal.java	Tue Jan 26 09:11:58 2016 +0100
@@ -53,7 +53,7 @@
  * Traversal feature, <code>DocumentTraversal</code> will be implemented by
  * the same objects that implement the Document interface.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface DocumentTraversal {
     /**
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/NodeFilter.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/NodeFilter.java	Tue Jan 26 09:11:58 2016 +0100
@@ -59,7 +59,7 @@
  * filter may be used with a number of different kinds of traversals,
  * encouraging code reuse.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface NodeFilter {
     // Constants returned by acceptNode
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/NodeIterator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/NodeIterator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
  * <code>NodeIterators</code> are created by calling
  * <code>DocumentTraversal</code><code>.createNodeIterator()</code>.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface NodeIterator {
     /**
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/TreeWalker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/traversal/TreeWalker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -60,7 +60,7 @@
  * nodes will be siblings and appear as direct children of the root node, no
  * matter how deeply nested the structure of the original document.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface TreeWalker {
     /**
--- a/jaxws/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxws/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -347,3 +347,4 @@
 97b31ca0dd77483cf20ff99a033a455673639578 jdk-9+99
 d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
 3e99318616da903e0dc8f07f9f9203dc1bd49921 jdk-9+101
+0868b93587cc99df3a4f4d3817a1aa756bea60ab jdk-9+102
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContextFactory.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContextFactory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,7 +32,7 @@
  *
  * JAXBContextFactory can be located using {@link java.util.ServiceLoader#load(Class)}
  *
- * @since 1.9, JAXB 2.3
+ * @since 9, JAXB 2.3
  */
 public interface JAXBContextFactory {
 
@@ -68,7 +68,7 @@
      * @throws IllegalArgumentException
      *      if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);})
      *
-     * @since 1.9, JAXB 2.3
+     * @since 9, JAXB 2.3
      */
     JAXBContext createContext(Class<?>[] classesToBeBound,
                               Map<String, ?> properties ) throws JAXBException;
@@ -100,7 +100,7 @@
      *   <li>failure to locate a value for the context factory provider property</li>
      *   <li>mixing schema derived packages from different providers on the same contextPath</li>
      * </ol>
-     * @since 1.9, JAXB 2.3
+     * @since 9, JAXB 2.3
      */
     JAXBContext createContext(String contextPath,
                               ClassLoader classLoader,
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -38,6 +38,8 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.logging.Logger;
+import java.util.Optional;
+
 
 /**
  * Manages all the WebService HTTP servers created by JAXWS runtime.
@@ -81,24 +83,38 @@
             synchronized(servers) {
                 state = servers.get(inetAddress);
                 if (state == null) {
-                    logger.fine("Creating new HTTP Server at "+inetAddress);
-                    // Creates server with default socket backlog
-                    server = HttpServer.create(inetAddress, 0);
-                    server.setExecutor(Executors.newCachedThreadPool());
-                    String path = url.toURI().getPath();
-                    logger.fine("Creating HTTP Context at = "+path);
-                    HttpContext context = server.createContext(path);
-                    server.start();
+                    final int finalPortNum = port;
+                    Optional<ServerState> stateOpt =
+                               servers.values()
+                                       .stream()
+                                       .filter(s -> s.getServer()
+                                                     .getAddress()
+                                                     .getPort() == finalPortNum)
+                                       .findAny();
 
-                    // we have to get actual inetAddress from server, which can differ from the original in some cases.
-                    // e.g. A port number of zero will let the system pick up an ephemeral port in a bind operation,
-                    // or IP: 0.0.0.0 - which is used to monitor network traffic from any valid IP address
-                    inetAddress = server.getAddress();
+                    if (inetAddress.getAddress().isAnyLocalAddress() &&
+                        stateOpt.isPresent()) {
+                        state = stateOpt.get();
+                    } else {
+                        logger.fine("Creating new HTTP Server at "+inetAddress);
+                        // Creates server with default socket backlog
+                        server = HttpServer.create(inetAddress, 0);
+                        server.setExecutor(Executors.newCachedThreadPool());
+                        String path = url.toURI().getPath();
+                        logger.fine("Creating HTTP Context at = "+path);
+                        HttpContext context = server.createContext(path);
+                        server.start();
 
-                    logger.fine("HTTP server started = "+inetAddress);
-                    state = new ServerState(server, path);
-                    servers.put(inetAddress, state);
-                    return context;
+                        // we have to get actual inetAddress from server, which can differ from the original in some cases.
+                        // e.g. A port number of zero will let the system pick up an ephemeral port in a bind operation,
+                        // or IP: 0.0.0.0 - which is used to monitor network traffic from any valid IP address
+                        inetAddress = server.getAddress();
+
+                        logger.fine("HTTP server started = "+inetAddress);
+                        state = new ServerState(server, path);
+                        servers.put(inetAddress, state);
+                        return context;
+                    }
                 }
             }
             server = state.getServer();
--- a/jdk/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
 3d452840f48299a36842760d17c0c8402f0e1266 jdk-9+100
 5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
+6eb3c8132e489dab81adde4ce29844904ce15482 jdk-9+102
--- a/jdk/make/CompileDemos.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/CompileDemos.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -38,7 +38,8 @@
 include ZipArchive.gmk
 
 # Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
+$(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/demo \
+    $(JDK_TOPDIR)/src/*/demo)))
 
 # Append demo goals to this variable.
 TARGETS =
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/CompileTools.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,83 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+JIMAGE_PKGS := \
+    jdk/internal/jimage \
+    jdk/internal/jrtfs \
+    #
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
+    SETUP := GENERATE_OLDBYTECODE, \
+    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+    INCLUDES := $(JIMAGE_PKGS), \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
+
+TARGETS += $(BUILD_INTERIM_JIMAGE)
+
+# Because of the explicit INCLUDES in the compilation setup above, the service provider
+# file will not be copied unless META-INF/services would also be added to the INCLUDES.
+# Adding META-INF/services would include all files in that directory when only the one
+# is needed, which is why this explicit copy is defined instead.
+$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
+    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+    DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+    FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
+
+TARGETS += $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
+    SETUP := GENERATE_OLDBYTECODE, \
+    ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
+        $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+        $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
+    SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+    COPY := boot.modules ext.modules))
+
+$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+TARGETS += $(BUILD_TOOLS_JDK)
+
+$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
+    SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
+    DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
+    FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
+
+TARGETS += $(COPY_NIMBUS_TEMPLATES)
+
+################################################################################
+
+all: $(TARGETS)
--- a/jdk/make/CopySamples.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/CopySamples.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -28,41 +28,38 @@
 include $(SPEC)
 include MakeBase.gmk
 
+################################################################################
+
 SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample/image
 SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
-SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
 SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
 
 # Exclude the vm directory
-SAMPLE_FIND_FILTER := -name vm -prune -o
-
-SAMPLE_SOURCE := $(shell $(FIND) $(SAMPLE_SOURCE_DIR) $(SAMPLE_FIND_FILTER) -type f -print)
-SAMPLE_TARGET := $(subst $(SAMPLE_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOURCE))
+$(eval $(call SetupCopyFiles, COPY_SHARE_SAMPLES, \
+    SRC := $(SAMPLE_SOURCE_DIR), \
+    DEST := $(SAMPLE_TARGET_DIR), \
+    FILES := $(filter-out $(SAMPLE_SOURCE_DIR)/vm/%, \
+        $(call CacheFind, $(SAMPLE_SOURCE_DIR))), \
+))
 
-ifndef OPENJDK
-# Exclude Main.java in EbayClient dir
-  SAMPLE_CLOSED_SOURCE := $(shell $(FIND) $(SAMPLE_CLOSED_SOURCE_DIR) -type f -print | $(GREP) -v EbayClient/Main.java)
-  SAMPLE_CLOSED_TARGET := $(subst $(SAMPLE_CLOSED_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_CLOSED_SOURCE))
-  SAMPLE_TARGET += $(SAMPLE_CLOSED_TARGET)
-endif
+TARGETS += $(COPY_SHARE_SAMPLES)
 
 ifneq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx))
-  SAMPLE_SOLARIS_SOURCE := $(shell $(FIND) $(SAMPLE_SOLARIS_SOURCE_DIR) -type f -print)
-  SAMPLE_SOLARIS_TARGET := $(subst $(SAMPLE_SOLARIS_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOLARIS_SOURCE))
-  SAMPLE_TARGET += $(SAMPLE_SOLARIS_TARGET)
+  $(eval $(call SetupCopyFiles, COPY_SOLARIS_SAMPLES, \
+      SRC := $(SAMPLE_SOLARIS_SOURCE_DIR), \
+      DEST := $(SAMPLE_TARGET_DIR), \
+      FILES := $(call CacheFind, $(SAMPLE_SOLARIS_SOURCE_DIR)), \
+  ))
+
+  TARGETS += $(COPY_SOLARIS_SAMPLES)
 endif
 
-$(SAMPLE_TARGET_DIR)/dtrace/%: $(SAMPLE_SOLARIS_SOURCE_DIR)/dtrace/%
-	$(call install-file)
+################################################################################
 
-$(SAMPLE_TARGET_DIR)/webservices/%: $(SAMPLE_CLOSED_SOURCE_DIR)/webservices/%
-	$(call install-file)
+$(eval $(call IncludeCustomExtension, jdk, CopySamples.gmk))
 
-$(SAMPLE_TARGET_DIR)/%: $(SAMPLE_SOURCE_DIR)/%
-	$(call install-file)
+################################################################################
 
-COPY_FILES += $(SAMPLE_TARGET)
+all: $(TARGETS)
 
-all: $(COPY_FILES)
-
-.PHONY: all
+.PHONY: all default
--- a/jdk/make/Import.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/Import.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -48,7 +48,7 @@
 ifneq ($(STATIC_BUILD), true)
   JSIG_IMPORT = jsig.*
 else
-  JSIG_IMPORT = 
+  JSIG_IMPORT =
 endif
 
 HOTSPOT_BASE_IMPORT_FILES := \
--- a/jdk/make/Tools.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/Tools.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -26,31 +26,14 @@
 ifndef _TOOLS_GMK
 _TOOLS_GMK := 1
 
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
 include JavaCompilation.gmk
-include NativeCompilation.gmk
-include SetupJavaCompilers.gmk
 
 ################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
-    SETUP := GENERATE_OLDBYTECODE, \
-    ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
-        $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
-        $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
-    SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
-    BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
-    COPY := boot.modules ext.modules))
-
-$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
-    SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
-    DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
-    FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
-
-BUILD_TOOLS_JDK += $(COPY_NIMBUS_TEMPLATES)
+# To avoid reevaluating the compilation setup for the tools each time this file
+# is included, the actual compilation is handled by CompileTools.gmk. The
+# following trick is used to be able to declare a dependency on the built tools.
+BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
+    BUILD_TOOLS_JDK, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes)
 
 ################################################################################
 
@@ -135,34 +118,4 @@
     -cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
     build.tools.module.ImageBuilder
 
-##########################################################################################
-
-JIMAGE_PKGS := \
-    jdk/internal/jimage \
-    jdk/internal/jrtfs \
-    #
-
-$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
-    SETUP := GENERATE_OLDBYTECODE, \
-    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
-    INCLUDES := $(JIMAGE_PKGS), \
-    BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
-
-# Because of the explicit INCLUDES in the compilation setup above, the service provider
-# file will not be copied unless META-INF/services would also be added to the INCLUDES.
-# Adding META-INF/services would include all files in that directory when only the one
-# is needed, which is why this explicit copy is defined instead.
-$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
-    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
-    DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
-    FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
-
-##########################################################################################
-
-$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
-
-java-tools: $(BUILD_TOOLS_JDK)
-
-all: java-tools
-
 endif # _TOOLS_GMK
--- a/jdk/make/copy/Copy-java.base.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/copy/Copy-java.base.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -187,27 +187,31 @@
 ifeq ($(CACERTS_FILE), )
   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 endif
+
 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
 
 $(CACERTS_DST): $(CACERTS_FILE)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
 	$(call install-file)
 
 TARGETS += $(CACERTS_DST)
 
 ################################################################################
 
-$(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
-	$(ECHO) $(LOG_INFO) Copying $(@F)
-	$(call install-file)
+$(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \
+    FILES := $(JDK_TOPDIR)/src/java.base/share/conf/net.properties, \
+    DEST := $(CONF_DST_DIR), \
+))
 
-TARGETS += $(CONF_DST_DIR)/net.properties
+TARGETS += $(COPY_NET_PROPERTIES)
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-  $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
-	$(ECHO) $(LOG_INFO) Copying $(@F)
-	$(call install-file)
+  $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
+      FILES := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
+      DEST := $(CONF_DST_DIR)/sdp, \
+  ))
 
-  TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
+  TARGETS += $(COPY_SDP_CONF)
 endif
 
 ################################################################################
--- a/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem	Tue Jan 26 09:11:58 2016 +0100
@@ -725,3 +725,26 @@
 DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI
 LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=
 -----END CERTIFICATE-----
+
+// Subject: CN=eDellRoot
+// Issuer: CN=eDellRoot
+// Serial Number:
+//     6b:c5:7b:95:18:93:aa:97:4b:62:4a:c0:88:fc:3b:b6
+-----BEGIN CERTIFICATE-----
+MIIC8zCCAd+gAwIBAgIQa8V7lRiTqpdLYkrAiPw7tjAJBgUrDgMCHQUAMBQxEjAQ
+BgNVBAMTCWVEZWxsUm9vdDAeFw0xNTA0MDcxMDIzMjdaFw0zOTEyMzEyMzU5NTla
+MBQxEjAQBgNVBAMTCWVEZWxsUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAL3RJg1uzVuEX0Hw4XWGzs6oI9W+o7HZdVdBMMVb4Gzb4uZjCTNjbPx4
+b8LNFL1uArUt+5VVMQDsOTY3Lg/Xe/UNukY2b+0llUOzzBYYpbsFcco4n6SsTvDh
+Ni5t+kPo7c23ZrYBPmOu82eEJ6cavs/t39u+wFOkXXwvRCiHA/lWyNWNEPh17+bC
+EP3q5N+JrV+6Ho3zQPEv5QUJYdmXsMmD2CMQojeQUj68J91P5w5BKjurG0xjivzh
+Soie9ym7VRwLFjWScRuw/9XV6CLqTyL5xrqiiDp1uTOuqNj3uxyts9ocbsoJXuxj
+5iEYkSM1nvLupEv+lgy9WqzIEFMm1l8CAwEAAaNJMEcwRQYDVR0BBD4wPIAQYA/f
+EzPwmaRcZuSaa/VZ1KEWMBQxEjAQBgNVBAMTCWVEZWxsUm9vdIIQa8V7lRiTqpdL
+YkrAiPw7tjAJBgUrDgMCHQUAA4IBAQArfdcScsezj8ooJ92UwwnPgg36noOgiUs5
+XzPLP4h0JpUYQVKB9hY1WTDwRUfTKGh7oNOowd027a/rVSb/TNeoiJIvMKn4gbvV
+CWAiHhO8u2u0RkHCDVsa7e0i4ncpueWsihjn6jBrY8T+7eDYwiFT/F03A8NJ7mK5
+lZA8SFd5CTDy3EBUU5UwzXUc5HoIRUxXSPycu3aIBWawg3sCdKiAoikScPAWj0bM
+0vmsP/8QSlTOBqO+QFQ6R82BtTvBNU3qbVICV4QObsxib++FAFL56NApPqskg7Vz
+LfNIAjKabHUcjbuZkmg6jr4BfYW7+oQDHCsYgADjjKGdKz/8U/fP
+-----END CERTIFICATE-----
--- a/jdk/make/gendata/GendataBreakIterator.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gendata/GendataBreakIterator.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -68,8 +68,8 @@
 $(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
 $(BASE_DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
 $(BASE_DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
-	$(ECHO) $(LOG_INFO) "Generating BreakIteratorData"
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating BreakIteratorData)
+	$(call MakeDir, $(@D))
 	$(RM) $(BIFILES)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 	    -o $(@D) \
@@ -79,8 +79,8 @@
 $(BIFILES_TH): $(LD_DATA_PKG_DIR)/_the.bifiles_th
 $(LD_DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
 $(LD_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
-	$(ECHO) $(LOG_INFO) "Generating BreakIteratorData_th"
-	$(MKDIR) -p $(@D)/th
+	$(call LogInfo, Generating BreakIteratorData_th)
+	$(call MakeDir, $(@D)/th)
 	$(RM) $(BIFILES_TH)
 	$(TOOL_GENERATEBREAKITERATORDATA) \
 	    -o $(@D) \
--- a/jdk/make/gendata/GendataHtml32dtd.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,7 @@
 
 HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
 $(HTML32DTD): $(BUILD_TOOLS_JDK)
-	$(ECHO) "Generating HTML DTD file"
+	$(call LogInfo, Generating HTML DTD file)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
--- a/jdk/make/gendata/GendataPolicyJars.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gendata/GendataPolicyJars.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -87,8 +87,7 @@
 
 $(US_EXPORT_POLICY_JAR_LIMITED): \
     $(US_EXPORT_POLICY_JAR_UNLIMITED)
-	$(ECHO) $(LOG_INFO) \
-	    Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
 TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
@@ -99,7 +98,7 @@
 else
   $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
 	$(install-file)
-endif 
+endif
 
 ifndef OPENJDK
   ifneq ($(UNLIMITED_CRYPTO), true)
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -46,30 +46,34 @@
     $(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
     $(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating jdk.charsets extcs)
+	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
 	    extcs charsets  $(CHARSET_STANDARD_OS) \
 	    $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
 	    $(CHARSET_EXTENDED_JAVA_DIR) \
 	    $(CHARSET_COPYRIGHT_HEADER) \
-	    $(LOG_INFO)
+	    $(LOG_DEBUG)
 	$(TOUCH) '$@'
 
 $(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating jdk.charsets hkscs)
+	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<'
 	$(TOUCH) '$@'
 
 $(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER)/EUC_TW.java \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating jdk.charsets euctw)
+	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<'
 	$(TOUCH) '$@'
 
 $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
 
 GENSRC_JDK_CHARSETS += \
@@ -86,4 +90,3 @@
 all: jdk.charsets
 
 .PHONY: all jdk.charsets
-
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -40,19 +40,18 @@
 
 # Touch the target of this rule at the end to avoid triggering false rebuilds
 $(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
-	$(MKDIR) -p $(@D)
-	$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
+	$(call LogInfo, Creating JDWP.java and JDWPCommands.h from jdwp.spec)
+	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent)
 	$(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
-	$(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
 	$(TOOL_JDWPGEN) $< -jdi $@ -include \
 	    $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
 	$(TOUCH) $@
 
 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Creating $(@F) from jdwp.spec)
+	$(call MakeDir, $(@D))
 	$(RM) $@
-	$(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
 	$(TOOL_JDWPGEN) $< -doc $@
 
 GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
@@ -63,14 +62,14 @@
 ################################################################################
 
 define process-provider
-	$(MKDIR) -p $(@D)
+	$(call MakeDir, $(@D))
 	$(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@
 endef
 
 # Filter com.sun.jdi.connect.Connector
 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
     $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
-    $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+    $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/META-INF/services/com.sun.jdi.connect.Connector
 	$(process-provider)
 
 # Copy the same service file into jdk.hotspot.agent so that they are kept the same.
--- a/jdk/make/gensrc/GensrcBuffer.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcBuffer.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -23,7 +23,7 @@
 # questions.
 #
 
-GENSRC_BUFFER := 
+GENSRC_BUFFER :=
 
 GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
 
@@ -31,9 +31,9 @@
 
 ###
 
-$(GENSRC_BUFFER_DST)/_the.buffer.dir: 
-	$(ECHO) "Generating buffer classes"
-	$(MKDIR) -p $(@D)
+$(GENSRC_BUFFER_DST)/_the.buffer.dir:
+	$(call LogInfo, Generating buffer classes)
+	$(call MakeDir, $(@D))
 	$(TOUCH) $@
 
 define fixRw
--- a/jdk/make/gensrc/GensrcCharacterData.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -35,8 +35,8 @@
 define SetupCharacterData
   $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
       $(CHARACTERDATA)/$1.java.template
-	$(MKDIR) -p $$(@D)
-	$(ECHO) $(LOG_INFO) Generating $1.java
+	$$(call LogInfo, Generating $1.java)
+	$$(call MakeDir, $$(@D))
 	$(TOOL_GENERATECHARACTER) $2 \
 	    -template $(CHARACTERDATA)/$1.java.template \
 	    -spec $(UNICODEDATA)/UnicodeData.txt \
@@ -56,7 +56,7 @@
 
 # Copy two Java files that need no preprocessing.
 $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
-	$(ECHO) $(LOG_INFO) Generating $(@F)
+	$(call LogInfo, Generating $(@F))
 	$(call install-file)
 
 GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -44,13 +44,13 @@
     $(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
     $(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
     $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating java.base charset mapping)
+	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
 	    stdcs charsets $(CHARSET_STANDARD_OS) \
 	    $(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
 	    $(CHARSET_COPYRIGHT_HEADER) \
-            $(LOG_INFO)
+            $(LOG_DEBUG)
 	$(TOUCH) '$@'
 
 GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
-
--- a/jdk/make/gensrc/GensrcExceptions.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcExceptions.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -32,21 +32,12 @@
 
 GENSRC_EXCEPTIONS_SRC_DIRS := . charset channels
 
-###
-
-$(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir:
-	$(ECHO) "Generating exceptions classes"
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
-
-
-###
-
 $(GENSRC_EXCEPTIONS_DST)/_the.%.marker: $(GENSRC_EXCEPTIONS_SRC)/%/exceptions \
-    $(GENSRC_EXCEPTIONS_CMD) \
-    $(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir
-	$(MKDIR) -p $(@D)/$*
-	SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_INFO)
+    $(GENSRC_EXCEPTIONS_CMD)
+	$(call LogInfo, Generating exceptions java.nio $*)
+	$(call MakeDir, $(@D)/$*)
+	SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) \
+	    $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG)
 	$(TOUCH) $@
 
 GENSRC_EXCEPTIONS += $(foreach D,$(GENSRC_EXCEPTIONS_SRC_DIRS),$(GENSRC_EXCEPTIONS_DST)/_the.$(D).marker)
--- a/jdk/make/gensrc/GensrcIcons.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcIcons.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -65,8 +65,8 @@
 ################################################################################
 
 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
-	$(ECHO) Generating icon classes
-	$(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
+	$(call LogInfo, Generating icon classes)
+	$(call MakeDir, $(GENSRC_AWT_ICONS_DST))
 	$(TOUCH) $@
 
 ################################################################################
@@ -121,8 +121,9 @@
   endif
 
   $(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
+	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call MakeDir, $(@D))
 	$(RM) $@ $@.tmp
-	$(MKDIR) -p $(dir $@)
 	$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
 	$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
 	$(ECHO) "};" >> $@.tmp
--- a/jdk/make/gensrc/GensrcLocaleData.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -28,8 +28,9 @@
 # into LocaleDataMetaInfo.java
 
 # First go look for all locale files
-LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \
-    $(JDK_TOPDIR)/src/jdk.localedata/share/classes \
+LOCALE_FILES := $(shell $(FIND) \
+    $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \
+    $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources \
     -name "FormatData_*.java" -o -name "FormatData_*.properties" -o \
     -name "CollationData_*.java" -o -name "CollationData_*.properties" -o \
     -name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
@@ -42,17 +43,21 @@
 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
 
 # Include the list of resources found during the previous compile.
--include $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+-include $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.locale_resources
 
 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
 
 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
   # There is a difference in the number of supported resources. Trigger a regeneration.
-  $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
-    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
-    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java \
-    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+  ifeq ($(MODULE), java.base)
+    $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
+        $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java)
+  endif
+  ifeq ($(MODULE), jdk.localedata)
+    $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
+        $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+  endif
 endif
 
 # The base locales
@@ -121,18 +126,18 @@
 
 $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \
     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+	$(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
 	$(MKDIR) -p $(@D)
-	$(ECHO) Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
 	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
-	    > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+	    > $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
 	$(SED) $(SED_BASEARGS) $< > $@
 
 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \
     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+	$(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
 	$(MKDIR) -p $(@D)
-	$(ECHO) Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
 	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
-	    > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+	    > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
 	$(SED) $(SED_NONBASEARGS) $< > $@
 
 GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java
--- a/jdk/make/gensrc/GensrcMisc.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcMisc.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -50,7 +50,7 @@
 SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
     $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
 
-$(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
+$(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOR_EXE, \
     SRC := $(GENSRC_SOR_SRC), \
     INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
     TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -86,7 +86,7 @@
   UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
 
-  $(eval $(call SetupNativeCompilation,BUILD_GENSRC_UC_EXE, \
+  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_UC_EXE, \
       SRC := $(GENSRC_UC_SRC), \
       INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
       TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -124,7 +124,7 @@
   SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
 
-  $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOL_EXE, \
+  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOL_EXE, \
       SRC := $(GENSRC_SOL_SRC), \
       INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
       TOOLCHAIN := TOOLCHAIN_BUILD, \
--- a/jdk/make/gensrc/GensrcProperties.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcProperties.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -75,7 +75,7 @@
 
   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
   # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
-  # Strip away prefix and suffix, leaving for example only: 
+  # Strip away prefix and suffix, leaving for example only:
   # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
   $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
       $(SUPPORT_OUTPUTDIR)/gensrc/%, \
--- a/jdk/make/gensrc/GensrcSwing.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcSwing.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -31,12 +31,11 @@
 NIMBUS_SKIN_FILE = $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf
 
 $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
+	$(call LogInfo, Generating Nimbus source files)
 	$(MKDIR) -p $(@D)
-	$(ECHO) "Generating Nimbus source files"
-	$(TOOL_GENERATENIMBUS) $(LOG_INFO) \
+	$(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
 	    -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
 	    -packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
-	$(ECHO) $(LOG_INFO) "Finished generating Nimbus source files"
 	$(TOUCH) $@
 
 GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -63,14 +63,14 @@
 # Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
 # file prefix it is given so those not needed need to be hidden.
 $(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
-	$(MKDIR) -p $(@D)
+	$(call MakeDir, $(@D))
 	$(RM) '$@'
 	$(SORT) $< > $@
 
 # Run the tool on the offset files copied from the source repository to generate several Java classes
 # used in awt.
 $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
+	$(call MakeDir, $(GENSRC_X11WRAPPERS_DST))
 	$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
 	$(TOUCH) $@
 
@@ -82,8 +82,8 @@
 
   # Generate the C code for the program that will output the offset file.
   $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c: $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
-	$(ECHO) "Generating X11 wrapper ($*-bit version)"
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Generating X11 wrapper ($*-bit version))
+	$(call MakeDir, $(@D))
 	$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
 
   # use -m32/-m64 only if the compiler supports it
@@ -103,7 +103,7 @@
 
   # Compile the C code into an executable.
   $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
-	$(MKDIR) -p $(@D)
+	$(call MakeDir, $(@D))
 	(cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
 	    $(X_CFLAGS) \
 	    $(X_LIBS) \
@@ -114,9 +114,9 @@
   # Run the executable create the offset file and check that it is identical
   # to the offset file in the source code repository.
   $(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Verifying X11 wrapper sizes)
+	$(call MakeDir, $(@D))
 	$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
-	$(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
 	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
 	mv $@.tmp $@
 
--- a/jdk/make/launcher/Launcher-java.base.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/launcher/Launcher-java.base.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -130,7 +130,6 @@
       LDFLAGS := $(LDFLAGS_JDKEXE), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
       OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
-      DEBUG_SYMBOLS := true, \
       PROGRAM := jexec))
 
   TARGETS += $(BUILD_JEXEC)
--- a/jdk/make/launcher/Launcher-jdk.accessibility.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -45,7 +45,6 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       PROGRAM := jabswitch, \
-      DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
       RC_FLAGS := $(RC_FLAGS) \
           -D "JDK_FNAME=jabswitch.exe" \
@@ -79,7 +78,6 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccessinspector$1, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       PROGRAM := jaccessinspector$1, \
-      DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $(TOPDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
       RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=jaccessinspector$1.exe" \
@@ -107,7 +105,6 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccesswalker$1, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
       PROGRAM := jaccesswalker$1, \
-      DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $(TOPDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
       RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=jaccesswalker$1.exe" \
--- a/jdk/make/launcher/Launcher-jdk.pack200.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -100,7 +100,6 @@
         -D "JDK_FNAME=unpack200.exe" \
         -D "JDK_INTERNAL_NAME=unpack200" \
         -D "JDK_FTYPE=0x1L", \
-    DEBUG_SYMBOLS := true, \
     MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest, \
     MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
 ))
--- a/jdk/make/launcher/LauncherCommon.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/launcher/LauncherCommon.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -25,15 +25,6 @@
 
 include NativeCompilation.gmk
 
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk binaries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  ENABLE_DEBUG_SYMBOLS := false
-endif
-
-# Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
-
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
 else
@@ -124,7 +115,7 @@
       $1_LDFLAGS += -exported_symbols_list \
               $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
       $1_LIBS += \
-          $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
+          $$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
           $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
           $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
           $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
@@ -174,8 +165,7 @@
   endif
 
   $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
-      SRC := $(LAUNCHER_SRC), \
-      INCLUDE_FILES := main.c, \
+      EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
       OPTIMIZATION := $$($1_OPTIMIZATION), \
       CFLAGS := $$($1_CFLAGS) \
           $(LAUNCHER_CFLAGS) \
@@ -204,7 +194,6 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
       OUTPUT_DIR := $$($1_OUTPUT_DIR), \
       PROGRAM := $1, \
-      DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
       RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
--- a/jdk/make/lib/Awt2dLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -69,7 +69,7 @@
         -D "JDK_INTERNAL_NAME=mlib_image" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
 
@@ -134,7 +134,7 @@
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljava -ljvm -lc $(BUILD_LIBMLIB_LDLIBS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
 
@@ -279,7 +279,7 @@
         -D "JDK_INTERNAL_NAME=awt" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBAWT): $(call FindLib, java.base, java)
 
@@ -369,7 +369,7 @@
             -D "JDK_INTERNAL_NAME=xawt" \
             -D "JDK_FTYPE=0x2L", \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+    ))
 
     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
 
@@ -433,7 +433,7 @@
         -D "JDK_INTERNAL_NAME=lcms" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBLCMS)
 
@@ -509,7 +509,7 @@
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
 
@@ -578,7 +578,7 @@
         LIBS_linux := -lm $(LIBDL), \
         LIBS_solaris := -lm $(LIBDL) $(LIBCXX) -lc, \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+    ))
 
     $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 
@@ -700,7 +700,7 @@
         -D "JDK_INTERNAL_NAME=fontmanager" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 
@@ -745,12 +745,13 @@
           -D "JDK_INTERNAL_NAME=jawt" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 
   $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
-	$(ECHO) Copying $(@F)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call MakeDir, $(@D))
 	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 
   TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
@@ -804,7 +805,7 @@
       LIBS_solaris := $(X_LIBS) -lXrender, \
       LIBS_macosx := -framework Cocoa, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   ifndef BUILD_HEADLESS_ONLY
     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
@@ -926,7 +927,7 @@
           -D "JDK_INTERNAL_NAME=splashscreen" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 
@@ -1002,7 +1003,7 @@
           -framework OpenGL \
           -framework QuartzCore -ljava, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBAWT_LWAWT)
 
@@ -1044,7 +1045,7 @@
           -framework JavaRuntimeSupport \
           -ljava -ljvm, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBOSXUI)
 
--- a/jdk/make/lib/CoreLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/CoreLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
 
 WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
+
+
 ##########################################################################################
 # libfdlibm is statically linked with libjava below and not delivered into the
 # product on its own.
@@ -51,7 +55,7 @@
       DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
 else
 
@@ -64,7 +68,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
       LDFLAGS := -nostdlib -r -arch x86_64, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
   $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
@@ -82,7 +86,7 @@
 
 LIBVERIFY_OPTIMIZATION := HIGH
 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
-  ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+  ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
     LIBVERIFY_OPTIMIZATION := LOW
   endif
 endif
@@ -106,7 +110,7 @@
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBVERIFY_REORDER), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
-    DEBUG_SYMBOLS := true))
+))
 
 TARGETS += $(BUILD_LIBVERIFY)
 
@@ -119,6 +123,9 @@
     -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
     -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 
+# Make it possible to override this variable
+LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
   BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,7 +153,7 @@
     System.c_CFLAGS := $(VERSION_CFLAGS), \
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
-    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
+    MAPFILE := $(LIBJAVA_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
@@ -171,7 +178,7 @@
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(LIBJAVA_REORDER), \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBJAVA)
 
@@ -228,8 +235,7 @@
         -D "JDK_INTERNAL_NAME=zip" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
+))
 
 $(BUILD_LIBZIP): $(BUILD_LIBJAVA)
 
@@ -273,7 +279,7 @@
         -D "JDK_INTERNAL_NAME=jimage" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
 
@@ -389,7 +395,7 @@
         -D "JDK_INTERNAL_NAME=jli" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBJLI)
 
@@ -407,7 +413,7 @@
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBJLI_STATIC)
 
@@ -426,7 +432,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
       LDFLAGS := -nostdlib -r, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   ifeq ($(STATIC_BUILD), true)
     TARGETS += $(BUILD_LIBJLI_STATIC)
--- a/jdk/make/lib/Lib-java.base.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.base.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -49,7 +49,7 @@
   JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols
 
   $(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC)
-	$(ECHO) $(LOG_INFO) "Generating java.base.symbols file"
+	$(call LogInfo, Generating java.base.symbols file)
 	$(CAT) $^ > $@
 
   # The individual symbol files is generated when the respective lib is built
--- a/jdk/make/lib/Lib-java.instrument.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.instrument.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -84,7 +84,7 @@
         -D "JDK_INTERNAL_NAME=instrument" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
-    DEBUG_SYMBOLS := true))
+))
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
   $(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
--- a/jdk/make/lib/Lib-java.management.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.management.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -40,7 +40,7 @@
 
 LIBMANAGEMENT_OPTIMIZATION := HIGH
 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
-  ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+  ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
     LIBMANAGEMENT_OPTIMIZATION := LOW
   endif
 endif
@@ -64,7 +64,7 @@
         -D "JDK_INTERNAL_NAME=management" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
-    DEBUG_SYMBOLS := true))
+))
 
 $(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/Lib-java.prefs.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.prefs.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
         -D "JDK_INTERNAL_NAME=prefs" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBPREFS): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/Lib-java.security.jgss.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -46,7 +46,7 @@
       LIBS := $(LIBDL), \
       LIBS_solaris := -lc, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBJ2GSS)
 endif
@@ -92,7 +92,7 @@
             -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
             -D "JDK_FTYPE=0x2L", \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+    ))
 
     TARGETS += $(BUILD_LIBKRB5)
   endif
--- a/jdk/make/lib/Lib-java.smartcardio.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -52,7 +52,7 @@
         -D "JDK_INTERNAL_NAME=j2pcsc" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBJ2PCSC)
 
--- a/jdk/make/lib/Lib-jdk.accessibility.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.accessibility.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -61,7 +61,7 @@
             -D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
             -D "JDK_FTYPE=0x02L", \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
-        DEBUG_SYMBOLS := true)
+    )
 
     $$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
 
@@ -91,7 +91,7 @@
             -D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
             -D "JDK_FTYPE=0x02L", \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
-        DEBUG_SYMBOLS := true)
+    )
 
     TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
 
@@ -113,7 +113,7 @@
             -D "JDK_INTERNAL_NAME=jabsysinfo" \
             -D "JDK_FTYPE=0x02L", \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
-        DEBUG_SYMBOLS := true)
+    )
 
     TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
 
--- a/jdk/make/lib/Lib-jdk.attach.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.attach.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -56,7 +56,7 @@
     LIBS_solaris := -ldoor, \
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
-    DEBUG_SYMBOLS := true))
+))
 
 $(BUILD_LIBATTACH): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -68,7 +68,7 @@
           -D "JDK_INTERNAL_NAME=sunec" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBSUNEC)
 endif
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -47,7 +47,7 @@
           -D "JDK_INTERNAL_NAME=sunmscapi" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBSUNMSCAPI)
 endif
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -51,7 +51,7 @@
         -D "JDK_INTERNAL_NAME=j2pkcs11" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBJ2PKCS11)
 
--- a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
       LIBS := $(LIBDL), \
       LIBS_solaris := -lc, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2ucrypto, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
 
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -57,7 +57,7 @@
           -framework SystemConfiguration \
           $(JDKLIB_LIBS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBOSX)
 
--- a/jdk/make/lib/Lib-jdk.internal.le.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.internal.le.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -51,7 +51,7 @@
           -D "JDK_INTERNAL_NAME=le" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lible, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBLE)
 
--- a/jdk/make/lib/Lib-jdk.jdi.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
           -D "JDK_INTERNAL_NAME=dt_shmem" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBDT_SHMEM)
 
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -56,7 +56,7 @@
         -D "JDK_INTERNAL_NAME=dt_socket" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
-    DEBUG_SYMBOLS := true))
+))
 
 $(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
 
@@ -95,7 +95,7 @@
         -D "JDK_INTERNAL_NAME=jdwp" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
-    DEBUG_SYMBOLS := true))
+))
 
 $(BUILD_LIBJDWP): $(call FindLib, java.base, java)
 
@@ -111,7 +111,7 @@
   JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/jdk.jdwp.agent.symbols
 
   $(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE): $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC)
-	$(ECHO) $(LOG_INFO) "Generating jdk.jdwp.agent symbols file"
+	$(call LogInfo, Generating jdk.jdwp.agent symbols file)
 	$(CAT) $^ > $@
 
   # The individual symbol files is generated when the respective lib is built
--- a/jdk/make/lib/Lib-jdk.management.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.management.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -48,7 +48,7 @@
 
 LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH
 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
-  ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+  ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
     LIBMANAGEMENT_EXT_OPTIMIZATION := LOW
   endif
 endif
@@ -73,7 +73,7 @@
         -D "JDK_INTERNAL_NAME=management_ext" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \
-    DEBUG_SYMBOLS := true))
+))
 
 $(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/Lib-jdk.pack200.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -52,7 +52,7 @@
         -D "JDK_FNAME=unpack.dll" \
         -D "JDK_INTERNAL_NAME=unpack" \
         -D "JDK_FTYPE=0x2L", \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/Lib-jdk.sctp.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -53,7 +53,7 @@
         LIBS_linux := -lpthread $(LIBDL), \
         LIBS_solaris := -lsocket -lc, \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+    ))
 
     TARGETS += $(BUILD_LIBSCTP)
 
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
         -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBJAAS): $(call FindLib, java.base, java)
 
--- a/jdk/make/lib/LibCommon.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/LibCommon.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -23,40 +23,24 @@
 # questions.
 #
 
-include $(SPEC)
-include MakeBase.gmk
 include NativeCompilation.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
+
+################################################################################
+
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
 # Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
 # elegant solution to this.
 WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
 
-ifdef OPENJDK
-  # Build everything with debugging on OpenJDK
-  DEBUG_ALL_BINARIES := true
-else
-  # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
-  # not on other platforms.
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    DEBUG_ALL_BINARIES := true
-  else
-    DEBUG_ALL_BINARIES := false
-  endif
-endif
-
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk libraries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  ENABLE_DEBUG_SYMBOLS := false
-endif
-
 ################################################################################
 # Find the default set of src dirs for a native library.
 # Param 1 - module name
 # Param 2 - library name
-FindSrcDirsForLib = \
+FindSrcDirsForLib += \
   $(call uniq, $(wildcard \
       $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
       $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
@@ -87,3 +71,5 @@
 else
   ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
 endif
+
+###############################################################################
--- a/jdk/make/lib/NetworkingLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/NetworkingLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -52,7 +52,7 @@
         -D "JDK_INTERNAL_NAME=net" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBNET): $(BUILD_LIBJAVA)
 
--- a/jdk/make/lib/NioLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/NioLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -91,7 +91,7 @@
         -D "JDK_INTERNAL_NAME=nio" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 TARGETS += $(BUILD_LIBNIO)
 
--- a/jdk/make/lib/PlatformLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/PlatformLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,7 @@
           -framework IOSurface \
           -framework QuartzCore, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   TARGETS += $(BUILD_LIBOSXAPP)
 
--- a/jdk/make/lib/SecurityLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/SecurityLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,7 @@
             -framework Security \
             $(JDKLIB_LIBS), \
         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxsecurity, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+    ))
 
     $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
 
--- a/jdk/make/lib/SoundLibraries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/lib/SoundLibraries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -138,7 +138,7 @@
         -D "JDK_INTERNAL_NAME=jsound" \
         -D "JDK_FTYPE=0x2L", \
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
 
 $(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
 
@@ -173,7 +173,7 @@
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := $(ALSA_LIBS) -ljava -ljvm, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
 
@@ -204,7 +204,7 @@
           -D "JDK_INTERNAL_NAME=jsoundds" \
           -D "JDK_FTYPE=0x2L", \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+  ))
 
   $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
 
--- a/jdk/make/src/classes/build/tools/spp/Spp.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/src/classes/build/tools/spp/Spp.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,10 @@
  * Spp: A simple regex-based stream preprocessor based on Mark Reinhold's
  *      sed-based spp.sh
  *
- * Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out
+ * Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out
  *
- * Source-file constructs
+ * If -nel is declared then empty lines will not be substituted for lines of
+ * text in the template that do not appear in the output.
  *
  *   Meaningful only at beginning of line, works with any number of keys:
  *
@@ -64,9 +65,10 @@
 
 public class Spp {
     public static void main(String args[]) throws Exception {
-        Map<String, String> vars = new HashMap<String, String>();
-        Set<String> keys = new HashSet<String>();
+        Map<String, String> vars = new HashMap<>();
+        Set<String> keys = new HashSet<>();
         boolean be = false;
+        boolean el = true;
 
         for (String arg:args) {
             if (arg.startsWith("-D")) {
@@ -76,8 +78,10 @@
                 keys.add(arg.substring(2));
             } else if ("-be".equals(arg)) {
                 be = true;
+            } else if ("-nel".equals(arg)) {
+                el = false;
             } else {
-                System.err.println("Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out");
+                System.err.println("Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out");
                 System.exit(-1);
             }
         }
@@ -85,7 +89,7 @@
         StringBuffer out = new StringBuffer();
         new Spp().spp(new Scanner(System.in),
                       out, "",
-                      keys, vars, be,
+                      keys, vars, be, el,
                       false);
         System.out.print(out.toString());
     }
@@ -93,7 +97,7 @@
     static final String LNSEP = System.getProperty("line.separator");
     static final String KEY = "([a-zA-Z0-9]+)";
     static final String VAR = "([a-zA-Z0-9_\\-]+)";
-    static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\$]+)"; // $ -- hack embedded $var$
+    static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\?\\[\\]\\$]+)"; // $ -- hack embedded $var$
 
     static final int GN_NOT = 1;
     static final int GN_KEY = 2;
@@ -101,11 +105,11 @@
     static final int GN_NO  = 5;
     static final int GN_VAR = 6;
 
-    Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher  vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
-    Matcher  vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
+    final Matcher   ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher  endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher  vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
+    final Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
 
     void append(StringBuffer buf, String ln,
                 Set<String> keys, Map<String, String> vars) {
@@ -135,7 +139,7 @@
     // return true if #end[key], #end or EOF reached
     boolean spp(Scanner in, StringBuffer buf, String key,
                 Set<String> keys, Map<String, String> vars,
-                boolean be, boolean skip) {
+                boolean be, boolean el, boolean skip) {
         while (in.hasNextLine()) {
             String ln = in.nextLine();
             if (be) {
@@ -154,9 +158,9 @@
                 boolean test = keys.contains(k);
                 if (ifkey.group(GN_NOT) != null)
                     test = !test;
-                buf.append(LNSEP);
-                if (!spp(in, buf, k, keys, vars, be, skip || !test)) {
-                    spp(in, buf, k, keys, vars, be, skip || test);
+                if (el) buf.append(LNSEP);
+                if (!spp(in, buf, k, keys, vars, be, el, skip || !test)) {
+                    spp(in, buf, k, keys, vars, be, el, skip || test);
                 }
                 continue;
             }
@@ -164,14 +168,14 @@
                 if (!key.equals(elsekey.group(GN_KEY))) {
                     throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
                 }
-                buf.append(LNSEP);
+                if (el) buf.append(LNSEP);
                 return false;
             }
             if (endkey.reset(ln).find()) {
                 if (!key.equals(endkey.group(GN_KEY))) {
                     throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
                 }
-                buf.append(LNSEP);
+                if (el) buf.append(LNSEP);
                 return true;
             }
             if (ln.startsWith("#warn")) {
@@ -181,8 +185,9 @@
             }
             if (!skip) {
                 append(buf, ln, keys, vars);
+                if (!el) buf.append(LNSEP);
             }
-            buf.append(LNSEP);
+            if (el) buf.append(LNSEP);
         }
         return true;
     }
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Tue Jan 26 09:11:58 2016 +0100
@@ -60,7 +60,7 @@
  * @author Stephen Colebourne
  * @author Michael Nascimento Santos
  *
- * @since   1.9
+ * @since   9
  */
 
 class TzdbZoneRulesProvider {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,7 +26,9 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.util.Objects;
 
+import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**
  * This class represents ciphers in counter (CTR) mode.
@@ -138,7 +140,7 @@
      * <code>cipherOffset</code>.
      *
      * @param in the buffer with the input data to be encrypted
-     * @param inOffset the offset in <code>plain</code>
+     * @param inOff the offset in <code>plain</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
@@ -170,6 +172,15 @@
      * are encrypted on demand.
      */
     private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+
+        cryptBlockCheck(in, inOff, len);
+        cryptBlockCheck(out, outOff, len);
+        return implCrypt(in, inOff, len, out, outOff);
+    }
+
+    // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
+    @HotSpotIntrinsicCandidate
+    private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
         int result = len;
         while (len-- > 0) {
             if (used >= blockSize) {
@@ -181,4 +192,23 @@
         }
         return result;
     }
+
+    // Used to perform all checks required by the Java semantics
+    // (i.e., null checks and bounds checks) on the input parameters to crypt().
+    // Normally, the Java Runtime performs these checks, however, as crypt() is
+    // possibly replaced with compiler intrinsic, the JDK performs the
+    // required checks instead.
+    // Does not check accesses to class-internal (private) arrays.
+    private static void cryptBlockCheck(byte[] array, int offset, int len) {
+        Objects.requireNonNull(array);
+
+        if (offset < 0 || len < 0 || offset >= array.length) {
+            throw new ArrayIndexOutOfBoundsException(offset);
+        }
+
+        int largestIndex = offset + len - 1;
+        if (largestIndex < 0 || largestIndex >= array.length) {
+            throw new ArrayIndexOutOfBoundsException(largestIndex);
+        }
+    }
 }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -263,7 +263,7 @@
             passwdChars[i] = (char) (passwdBytes[i] & 0x7f);
 
         PBEKeySpec pbeSpec =
-            new PBEKeySpec(passwdChars, salt, iCount, blkSize * 8);
+            new PBEKeySpec(passwdChars, salt, iCount, keyLength);
             // password char[] was cloned in PBEKeySpec constructor,
             // so we can zero it out here
         java.util.Arrays.fill(passwdChars, ' ');
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -76,11 +76,14 @@
                 "TlsRsaPremasterSecretGenerator must be initialized");
         }
 
-        if (random == null) {
-            random = new SecureRandom();
+        byte[] b = spec.getEncodedSecret();
+        if (b == null) {
+            if (random == null) {
+                random = new SecureRandom();
+            }
+            b = new byte[48];
+            random.nextBytes(b);
         }
-        byte[] b = new byte[48];
-        random.nextBytes(b);
         b[0] = (byte)spec.getMajorVersion();
         b[1] = (byte)spec.getMinorVersion();
 
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java	Tue Jan 26 09:11:58 2016 +0100
@@ -228,7 +228,7 @@
      *         allocated. For example, if an array larger than {@code 2GB} would
      *         be required to store the bytes.
      *
-     * @since 1.9
+     * @since 9
      */
     public byte[] readAllBytes() throws IOException {
         byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
@@ -298,7 +298,7 @@
      * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len}
      *         is negative, or {@code len} is greater than {@code b.length - off}
      *
-     * @since 1.9
+     * @since 9
      */
     public int readNBytes(byte[] b, int off, int len) throws IOException {
         Objects.requireNonNull(b);
@@ -514,7 +514,7 @@
      * @throws IOException if an I/O error occurs when reading or writing
      * @throws NullPointerException if {@code out} is {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     public long transferTo(OutputStream out) throws IOException {
         Objects.requireNonNull(out, "out");
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1526,7 +1526,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public IntStream chars() {
@@ -1543,7 +1543,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public IntStream codePoints() {
--- a/jdk/src/java.base/share/classes/java/lang/Character.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/Character.java	Tue Jan 26 09:11:58 2016 +0100
@@ -493,25 +493,25 @@
 
     /**
      * Weak bidirectional character type "LRI" in the Unicode specification.
-     * @since 1.9
+     * @since 9
      */
     public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19;
 
     /**
      * Weak bidirectional character type "RLI" in the Unicode specification.
-     * @since 1.9
+     * @since 9
      */
     public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20;
 
     /**
      * Weak bidirectional character type "FSI" in the Unicode specification.
-     * @since 1.9
+     * @since 9
      */
     public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21;
 
     /**
      * Weak bidirectional character type "PDI" in the Unicode specification.
-     * @since 1.9
+     * @since 9
      */
     public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22;
 
@@ -2590,7 +2590,7 @@
         /**
          * Constant for the "Combining Diacritical Marks Extended" Unicode
          * character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_EXTENDED =
             new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_EXTENDED",
@@ -2599,7 +2599,7 @@
 
         /**
          * Constant for the "Myanmar Extended-B" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MYANMAR_EXTENDED_B =
             new UnicodeBlock("MYANMAR_EXTENDED_B",
@@ -2608,7 +2608,7 @@
 
         /**
          * Constant for the "Latin Extended-E" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock LATIN_EXTENDED_E =
             new UnicodeBlock("LATIN_EXTENDED_E",
@@ -2617,7 +2617,7 @@
 
         /**
          * Constant for the "Coptic Epact Numbers" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock COPTIC_EPACT_NUMBERS =
             new UnicodeBlock("COPTIC_EPACT_NUMBERS",
@@ -2626,7 +2626,7 @@
 
         /**
          * Constant for the "Old Permic" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock OLD_PERMIC =
             new UnicodeBlock("OLD_PERMIC",
@@ -2635,14 +2635,14 @@
 
         /**
          * Constant for the "Elbasan" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock ELBASAN =
             new UnicodeBlock("ELBASAN");
 
         /**
          * Constant for the "Caucasian Albanian" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock CAUCASIAN_ALBANIAN =
             new UnicodeBlock("CAUCASIAN_ALBANIAN",
@@ -2651,7 +2651,7 @@
 
         /**
          * Constant for the "Linear A" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock LINEAR_A =
             new UnicodeBlock("LINEAR_A",
@@ -2660,21 +2660,21 @@
 
         /**
          * Constant for the "Palmyrene" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock PALMYRENE =
             new UnicodeBlock("PALMYRENE");
 
         /**
          * Constant for the "Nabataean" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock NABATAEAN =
             new UnicodeBlock("NABATAEAN");
 
         /**
          * Constant for the "Old North Arabian" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock OLD_NORTH_ARABIAN =
             new UnicodeBlock("OLD_NORTH_ARABIAN",
@@ -2683,14 +2683,14 @@
 
         /**
          * Constant for the "Manichaean" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MANICHAEAN =
             new UnicodeBlock("MANICHAEAN");
 
         /**
          * Constant for the "Psalter Pahlavi" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock PSALTER_PAHLAVI =
             new UnicodeBlock("PSALTER_PAHLAVI",
@@ -2699,14 +2699,14 @@
 
         /**
          * Constant for the "Mahajani" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MAHAJANI =
             new UnicodeBlock("MAHAJANI");
 
         /**
          * Constant for the "Sinhala Archaic Numbers" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SINHALA_ARCHAIC_NUMBERS =
             new UnicodeBlock("SINHALA_ARCHAIC_NUMBERS",
@@ -2715,49 +2715,49 @@
 
         /**
          * Constant for the "Khojki" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock KHOJKI =
             new UnicodeBlock("KHOJKI");
 
         /**
          * Constant for the "Khudawadi" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock KHUDAWADI =
             new UnicodeBlock("KHUDAWADI");
 
         /**
          * Constant for the "Grantha" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock GRANTHA =
             new UnicodeBlock("GRANTHA");
 
         /**
          * Constant for the "Tirhuta" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock TIRHUTA =
             new UnicodeBlock("TIRHUTA");
 
         /**
          * Constant for the "Siddham" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SIDDHAM =
             new UnicodeBlock("SIDDHAM");
 
         /**
          * Constant for the "Modi" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MODI =
             new UnicodeBlock("MODI");
 
         /**
          * Constant for the "Warang Citi" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock WARANG_CITI =
             new UnicodeBlock("WARANG_CITI",
@@ -2766,7 +2766,7 @@
 
         /**
          * Constant for the "Pau Cin Hau" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock PAU_CIN_HAU =
             new UnicodeBlock("PAU_CIN_HAU",
@@ -2775,14 +2775,14 @@
 
         /**
          * Constant for the "Mro" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MRO =
             new UnicodeBlock("MRO");
 
         /**
          * Constant for the "Bassa Vah" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock BASSA_VAH =
             new UnicodeBlock("BASSA_VAH",
@@ -2791,7 +2791,7 @@
 
         /**
          * Constant for the "Pahawh Hmong" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock PAHAWH_HMONG =
             new UnicodeBlock("PAHAWH_HMONG",
@@ -2800,14 +2800,14 @@
 
         /**
          * Constant for the "Duployan" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock DUPLOYAN =
             new UnicodeBlock("DUPLOYAN");
 
         /**
          * Constant for the "Shorthand Format Controls" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SHORTHAND_FORMAT_CONTROLS =
             new UnicodeBlock("SHORTHAND_FORMAT_CONTROLS",
@@ -2816,7 +2816,7 @@
 
         /**
          * Constant for the "Mende Kikakui" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MENDE_KIKAKUI =
             new UnicodeBlock("MENDE_KIKAKUI",
@@ -2825,7 +2825,7 @@
 
         /**
          * Constant for the "Ornamental Dingbats" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock ORNAMENTAL_DINGBATS =
             new UnicodeBlock("ORNAMENTAL_DINGBATS",
@@ -2834,7 +2834,7 @@
 
         /**
          * Constant for the "Geometric Shapes Extended" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock GEOMETRIC_SHAPES_EXTENDED =
             new UnicodeBlock("GEOMETRIC_SHAPES_EXTENDED",
@@ -2843,7 +2843,7 @@
 
         /**
          * Constant for the "Supplemental Arrows-C" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SUPPLEMENTAL_ARROWS_C =
             new UnicodeBlock("SUPPLEMENTAL_ARROWS_C",
@@ -2852,7 +2852,7 @@
 
         /**
          * Constant for the "Cherokee Supplement" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock CHEROKEE_SUPPLEMENT =
             new UnicodeBlock("CHEROKEE_SUPPLEMENT",
@@ -2861,14 +2861,14 @@
 
         /**
          * Constant for the "Hatran" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock HATRAN =
             new UnicodeBlock("HATRAN");
 
         /**
          * Constant for the "Old Hungarian" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock OLD_HUNGARIAN =
             new UnicodeBlock("OLD_HUNGARIAN",
@@ -2877,21 +2877,21 @@
 
         /**
          * Constant for the "Multani" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock MULTANI =
             new UnicodeBlock("MULTANI");
 
         /**
          * Constant for the "Ahom" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock AHOM =
             new UnicodeBlock("AHOM");
 
         /**
          * Constant for the "Early Dynastic Cuneiform" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock EARLY_DYNASTIC_CUNEIFORM =
             new UnicodeBlock("EARLY_DYNASTIC_CUNEIFORM",
@@ -2900,7 +2900,7 @@
 
         /**
          * Constant for the "Anatolian Hieroglyphs" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock ANATOLIAN_HIEROGLYPHS =
             new UnicodeBlock("ANATOLIAN_HIEROGLYPHS",
@@ -2909,7 +2909,7 @@
 
         /**
          * Constant for the "Sutton SignWriting" Unicode character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SUTTON_SIGNWRITING =
             new UnicodeBlock("SUTTON_SIGNWRITING",
@@ -2919,7 +2919,7 @@
         /**
          * Constant for the "Supplemental Symbols and Pictographs" Unicode
          * character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS =
             new UnicodeBlock("SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS",
@@ -2929,7 +2929,7 @@
         /**
          * Constant for the "CJK Unified Ideographs Extension E" Unicode
          * character block.
-         * @since 1.9
+         * @since 9
          */
         public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E =
             new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E",
@@ -4189,175 +4189,175 @@
 
         /**
          * Unicode script "Caucasian Albanian".
-         * @since 1.9
+         * @since 9
          */
         CAUCASIAN_ALBANIAN,
 
         /**
          * Unicode script "Bassa Vah".
-         * @since 1.9
+         * @since 9
          */
         BASSA_VAH,
 
         /**
          * Unicode script "Duployan".
-         * @since 1.9
+         * @since 9
          */
         DUPLOYAN,
 
         /**
          * Unicode script "Elbasan".
-         * @since 1.9
+         * @since 9
          */
         ELBASAN,
 
         /**
          * Unicode script "Grantha".
-         * @since 1.9
+         * @since 9
          */
         GRANTHA,
 
         /**
          * Unicode script "Pahawh Hmong".
-         * @since 1.9
+         * @since 9
          */
         PAHAWH_HMONG,
 
         /**
          * Unicode script "Khojki".
-         * @since 1.9
+         * @since 9
          */
         KHOJKI,
 
         /**
          * Unicode script "Linear A".
-         * @since 1.9
+         * @since 9
          */
         LINEAR_A,
 
         /**
          * Unicode script "Mahajani".
-         * @since 1.9
+         * @since 9
          */
         MAHAJANI,
 
         /**
          * Unicode script "Manichaean".
-         * @since 1.9
+         * @since 9
          */
         MANICHAEAN,
 
         /**
          * Unicode script "Mende Kikakui".
-         * @since 1.9
+         * @since 9
          */
         MENDE_KIKAKUI,
 
         /**
          * Unicode script "Modi".
-         * @since 1.9
+         * @since 9
          */
         MODI,
 
         /**
          * Unicode script "Mro".
-         * @since 1.9
+         * @since 9
          */
         MRO,
 
         /**
          * Unicode script "Old North Arabian".
-         * @since 1.9
+         * @since 9
          */
         OLD_NORTH_ARABIAN,
 
         /**
          * Unicode script "Nabataean".
-         * @since 1.9
+         * @since 9
          */
         NABATAEAN,
 
         /**
          * Unicode script "Palmyrene".
-         * @since 1.9
+         * @since 9
          */
         PALMYRENE,
 
         /**
          * Unicode script "Pau Cin Hau".
-         * @since 1.9
+         * @since 9
          */
         PAU_CIN_HAU,
 
         /**
          * Unicode script "Old Permic".
-         * @since 1.9
+         * @since 9
          */
         OLD_PERMIC,
 
         /**
          * Unicode script "Psalter Pahlavi".
-         * @since 1.9
+         * @since 9
          */
         PSALTER_PAHLAVI,
 
         /**
          * Unicode script "Siddham".
-         * @since 1.9
+         * @since 9
          */
         SIDDHAM,
 
         /**
          * Unicode script "Khudawadi".
-         * @since 1.9
+         * @since 9
          */
         KHUDAWADI,
 
         /**
          * Unicode script "Tirhuta".
-         * @since 1.9
+         * @since 9
          */
         TIRHUTA,
 
         /**
          * Unicode script "Warang Citi".
-         * @since 1.9
+         * @since 9
          */
         WARANG_CITI,
 
          /**
          * Unicode script "Ahom".
-         * @since 1.9
+         * @since 9
          */
         AHOM,
 
         /**
          * Unicode script "Anatolian Hieroglyphs".
-         * @since 1.9
+         * @since 9
          */
         ANATOLIAN_HIEROGLYPHS,
 
         /**
          * Unicode script "Hatran".
-         * @since 1.9
+         * @since 9
          */
         HATRAN,
 
         /**
          * Unicode script "Multani".
-         * @since 1.9
+         * @since 9
          */
         MULTANI,
 
         /**
          * Unicode script "Old Hungarian".
-         * @since 1.9
+         * @since 9
          */
         OLD_HUNGARIAN,
 
         /**
          * Unicode script "SignWriting".
-         * @since 1.9
+         * @since 9
          */
         SIGNWRITING,
 
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -716,7 +716,7 @@
      *             {@code radix}, or if {@code radix} is either smaller than
      *             {@link java.lang.Character#MIN_RADIX} or larger than
      *             {@link java.lang.Character#MAX_RADIX}.
-     * @since  1.9
+     * @since  9
      */
     public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
@@ -899,7 +899,7 @@
      *             {@code radix}, or if {@code radix} is either smaller than
      *             {@link java.lang.Character#MIN_RADIX} or larger than
      *             {@link java.lang.Character#MAX_RADIX}.
-     * @since  1.9
+     * @since  9
      */
     public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
--- a/jdk/src/java.base/share/classes/java/lang/Long.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java	Tue Jan 26 09:11:58 2016 +0100
@@ -747,7 +747,7 @@
      *             {@code radix}, or if {@code radix} is either smaller than
      *             {@link java.lang.Character#MIN_RADIX} or larger than
      *             {@link java.lang.Character#MAX_RADIX}.
-     * @since  1.9
+     * @since  9
      */
     public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
@@ -993,7 +993,7 @@
      *             {@code radix}, or if {@code radix} is either smaller than
      *             {@link java.lang.Character#MIN_RADIX} or larger than
      *             {@link java.lang.Character#MAX_RADIX}.
-     * @since  1.9
+     * @since  9
      */
     public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
--- a/jdk/src/java.base/share/classes/java/lang/Process.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java	Tue Jan 26 09:11:58 2016 +0100
@@ -304,7 +304,7 @@
      *         otherwise, {@link #destroy} forcibly terminates the process
      * @throws UnsupportedOperationException if the Process implementation
      *         does not support this operation
-     * @since 1.9
+     * @since 9
      */
     public boolean supportsNormalTermination() {
         throw new UnsupportedOperationException(this.getClass()
@@ -340,7 +340,7 @@
      * @return the native process id of the process
      * @throws UnsupportedOperationException if the Process implementation
      *         does not support this operation
-     * @since 1.9
+     * @since 9
      */
     public long getPid() {
         return toHandle().getPid();
@@ -409,7 +409,7 @@
      *
      * @return a new {@code CompletableFuture<Process>} for the Process
      *
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<Process> onExit() {
         return CompletableFuture.supplyAsync(this::waitForInternal);
@@ -471,7 +471,7 @@
      *         does not support this operation
      * @throws SecurityException if a security manager has been installed and
      *         it denies RuntimePermission("manageProcess")
-     * @since 1.9
+     * @since 9
      */
     public ProcessHandle toHandle() {
         throw new UnsupportedOperationException(this.getClass()
@@ -491,7 +491,7 @@
      * @return a snapshot of information about the process, always non-null
      * @throws UnsupportedOperationException if the Process implementation
      *         does not support this operation
-     * @since 1.9
+     * @since 9
      */
     public ProcessHandle.Info info() {
         return toHandle().info();
@@ -516,7 +516,7 @@
      *         does not support this operation
      * @throws SecurityException if a security manager has been installed and
      *         it denies RuntimePermission("manageProcess")
-     * @since 1.9
+     * @since 9
      */
     public Stream<ProcessHandle> children() {
         return toHandle().children();
@@ -542,7 +542,7 @@
      *         does not support this operation
      * @throws SecurityException if a security manager has been installed and
      *         it denies RuntimePermission("manageProcess")
-     * @since 1.9
+     * @since 9
      */
     public Stream<ProcessHandle> descendants() {
         return toHandle().descendants();
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java	Tue Jan 26 09:11:58 2016 +0100
@@ -89,7 +89,7 @@
  * {@link #compareTo(ProcessHandle) compareTo} methods to compare ProcessHandles.
  *
  * @see Process
- * @since 1.9
+ * @since 9
  */
 public interface ProcessHandle extends Comparable<ProcessHandle> {
 
@@ -215,7 +215,7 @@
      * by the operating system privileges of the process making the request.
      * The return types are {@code Optional<T>} allowing explicit tests
      * and actions if the value is available.
-     * @since 1.9
+     * @since 9
      */
     public interface Info {
         /**
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -50,7 +50,7 @@
  * ProcessHandleImpl is the implementation of ProcessHandle.
  *
  * @see Process
- * @since 1.9
+ * @since 9
  */
 final class ProcessHandleImpl implements ProcessHandle {
     /**
@@ -338,7 +338,7 @@
      *
      * @return {@code true} if the process represented by this
      * {@code ProcessHandle} object has not yet terminated.
-     * @since 1.9
+     * @since 9
      */
     @Override
     public boolean isAlive() {
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -81,7 +81,7 @@
  * will cause a {@link NullPointerException NullPointerException}
  * to be thrown.
  *
- * @since 1.9
+ * @since 9
  */
 public final class StackWalker {
     /**
@@ -92,7 +92,7 @@
      * by the {@linkplain Option stack walking options} of a {@linkplain
      * StackWalker stack walker}.
      *
-     * @since 1.9
+     * @since 9
      * @jvms 2.6
      */
     public static interface StackFrame {
@@ -185,7 +185,7 @@
      * Stack walker option to configure the {@linkplain StackFrame stack frame}
      * information obtained by a {@code StackWalker}.
      *
-     * @since 1.9
+     * @since 9
      */
     public enum Option {
         /**
--- a/jdk/src/java.base/share/classes/java/lang/String.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Tue Jan 26 09:11:58 2016 +0100
@@ -2674,7 +2674,7 @@
      * point</a> is passed through uninterpreted.
      *
      * @return an IntStream of char values from this sequence
-     * @since 1.9
+     * @since 9
      */
     @Override
     public IntStream chars() {
@@ -2694,7 +2694,7 @@
      * {@code int} values which are then passed to the stream.
      *
      * @return an IntStream of Unicode code points from this sequence
-     * @since 1.9
+     * @since 9
      */
     @Override
     public IntStream codePoints() {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,25 +25,25 @@
 
 package java.lang.invoke;
 
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
+import jdk.internal.vm.annotation.Stable;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
 
 import java.lang.invoke.LambdaForm.NamedFunction;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
 import java.util.Arrays;
-import java.util.function.Function;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
 
-import jdk.internal.org.objectweb.asm.FieldVisitor;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.Wrapper;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
 /**
  * The flavor of method handle which emulates an invoke instruction
@@ -459,7 +459,7 @@
         static final String BMH_SIG  = "L"+BMH+";";
         static final String SPECIES_DATA     = "java/lang/invoke/BoundMethodHandle$SpeciesData";
         static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
-        static final String STABLE_SIG       = "Ljava/lang/invoke/Stable;";
+        static final String STABLE_SIG       = "Ljdk/internal/vm/annotation/Stable;";
 
         static final String SPECIES_PREFIX_NAME = "Species_";
         static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,19 +26,23 @@
 package java.lang.invoke;
 
 import jdk.internal.misc.Unsafe;
+import jdk.internal.vm.annotation.ForceInline;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
+import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Arrays;
-import sun.invoke.util.VerifyAccess;
+import java.util.Objects;
+
+import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.MethodHandleStatics.UNSAFE;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
 import static java.lang.invoke.MethodTypeForm.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.util.Objects;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.VerifyType;
-import sun.invoke.util.Wrapper;
 
 /**
  * The flavor of method handle which implements a constant reference
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DontInline.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.  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 java.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface DontInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/ForceInline.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.  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 java.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface ForceInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -625,9 +625,9 @@
 
         if (lambdaForm.forceInline) {
             // Force inlining of this invoker method.
-            mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+            mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
         } else {
-            mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+            mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
         }
 
         if (lambdaForm.customized != null) {
@@ -1309,7 +1309,7 @@
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
         // Don't inline the interpreter entry.
-        mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+        mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
 
         // create parameter array
         emitIconstInsn(invokerType.parameterCount());
@@ -1368,7 +1368,7 @@
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
         // Force inlining of this invoker method.
-        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+        mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
 
         // Load receiver
         emitAloadInsn(0);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.Array;
 import java.util.Arrays;
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,18 +25,24 @@
 
 package java.lang.invoke;
 
-import java.lang.annotation.*;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.Stable;
+import sun.invoke.util.Wrapper;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.Arrays;
 import java.util.HashMap;
-
-import sun.invoke.util.Wrapper;
-import java.lang.reflect.Field;
+import java.util.List;
 
 import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.MethodHandleStatics.debugEnabled;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.function.Function;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyType;
@@ -1487,7 +1488,7 @@
     }
 
     private static final int LEFT_ARGS = FILL_ARRAYS_COUNT - 1;
-    private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
+    private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY + 1];
     /** fill_array_to_right(N).invoke(a, argL..arg[N-1])
      *  fills a[L]..a[N-1] with corresponding arguments,
      *  and then returns a.  The value L is a global constant (LEFT_ARGS).
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 import java.lang.ref.WeakReference;
 import java.lang.ref.Reference;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 import java.lang.ref.SoftReference;
 import static java.lang.invoke.MethodHandleStatics.*;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Stable.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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.  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 java.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * A field may be annotated as stable if all of its component variables
- * changes value at most once.
- * A field's value counts as its component value.
- * If the field is typed as an array, then all the non-null components
- * of the array, of depth up to the rank of the field's array type,
- * also count as component values.
- * By extension, any variable (either array or field) which has annotated
- * as stable is called a stable variable, and its non-null or non-zero
- * value is called a stable value.
- * <p>
- * Since all fields begin with a default value of null for references
- * (resp., zero for primitives), it follows that this annotation indicates
- * that the first non-null (resp., non-zero) value stored in the field
- * will never be changed.
- * <p>
- * If the field is not of an array type, there are no array elements,
- * then the value indicated as stable is simply the value of the field.
- * If the dynamic type of the field value is an array but the static type
- * is not, the components of the array are <em>not</em> regarded as stable.
- * <p>
- * If the field is an array type, then both the field value and
- * all the components of the field value (if the field value is non-null)
- * are indicated to be stable.
- * If the field type is an array type with rank {@code N > 1},
- * then each component of the field value (if the field value is non-null),
- * is regarded as a stable array of rank {@code N-1}.
- * <p>
- * Fields which are declared {@code final} may also be annotated as stable.
- * Since final fields already behave as stable values, such an annotation
- * indicates no additional information, unless the type of the field is
- * an array type.
- * <p>
- * It is (currently) undefined what happens if a field annotated as stable
- * is given a third value.  In practice, if the JVM relies on this annotation
- * to promote a field reference to a constant, it may be that the Java memory
- * model would appear to be broken, if such a constant (the second value of the field)
- * is used as the value of the field even after the field value has changed.
- */
-/* package-private */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-@interface Stable {
-}
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -29,23 +29,20 @@
 /**
  * Phantom reference objects, which are enqueued after the collector
  * determines that their referents may otherwise be reclaimed.  Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
  *
- * <p> If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is <a
- * href="package-summary.html#reachability">phantom reachable</a>, then at that
- * time or at some later time it will enqueue the reference.
+ * <p> Suppose the garbage collector determines at a certain point in time
+ * that an object is <a href="package-summary.html#reachability">
+ * phantom reachable</a>.  At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
  *
  * <p> In order to ensure that a reclaimable object remains so, the referent of
  * a phantom reference may not be retrieved: The {@code get} method of a
  * phantom reference always returns {@code null}.
  *
- * <p> Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued.  An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
- *
  * @author   Mark Reinhold
  * @since    1.2
  */
@@ -69,8 +66,8 @@
      *
      * <p> It is possible to create a phantom reference with a {@code null}
      * queue, but such a reference is completely useless: Its {@code get}
-     * method will always return null and, since it does not have a queue, it
-     * will never be enqueued.
+     * method will always return {@code null} and, since it does not have a queue,
+     * it will never be enqueued.
      *
      * @param referent the object the new phantom reference will refer to
      * @param q the queue with which the reference is to be registered,
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
 
 package java.lang.ref;
 
+import jdk.internal.vm.annotation.DontInline;
 import sun.misc.Cleaner;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangRefAccess;
@@ -310,4 +311,120 @@
         this.queue = (queue == null) ? ReferenceQueue.NULL : queue;
     }
 
+    /**
+     * Ensures that the object referenced by the given reference remains
+     * <a href="package-summary.html#reachability"><em>strongly reachable</em></a>,
+     * regardless of any prior actions of the program that might otherwise cause
+     * the object to become unreachable; thus, the referenced object is not
+     * reclaimable by garbage collection at least until after the invocation of
+     * this method.  Invocation of this method does not itself initiate garbage
+     * collection or finalization.
+     *
+     * <p> This method establishes an ordering for
+     * <a href="package-summary.html#reachability"><em>strong reachability</em></a>
+     * with respect to garbage collection.  It controls relations that are
+     * otherwise only implicit in a program -- the reachability conditions
+     * triggering garbage collection.  This method is designed for use in
+     * uncommon situations of premature finalization where using
+     * {@code synchronized} blocks or methods, or using other synchronization
+     * facilities are not possible or do not provide the desired control.  This
+     * method is applicable only when reclamation may have visible effects,
+     * which is possible for objects with finalizers (See
+     * <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6">
+     * Section 12.6 17 of <cite>The Java&trade; Language Specification</cite></a>)
+     * that are implemented in ways that rely on ordering control for correctness.
+     *
+     * @apiNote
+     * Finalization may occur whenever the virtual machine detects that no
+     * reference to an object will ever be stored in the heap: The garbage
+     * collector may reclaim an object even if the fields of that object are
+     * still in use, so long as the object has otherwise become unreachable.
+     * This may have surprising and undesirable effects in cases such as the
+     * following example in which the bookkeeping associated with a class is
+     * managed through array indices.  Here, method {@code action} uses a
+     * {@code reachabilityFence} to ensure that the {@code Resource} object is
+     * not reclaimed before bookkeeping on an associated
+     * {@code ExternalResource} has been performed; in particular here, to
+     * ensure that the array slot holding the {@code ExternalResource} is not
+     * nulled out in method {@link Object#finalize}, which may otherwise run
+     * concurrently.
+     *
+     * <pre> {@code
+     * class Resource {
+     *   private static ExternalResource[] externalResourceArray = ...
+     *
+     *   int myIndex;
+     *   Resource(...) {
+     *     myIndex = ...
+     *     externalResourceArray[myIndex] = ...;
+     *     ...
+     *   }
+     *   protected void finalize() {
+     *     externalResourceArray[myIndex] = null;
+     *     ...
+     *   }
+     *   public void action() {
+     *     try {
+     *       // ...
+     *       int i = myIndex;
+     *       Resource.update(externalResourceArray[i]);
+     *     } finally {
+     *       Reference.reachabilityFence(this);
+     *     }
+     *   }
+     *   private static void update(ExternalResource ext) {
+     *     ext.status = ...;
+     *   }
+     * }}</pre>
+     *
+     * Here, the invocation of {@code reachabilityFence} is nonintuitively
+     * placed <em>after</em> the call to {@code update}, to ensure that the
+     * array slot is not nulled out by {@link Object#finalize} before the
+     * update, even if the call to {@code action} was the last use of this
+     * object.  This might be the case if, for example a usage in a user program
+     * had the form {@code new Resource().action();} which retains no other
+     * reference to this {@code Resource}.  While probably overkill here,
+     * {@code reachabilityFence} is placed in a {@code finally} block to ensure
+     * that it is invoked across all paths in the method.  In a method with more
+     * complex control paths, you might need further precautions to ensure that
+     * {@code reachabilityFence} is encountered along all of them.
+     *
+     * <p> It is sometimes possible to better encapsulate use of
+     * {@code reachabilityFence}.  Continuing the above example, if it were
+     * acceptable for the call to method {@code update} to proceed even if the
+     * finalizer had already executed (nulling out slot), then you could
+     * localize use of {@code reachabilityFence}:
+     *
+     * <pre> {@code
+     * public void action2() {
+     *   // ...
+     *   Resource.update(getExternalResource());
+     * }
+     * private ExternalResource getExternalResource() {
+     *   ExternalResource ext = externalResourceArray[myIndex];
+     *   Reference.reachabilityFence(this);
+     *   return ext;
+     * }}</pre>
+     *
+     * <p> Method {@code reachabilityFence} is not required in constructions
+     * that themselves ensure reachability.  For example, because objects that
+     * are locked cannot, in general, be reclaimed, it would suffice if all
+     * accesses of the object, in all methods of class {@code Resource}
+     * (including {@code finalize}) were enclosed in {@code synchronized (this)}
+     * blocks.  (Further, such blocks must not include infinite loops, or
+     * themselves be unreachable, which fall into the corner case exceptions to
+     * the "in general" disclaimer.)  However, method {@code reachabilityFence}
+     * remains a better option in cases where this approach is not as efficient,
+     * desirable, or possible; for example because it would encounter deadlock.
+     *
+     * @param ref the reference. If {@code null}, this method has no effect.
+     * @since 9
+     */
+    @DontInline
+    public static void reachabilityFence(Object ref) {
+        // Does nothing, because this method is annotated with @DontInline
+        // HotSpot needs to retain the ref and not GC it before a call to this
+        // method
+    }
+
 }
--- a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -66,9 +66,9 @@
  * object with a <em>reference queue</em> at the time the reference
  * object is created.  Some time after the garbage collector
  * determines that the reachability of the referent has changed to the
- * value corresponding to the type of the reference, it will add the
- * reference to the associated queue.  At this point, the reference is
- * considered to be <em>enqueued</em>.  The program may remove
+ * value corresponding to the type of the reference, it will clear the
+ * reference and add it to the associated queue.  At this point, the
+ * reference is considered to be <em>enqueued</em>.  The program may remove
  * references from a queue either by polling or by blocking until a
  * reference becomes available.  Reference queues are implemented by
  * the {@link java.lang.ref.ReferenceQueue} class.
@@ -94,16 +94,6 @@
  * structure, this check will add little overhead to the hashtable
  * access methods.
  *
- * <h3>Automatically-cleared references</h3>
- *
- * Soft and weak references are automatically cleared by the collector
- * before being added to the queues with which they are registered, if
- * any.  Therefore soft and weak references need not be registered
- * with a queue in order to be useful, while phantom references do.
- * An object that is reachable via phantom references will remain so
- * until all such references are cleared or themselves become
- * unreachable.
- *
  * <a name="reachability"></a>
  * <h3>Reachability</h3>
  *
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -53,7 +53,7 @@
      *
      * @return {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     @Override
     AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -59,7 +59,7 @@
      *     refers to a parameterized type that cannot be instantiated
      *     for any reason
      *
-     * @since 1.9
+     * @since 9
      */
     @Override
     AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -60,7 +60,7 @@
      *     refers to a parameterized type that cannot be instantiated
      *     for any reason
      *
-     * @since 1.9
+     * @since 9
      */
     default AnnotatedType getAnnotatedOwnerType() {
         return null;
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,7 @@
      *
      * @return {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     @Override
     AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -65,7 +65,7 @@
      *
      * @return {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     @Override
     AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java	Tue Jan 26 09:11:58 2016 +0100
@@ -297,7 +297,7 @@
      * @throws IndexOutOfBoundsException if the provided array offset and
      *         length would cause an index into the byte array to be
      *         negative or greater than or equal to the array length.
-     * @since 1.9
+     * @since 9
      */
     public BigInteger(byte[] val, int off, int len) {
         if (val.length == 0) {
@@ -385,7 +385,7 @@
      * @throws IndexOutOfBoundsException if the provided array offset and
      *         length would cause an index into the byte array to be
      *         negative or greater than or equal to the array length.
-     * @since 1.9
+     * @since 9
      */
     public BigInteger(int signum, byte[] magnitude, int off, int len) {
         if (signum < -1 || signum > 1) {
@@ -2424,7 +2424,7 @@
      *         {@code (i * sqrt(-val))} where <i>i</i> is the
      *         <i>imaginary unit</i> and is equal to
      *         {@code sqrt(-1)}.)
-     * @since  1.9
+     * @since  9
      */
     public BigInteger sqrt() {
         if (this.signum < 0) {
@@ -2447,7 +2447,7 @@
      *         <i>imaginary unit</i> and is equal to
      *         {@code sqrt(-1)}.)
      * @see #sqrt()
-     * @since  1.9
+     * @since  9
      */
     public BigInteger[] sqrtAndRemainder() {
         BigInteger s = sqrt();
--- a/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1878,7 +1878,7 @@
      * @throws ArithmeticException if the value returned by {@code bitLength()}
      * overflows the range of {@code int}.
      * @return the integer square root of {@code this}
-     * @since 1.9
+     * @since 9
      */
     MutableBigInteger sqrt() {
         // Special cases.
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1338,7 +1338,7 @@
      *
      * @throws NullPointerException if name is {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     public <T> DatagramSocket setOption(SocketOption<T> name, T value)
         throws IOException
@@ -1368,7 +1368,7 @@
      *         {@link java.net.StandardSocketOptions StandardSocketOptions}
      *         do not require any security permission.
      *
-     * @since 1.9
+     * @since 9
      */
     public <T> T getOption(SocketOption<T> name) throws IOException {
         return getImpl().getOption(name);
@@ -1386,7 +1386,7 @@
      * @return A set of the socket options supported by this socket. This set
      *        may be empty if the socket's DatagramSocketImpl cannot be created.
      *
-     * @since 1.9
+     * @since 9
      */
     public Set<SocketOption<?>> supportedOptions() {
         synchronized(DatagramSocket.class) {
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -278,7 +278,7 @@
      *
      * @throws NullPointerException if name is {@code null}
      * @throws IOException if an I/O problem occurs while attempting to set the option
-     * @since 1.9
+     * @since 9
      */
     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
         if (name == StandardSocketOptions.SO_SNDBUF) {
@@ -319,7 +319,7 @@
      * @throws NullPointerException if name is {@code null}
      * @throws IOException if an I/O problem occurs while attempting to set the option
      *
-     * @since 1.9
+     * @since 9
      */
     @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
--- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java	Tue Jan 26 09:11:58 2016 +0100
@@ -130,7 +130,7 @@
      *
      * @return a Stream object with all or a subset of the InetAddresses
      * bound to this network interface
-     * @since 1.9
+     * @since 9
      */
     public Stream<InetAddress> inetAddresses() {
         return streamFromArray(getCheckedInetAddresses());
@@ -208,7 +208,7 @@
      *
      * @return a Stream object with all of the subinterfaces
      * of this network interface
-     * @since 1.9
+     * @since 9
      */
     public Stream<NetworkInterface> subInterfaces() {
         return streamFromArray(childs);
@@ -362,7 +362,7 @@
      *
      * @return a Stream of NetworkInterfaces found on this machine
      * @exception  SocketException  if an I/O error occurs.
-     * @since 1.9
+     * @since 9
      */
     public static Stream<NetworkInterface> networkInterfaces()
         throws SocketException {
--- a/jdk/src/java.base/share/classes/java/net/ServerSocket.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java	Tue Jan 26 09:11:58 2016 +0100
@@ -946,7 +946,7 @@
      *         {@link java.net.StandardSocketOptions StandardSocketOptions}
      *         do not require any security permission.
      *
-     * @since 1.9
+     * @since 9
      */
     public <T> ServerSocket setOption(SocketOption<T> name, T value)
         throws IOException
@@ -976,7 +976,7 @@
      *         {@link java.net.StandardSocketOptions StandardSocketOptions}
      *         do not require any security permission.
      *
-     * @since 1.9
+     * @since 9
      */
     public <T> T getOption(SocketOption<T> name) throws IOException {
         return getImpl().getOption(name);
@@ -994,7 +994,7 @@
      * @return A set of the socket options supported by this socket. This set
      *         may be empty if the socket's SocketImpl cannot be created.
      *
-     * @since 1.9
+     * @since 9
      */
     public Set<SocketOption<?>> supportedOptions() {
         synchronized (ServerSocket.class) {
--- a/jdk/src/java.base/share/classes/java/net/Socket.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1756,7 +1756,7 @@
      *         {@link java.net.StandardSocketOptions StandardSocketOptions}
      *         do not require any security permission.
      *
-     * @since 1.9
+     * @since 9
      */
     public <T> Socket setOption(SocketOption<T> name, T value) throws IOException {
         getImpl().setOption(name, value);
@@ -1784,7 +1784,7 @@
      *         {@link java.net.StandardSocketOptions StandardSocketOptions}
      *         do not require any security permission.
      *
-     * @since 1.9
+     * @since 9
      */
     @SuppressWarnings("unchecked")
     public <T> T getOption(SocketOption<T> name) throws IOException {
@@ -1803,7 +1803,7 @@
      * @return A set of the socket options supported by this socket. This set
      *         may be empty if the socket's SocketImpl cannot be created.
      *
-     * @since 1.9
+     * @since 9
      */
     public Set<SocketOption<?>> supportedOptions() {
         synchronized (Socket.class) {
--- a/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -373,7 +373,7 @@
      *
      * @throws IOException if an I/O error occurs, or if the socket is closed.
      *
-     * @since 1.9
+     * @since 9
      */
     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
         if (name == StandardSocketOptions.SO_KEEPALIVE &&
@@ -412,7 +412,7 @@
      *
      * @throws IOException if an I/O error occurs, or if the socket is closed.
      *
-     * @since 1.9
+     * @since 9
      */
     @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
--- a/jdk/src/java.base/share/classes/java/net/URL.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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,10 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Hashtable;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.ObjectStreamField;
+import java.io.ObjectInputStream.GetField;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.ServiceConfigurationError;
@@ -142,6 +146,7 @@
  */
 public final class URL implements java.io.Serializable {
 
+    static final String BUILTIN_HANDLERS_PREFIX = "sun.net.www.protocol";
     static final long serialVersionUID = -7627629688361524110L;
 
     /**
@@ -226,6 +231,8 @@
      */
     private int hashCode = -1;
 
+    private transient UrlDeserializedState tempState;
+
     /**
      * Creates a {@code URL} object from the specified
      * {@code protocol}, {@code host}, {@code port}
@@ -1354,6 +1361,31 @@
     }
 
     /**
+     * @serialField    protocol String
+     *
+     * @serialField    host String
+     *
+     * @serialField    port int
+     *
+     * @serialField    authority String
+     *
+     * @serialField    file String
+     *
+     * @serialField    ref String
+     *
+     * @serialField    hashCode int
+     *
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("protocol", String.class),
+        new ObjectStreamField("host", String.class),
+        new ObjectStreamField("port", int.class),
+        new ObjectStreamField("authority", String.class),
+        new ObjectStreamField("file", String.class),
+        new ObjectStreamField("ref", String.class),
+        new ObjectStreamField("hashCode", int.class), };
+
+    /**
      * WriteObject is called to save the state of the URL to an
      * ObjectOutputStream. The handler is not saved since it is
      * specific to this system.
@@ -1375,16 +1407,67 @@
      * stream handler.
      */
     private synchronized void readObject(java.io.ObjectInputStream s)
-         throws IOException, ClassNotFoundException
-    {
-        s.defaultReadObject();  // read the fields
-        if ((handler = getURLStreamHandler(protocol)) == null) {
+            throws IOException, ClassNotFoundException {
+        GetField gf = s.readFields();
+        String protocol = (String)gf.get("protocol", null);
+        if (getURLStreamHandler(protocol) == null) {
             throw new IOException("unknown protocol: " + protocol);
         }
+        String host = (String)gf.get("host", null);
+        int port = gf.get("port", -1);
+        String authority = (String)gf.get("authority", null);
+        String file = (String)gf.get("file", null);
+        String ref = (String)gf.get("ref", null);
+        int hashCode = gf.get("hashCode", -1);
+        if (authority == null
+                && ((host != null && host.length() > 0) || port != -1)) {
+            if (host == null)
+                host = "";
+            authority = (port == -1) ? host : host + ":" + port;
+        }
+        tempState = new UrlDeserializedState(protocol, host, port, authority,
+               file, ref, hashCode);
+    }
+
+    /**
+     * Replaces the de-serialized object with an URL object.
+     *
+     * @return a newly created object from deserialized data
+     *
+     * @throws ObjectStreamException if a new object replacing this
+     * object could not be created
+     */
+
+   private Object readResolve() throws ObjectStreamException {
+
+        URLStreamHandler handler = null;
+        // already been checked in readObject
+        handler = getURLStreamHandler(tempState.getProtocol());
+
+        URL replacementURL = null;
+        if (isBuiltinStreamHandler(handler.getClass().getName())) {
+            replacementURL = fabricateNewURL();
+        } else {
+            replacementURL = setDeserializedFields(handler);
+        }
+        return replacementURL;
+    }
+
+    private URL setDeserializedFields(URLStreamHandler handler) {
+        URL replacementURL;
+        String userInfo = null;
+        String protocol = tempState.getProtocol();
+        String host = tempState.getHost();
+        int port = tempState.getPort();
+        String authority = tempState.getAuthority();
+        String file = tempState.getFile();
+        String ref = tempState.getRef();
+        int hashCode = tempState.getHashCode();
+
 
         // Construct authority part
-        if (authority == null &&
-            ((host != null && host.length() > 0) || port != -1)) {
+        if (authority == null
+            && ((host != null && host.length() > 0) || port != -1)) {
             if (host == null)
                 host = "";
             authority = (port == -1) ? host : host + ":" + port;
@@ -1403,8 +1486,8 @@
         }
 
         // Construct path and query part
-        path = null;
-        query = null;
+        String path = null;
+        String query = null;
         if (file != null) {
             // Fix: only do this if hierarchical?
             int q = file.lastIndexOf('?');
@@ -1414,6 +1497,67 @@
             } else
                 path = file;
         }
+
+        if (port == -1) {
+            port = 0;
+        }
+        // Set the object fields.
+        this.protocol = protocol;
+        this.host = host;
+        this.port = port;
+        this.file = file;
+        this.authority = authority;
+        this.ref = ref;
+        this.hashCode = hashCode;
+        this.handler = handler;
+        this.query = query;
+        this.path = path;
+        this.userInfo = userInfo;
+        replacementURL = this;
+        return replacementURL;
+    }
+
+    private URL fabricateNewURL()
+                throws InvalidObjectException {
+        // create URL string from deserialized object
+        URL replacementURL = null;
+        String urlString = tempState.reconstituteUrlString();
+
+        try {
+            replacementURL = new URL(urlString);
+        } catch (MalformedURLException mEx) {
+            resetState();
+            InvalidObjectException invoEx = new InvalidObjectException(
+                    "Malformed URL:  " + urlString);
+            invoEx.initCause(mEx);
+            throw invoEx;
+        }
+        replacementURL.setSerializedHashCode(tempState.getHashCode());
+        resetState();
+        return replacementURL;
+    }
+
+    private boolean isBuiltinStreamHandler(String handlerClassName) {
+        return (handlerClassName.startsWith(BUILTIN_HANDLERS_PREFIX));
+    }
+
+    private void resetState() {
+        this.protocol = null;
+        this.host = null;
+        this.port = -1;
+        this.file = null;
+        this.authority = null;
+        this.ref = null;
+        this.hashCode = -1;
+        this.handler = null;
+        this.query = null;
+        this.path = null;
+        this.userInfo = null;
+        this.tempState = null;
+    }
+
+    private void setSerializedHashCode(int hc) {
+        this.hashCode = hc;
     }
 }
 
@@ -1445,3 +1589,82 @@
         return ref;
     }
 }
+
+final class UrlDeserializedState {
+    private final String protocol;
+    private final String host;
+    private final int port;
+    private final String authority;
+    private final String file;
+    private final String ref;
+    private final int hashCode;
+
+    public UrlDeserializedState(String protocol,
+                                String host, int port,
+                                String authority, String file,
+                                String ref, int hashCode) {
+        this.protocol = protocol;
+        this.host = host;
+        this.port = port;
+        this.authority = authority;
+        this.file = file;
+        this.ref = ref;
+        this.hashCode = hashCode;
+    }
+
+    String getProtocol() {
+        return protocol;
+    }
+
+    String getHost() {
+        return host;
+    }
+
+    String getAuthority () {
+        return authority;
+    }
+
+    int getPort() {
+        return port;
+    }
+
+    String getFile () {
+        return file;
+    }
+
+    String getRef () {
+        return ref;
+    }
+
+    int getHashCode () {
+        return hashCode;
+    }
+
+    String reconstituteUrlString() {
+
+        // pre-compute length of StringBuffer
+        int len = protocol.length() + 1;
+        if (authority != null && authority.length() > 0)
+            len += 2 + authority.length();
+        if (file != null) {
+            len += file.length();
+        }
+        if (ref != null)
+            len += 1 + ref.length();
+        StringBuilder result = new StringBuilder(len);
+        result.append(protocol);
+        result.append(":");
+        if (authority != null && authority.length() > 0) {
+            result.append("//");
+            result.append(authority);
+        }
+        if (file != null) {
+            result.append(file);
+        }
+        if (ref != null) {
+            result.append("#");
+            result.append(ref);
+        }
+        return result.toString();
+    }
+}
--- a/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
  * <p> URL stream handler providers are located at runtime, as specified in the
  * {@linkplain java.net.URL#URL(String,String,int,String) URL constructor}.
  *
- * @since 1.9
+ * @since 9
  */
 public abstract class URLStreamHandlerProvider
     implements URLStreamHandlerFactory
--- a/jdk/src/java.base/share/classes/java/net/spi/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/net/spi/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,7 +29,7 @@
  * <p> Only developers who are defining new URL stream handler providers
  * should need to make direct use of this package.
  *
- * @since 1.9
+ * @since 9
  */
 
 package java.net.spi;
--- a/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -213,7 +213,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer position(int newPosition) {
@@ -223,7 +223,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer limit(int newLimit) {
@@ -233,7 +233,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer mark() {
@@ -243,7 +243,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer reset() {
@@ -253,7 +253,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer clear() {
@@ -263,7 +263,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer flip() {
@@ -273,7 +273,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public final MappedByteBuffer rewind() {
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Tue Jan 26 09:11:58 2016 +0100
@@ -1064,7 +1064,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public
@@ -1078,7 +1078,7 @@
     
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public
@@ -1092,7 +1092,7 @@
     
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public 
@@ -1106,7 +1106,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public 
@@ -1120,7 +1120,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public 
@@ -1134,7 +1134,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public 
@@ -1148,7 +1148,7 @@
 
     /**
      * {@inheritDoc}
-     * @since 1.9
+     * @since 9
      */
     @Override
     public 
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1666,7 +1666,7 @@
      *
      * @see Provider
      *
-     * @since 1.9
+     * @since 9
      */
     public static final KeyStore getInstance(File file, char[] password)
         throws KeyStoreException, IOException, NoSuchAlgorithmException,
@@ -1722,7 +1722,7 @@
      *
      * @see Provider
      *
-     * @since 1.9
+     * @since 9
      */
     public static final KeyStore getInstance(File file,
         LoadStoreParameter param) throws KeyStoreException, IOException,
@@ -2006,7 +2006,7 @@
          *   of either PasswordProtection or CallbackHandlerProtection; or
          *   if file does not exist or does not refer to a normal file
          *
-         * @since 1.9
+         * @since 9
          */
         public static Builder newInstance(File file,
             ProtectionParameter protection) {
--- a/jdk/src/java.base/share/classes/java/security/PermissionCollection.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/PermissionCollection.java	Tue Jan 26 09:11:58 2016 +0100
@@ -144,7 +144,7 @@
      * the enumeration returned from a call to {@link #elements()}.
      *
      * @return a stream of all the Permissions.
-     * @since 1.9
+     * @since 9
      */
     public Stream<Permission> elementsAsStream() {
         int characteristics = isReadOnly()
--- a/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,7 +43,7 @@
  * provide the necessary locking. Multiple threads each manipulating
  * separate objects need not synchronize.
  *
- * @since       1.9
+ * @since       9
  * @see         CertStore
  * @see         java.net.URI
  */
--- a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java	Tue Jan 26 09:11:58 2016 +0100
@@ -74,7 +74,7 @@
      * or {@code algorithm} is null.
      * @throws IllegalArgumentException if {@code algorithm} is
      * the empty string {@code ""}
-     * @since 1.9
+     * @since 9
      */
     protected EncodedKeySpec(byte[] encodedKey, String algorithm) {
         if (algorithm == null) {
@@ -93,7 +93,7 @@
      * Returns the name of the algorithm of the encoded key.
      *
      * @return the name of the algorithm, or null if not specified
-     * @since 1.9
+     * @since 9
      */
     public String getAlgorithm() {
         return algorithmName;
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java	Tue Jan 26 09:11:58 2016 +0100
@@ -92,7 +92,7 @@
      * or {@code algorithm} is null.
      * @throws IllegalArgumentException if {@code algorithm} is
      * the empty string {@code ""}
-     * @since 1.9
+     * @since 9
      */
     public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) {
         super(encodedKey, algorithm);
--- a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java	Tue Jan 26 09:11:58 2016 +0100
@@ -82,7 +82,7 @@
      * or {@code algorithm} is null.
      * @throws IllegalArgumentException if {@code algorithm} is
      * the empty string {@code ""}
-     * @since 1.9
+     * @since 9
      */
     public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {
         super(encodedKey, algorithm);
--- a/jdk/src/java.base/share/classes/java/util/ArrayList.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/ArrayList.java	Tue Jan 26 09:11:58 2016 +0100
@@ -207,39 +207,19 @@
      * necessary, to ensure that it can hold at least the number of elements
      * specified by the minimum capacity argument.
      *
-     * @param   minCapacity   the desired minimum capacity
+     * @param minCapacity the desired minimum capacity
      */
     public void ensureCapacity(int minCapacity) {
-        int minExpand = (elementData != DEFAULTCAPACITY_EMPTY_ELEMENTDATA)
-            // any size if not default element table
-            ? 0
-            // larger than default for default empty table. It's already
-            // supposed to be at default size.
-            : DEFAULT_CAPACITY;
-
-        if (minCapacity > minExpand) {
-            ensureExplicitCapacity(minCapacity);
+        if (minCapacity > elementData.length
+            && !(elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA
+                 && minCapacity <= DEFAULT_CAPACITY)) {
+            modCount++;
+            grow(minCapacity);
         }
     }
 
-    private void ensureCapacityInternal(int minCapacity) {
-        if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) {
-            minCapacity = Math.max(DEFAULT_CAPACITY, minCapacity);
-        }
-
-        ensureExplicitCapacity(minCapacity);
-    }
-
-    private void ensureExplicitCapacity(int minCapacity) {
-        modCount++;
-
-        // overflow-conscious code
-        if (minCapacity - elementData.length > 0)
-            grow(minCapacity);
-    }
-
     /**
-     * The maximum size of array to allocate.
+     * The maximum size of array to allocate (unless necessary).
      * Some VMs reserve some header words in an array.
      * Attempts to allocate larger arrays may result in
      * OutOfMemoryError: Requested array size exceeds VM limit
@@ -251,25 +231,48 @@
      * number of elements specified by the minimum capacity argument.
      *
      * @param minCapacity the desired minimum capacity
+     * @throws OutOfMemoryError if minCapacity is less than zero
      */
-    private void grow(int minCapacity) {
+    private Object[] grow(int minCapacity) {
+        return elementData = Arrays.copyOf(elementData,
+                                           newCapacity(minCapacity));
+    }
+
+    private Object[] grow() {
+        return grow(size + 1);
+    }
+
+    /**
+     * Returns a capacity at least as large as the given minimum capacity.
+     * Returns the current capacity increased by 50% if that suffices.
+     * Will not return a capacity greater than MAX_ARRAY_SIZE unless
+     * the given minimum capacity is greater than MAX_ARRAY_SIZE.
+     *
+     * @param minCapacity the desired minimum capacity
+     * @throws OutOfMemoryError if minCapacity is less than zero
+     */
+    private int newCapacity(int minCapacity) {
         // overflow-conscious code
         int oldCapacity = elementData.length;
         int newCapacity = oldCapacity + (oldCapacity >> 1);
-        if (newCapacity - minCapacity < 0)
-            newCapacity = minCapacity;
-        if (newCapacity - MAX_ARRAY_SIZE > 0)
-            newCapacity = hugeCapacity(minCapacity);
-        // minCapacity is usually close to size, so this is a win:
-        elementData = Arrays.copyOf(elementData, newCapacity);
+        if (newCapacity - minCapacity <= 0) {
+            if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA)
+                return Math.max(DEFAULT_CAPACITY, minCapacity);
+            if (minCapacity < 0) // overflow
+                throw new OutOfMemoryError();
+            return minCapacity;
+        }
+        return (newCapacity - MAX_ARRAY_SIZE <= 0)
+            ? newCapacity
+            : hugeCapacity(minCapacity);
     }
 
     private static int hugeCapacity(int minCapacity) {
         if (minCapacity < 0) // overflow
             throw new OutOfMemoryError();
-        return (minCapacity > MAX_ARRAY_SIZE) ?
-            Integer.MAX_VALUE :
-            MAX_ARRAY_SIZE;
+        return (minCapacity > MAX_ARRAY_SIZE)
+            ? Integer.MAX_VALUE
+            : MAX_ARRAY_SIZE;
     }
 
     /**
@@ -452,14 +455,26 @@
     }
 
     /**
+     * This helper method split out from add(E) to keep method
+     * bytecode size under 35 (the -XX:MaxInlineSize default value),
+     * which helps when add(E) is called in a C1-compiled loop.
+     */
+    private void add(E e, Object[] elementData, int s) {
+        if (s == elementData.length)
+            elementData = grow();
+        elementData[s] = e;
+        size = s + 1;
+    }
+
+    /**
      * Appends the specified element to the end of this list.
      *
      * @param e element to be appended to this list
      * @return {@code true} (as specified by {@link Collection#add})
      */
     public boolean add(E e) {
-        ensureCapacityInternal(size + 1);  // Increments modCount!!
-        elementData[size++] = e;
+        modCount++;
+        add(e, elementData, size);
         return true;
     }
 
@@ -474,12 +489,16 @@
      */
     public void add(int index, E element) {
         rangeCheckForAdd(index);
-
-        ensureCapacityInternal(size + 1);  // Increments modCount!!
-        System.arraycopy(elementData, index, elementData, index + 1,
-                         size - index);
+        modCount++;
+        final int s;
+        Object[] elementData;
+        if ((s = size) == (elementData = this.elementData).length)
+            elementData = grow();
+        System.arraycopy(elementData, index,
+                         elementData, index + 1,
+                         s - index);
         elementData[index] = element;
-        size++;
+        size = s + 1;
     }
 
     /**
@@ -578,11 +597,17 @@
      */
     public boolean addAll(Collection<? extends E> c) {
         Object[] a = c.toArray();
+        modCount++;
         int numNew = a.length;
-        ensureCapacityInternal(size + numNew);  // Increments modCount
-        System.arraycopy(a, 0, elementData, size, numNew);
-        size += numNew;
-        return numNew != 0;
+        if (numNew == 0)
+            return false;
+        Object[] elementData;
+        final int s;
+        if (numNew > (elementData = this.elementData).length - (s = size))
+            elementData = grow(s + numNew);
+        System.arraycopy(a, 0, elementData, s, numNew);
+        size = s + numNew;
+        return true;
     }
 
     /**
@@ -604,17 +629,23 @@
         rangeCheckForAdd(index);
 
         Object[] a = c.toArray();
+        modCount++;
         int numNew = a.length;
-        ensureCapacityInternal(size + numNew);  // Increments modCount
+        if (numNew == 0)
+            return false;
+        Object[] elementData;
+        final int s;
+        if (numNew > (elementData = this.elementData).length - (s = size))
+            elementData = grow(s + numNew);
 
-        int numMoved = size - index;
+        int numMoved = s - index;
         if (numMoved > 0)
-            System.arraycopy(elementData, index, elementData, index + numNew,
+            System.arraycopy(elementData, index,
+                             elementData, index + numNew,
                              numMoved);
-
         System.arraycopy(a, 0, elementData, index, numNew);
-        size += numNew;
-        return numNew != 0;
+        size = s + numNew;
+        return true;
     }
 
     /**
@@ -786,7 +817,6 @@
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
-        elementData = EMPTY_ELEMENTDATA;
 
         // Read in size, and any hidden stuff
         s.defaultReadObject();
@@ -795,14 +825,19 @@
         s.readInt(); // ignored
 
         if (size > 0) {
-            // be like clone(), allocate array based upon size not capacity
-            ensureCapacityInternal(size);
+            // like clone(), allocate array based upon size not capacity
+            Object[] elements = new Object[size];
 
-            Object[] a = elementData;
             // Read in all elements in the proper order.
-            for (int i=0; i<size; i++) {
-                a[i] = s.readObject();
+            for (int i = 0; i < size; i++) {
+                elements[i] = s.readObject();
             }
+
+            elementData = elements;
+        } else if (size == 0) {
+            elementData = EMPTY_ELEMENTDATA;
+        } else {
+            throw new java.io.InvalidObjectException("Invalid size: " + size);
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java	Tue Jan 26 09:11:58 2016 +0100
@@ -110,7 +110,7 @@
      * Checks that {@code fromIndex} and {@code toIndex} are in
      * the range and throws an exception if they aren't.
      */
-    private static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
+    static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
         if (fromIndex > toIndex) {
             throw new IllegalArgumentException(
                     "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
@@ -2579,11 +2579,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2628,11 +2624,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2657,11 +2651,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2706,11 +2696,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2735,11 +2723,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2784,11 +2768,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2814,11 +2796,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2863,11 +2841,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2893,11 +2869,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2942,11 +2914,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2971,11 +2941,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3020,11 +2986,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -3055,14 +3019,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++) {
-            double v1 = a[i], v2 = a2[i];
-            if (Double.doubleToRawLongBits(v1) != Double.doubleToRawLongBits(v2))
-                if (!Double.isNaN(v1) || !Double.isNaN(v2))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3113,14 +3070,8 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++) {
-            Double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex, aLength) < 0;
     }
 
     /**
@@ -3151,14 +3102,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++) {
-            float v1 = a[i], v2 = a2[i];
-            if (Float.floatToRawIntBits(v1) != Float.floatToRawIntBits(v2))
-                if (!Float.isNaN(v1) || !Float.isNaN(v2))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3209,14 +3153,8 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex, aLength) < 0;
     }
 
     /**
@@ -5804,9 +5742,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Boolean.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Boolean.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -5880,11 +5819,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            boolean va = a[aFromIndex++];
-            boolean vb = b[bFromIndex++];
-            if (va != vb) return Boolean.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -5939,9 +5878,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Byte.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6014,11 +5954,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            byte va = a[aFromIndex++];
-            byte vb = b[bFromIndex++];
-            if (va != vb) return Byte.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6066,9 +6006,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Byte.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6133,11 +6074,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            byte va = a[aFromIndex++];
-            byte vb = b[bFromIndex++];
-            if (va != vb) return Byte.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6192,9 +6133,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Short.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6267,11 +6209,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            short va = a[aFromIndex++];
-            short vb = b[bFromIndex++];
-            if (va != vb) return Short.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6319,9 +6261,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Short.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6385,11 +6328,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            short va = a[aFromIndex++];
-            short vb = b[bFromIndex++];
-            if (va != vb) return Short.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6444,9 +6387,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Character.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6519,11 +6463,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            char va = a[aFromIndex++];
-            char vb = b[bFromIndex++];
-            if (va != vb) return Character.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6578,9 +6522,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Integer.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6653,11 +6598,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            int va = a[aFromIndex++];
-            int vb = b[bFromIndex++];
-            if (va != vb) return Integer.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6705,9 +6650,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Integer.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6771,11 +6717,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            int va = a[aFromIndex++];
-            int vb = b[bFromIndex++];
-            if (va != vb) return Integer.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6830,9 +6776,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Long.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6905,11 +6852,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            long va = a[aFromIndex++];
-            long vb = b[bFromIndex++];
-            if (va != vb) return Long.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6957,9 +6904,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Long.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7023,11 +6971,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            long va = a[aFromIndex++];
-            long vb = b[bFromIndex++];
-            if (va != vb) return Long.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7082,13 +7030,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            float va = a[i], vb = b[i];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
-                int c = Float.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Float.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7161,13 +7106,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
-                int c = Float.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7222,13 +7165,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            double va = a[i], vb = b[i];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
-                int c = Double.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Double.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7301,13 +7241,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
-                int c = Double.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7673,11 +7611,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -7749,11 +7684,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch byte
@@ -7804,11 +7738,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -7880,11 +7811,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch char
@@ -7935,11 +7865,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8011,11 +7938,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch short
@@ -8066,11 +7992,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8142,11 +8065,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch int
@@ -8197,11 +8119,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8273,11 +8192,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch long
@@ -8328,11 +8246,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8404,11 +8319,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch float
@@ -8459,14 +8373,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            float va = a[i], vb = b[i];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8538,14 +8446,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch double
@@ -8596,14 +8500,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            double va = a[i], vb = b[i];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8675,14 +8573,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch objects
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/ArraysSupport.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, 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 java.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ * <p>Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access.  For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM.  On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions.  So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ * <p>None of the mismatch methods perform array bounds checks.  It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+class ArraysSupport {
+    static final Unsafe U = Unsafe.getUnsafe();
+
+    private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+    private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+    private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+    private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+    private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+    private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+    private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+    private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+    private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+    private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+    private static int exactLog2(int scale) {
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("data type scale not a power of two");
+        return Integer.numberOfTrailingZeros(scale);
+    }
+
+    private ArraysSupport() {}
+
+    /**
+     * Find the relative index of the first mismatching pair of elements in two
+     * primitive arrays of the same component type.  Pairs of elements will be
+     * tested in order relative to given offsets into both arrays.
+     *
+     * <p>This method does not perform type checks or bounds checks.  It is the
+     * responsibility of the caller to perform such checks before calling this
+     * method.
+     *
+     * <p>The given offsets, in bytes, need not be aligned according to the
+     * given log<sub>2</sub> size the array elements.  More specifically, an
+     * offset modulus the size need not be zero.
+     *
+     * @param a the first array to be tested for mismatch, or {@code null} for
+     * direct memory access
+     * @param aOffset the relative offset, in bytes, from the base address of
+     * the first array to test from, otherwise if the first array is
+     * {@code null}, an absolute address pointing to the first element to test.
+     * @param b the second array to be tested for mismatch, or {@code null} for
+     * direct memory access
+     * @param bOffset the relative offset, in bytes, from the base address of
+     * the second array to test from, otherwise if the second array is
+     * {@code null}, an absolute address pointing to the first element to test.
+     * @param length the number of array elements to test
+     * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
+     * corresponds to the size, in bytes, of an array element.
+     * @return if a mismatch is found a relative index, between 0 (inclusive)
+     * and {@code length} (exclusive), of the first mismatching pair of elements
+     * in the two arrays.  Otherwise, if a mismatch is not found the bitwise
+     * compliment of the number of remaining pairs of elements to be checked in
+     * the tail of the two arrays.
+     */
+    @HotSpotIntrinsicCandidate
+    static int vectorizedMismatch(Object a, long aOffset,
+                                  Object b, long bOffset,
+                                  int length,
+                                  int log2ArrayIndexScale) {
+        // assert a.getClass().isArray();
+        // assert b.getClass().isArray();
+        // assert 0 <= length <= sizeOf(a)
+        // assert 0 <= length <= sizeOf(b)
+        // assert 0 <= log2ArrayIndexScale <= 3
+
+        int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+        int wi = 0;
+        for (; wi < length >> log2ValuesPerWidth; wi++) {
+            long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+            long av = U.getLongUnaligned(a, aOffset + bi);
+            long bv = U.getLongUnaligned(b, bOffset + bi);
+            if (av != bv) {
+                long x = av ^ bv;
+                int o = BIG_ENDIAN
+                        ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+                        : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+                return (wi << log2ValuesPerWidth) + o;
+            }
+        }
+
+        // Calculate the tail of remaining elements to check
+        int tail = length - (wi << log2ValuesPerWidth);
+
+        if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+            int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+            // Handle 4 bytes or 2 chars in the tail using int width
+            if (tail >= wordTail) {
+                long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+                int av = U.getIntUnaligned(a, aOffset + bi);
+                int bv = U.getIntUnaligned(b, bOffset + bi);
+                if (av != bv) {
+                    int x = av ^ bv;
+                    int o = BIG_ENDIAN
+                            ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+                            : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+                    return (wi << log2ValuesPerWidth) + o;
+                }
+                tail -= wordTail;
+            }
+            return ~tail;
+        }
+        else {
+            return ~tail;
+        }
+    }
+
+    // Booleans
+    // Each boolean element takes up one byte
+
+    static int mismatch(boolean[] a,
+                        boolean[] b,
+                        int length) {
+        int i = 0;
+        if (length > 7) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                    b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(boolean[] a, int aFromIndex,
+                        boolean[] b, int bFromIndex,
+                        int length) {
+        int i = 0;
+        if (length > 7) {
+            int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+            int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Bytes
+
+    /**
+     * Find the index of a mismatch between two arrays.
+     *
+     * <p>This method does not perform bounds checks. It is the responsibility
+     * of the caller to perform such bounds checks before calling this method.
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @param length the number of bytes from each array to check
+     * @return the index of a mismatch between the two arrays, otherwise -1 if
+     * no mismatch.  The index will be within the range of (inclusive) 0 to
+     * (exclusive) the smaller of the two array lengths.
+     */
+    static int mismatch(byte[] a,
+                        byte[] b,
+                        int length) {
+        // ISSUE: defer to index receiving methods if performance is good
+        // assert length <= a.length
+        // assert length <= b.length
+
+        int i = 0;
+        if (length > 7) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+                    b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            // Align to tail
+            i = length - ~i;
+//            assert i >= 0 && i <= 7;
+        }
+        // Tail < 8 bytes
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    /**
+     * Find the relative index of a mismatch between two arrays starting from
+     * given indexes.
+     *
+     * <p>This method does not perform bounds checks. It is the responsibility
+     * of the caller to perform such bounds checks before calling this method.
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index of the first element (inclusive) in the first
+     * array to be compared
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index of the first element (inclusive) in the
+     * second array to be compared
+     * @param length the number of bytes from each array to check
+     * @return the relative index of a mismatch between the two arrays,
+     * otherwise -1 if no mismatch.  The index will be within the range of
+     * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+     */
+    static int mismatch(byte[] a, int aFromIndex,
+                        byte[] b, int bFromIndex,
+                        int length) {
+        // assert 0 <= aFromIndex < a.length
+        // assert 0 <= aFromIndex + length <= a.length
+        // assert 0 <= bFromIndex < b.length
+        // assert 0 <= bFromIndex + length <= b.length
+        // assert length >= 0
+
+        int i = 0;
+        if (length > 7) {
+            int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+            int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Chars
+
+    static int mismatch(char[] a,
+                        char[] b,
+                        int length) {
+        int i = 0;
+        if (length > 3) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+                    b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(char[] a, int aFromIndex,
+                        char[] b, int bFromIndex,
+                        int length) {
+        int i = 0;
+        if (length > 3) {
+            int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Shorts
+
+    static int mismatch(short[] a,
+                        short[] b,
+                        int length) {
+        int i = 0;
+        if (length > 3) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+                    b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(short[] a, int aFromIndex,
+                        short[] b, int bFromIndex,
+                        int length) {
+        int i = 0;
+        if (length > 3) {
+            int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Ints
+
+    static int mismatch(int[] a,
+                        int[] b,
+                        int length) {
+        int i = 0;
+        if (length > 1) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_INT_BASE_OFFSET,
+                    b, Unsafe.ARRAY_INT_BASE_OFFSET,
+                    length, LOG2_ARRAY_INT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(int[] a, int aFromIndex,
+                        int[] b, int bFromIndex,
+                        int length) {
+        int i = 0;
+        if (length > 1) {
+            int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_INT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Floats
+
+    static int mismatch(float[] a,
+                        float[] b,
+                        int length) {
+        return mismatch(a, 0, b, 0, length);
+    }
+
+    static int mismatch(float[] a, int aFromIndex,
+                        float[] b, int bFromIndex,
+                        int length) {
+        int i = 0;
+        if (length > 1) {
+            int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            // Mismatched
+            if (i >= 0) {
+                // Check if mismatch is not associated with two NaN values
+                if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+                    return i;
+
+                // Mismatch on two different NaN values that are normalized to match
+                // Fall back to slow mechanism
+                // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+                // However, requires that returned value be relative to input ranges
+                i++;
+            }
+            // Matched
+            else {
+                i = length - ~i;
+            }
+        }
+        for (; i < length; i++) {
+            if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+                return i;
+        }
+        return -1;
+    }
+
+    // 64 bit sizes
+
+    // Long
+
+    static int mismatch(long[] a,
+                        long[] b,
+                        int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int i = vectorizedMismatch(
+                a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+                b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+                length, LOG2_ARRAY_LONG_INDEX_SCALE);
+        return i >= 0 ? i : -1;
+    }
+
+    static int mismatch(long[] a, int aFromIndex,
+                        long[] b, int bFromIndex,
+                        int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+        int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+        int i = vectorizedMismatch(
+                a, aOffset,
+                b, bOffset,
+                length, LOG2_ARRAY_LONG_INDEX_SCALE);
+        return i >= 0 ? i : -1;
+    }
+
+
+    // Double
+
+    static int mismatch(double[] a,
+                        double[] b,
+                        int length) {
+        return mismatch(a, 0, b, 0, length);
+    }
+
+    static int mismatch(double[] a, int aFromIndex,
+                        double[] b, int bFromIndex,
+                        int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        int i = vectorizedMismatch(
+                a, aOffset,
+                b, bOffset,
+                length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        if (i >= 0) {
+            // Check if mismatch is not associated with two NaN values
+            if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+                return i;
+
+            // Mismatch on two different NaN values that are normalized to match
+            // Fall back to slow mechanism
+            // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+            // However, requires that returned value be relative to input ranges
+            i++;
+            for (; i < length; i++) {
+                if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+                    return i;
+            }
+        }
+
+        return -1;
+    }
+}
--- a/jdk/src/java.base/share/classes/java/util/EnumMap.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/EnumMap.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,7 +25,6 @@
 
 package java.util;
 
-import java.util.Map.Entry;
 import jdk.internal.misc.SharedSecrets;
 
 /**
@@ -125,8 +124,6 @@
         return (V)(value == NULL ? null : value);
     }
 
-    private static final Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0];
-
     /**
      * Creates an empty enum map with the specified key type.
      *
--- a/jdk/src/java.base/share/classes/java/util/EnumSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/EnumSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -92,8 +92,6 @@
      */
     final Enum<?>[] universe;
 
-    private static Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0];
-
     EnumSet(Class<E>elementType, Enum<?>[] universe) {
         this.elementType = elementType;
         this.universe    = universe;
@@ -421,6 +419,9 @@
     private static class SerializationProxy <E extends Enum<E>>
         implements java.io.Serializable
     {
+
+        private static final Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0];
+
         /**
          * The element type of this enum set.
          *
--- a/jdk/src/java.base/share/classes/java/util/Enumeration.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/Enumeration.java	Tue Jan 26 09:11:58 2016 +0100
@@ -112,7 +112,7 @@
      *
      * @return an Iterator representing the remaining elements of this Enumeration
      *
-     * @since 1.9
+     * @since 9
      */
     default Iterator<E> asIterator() {
         return new Iterator<>() {
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java	Tue Jan 26 09:11:58 2016 +0100
@@ -2684,7 +2684,7 @@
      *
      * @return a sequential stream of token strings
      * @throws IllegalStateException if this scanner is closed
-     * @since 1.9
+     * @since 9
      */
     public Stream<String> tokens() {
         ensureOpen();
@@ -2770,7 +2770,7 @@
      * @return a sequential stream of match results
      * @throws NullPointerException if pattern is null
      * @throws IllegalStateException if this scanner is closed
-     * @since 1.9
+     * @since 9
      */
     public Stream<MatchResult> findAll(Pattern pattern) {
         Objects.requireNonNull(pattern);
@@ -2792,7 +2792,7 @@
      * @throws NullPointerException if patString is null
      * @throws IllegalStateException if this scanner is closed
      * @throws PatternSyntaxException if the regular expression's syntax is invalid
-     * @since 1.9
+     * @since 9
      * @see java.util.regex.Pattern
      */
     public Stream<MatchResult> findAll(String patString) {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Tue Jan 26 09:11:58 2016 +0100
@@ -2429,7 +2429,7 @@
      *
      * @param <U> the type of the value
      * @return a new CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public <U> CompletableFuture<U> newIncompleteFuture() {
         return new CompletableFuture<U>();
@@ -2444,7 +2444,7 @@
      * an Executor that provides at least one independent thread.
      *
      * @return the executor
-     * @since 1.9
+     * @since 9
      */
     public Executor defaultExecutor() {
         return ASYNC_POOL;
@@ -2462,7 +2462,7 @@
      * arrange dependent actions.
      *
      * @return the new CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<T> copy() {
         return uniCopyStage();
@@ -2479,7 +2479,7 @@
      * cause.
      *
      * @return the new CompletionStage
-     * @since 1.9
+     * @since 9
      */
     public CompletionStage<T> minimalCompletionStage() {
         return uniAsMinimalStage();
@@ -2494,7 +2494,7 @@
      * to complete this CompletableFuture
      * @param executor the executor to use for asynchronous execution
      * @return this CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier,
                                               Executor executor) {
@@ -2512,7 +2512,7 @@
      * @param supplier a function returning the value to be used
      * to complete this CompletableFuture
      * @return this CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) {
         return completeAsync(supplier, defaultExecutor());
@@ -2528,7 +2528,7 @@
      * @param unit a {@code TimeUnit} determining how to interpret the
      *        {@code timeout} parameter
      * @return this CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) {
         if (unit == null)
@@ -2549,7 +2549,7 @@
      * @param unit a {@code TimeUnit} determining how to interpret the
      *        {@code timeout} parameter
      * @return this CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public CompletableFuture<T> completeOnTimeout(T value, long timeout,
                                                   TimeUnit unit) {
@@ -2573,7 +2573,7 @@
      *        {@code delay} parameter
      * @param executor the base executor
      * @return the new delayed executor
-     * @since 1.9
+     * @since 9
      */
     public static Executor delayedExecutor(long delay, TimeUnit unit,
                                            Executor executor) {
@@ -2592,7 +2592,7 @@
      * @param unit a {@code TimeUnit} determining how to interpret the
      *        {@code delay} parameter
      * @return the new delayed executor
-     * @since 1.9
+     * @since 9
      */
     public static Executor delayedExecutor(long delay, TimeUnit unit) {
         if (unit == null)
@@ -2608,7 +2608,7 @@
      * @param value the value
      * @param <U> the type of the value
      * @return the completed CompletionStage
-     * @since 1.9
+     * @since 9
      */
     public static <U> CompletionStage<U> completedStage(U value) {
         return new MinimalStage<U>((value == null) ? NIL : value);
@@ -2621,7 +2621,7 @@
      * @param ex the exception
      * @param <U> the type of the value
      * @return the exceptionally completed CompletableFuture
-     * @since 1.9
+     * @since 9
      */
     public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
         if (ex == null) throw new NullPointerException();
@@ -2636,7 +2636,7 @@
      * @param ex the exception
      * @param <U> the type of the value
      * @return the exceptionally completed CompletionStage
-     * @since 1.9
+     * @since 9
      */
     public static <U> CompletionStage<U> failedStage(Throwable ex) {
         if (ex == null) throw new NullPointerException();
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java	Tue Jan 26 09:11:58 2016 +0100
@@ -161,7 +161,7 @@
  * }}</pre>
  *
  * @author Doug Lea
- * @since 1.9
+ * @since 9
  */
 public final class Flow {
 
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1301,7 +1301,7 @@
      * support extensions, and is unlikely to be useful otherwise.
      *
      * @return a task, or {@code null} if none are available
-     * @since 1.9
+     * @since 9
      */
     protected static ForkJoinTask<?> pollSubmission() {
         Thread t;
--- a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -154,7 +154,7 @@
  *
  * @param <T> the published item type
  * @author Doug Lea
- * @since 1.9
+ * @since 9
  */
 public class SubmissionPublisher<T> implements Flow.Publisher<T>,
                                                AutoCloseable {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,6 +39,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
 
 /**
  * Provides a framework for implementing blocking locks and related
@@ -886,6 +887,7 @@
      * @param arg the acquire argument
      * @return {@code true} if interrupted while waiting
      */
+    @ReservedStackAccess
     final boolean acquireQueued(final Node node, int arg) {
         try {
             boolean interrupted = false;
@@ -1218,6 +1220,7 @@
      *        {@link #tryAcquire} but is otherwise uninterpreted and
      *        can represent anything you like.
      */
+    @ReservedStackAccess
     public final void acquire(int arg) {
         if (!tryAcquire(arg) &&
             acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
@@ -1281,6 +1284,7 @@
      *        can represent anything you like.
      * @return the value returned from {@link #tryRelease}
      */
+    @ReservedStackAccess
     public final boolean release(int arg) {
         if (tryRelease(arg)) {
             Node h = head;
@@ -1361,6 +1365,7 @@
      *        and can represent anything you like.
      * @return the value returned from {@link #tryReleaseShared}
      */
+    @ReservedStackAccess
     public final boolean releaseShared(int arg) {
         if (tryReleaseShared(arg)) {
             doReleaseShared();
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,6 +37,7 @@
 
 import java.util.Collection;
 import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
 
 /**
  * A reentrant mutual exclusion {@link Lock} with the same basic
@@ -127,6 +128,7 @@
          * Performs non-fair tryLock.  tryAcquire is implemented in
          * subclasses, but both need nonfair try for trylock method.
          */
+        @ReservedStackAccess
         final boolean nonfairTryAcquire(int acquires) {
             final Thread current = Thread.currentThread();
             int c = getState();
@@ -146,6 +148,7 @@
             return false;
         }
 
+        @ReservedStackAccess
         protected final boolean tryRelease(int releases) {
             int c = getState() - releases;
             if (Thread.currentThread() != getExclusiveOwnerThread())
@@ -203,6 +206,7 @@
          * Performs lock.  Try immediate barge, backing up to normal
          * acquire on failure.
          */
+        @ReservedStackAccess
         final void lock() {
             if (compareAndSetState(0, 1))
                 setExclusiveOwnerThread(Thread.currentThread());
@@ -229,6 +233,7 @@
          * Fair version of tryAcquire.  Don't grant access unless
          * recursive call or no waiters or is first.
          */
+        @ReservedStackAccess
         protected final boolean tryAcquire(int acquires) {
             final Thread current = Thread.currentThread();
             int c = getState();
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -974,7 +974,7 @@
      * @throws  IndexOutOfBoundsException
      *          If the replacement string refers to a capturing group
      *          that does not exist in the pattern
-     * @since 1.9
+     * @since 9
      */
     public Matcher appendReplacement(StringBuilder sb, String replacement) {
         // If no match, return error
@@ -1117,7 +1117,7 @@
      *
      * @return  The target string builder
      *
-     * @since 1.9
+     * @since 9
      */
     public StringBuilder appendTail(StringBuilder sb) {
         sb.append(text, lastAppendPosition, getTextLength());
@@ -1229,7 +1229,7 @@
      * @throws ConcurrentModificationException if it is detected, on a
      *         best-effort basis, that the replacer function modified this
      *         matcher's state
-     * @since 1.9
+     * @since 9
      */
     public String replaceAll(Function<MatchResult, String> replacer) {
         Objects.requireNonNull(replacer);
@@ -1273,7 +1273,7 @@
      * modification is detected.
      *
      * @return a sequential stream of match results.
-     * @since 1.9
+     * @since 9
      */
     public Stream<MatchResult> results() {
         class MatchResultIterator implements Iterator<MatchResult> {
@@ -1451,7 +1451,7 @@
      * @throws ConcurrentModificationException if it is detected, on a
      *         best-effort basis, that the replacer function modified this
      *         matcher's state
-     * @since 1.9
+     * @since 9
      */
     public String replaceFirst(Function<MatchResult, String> replacer) {
         Objects.requireNonNull(replacer);
--- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java	Tue Jan 26 09:11:58 2016 +0100
@@ -329,7 +329,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default DoubleStream takeWhile(DoublePredicate predicate) {
         Objects.requireNonNull(predicate);
@@ -396,7 +396,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default DoubleStream dropWhile(DoublePredicate predicate) {
         Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java	Tue Jan 26 09:11:58 2016 +0100
@@ -326,7 +326,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default IntStream takeWhile(IntPredicate predicate) {
         Objects.requireNonNull(predicate);
@@ -392,7 +392,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default IntStream dropWhile(IntPredicate predicate) {
         Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java	Tue Jan 26 09:11:58 2016 +0100
@@ -327,7 +327,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default LongStream takeWhile(LongPredicate predicate) {
         Objects.requireNonNull(predicate);
@@ -394,7 +394,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default LongStream dropWhile(LongPredicate predicate) {
         Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Tue Jan 26 09:11:58 2016 +0100
@@ -533,7 +533,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default Stream<T> takeWhile(Predicate<? super T> predicate) {
         Objects.requireNonNull(predicate);
@@ -599,7 +599,7 @@
      *                  predicate to apply to elements to determine the longest
      *                  prefix of elements.
      * @return the new stream
-     * @since 1.9
+     * @since 9
      */
     default Stream<T> dropWhile(Predicate<? super T> predicate) {
         Objects.requireNonNull(predicate);
@@ -1146,7 +1146,7 @@
      * @param <T> the type of stream elements
      * @return a stream with a single element if the specified element
      *         is non-null, otherwise an empty stream
-     * @since 1.9
+     * @since 9
      */
     public static<T> Stream<T> ofNullable(T t) {
         return t == null ? Stream.empty()
--- a/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,7 +43,7 @@
  * Factory for instances of a takeWhile and dropWhile operations
  * that produce subsequences of their input stream.
  *
- * @since 1.9
+ * @since 9
  */
 final class WhileOps {
 
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
  * {@link NullPointerException} to be thrown.
  * </p>
  *
- * @since 1.9
+ * @since 9
  */
 public final class CRC32C implements Checksum {
 
--- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java	Tue Jan 26 09:11:58 2016 +0100
@@ -51,7 +51,7 @@
      * @throws NullPointerException
      *         if {@code b} is {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     default public void update(byte[] b) {
         update(b, 0, b.length);
@@ -99,7 +99,7 @@
      * @throws NullPointerException
      *         if {@code buffer} is {@code null}
      *
-     * @since 1.9
+     * @since 9
      */
     default public void update(ByteBuffer buffer) {
         int pos = buffer.position();
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java	Tue Jan 26 09:11:58 2016 +0100
@@ -220,7 +220,7 @@
      *         The last modification time of the entry in local date-time
      *
      * @see #getTimeLocal()
-     * @since 1.9
+     * @since 9
      */
     public void setTimeLocal(LocalDateTime time) {
         int year = time.getYear() - 1980;
@@ -259,7 +259,7 @@
      * @return  The last modification time of the entry in local date-time
      *
      * @see #setTimeLocal(LocalDateTime)
-     * @since 1.9
+     * @since 9
      */
     public LocalDateTime getTimeLocal() {
         if (mtime != null) {
--- a/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java	Tue Jan 26 09:11:58 2016 +0100
@@ -117,7 +117,7 @@
  * and that (2) for all methods of that class annotated with
  * {@code @HotSpotIntrinsicCandidate} there is an intrinsic in the list.
  *
- * @since 1.9
+ * @since 9
  */
 @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
 @Retention(RetentionPolicy.RUNTIME)
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -63,6 +63,6 @@
  * @see sun.util.logging.PlatformLogger.Bridge
  * @see sun.util.logging.internal
  *
- * @since 1.9
+ * @since 9
  */
 package jdk.internal.logger;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1081,7 +1081,7 @@
      * @return the value fetched from the indicated object
      * @throws RuntimeException No defined exceptions are thrown, not even
      *         {@link NullPointerException}
-     * @since 1.9
+     * @since 9
      */
     @HotSpotIntrinsicCandidate
     public final long getLongUnaligned(Object o, long offset) {
@@ -1115,7 +1115,7 @@
      * @param offset The offset in bytes from the start of the object
      * @param bigEndian The endianness of the value
      * @return the value fetched from the indicated object
-     * @since 1.9
+     * @since 9
      */
     public final long getLongUnaligned(Object o, long offset, boolean bigEndian) {
         return convEndian(bigEndian, getLongUnaligned(o, offset));
@@ -1193,7 +1193,7 @@
      * @param x the value to store
      * @throws RuntimeException No defined exceptions are thrown, not even
      *         {@link NullPointerException}
-     * @since 1.9
+     * @since 9
      */
     @HotSpotIntrinsicCandidate
     public final void putLongUnaligned(Object o, long offset, long x) {
@@ -1231,7 +1231,7 @@
      * @param bigEndian The endianness of the value
      * @throws RuntimeException No defined exceptions are thrown, not even
      *         {@link NullPointerException}
-     * @since 1.9
+     * @since 9
      */
     public final void putLongUnaligned(Object o, long offset, long x, boolean bigEndian) {
         putLongUnaligned(o, offset, convEndian(bigEndian, x));
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,7 @@
 package jdk.internal.ref;
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.PhantomReference;
 import java.util.Objects;
 
@@ -66,9 +67,9 @@
         this.list = CleanerImpl.getCleanerImpl(cleaner).phantomCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,7 @@
 package jdk.internal.ref;
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
 import java.util.Objects;
 
@@ -66,9 +67,9 @@
         list = CleanerImpl.getCleanerImpl(cleaner).softCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,7 @@
  */
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
 
@@ -66,9 +67,10 @@
         list = CleanerImpl.getCleanerImpl(cleaner).weakCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
+
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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.  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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "don't inline" if the inlining of
+ * this method should not be performed by the HotSpot VM.
+ * <p>
+ * This annotation must be used sparingly.  It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy.  In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader.  Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DontInline {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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.  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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "force inline" if the standard
+ * inlining metrics are to be ignored when the HotSpot VM inlines the method
+ * or constructor.
+ * <p>
+ * This annotation must be used sparingly.  It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy.  In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader.  Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ForceInline {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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.vm.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>An annotation expressing that a method is especially sensitive
+ * to stack overflows. This is a hint the JVM can use to grant access to
+ * extra stack space when executing this code if such feature is supported
+ * by the JVM. The JVM is free to ignore this annotation.
+ *
+ * A possible way for the JVM to improve the execution context for methods
+ * with this annotation is to reserve part of the thread's execution stack
+ * for them. Access to this section of the stack would be denied by default
+ * but could be granted if the JVM detects a possible stack overflow and
+ * the thread's call stack includes at least one annotated method. Even if
+ * access to this reserved area has been granted, the JVM might decide to
+ * throw a delayed StackOverflowError when the thread exits the annotated
+ * method.
+ *
+ * @since 1.9
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface ReservedStackAccess { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,90 @@
+/*
+ * 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.  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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A field may be annotated as stable if all of its component variables
+ * changes value at most once.
+ * A field's value counts as its component value.
+ * If the field is typed as an array, then all the non-null components
+ * of the array, of depth up to the rank of the field's array type,
+ * also count as component values.
+ * By extension, any variable (either array or field) which has annotated
+ * as stable is called a stable variable, and its non-null or non-zero
+ * value is called a stable value.
+ * <p>
+ * Since all fields begin with a default value of null for references
+ * (resp., zero for primitives), it follows that this annotation indicates
+ * that the first non-null (resp., non-zero) value stored in the field
+ * will never be changed.
+ * <p>
+ * If the field is not of an array type, there are no array elements,
+ * then the value indicated as stable is simply the value of the field.
+ * If the dynamic type of the field value is an array but the static type
+ * is not, the components of the array are <em>not</em> regarded as stable.
+ * <p>
+ * If the field is an array type, then both the field value and
+ * all the components of the field value (if the field value is non-null)
+ * are indicated to be stable.
+ * If the field type is an array type with rank {@code N > 1},
+ * then each component of the field value (if the field value is non-null),
+ * is regarded as a stable array of rank {@code N-1}.
+ * <p>
+ * Fields which are declared {@code final} may also be annotated as stable.
+ * Since final fields already behave as stable values, such an annotation
+ * conveys no additional information regarding change of the field's value, but
+ * still conveys information regarding change of additional components values if
+ * the type of the field is an array type (as described above).
+ * <p>
+ * The HotSpot VM relies on this annotation to promote a non-null (resp.,
+ * non-zero) component value to a constant, thereby enabling superior
+ * optimizations of code depending on such a value (such as constant folding).
+ * More specifically, the HotSpot VM will process non-null stable fields (final
+ * or otherwise) in a similar manner to static final fields with respect to
+ * promoting the field's value to a constant.  Thus, placing aside the
+ * differences for null/non-null values and arrays, a final stable field is
+ * treated as if it is really final from both the Java language and the HotSpot
+ * VM.
+ * <p>
+ * It is (currently) undefined what happens if a field annotated as stable
+ * is given a third value (by explicitly updating a stable field, a component of
+ * a stable array, or a final stable field via reflection or other means).
+ * Since the HotSpot VM promotes a non-null component value to constant, it may
+ * be that the Java memory model would appear to be broken, if such a constant
+ * (the second value of the field) is used as the value of the field even after
+ * the field value has changed (to a third value).
+ *
+ * @implNote
+ * This annotation only takes effect for fields of classes loaded by the boot
+ * loader.  Annoations on fields of classes loaded outside of the boot loader
+ * are ignored.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Stable {
+}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-package sun.invoke.anon;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Anonymous class loader.  Will load any valid classfile, producing
- * a {@link Class} metaobject, without installing that class in the
- * system dictionary.  Therefore, {@link Class#forName(String)} will never
- * produce a reference to an anonymous class.
- * <p>
- * The access permissions of the anonymous class are borrowed from
- * a <em>host class</em>.  The new class behaves as if it were an
- * inner class of the host class.  It can access the host's private
- * members, if the creator of the class loader has permission to
- * do so (or to create accessible reflective objects).
- * <p>
- * When the anonymous class is loaded, elements of its constant pool
- * can be patched to new values.  This provides a hook to pre-resolve
- * named classes in the constant pool to other classes, including
- * anonymous ones.  Also, string constants can be pre-resolved to
- * any reference.  (The verifier treats non-string, non-class reference
- * constants as plain objects.)
- *  <p>
- * Why include the patching function?  It makes some use cases much easier.
- * Second, the constant pool needed some internal patching anyway,
- * to anonymize the loaded class itself.  Finally, if you are going
- * to use this seriously, you'll want to build anonymous classes
- * on top of pre-existing anonymous classes, and that requires patching.
- *
- * <p>%%% TO-DO:
- * <ul>
- * <li>needs better documentation</li>
- * <li>needs more security work (for safe delegation)</li>
- * <li>needs a clearer story about error processing</li>
- * <li>patch member references also (use ';' as delimiter char)</li>
- * <li>patch method references to (conforming) method handles</li>
- * </ul>
- *
- * @author jrose
- * @author Remi Forax
- * @see <a href="http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm">
- *      http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm</a>
- */
-
-public class AnonymousClassLoader {
-    final Class<?> hostClass;
-
-    // Privileged constructor.
-    private AnonymousClassLoader(Class<?> hostClass) {
-        this.hostClass = hostClass;
-    }
-
-    public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class<?> hostClass) {
-        if (unsafe == null)  throw new NullPointerException();
-        return new AnonymousClassLoader(hostClass);
-    }
-
-    public Class<?> loadClass(byte[] classFile) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            try {
-                return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
-            } catch (InvalidConstantPoolFormatException ee) {
-                throw new IllegalArgumentException(ee);
-            }
-        }
-        return loadClass(classFile, null);
-    }
-
-    public Class<?> loadClass(ConstantPoolPatch classPatch) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            return fakeLoadClass(classPatch);
-        }
-        Object[] patches = classPatch.patchArray;
-        // Convert class names (this late in the game)
-        // to use slash '/' instead of dot '.'.
-        // Java likes dots, but the JVM likes slashes.
-        for (int i = 0; i < patches.length; i++) {
-            Object value = patches[i];
-            if (value != null) {
-                byte tag = classPatch.getTag(i);
-                switch (tag) {
-                case ConstantPoolVisitor.CONSTANT_Class:
-                    if (value instanceof String) {
-                        if (patches == classPatch.patchArray)
-                            patches = patches.clone();
-                        patches[i] = ((String)value).replace('.', '/');
-                    }
-                    break;
-                case ConstantPoolVisitor.CONSTANT_Fieldref:
-                case ConstantPoolVisitor.CONSTANT_Methodref:
-                case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
-                case ConstantPoolVisitor.CONSTANT_NameAndType:
-                    // When/if the JVM supports these patches,
-                    // we'll probably need to reformat them also.
-                    // Meanwhile, let the class loader create the error.
-                    break;
-                }
-            }
-        }
-        return loadClass(classPatch.outer.classFile, classPatch.patchArray);
-    }
-
-    private Class<?> loadClass(byte[] classFile, Object[] patchArray) {
-        try {
-            return (Class<?>)
-                defineAnonymousClass.invoke(unsafe,
-                                            hostClass, classFile, patchArray);
-        } catch (Exception ex) {
-            throwReflectedException(ex);
-            throw new RuntimeException("error loading into "+hostClass, ex);
-        }
-    }
-
-    private static void throwReflectedException(Exception ex) {
-        if (ex instanceof InvocationTargetException) {
-            Throwable tex = ((InvocationTargetException)ex).getTargetException();
-            if (tex instanceof Error)
-                throw (Error) tex;
-            ex = (Exception) tex;
-        }
-        if (ex instanceof RuntimeException) {
-            throw (RuntimeException) ex;
-        }
-    }
-
-    private Class<?> fakeLoadClass(ConstantPoolPatch classPatch) {
-        // Implementation:
-        // 1. Make up a new name nobody has used yet.
-        // 2. Inspect the tail-header of the class to find the this_class index.
-        // 3. Patch the CONSTANT_Class for this_class to the new name.
-        // 4. Add other CP entries required by (e.g.) string patches.
-        // 5. Flatten Class constants down to their names, making sure that
-        //    the host class loader can pick them up again accurately.
-        // 6. Generate the edited class file bytes.
-        //
-        // Potential limitations:
-        // * The class won't be truly anonymous, and may interfere with others.
-        // * Flattened class constants might not work, because of loader issues.
-        // * Pseudo-string constants will not flatten down to real strings.
-        // * Method handles will (of course) fail to flatten to linkage strings.
-        if (true)  throw new UnsupportedOperationException("NYI");
-        Object[] cpArray;
-        try {
-            cpArray = classPatch.getOriginalCP();
-        } catch (InvalidConstantPoolFormatException ex) {
-            throw new RuntimeException(ex);
-        }
-        int thisClassIndex = classPatch.getParser().getThisClassIndex();
-        String thisClassName = (String) cpArray[thisClassIndex];
-        synchronized (AnonymousClassLoader.class) {
-            thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
-        }
-        classPatch.putUTF8(thisClassIndex, thisClassName);
-        byte[] classFile = null;
-        return unsafe.defineClass(null, classFile, 0, classFile.length,
-                                  hostClass.getClassLoader(),
-                                  hostClass.getProtectionDomain());
-    }
-    private static int fakeNameCounter = 99999;
-
-    // ignore two warnings on this line:
-    private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-    // preceding line requires that this class be on the boot class path
-
-    private static final Method defineAnonymousClass;
-    static {
-        Method dac = null;
-        Class<? extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
-        try {
-            dac = unsafeClass.getMethod("defineAnonymousClass",
-                                        Class.class,
-                                        byte[].class,
-                                        Object[].class);
-        } catch (Exception ee) {
-            dac = null;
-        }
-        defineAnonymousClass = dac;
-    }
-
-    private static void noJVMSupport() {
-        throw new UnsupportedOperationException("no JVM support for anonymous classes");
-    }
-
-
-    private static native Class<?> loadClassInternal(Class<?> hostClass,
-                                                     byte[] classFile,
-                                                     Object[] patchArray);
-
-    public static byte[] readClassFile(Class<?> templateClass) throws IOException {
-        String templateName = templateClass.getName();
-        int lastDot = templateName.lastIndexOf('.');
-        java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
-        java.net.URLConnection connection = url.openConnection();
-        int contentLength = connection.getContentLength();
-        if (contentLength < 0)
-            throw new IOException("invalid content length "+contentLength);
-
-        byte[] b = connection.getInputStream().readAllBytes();
-        if (b.length != contentLength)
-            throw new EOFException("Expected:" + contentLength + ", read:" + b.length);
-
-        return b;
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A constant pool parser.
- */
-public class ConstantPoolParser {
-    final byte[] classFile;
-    final byte[] tags;
-    final char[] firstHeader;  // maghi, maglo, minor, major, cplen
-
-    // these are filled in on first parse:
-    int endOffset;
-    char[] secondHeader;       // flags, this_class, super_class, intlen
-
-    // used to decode UTF8 array
-    private char[] charArray = new char[80];
-
-    /** Creates a constant pool parser.
-     * @param classFile an array of bytes containing a class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     */
-    public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this.classFile = classFile;
-        this.firstHeader = parseHeader(classFile);
-        this.tags = new byte[firstHeader[4]];
-    }
-
-    /** Create a constant pool parser by loading the bytecodes of the
-     *  class taken as argument.
-     *
-     * @param templateClass the class to parse.
-     *
-     * @throws IOException raised if an I/O occurs when loading
-     *  the bytecode of the template class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     *
-     * @see #ConstantPoolParser(byte[])
-     * @see AnonymousClassLoader#readClassFile(Class)
-     */
-    public ConstantPoolParser(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(AnonymousClassLoader.readClassFile(templateClass));
-    }
-
-    /** Creates an empty patch to patch the class file
-     *  used by the current parser.
-     * @return a new class patch.
-     */
-    public ConstantPoolPatch createPatch() {
-        return new ConstantPoolPatch(this);
-    }
-
-    /** Report the tag of the indicated CP entry.
-     * @param index
-     * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
-     */
-    public byte getTag(int index) {
-        getEndOffset();  // trigger an exception if we haven't parsed yet
-        return tags[index];
-    }
-
-    /** Report the length of the constant pool. */
-    public int getLength() {
-        return firstHeader[4];
-    }
-
-    /** Report the offset, within the class file, of the start of the constant pool. */
-    public int getStartOffset() {
-        return firstHeader.length * 2;
-    }
-
-    /** Report the offset, within the class file, of the end of the constant pool. */
-    public int getEndOffset() {
-        if (endOffset == 0)
-            throw new IllegalStateException("class file has not yet been parsed");
-        return endOffset;
-    }
-
-    /** Report the CP index of this class's own name. */
-    public int getThisClassIndex() {
-        getEndOffset();   // provoke exception if not yet parsed
-        return secondHeader[1];
-    }
-
-    /** Report the total size of the class file. */
-    public int getTailLength() {
-        return classFile.length - getEndOffset();
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeHead(OutputStream out) throws IOException {
-        out.write(classFile, 0, getEndOffset());
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream,
-     *  incorporating the non-null entries of the given array
-     *  as patches.
-     */
-    void writePatchedHead(OutputStream out, Object[] patchArray) {
-        // this will be useful to partially emulate the class loader on old JVMs
-        throw new UnsupportedOperationException("Not yet implemented");
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeTail(OutputStream out) throws IOException {
-        out.write(classFile, getEndOffset(), getTailLength());
-    }
-
-    private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
-        char[] result = new char[5];
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        for (int i = 0; i < result.length; i++)
-            result[i] = (char) getUnsignedShort(buffer);
-        int magic = result[0] << 16 | result[1] << 0;
-        if (magic != 0xCAFEBABE)
-            throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
-        // skip major, minor version
-        int len = result[4];
-        if (len < 1)
-            throw new InvalidConstantPoolFormatException("constant pool length < 1");
-        return result;
-    }
-
-    /** Parse the constant pool of the class
-     *  calling a method visit* each time a constant pool entry is parsed.
-     *
-     *  The order of the calls to visit* is not guaranteed to be the same
-     *  than the order of the constant pool entry in the bytecode array.
-     *
-     * @param visitor
-     * @throws InvalidConstantPoolFormatException
-     */
-    public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        buffer.position(getStartOffset()); //skip header
-
-        Object[] values = new Object[getLength()];
-        try {
-            parseConstantPool(buffer, values, visitor);
-        } catch(BufferUnderflowException e) {
-            throw new InvalidConstantPoolFormatException(e);
-        }
-        if (endOffset == 0) {
-            endOffset = buffer.position();
-            secondHeader = new char[4];
-            for (int i = 0; i < secondHeader.length; i++) {
-                secondHeader[i] = (char) getUnsignedShort(buffer);
-            }
-        }
-        resolveConstantPool(values, visitor);
-    }
-
-    private char[] getCharArray(int utfLength) {
-        if (utfLength <= charArray.length)
-            return charArray;
-        return charArray = new char[utfLength];
-    }
-
-    private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        for (int i = 1; i < tags.length; ) {
-            byte tag = (byte) getUnsignedByte(buffer);
-            assert(tags[i] == 0 || tags[i] == tag);
-            tags[i] = tag;
-            switch (tag) {
-                case CONSTANT_Utf8:
-                    int utfLen = getUnsignedShort(buffer);
-                    String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
-                    visitor.visitUTF8(i, CONSTANT_Utf8, value);
-                    tags[i] = tag;
-                    values[i++] = value;
-                    break;
-                case CONSTANT_Integer:
-                    visitor.visitConstantValue(i, tag, buffer.getInt());
-                    i++;
-                    break;
-                case CONSTANT_Float:
-                    visitor.visitConstantValue(i, tag, buffer.getFloat());
-                    i++;
-                    break;
-                case CONSTANT_Long:
-                    visitor.visitConstantValue(i, tag, buffer.getLong());
-                    i+=2;
-                    break;
-                case CONSTANT_Double:
-                    visitor.visitConstantValue(i, tag, buffer.getDouble());
-                    i+=2;
-                    break;
-
-                case CONSTANT_Class:    // fall through:
-                case CONSTANT_String:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer) };
-                    break;
-
-                case CONSTANT_Fieldref:           // fall through:
-                case CONSTANT_Methodref:          // fall through:
-                case CONSTANT_InterfaceMethodref: // fall through:
-                case CONSTANT_NameAndType:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
-                    break;
-                default:
-                    throw new AssertionError("invalid constant "+tag);
-            }
-        }
-    }
-
-    private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
-        // clean out the int[] values, which are temporary
-        for (int beg = 1, end = values.length-1, beg2, end2;
-             beg <= end;
-             beg = beg2, end = end2) {
-             beg2 = end; end2 = beg-1;
-             //System.out.println("CP resolve pass: "+beg+".."+end);
-             for (int i = beg; i <= end; i++) {
-                  Object value = values[i];
-                  if (!(value instanceof int[]))
-                      continue;
-                  int[] array = (int[]) value;
-                  byte tag = tags[i];
-                  switch (tag) {
-                      case CONSTANT_String:
-                          String stringBody = (String) values[array[0]];
-                          visitor.visitConstantString(i, tag, stringBody, array[0]);
-                          values[i] = null;
-                          break;
-                      case CONSTANT_Class: {
-                          String className = (String) values[array[0]];
-                          // use the external form favored by Class.forName:
-                          className = className.replace('/', '.');
-                          visitor.visitConstantString(i, tag, className, array[0]);
-                          values[i] = className;
-                          break;
-                      }
-                      case CONSTANT_NameAndType: {
-                          String memberName = (String) values[array[0]];
-                          String signature  = (String) values[array[1]];
-                          visitor.visitDescriptor(i, tag, memberName, signature,
-                                                  array[0], array[1]);
-                          values[i] = new String[] {memberName, signature};
-                          break;
-                      }
-                      case CONSTANT_Fieldref:           // fall through:
-                      case CONSTANT_Methodref:          // fall through:
-                      case CONSTANT_InterfaceMethodref: {
-                              Object className   = values[array[0]];
-                              Object nameAndType = values[array[1]];
-                              if (!(className instanceof String) ||
-                                  !(nameAndType instanceof String[])) {
-                                   // one more pass is needed
-                                   if (beg2 > i)  beg2 = i;
-                                   if (end2 < i)  end2 = i;
-                                   continue;
-                              }
-                              String[] nameAndTypeArray = (String[]) nameAndType;
-                              visitor.visitMemberRef(i, tag,
-                                  (String)className,
-                                  nameAndTypeArray[0],
-                                  nameAndTypeArray[1],
-                                  array[0], array[1]);
-                              values[i] = null;
-                          }
-                          break;
-                      default:
-                          continue;
-                }
-            }
-        }
-    }
-
-    private static int getUnsignedByte(ByteBuffer buffer) {
-        return buffer.get() & 0xFF;
-    }
-
-    private static int getUnsignedShort(ByteBuffer buffer) {
-        int b1 = getUnsignedByte(buffer);
-        int b2 = getUnsignedByte(buffer);
-        return (b1 << 8) + (b2 << 0);
-    }
-
-    private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
-      int utfLimit = buffer.position() + utfLen;
-      int index = 0;
-      while (buffer.position() < utfLimit) {
-          int c = buffer.get() & 0xff;
-          if (c > 127) {
-              buffer.position(buffer.position() - 1);
-              return getUTF8Extended(buffer, utfLimit, charArray, index);
-          }
-          charArray[index++] = (char)c;
-      }
-      return new String(charArray, 0, index);
-    }
-
-    private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
-        int c, c2, c3;
-        while (buffer.position() < utfLimit) {
-            c = buffer.get() & 0xff;
-            switch (c >> 4) {
-                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
-                    /* 0xxxxxxx*/
-                    charArray[index++] = (char)c;
-                    break;
-                case 12: case 13:
-                    /* 110x xxxx   10xx xxxx*/
-                    c2 = buffer.get();
-                    if ((c2 & 0xC0) != 0x80)
-                        throw new InvalidConstantPoolFormatException(
-                            "malformed input around byte " + buffer.position());
-                     charArray[index++] = (char)(((c  & 0x1F) << 6) |
-                                                  (c2 & 0x3F));
-                    break;
-                case 14:
-                    /* 1110 xxxx  10xx xxxx  10xx xxxx */
-                    c2 = buffer.get();
-                    c3 = buffer.get();
-                    if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
-                       throw new InvalidConstantPoolFormatException(
-                          "malformed input around byte " + (buffer.position()));
-                    charArray[index++] = (char)(((c  & 0x0F) << 12) |
-                                                ((c2 & 0x3F) << 6)  |
-                                                ((c3 & 0x3F) << 0));
-                    break;
-                default:
-                    /* 10xx xxxx,  1111 xxxx */
-                    throw new InvalidConstantPoolFormatException(
-                        "malformed input around byte " + buffer.position());
-            }
-        }
-        // The number of chars produced may be less than utflen
-        return new String(charArray, 0, index);
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A class and its patched constant pool.
- *
- *  This class allow to modify (patch) a constant pool
- *  by changing the value of its entry.
- *  Entry are referenced using index that can be get
- *  by parsing the constant pool using
- *  {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
- *
- * @see ConstantPoolVisitor
- * @see ConstantPoolParser#createPatch()
- */
-public class ConstantPoolPatch {
-    final ConstantPoolParser outer;
-    final Object[] patchArray;
-
-    ConstantPoolPatch(ConstantPoolParser outer) {
-        this.outer      = outer;
-        this.patchArray = new Object[outer.getLength()];
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
-     *
-     * @param classFile an array of bytes containing a class.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(classFile));
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
-     *
-     * @param templateClass the class to parse.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(templateClass));
-    }
-
-
-    /** Creates a patch from an existing patch.
-     *  All changes are copied from that patch.
-     * @param patch a patch
-     *
-     * @see ConstantPoolParser#createPatch()
-     */
-    public ConstantPoolPatch(ConstantPoolPatch patch) {
-        outer      = patch.outer;
-        patchArray = patch.patchArray.clone();
-    }
-
-    /** Which parser built this patch? */
-    public ConstantPoolParser getParser() {
-        return outer;
-    }
-
-    /** Report the tag at the given index in the constant pool. */
-    public byte getTag(int index) {
-        return outer.getTag(index);
-    }
-
-    /** Report the current patch at the given index of the constant pool.
-     *  Null means no patch will be made.
-     *  To observe the unpatched entry at the given index, use
-     *  {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
-     */
-    public Object getPatch(int index) {
-        Object value = patchArray[index];
-        if (value == null)  return null;
-        switch (getTag(index)) {
-        case CONSTANT_Fieldref:
-        case CONSTANT_Methodref:
-        case CONSTANT_InterfaceMethodref:
-            if (value instanceof String)
-                value = stripSemis(2, (String) value);
-            break;
-        case CONSTANT_NameAndType:
-            if (value instanceof String)
-                value = stripSemis(1, (String) value);
-            break;
-        }
-        return value;
-    }
-
-    /** Clear all patches. */
-    public void clear() {
-        Arrays.fill(patchArray, null);
-    }
-
-    /** Clear one patch. */
-    public void clear(int index) {
-        patchArray[index] = null;
-    }
-
-    /** Produce the patches as an array. */
-    public Object[] getPatches() {
-        return patchArray.clone();
-    }
-
-    /** Produce the original constant pool as an array. */
-    public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
-        return getOriginalCP(0, patchArray.length, -1);
-    }
-
-    /** Walk the constant pool, applying patches using the given map.
-     *
-     * @param utf8Map Utf8 strings to modify, if encountered
-     * @param classMap Classes (or their names) to modify, if encountered
-     * @param valueMap Constant values to modify, if encountered
-     * @param deleteUsedEntries if true, delete map entries that are used
-     */
-    public void putPatches(final Map<String,String> utf8Map,
-                           final Map<String,Object> classMap,
-                           final Map<Object,Object> valueMap,
-                           boolean deleteUsedEntries) throws InvalidConstantPoolFormatException {
-        final HashSet<String> usedUtf8Keys;
-        final HashSet<String> usedClassKeys;
-        final HashSet<Object> usedValueKeys;
-        if (deleteUsedEntries) {
-            usedUtf8Keys  = (utf8Map  == null) ? null : new HashSet<String>();
-            usedClassKeys = (classMap == null) ? null : new HashSet<String>();
-            usedValueKeys = (valueMap == null) ? null : new HashSet<Object>();
-        } else {
-            usedUtf8Keys = null;
-            usedClassKeys = null;
-            usedValueKeys = null;
-        }
-
-        outer.parse(new ConstantPoolVisitor() {
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                putUTF8(index, utf8Map.get(utf8));
-                if (usedUtf8Keys != null)  usedUtf8Keys.add(utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                putConstantValue(index, tag, valueMap.get(value));
-                if (usedValueKeys != null)  usedValueKeys.add(value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag, String name, int nameIndex) {
-                if (tag == CONSTANT_Class) {
-                    putConstantValue(index, tag, classMap.get(name));
-                    if (usedClassKeys != null)  usedClassKeys.add(name);
-                } else {
-                    assert(tag == CONSTANT_String);
-                    visitConstantValue(index, tag, name);
-                }
-            }
-        });
-        if (usedUtf8Keys != null)   utf8Map.keySet().removeAll(usedUtf8Keys);
-        if (usedClassKeys != null)  classMap.keySet().removeAll(usedClassKeys);
-        if (usedValueKeys != null)  valueMap.keySet().removeAll(usedValueKeys);
-    }
-
-    Object[] getOriginalCP(final int startIndex,
-                           final int endIndex,
-                           final int tagMask) throws InvalidConstantPoolFormatException {
-        final Object[] cpArray = new Object[endIndex - startIndex];
-        outer.parse(new ConstantPoolVisitor() {
-
-            void show(int index, byte tag, Object value) {
-                if (index < startIndex || index >= endIndex)  return;
-                if (((1 << tag) & tagMask) == 0)  return;
-                cpArray[index - startIndex] = value;
-            }
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                show(index, tag, utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                assert(tag != CONSTANT_String);
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag,
-                                            String value, int j) {
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitMemberRef(int index, byte tag,
-                    String className, String memberName,
-                    String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ className, memberName, signature });
-            }
-
-            @Override
-            public void visitDescriptor(int index, byte tag,
-                    String memberName, String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ memberName, signature });
-            }
-        });
-        return cpArray;
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeHead(OutputStream out) throws IOException {
-        outer.writePatchedHead(out, patchArray);
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeTail(OutputStream out) throws IOException {
-        outer.writeTail(out);
-    }
-
-    private void checkConstantTag(byte tag, Object value) {
-        if (value == null)
-            throw new IllegalArgumentException(
-                    "invalid null constant value");
-        if (classForTag(tag) != value.getClass())
-            throw new IllegalArgumentException(
-                    "invalid constant value"
-                    + (tag == CONSTANT_None ? ""
-                        : " for tag "+tagName(tag))
-                    + " of class "+value.getClass());
-    }
-
-    private void checkTag(int index, byte putTag) {
-        byte tag = outer.tags[index];
-        if (tag != putTag)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " for " + tagName(putTag)
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private void checkTagMask(int index, int tagBitMask) {
-        byte tag = outer.tags[index];
-        int tagBit = ((tag & 0x1F) == tag) ? (1 << tag) : 0;
-        if ((tagBit & tagBitMask) == 0)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private static void checkMemberName(String memberName) {
-        if (memberName.indexOf(';') >= 0)
-            throw new IllegalArgumentException("memberName " + memberName + " contains a ';'");
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new string.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_Utf8} value.
-     * @param utf8 a string
-     *
-     * @see ConstantPoolVisitor#visitUTF8(int, byte, String)
-     */
-    public void putUTF8(int index, String utf8) {
-        if (utf8 == null) { clear(index); return; }
-        checkTag(index, CONSTANT_Utf8);
-        patchArray[index] = utf8;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value, depending on its dynamic type.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        one of the following structures:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed int, float, long or double; or a string or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type,
-     *         as reported by {@link #getTag(int)}
-     *
-     * @see #putConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, Object value) {
-        if (value == null) { clear(index); return; }
-        byte tag = tagForConstant(value.getClass());
-        checkConstantTag(tag, value);
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value.
-     *
-     * @param index an index to a constant pool entry matching the given tag
-     * @param tag one of the following values:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed number, string, or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type, or if a class name contains
-     *         '/' or ';'
-     *
-     * @see #putConstantValue(int, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, byte tag, Object value) {
-        if (value == null) { clear(index); return; }
-        checkTag(index, tag);
-        if (tag == CONSTANT_Class && value instanceof String) {
-            checkClassName((String) value);
-        } else if (tag == CONSTANT_String) {
-            // the JVM accepts any object as a patch for a string
-        } else {
-            // make sure the incoming value is the right type
-            checkConstantTag(tag, value);
-        }
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     * @param memberName a memberName
-     * @param signature a signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *
-     * @see ConstantPoolVisitor#visitDescriptor(int, byte, String, String, int, int)
-     */
-    public void putDescriptor(int index, String memberName, String signature) {
-        checkTag(index, CONSTANT_NameAndType);
-        checkMemberName(memberName);
-        patchArray[index] = addSemis(memberName, signature);
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_Fieldref},
-     *  {@link ConstantPoolVisitor#CONSTANT_Methodref}, or
-     *  {@link ConstantPoolVisitor#CONSTANT_InterfaceMethodref} value.
-     *
-     * @param index an index to a constant pool entry containing a member reference
-     * @param className a class name
-     * @param memberName a field or method name
-     * @param signature a field or method signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *             or signature is not a correct signature
-     *
-     * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
-     */
-    public void putMemberRef(int index, byte tag,
-                    String className, String memberName, String signature) {
-        checkTagMask(tag, CONSTANT_MemberRef_MASK);
-        checkTag(index, tag);
-        checkClassName(className);
-        checkMemberName(memberName);
-        if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
-            throw new IllegalArgumentException("bad signature: "+signature);
-        patchArray[index] = addSemis(className, memberName, signature);
-    }
-
-    private static final int CONSTANT_MemberRef_MASK =
-              CONSTANT_Fieldref
-            | CONSTANT_Methodref
-            | CONSTANT_InterfaceMethodref;
-
-    private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
-        = new IdentityHashMap<Class<?>, Byte>(6);
-    private static final Class<?>[] CONSTANT_VALUE_CLASS = new Class<?>[16];
-    static {
-        Object[][] values = {
-            {Integer.class, CONSTANT_Integer},
-            {Long.class, CONSTANT_Long},
-            {Float.class, CONSTANT_Float},
-            {Double.class, CONSTANT_Double},
-            {String.class, CONSTANT_String},
-            {Class.class, CONSTANT_Class}
-        };
-        for (Object[] value : values) {
-            Class<?> cls = (Class<?>)value[0];
-            Byte     tag = (Byte) value[1];
-            CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
-            CONSTANT_VALUE_CLASS[(byte)tag] = cls;
-        }
-    }
-
-    static Class<?> classForTag(byte tag) {
-        if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
-            return null;
-        return CONSTANT_VALUE_CLASS[tag];
-    }
-
-    static byte tagForConstant(Class<?> cls) {
-        Byte tag = CONSTANT_VALUE_CLASS_TAG.get(cls);
-        return (tag == null) ? CONSTANT_None : (byte)tag;
-    }
-
-    private static void checkClassName(String className) {
-        if (className.indexOf('/') >= 0 || className.indexOf(';') >= 0)
-            throw new IllegalArgumentException("invalid class name " + className);
-    }
-
-    static String addSemis(String name, String... names) {
-        StringBuilder buf = new StringBuilder(name.length() * 5);
-        buf.append(name);
-        for (String name2 : names) {
-            buf.append(';').append(name2);
-        }
-        String res = buf.toString();
-        assert(stripSemis(names.length, res)[0].equals(name));
-        assert(stripSemis(names.length, res)[1].equals(names[0]));
-        assert(names.length == 1 ||
-               stripSemis(names.length, res)[2].equals(names[1]));
-        return res;
-    }
-
-    static String[] stripSemis(int count, String string) {
-        String[] res = new String[count+1];
-        int pos = 0;
-        for (int i = 0; i < count; i++) {
-            int pos2 = string.indexOf(';', pos);
-            if (pos2 < 0)  pos2 = string.length();  // yuck
-            res[i] = string.substring(pos, pos2);
-            pos = pos2;
-        }
-        res[count] = string.substring(pos);
-        return res;
-    }
-
-    public String toString() {
-        StringBuilder buf = new StringBuilder(this.getClass().getName());
-        buf.append("{");
-        Object[] origCP = null;
-        for (int i = 0; i < patchArray.length; i++) {
-            if (patchArray[i] == null)  continue;
-            if (origCP != null) {
-                buf.append(", ");
-            } else {
-                try {
-                    origCP = getOriginalCP();
-                } catch (InvalidConstantPoolFormatException ee) {
-                    origCP = new Object[0];
-                }
-            }
-            Object orig = (i < origCP.length) ? origCP[i] : "?";
-            buf.append(orig).append("=").append(patchArray[i]);
-        }
-        buf.append("}");
-        return buf.toString();
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolVisitor.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
-
-/**
- * A visitor called by {@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- * when a constant pool entry is parsed.
- * <p>
- * A visit* method is called when a constant pool entry is parsed.
- * The first argument is always the constant pool index.
- * The second argument is always the constant pool tag,
- * even for methods like {@link #visitUTF8(int, byte, String)} which only apply to one tag.
- * String arguments refer to Utf8 or NameAndType entries declared elsewhere,
- * and are always accompanied by the indexes of those entries.
- * <p>
- * The order of the calls to the visit* methods is not necessarily related
- * to the order of the entries in the constant pool.
- * If one entry has a reference to another entry, the latter (lower-level)
- * entry will be visited first.
- * <p>
- * The following table shows the relation between constant pool entry
- * types and the corresponding visit* methods:
- *
- * <table border=1 cellpadding=5 summary="constant pool visitor methods">
- * <tr><th>Tag(s)</th><th>Method</th></tr>
- * <tr>
- *   <td>{@link #CONSTANT_Utf8}</td>
- *   <td>{@link #visitUTF8(int, byte, String)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Integer}, {@link #CONSTANT_Float},
- *       {@link #CONSTANT_Long}, {@link #CONSTANT_Double}</td>
- *   <td>{@link #visitConstantValue(int, byte, Object)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_String}, {@link #CONSTANT_Class}</td>
- *   <td>{@link #visitConstantString(int, byte, String, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_NameAndType}</td>
- *   <td>{@link #visitDescriptor(int, byte, String, String, int, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Fieldref},
- *       {@link #CONSTANT_Methodref},
- *       {@link #CONSTANT_InterfaceMethodref}</td>
- *   <td>{@link #visitMemberRef(int, byte, String, String, String, int, int)}</td>
- * </tr>
- * </table>
- *
- * @see ConstantPoolPatch
- * @author Remi Forax
- * @author jrose
- */
-public class ConstantPoolVisitor {
-  /** Called each time an UTF8 constant pool entry is found.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_Utf8}
-   * @param utf8 string encoded in modified UTF-8 format passed as a {@code String}
-   *
-   * @see ConstantPoolPatch#putUTF8(int, String)
-   */
-  public void visitUTF8(int index, byte tag, String utf8) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes an integer,
-   *  a float, a long, or a double.
-   *  Constant strings and classes are not managed by this method but
-   *  by {@link #visitConstantString(int, byte, String, int)}.
-   *
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Integer},
-   *            {@link #CONSTANT_Float},
-   *            {@link #CONSTANT_Long},
-   *            or {@link #CONSTANT_Double}
-   * @param value encoded value
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, Object)
-   */
-  public void visitConstantValue(int index, byte tag, Object value) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a string or a class.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_String},
-   *            {@link #CONSTANT_Class},
-   * @param name string body or class name (using dot separator)
-   * @param nameIndex the index of the Utf8 string for the name
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, byte, Object)
-   */
-  public void visitConstantString(int index, byte tag,
-                                  String name, int nameIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a name and type.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_NameAndType}
-   * @param memberName a field or method name
-   * @param signature the member signature
-   * @param memberNameIndex index of the Utf8 string for the member name
-   * @param signatureIndex index of the Utf8 string for the signature
-   *
-   * @see ConstantPoolPatch#putDescriptor(int, String, String)
-   */
-  public void visitDescriptor(int index, byte tag,
-                              String memberName, String signature,
-                              int memberNameIndex, int signatureIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a field or method.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Fieldref},
-   *            or {@link #CONSTANT_Methodref},
-   *            or {@link #CONSTANT_InterfaceMethodref}
-   * @param className the class name (using dot separator)
-   * @param memberName name of the field or method
-   * @param signature the field or method signature
-   * @param classNameIndex index of the Utf8 string for the class name
-   * @param descriptorIndex index of the NameAndType descriptor constant
-   *
-   * @see ConstantPoolPatch#putMemberRef(int, byte, String, String, String)
-   */
-  public void visitMemberRef(int index, byte tag,
-                             String className, String memberName, String signature,
-                             int classNameIndex, int descriptorIndex) {
-    // do nothing
-  }
-
-    public static final byte
-      CONSTANT_None = 0,
-      CONSTANT_Utf8 = 1,
-      //CONSTANT_Unicode = 2,               /* unused */
-      CONSTANT_Integer = 3,
-      CONSTANT_Float = 4,
-      CONSTANT_Long = 5,
-      CONSTANT_Double = 6,
-      CONSTANT_Class = 7,
-      CONSTANT_String = 8,
-      CONSTANT_Fieldref = 9,
-      CONSTANT_Methodref = 10,
-      CONSTANT_InterfaceMethodref = 11,
-      CONSTANT_NameAndType = 12;
-
-    private static String[] TAG_NAMES = {
-        "Empty",
-        "Utf8",
-        null, //"Unicode",
-        "Integer",
-        "Float",
-        "Long",
-        "Double",
-        "Class",
-        "String",
-        "Fieldref",
-        "Methodref",
-        "InterfaceMethodref",
-        "NameAndType"
-    };
-
-    public static String tagName(byte tag) {
-        String name = null;
-        if ((tag & 0xFF) < TAG_NAMES.length)
-            name = TAG_NAMES[tag];
-        if (name == null)
-            name = "Unknown#"+(tag&0xFF);
-        return name;
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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 sun.invoke.anon;
-
-/** Exception used when there is an error in the constant pool
- *  format.
- */
-public class InvalidConstantPoolFormatException extends Exception {
-    private static final long serialVersionUID=-6103888330523770949L;
-
-    public InvalidConstantPoolFormatException(String message,Throwable cause) {
-        super(message,cause);
-    }
-
-    public InvalidConstantPoolFormatException(String message) {
-        super(message);
-    }
-
-    public InvalidConstantPoolFormatException(Throwable cause) {
-        super(cause);
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/ClassFileTransformer.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.misc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is an abstract base class originally intended to be called by
- * {@code java.lang.ClassLoader} when {@code ClassFormatError} is
- * thrown inside {@code defineClass()}. It is no longer hooked into
- * {@code ClassLoader} and will be removed in a future release.
- *
- * @author      Stanley Man-Kit Ho
- */
-
-@Deprecated
-public abstract class ClassFileTransformer {
-
-    private static final List<ClassFileTransformer> transformers
-        = new ArrayList<ClassFileTransformer>();
-
-    /**
-     * Add the class file transformer object.
-     *
-     * @param t Class file transformer instance
-     */
-    public static void add(ClassFileTransformer t) {
-        synchronized (transformers) {
-            transformers.add(t);
-        }
-    }
-
-    /**
-     * Get the array of ClassFileTransformer object.
-     *
-     * @return ClassFileTransformer object array
-     */
-    public static ClassFileTransformer[] getTransformers() {
-        synchronized (transformers) {
-            ClassFileTransformer[] result = new ClassFileTransformer[transformers.size()];
-            return transformers.toArray(result);
-        }
-    }
-
-
-    /**
-     * Transform a byte array from one to the other.
-     *
-     * @param b Byte array
-     * @param off Offset
-     * @param len Length of byte array
-     * @return Transformed byte array
-     */
-    public abstract byte[] transform(byte[] b, int off, int len)
-        throws ClassFormatError;
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,14 +25,13 @@
 
 package sun.misc;
 
-import java.lang.reflect.Field;
-import java.security.ProtectionDomain;
-
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 
-import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.misc.VM;
+import java.lang.reflect.Field;
+import java.security.ProtectionDomain;
 
 
 /**
@@ -1036,9 +1035,4 @@
     private static void throwIllegalAccessError() {
         throw new IllegalAccessError();
     }
-
-    // JVM interface methods
-    private native boolean unalignedAccess0();
-    private native boolean isBigEndian0();
-
 }
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -30,7 +30,6 @@
 import java.net.ProtocolException;
 import java.net.PasswordAuthentication;
 import java.util.Arrays;
-import java.util.StringTokenizer;
 import java.util.Random;
 
 import sun.net.www.HeaderParser;
@@ -146,9 +145,9 @@
 
         synchronized void setQop (String qop) {
             if (qop != null) {
-                StringTokenizer st = new StringTokenizer (qop, " ");
-                while (st.hasMoreTokens()) {
-                    if (st.nextToken().equalsIgnoreCase ("auth")) {
+                String items[] = qop.split(",");
+                for (String item : items) {
+                    if ("auth".equalsIgnoreCase(item.trim())) {
                         serverQop = true;
                         return;
                     }
@@ -163,7 +162,7 @@
         synchronized String getNonce () { return nonce;}
 
         synchronized void setNonce (String s) {
-            if (!s.equals(nonce)) {
+            if (nonce == null || !s.equals(nonce)) {
                 nonce=s;
                 NCcount = 0;
                 redoCachedHA1 = true;
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
 
 package sun.reflect.annotation;
 
+import java.io.ObjectInputStream;
 import java.lang.annotation.*;
 import java.lang.reflect.*;
 import java.io.Serializable;
@@ -431,35 +432,72 @@
 
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();
+        ObjectInputStream.GetField fields = s.readFields();
+
+        @SuppressWarnings("unchecked")
+        Class<? extends Annotation> t = (Class<? extends Annotation>)fields.get("type", null);
+        @SuppressWarnings("unchecked")
+        Map<String, Object> streamVals = (Map<String, Object>)fields.get("memberValues", null);
 
         // Check to make sure that types have not evolved incompatibly
 
         AnnotationType annotationType = null;
         try {
-            annotationType = AnnotationType.getInstance(type);
+            annotationType = AnnotationType.getInstance(t);
         } catch(IllegalArgumentException e) {
             // Class is no longer an annotation type; time to punch out
             throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream");
         }
 
         Map<String, Class<?>> memberTypes = annotationType.memberTypes();
+        // consistent with runtime Map type
+        Map<String, Object> mv = new LinkedHashMap<>();
 
         // If there are annotation members without values, that
         // situation is handled by the invoke method.
-        for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
+        for (Map.Entry<String, Object> memberValue : streamVals.entrySet()) {
             String name = memberValue.getKey();
+            Object value = null;
             Class<?> memberType = memberTypes.get(name);
             if (memberType != null) {  // i.e. member still exists
-                Object value = memberValue.getValue();
+                value = memberValue.getValue();
                 if (!(memberType.isInstance(value) ||
                       value instanceof ExceptionProxy)) {
-                    memberValue.setValue(
-                        new AnnotationTypeMismatchExceptionProxy(
+                    value = new AnnotationTypeMismatchExceptionProxy(
                             value.getClass() + "[" + value + "]").setMember(
-                                annotationType.members().get(name)));
+                                annotationType.members().get(name));
                 }
             }
+            mv.put(name, value);
+        }
+
+        UnsafeAccessor.setType(this, t);
+        UnsafeAccessor.setMemberValues(this, mv);
+    }
+
+    private static class UnsafeAccessor {
+        private static final jdk.internal.misc.Unsafe unsafe;
+        private static final long typeOffset;
+        private static final long memberValuesOffset;
+        static {
+            try {
+                unsafe = jdk.internal.misc.Unsafe.getUnsafe();
+                typeOffset = unsafe.objectFieldOffset
+                        (AnnotationInvocationHandler.class.getDeclaredField("type"));
+                memberValuesOffset = unsafe.objectFieldOffset
+                        (AnnotationInvocationHandler.class.getDeclaredField("memberValues"));
+            } catch (Exception ex) {
+                throw new ExceptionInInitializerError(ex);
+            }
+        }
+        static void setType(AnnotationInvocationHandler o,
+                            Class<? extends Annotation> type) {
+            unsafe.putObject(o, typeOffset, type);
+        }
+
+        static void setMemberValues(AnnotationInvocationHandler o,
+                                    Map<String, Object> memberValues) {
+            unsafe.putObject(o, memberValuesOffset, memberValues);
         }
     }
 }
--- a/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,6 +43,8 @@
 public class TlsRsaPremasterSecretParameterSpec
         implements AlgorithmParameterSpec {
 
+    private final byte[] encodedSecret;
+
     /*
      * The TLS spec says that the version in the RSA premaster secret must
      * be the maximum version supported by the client (i.e. the version it
@@ -89,6 +91,33 @@
 
         this.clientVersion = checkVersion(clientVersion);
         this.serverVersion = checkVersion(serverVersion);
+        this.encodedSecret = null;
+    }
+
+    /**
+     * Constructs a new TlsRsaPremasterSecretParameterSpec.
+     *
+     * @param clientVersion the version of the TLS protocol by which the
+     *        client wishes to communicate during this session
+     * @param serverVersion the negotiated version of the TLS protocol which
+     *        contains the lower of that suggested by the client in the client
+     *        hello and the highest supported by the server.
+     * @param encodedSecret the encoded secret key
+     *
+     * @throws IllegalArgumentException if clientVersion or serverVersion are
+     *   negative or larger than (2^16 - 1) or if encodedSecret is not
+     *   exactly 48 bytes
+     */
+    public TlsRsaPremasterSecretParameterSpec(
+            int clientVersion, int serverVersion, byte[] encodedSecret) {
+
+        this.clientVersion = checkVersion(clientVersion);
+        this.serverVersion = checkVersion(serverVersion);
+        if (encodedSecret == null || encodedSecret.length != 48) {
+            throw new IllegalArgumentException(
+                        "Encoded secret is not exactly 48 bytes");
+        }
+        this.encodedSecret = encodedSecret.clone();
     }
 
     /**
@@ -147,4 +176,13 @@
         }
         return version;
     }
+
+    /**
+     * Returns the encoded secret.
+     *
+     * @return the encoded secret, may be null if no encoded secret.
+     */
+    public byte[] getEncodedSecret() {
+        return encodedSecret == null ? null : encodedSecret.clone();
+    }
 }
--- a/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -41,12 +41,6 @@
         // no instantiation
     }
 
-    // lock to use for synchronization
-    private static final Object LOCK = JCAUtil.class;
-
-    // cached SecureRandom instance
-    private static volatile SecureRandom secureRandom;
-
     // size of the temporary arrays we use. Should fit into the CPU's 1st
     // level cache and could be adjusted based on the platform
     private static final int ARRAY_SIZE = 4096;
@@ -60,26 +54,19 @@
         return Math.min(ARRAY_SIZE, totalSize);
     }
 
+    // cached SecureRandom instance
+    private static class CachedSecureRandomHolder {
+        public static SecureRandom instance = new SecureRandom();
+    }
+
     /**
-     * Get a SecureRandom instance. This method should me used by JDK
+     * Get a SecureRandom instance. This method should be used by JDK
      * internal code in favor of calling "new SecureRandom()". That needs to
      * iterate through the provider table to find the default SecureRandom
      * implementation, which is fairly inefficient.
      */
     public static SecureRandom getSecureRandom() {
-        // we use double checked locking to minimize synchronization
-        // works because we use a volatile reference
-        SecureRandom r = secureRandom;
-        if (r == null) {
-            synchronized (LOCK) {
-                r = secureRandom;
-                if (r == null) {
-                    r = new SecureRandom();
-                    secureRandom = r;
-                }
-            }
-        }
-        return r;
+        return CachedSecureRandomHolder.instance;
     }
 
 }
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java	Tue Jan 26 09:11:58 2016 +0100
@@ -49,7 +49,7 @@
  * </pre>
  *
  * @see ResponderId.Type
- * @since 1.9
+ * @since 9
  */
 public final class ResponderId {
 
@@ -58,7 +58,7 @@
      * {@code ResponderId}.
      *
      * @see ResponderId
-     * @since 1.9
+     * @since 9
      */
     public static enum Type {
         /**
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -333,7 +333,7 @@
                             input, serverKey,
                             clnt_random.random_bytes, svr_random.random_bytes,
                             messageLen,
-                            localSupportedSignAlgs, protocolVersion);
+                            getLocalSupportedSignAlgs(), protocolVersion);
                     handshakeState.update(dhSrvKeyExchange, resumingSession);
                     this.serverKeyExchange(dhSrvKeyExchange);
                 } catch (GeneralSecurityException e) {
@@ -348,7 +348,7 @@
                         new ECDH_ServerKeyExchange
                             (input, serverKey, clnt_random.random_bytes,
                             svr_random.random_bytes,
-                            localSupportedSignAlgs, protocolVersion);
+                            getLocalSupportedSignAlgs(), protocolVersion);
                     handshakeState.update(ecdhSrvKeyExchange, resumingSession);
                     this.serverKeyExchange(ecdhSrvKeyExchange);
                 } catch (GeneralSecurityException e) {
@@ -398,7 +398,7 @@
 
                 Collection<SignatureAndHashAlgorithm> supportedPeerSignAlgs =
                     SignatureAndHashAlgorithm.getSupportedAlgorithms(
-                                                            peerSignAlgs);
+                            algorithmConstraints, peerSignAlgs);
                 if (supportedPeerSignAlgs.isEmpty()) {
                     throw new SSLHandshakeException(
                         "No supported signature and hash algorithm in common");
@@ -1211,8 +1211,8 @@
                 if (protocolVersion.useTLS12PlusSpec()) {
                     preferableSignatureAlgorithm =
                         SignatureAndHashAlgorithm.getPreferableAlgorithm(
-                            peerSupportedSignAlgs, signingKey.getAlgorithm(),
-                            signingKey);
+                            getPeerSupportedSignAlgs(),
+                            signingKey.getAlgorithm(), signingKey);
 
                     if (preferableSignatureAlgorithm == null) {
                         throw new SSLHandshakeException(
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java	Tue Jan 26 09:11:58 2016 +0100
@@ -41,7 +41,7 @@
  * Models a service that provides support for a particular client key exchange
  * mode. Currently used to implement Kerberos-related cipher suites.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ClientKeyExchangeService {
 
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1943,7 +1943,7 @@
     // the signature bytes
     private byte[] signature;
 
-    // protocol version being established using this ServerKeyExchange message
+    // protocol version being established using this CertificateVerify message
     ProtocolVersion protocolVersion;
 
     // the preferable signature algorithm used by this CertificateVerify message
@@ -1996,7 +1996,7 @@
                     preferableSignatureAlgorithm)) {
                 throw new SSLHandshakeException(
                         "Unsupported SignatureAndHashAlgorithm in " +
-                        "ServerKeyExchange message");
+                        "CertificateVerify message");
             }
         }
 
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -90,7 +90,7 @@
     AlgorithmConstraints        algorithmConstraints = null;
 
     // Local supported signature and algorithms
-    Collection<SignatureAndHashAlgorithm> localSupportedSignAlgs;
+    private Collection<SignatureAndHashAlgorithm> localSupportedSignAlgs;
 
     // Peer supported signature and algorithms
     Collection<SignatureAndHashAlgorithm> peerSupportedSignAlgs;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -113,14 +113,34 @@
             }
         }
 
+        byte[] encoded = null;
         try {
             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
-            cipher.init(Cipher.UNWRAP_MODE, privateKey,
-                    new TlsRsaPremasterSecretParameterSpec(
-                            maxVersion.v, currentVersion.v),
-                    generator);
-            preMaster = (SecretKey)cipher.unwrap(encrypted,
-                                "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
+            boolean needFailover = !KeyUtil.isOracleJCEProvider(
+                    cipher.getProvider().getName());
+            if (needFailover) {
+                cipher.init(Cipher.DECRYPT_MODE, privateKey);
+                boolean failed = false;
+                try {
+                    encoded = cipher.doFinal(encrypted);
+                } catch (BadPaddingException bpe) {
+                    // Note: encoded == null
+                    failed = true;
+                }
+                encoded = KeyUtil.checkTlsPreMasterSecretKey(
+                                maxVersion.v, currentVersion.v,
+                                generator, encoded, failed);
+                preMaster = generatePreMasterSecret(
+                                maxVersion.v, currentVersion.v,
+                                encoded, generator);
+            } else {
+                cipher.init(Cipher.UNWRAP_MODE, privateKey,
+                        new TlsRsaPremasterSecretParameterSpec(
+                                maxVersion.v, currentVersion.v),
+                        generator);
+                preMaster = (SecretKey)cipher.unwrap(encrypted,
+                        "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
+            }
         } catch (InvalidKeyException ibk) {
             // the message is too big to process with RSA
             throw new SSLProtocolException(
@@ -135,6 +155,35 @@
         }
     }
 
+    // generate a premaster secret with the specified version number
+    @SuppressWarnings("deprecation")
+    private static SecretKey generatePreMasterSecret(
+            int clientVersion, int serverVersion,
+            byte[] encodedSecret, SecureRandom generator) {
+
+        if (debug != null && Debug.isOn("handshake")) {
+            System.out.println("Generating a premaster secret");
+        }
+
+        try {
+            String s = ((clientVersion >= ProtocolVersion.TLS12.v) ?
+                "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret");
+            KeyGenerator kg = JsseJce.getKeyGenerator(s);
+            kg.init(new TlsRsaPremasterSecretParameterSpec(
+                    clientVersion, serverVersion, encodedSecret),
+                    generator);
+            return kg.generateKey();
+        } catch (InvalidAlgorithmParameterException |
+                NoSuchAlgorithmException iae) {
+            // unlikely to happen, otherwise, must be a provider exception
+            if (debug != null && Debug.isOn("handshake")) {
+                System.out.println("RSA premaster secret generation error:");
+                iae.printStackTrace(System.out);
+            }
+            throw new RuntimeException("Could not generate premaster secret", iae);
+        }
+    }
+
     @Override
     int messageType() {
         return ht_client_key_exchange;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -320,7 +320,7 @@
             case HandshakeMessage.ht_certificate_verify:
                 CertificateVerify cvm =
                         new CertificateVerify(input,
-                            localSupportedSignAlgs, protocolVersion);
+                            getLocalSupportedSignAlgs(), protocolVersion);
                 handshakeState.update(cvm, resumingSession);
                 this.clientCertificateVerify(cvm);
 
@@ -772,11 +772,10 @@
                     Collection<SignatureAndHashAlgorithm>
                         supportedPeerSignAlgs =
                             SignatureAndHashAlgorithm.getSupportedAlgorithms(
-                                                            peerSignAlgs);
+                                algorithmConstraints, peerSignAlgs);
                     if (supportedPeerSignAlgs.isEmpty()) {
                         throw new SSLHandshakeException(
-                            "No supported signature and hash algorithm " +
-                            "in common");
+                            "No signature and hash algorithm in common");
                     }
 
                     setPeerSupportedSignAlgs(supportedPeerSignAlgs);
@@ -1351,6 +1350,13 @@
                     supportedSignAlgs =
                         new ArrayList<SignatureAndHashAlgorithm>(1);
                     supportedSignAlgs.add(algorithm);
+
+                    supportedSignAlgs =
+                            SignatureAndHashAlgorithm.getSupportedAlgorithms(
+                                algorithmConstraints, supportedSignAlgs);
+
+                    // May be no default activated signature algorithm, but
+                    // let the following process make the final decision.
                 }
 
                 // Sets the peer supported signature algorithm to use in KM
@@ -1395,6 +1401,11 @@
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
                                         supportedSignAlgs, "RSA", privateKey);
                 if (preferableSignatureAlgorithm == null) {
+                    if ((debug != null) && Debug.isOn("handshake")) {
+                        System.out.println(
+                                "No signature and hash algorithm for cipher " +
+                                suite);
+                    }
                     return false;
                 }
             }
@@ -1413,6 +1424,11 @@
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
                                         supportedSignAlgs, "RSA", privateKey);
                 if (preferableSignatureAlgorithm == null) {
+                    if ((debug != null) && Debug.isOn("handshake")) {
+                        System.out.println(
+                                "No signature and hash algorithm for cipher " +
+                                suite);
+                    }
                     return false;
                 }
             }
@@ -1428,6 +1444,11 @@
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
                                                 supportedSignAlgs, "DSA");
                 if (preferableSignatureAlgorithm == null) {
+                    if ((debug != null) && Debug.isOn("handshake")) {
+                        System.out.println(
+                                "No signature and hash algorithm for cipher " +
+                                suite);
+                    }
                     return false;
                 }
             }
@@ -1446,6 +1467,11 @@
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
                                             supportedSignAlgs, "ECDSA");
                 if (preferableSignatureAlgorithm == null) {
+                    if ((debug != null) && Debug.isOn("handshake")) {
+                        System.out.println(
+                                "No signature and hash algorithm for cipher " +
+                                suite);
+                    }
                     return false;
                 }
             }
@@ -1487,7 +1513,8 @@
                     ClientKeyExchangeService.find(keyExchange.name);
             if (p == null) {
                 // internal error, unknown key exchange
-                throw new RuntimeException("Unrecognized cipherSuite: " + suite);
+                throw new RuntimeException(
+                        "Unrecognized cipherSuite: " + suite);
             }
             // need service creds
             if (serviceCreds == null) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Tue Jan 26 09:11:58 2016 +0100
@@ -166,10 +166,13 @@
 
     // Get supported algorithm collection from an untrusted collection
     static Collection<SignatureAndHashAlgorithm> getSupportedAlgorithms(
+            AlgorithmConstraints constraints,
             Collection<SignatureAndHashAlgorithm> algorithms ) {
         Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
         for (SignatureAndHashAlgorithm sigAlg : algorithms) {
-            if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
+            if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
+                    constraints.permits(SIGNATURE_PRIMITIVE_SET,
+                                sigAlg.algorithm, null)) {
                 supported.add(sigAlg);
             }
         }
@@ -233,30 +236,42 @@
     }
 
     static SignatureAndHashAlgorithm getPreferableAlgorithm(
-        Collection<SignatureAndHashAlgorithm> algorithms,
-        String expected, PrivateKey signingKey) {
+            Collection<SignatureAndHashAlgorithm> algorithms,
+            String expected, PrivateKey signingKey) {
 
-        if (expected == null && !algorithms.isEmpty()) {
-            for (SignatureAndHashAlgorithm sigAlg : algorithms) {
-                if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
-                    return sigAlg;
+        int maxDigestLength = getMaxDigestLength(signingKey);
+        for (SignatureAndHashAlgorithm algorithm : algorithms) {
+            int signValue = algorithm.id & 0xFF;
+            if ((expected == null) ||
+                    (expected.equalsIgnoreCase("rsa") &&
+                            signValue == SignatureAlgorithm.RSA.value) ||
+                    (expected.equalsIgnoreCase("dsa") &&
+                            signValue == SignatureAlgorithm.DSA.value) ||
+                    (expected.equalsIgnoreCase("ecdsa") &&
+                            signValue == SignatureAlgorithm.ECDSA.value) ||
+                    (expected.equalsIgnoreCase("ec") &&
+                            signValue == SignatureAlgorithm.ECDSA.value)) {
+
+                if (algorithm.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
+                        algorithm.hash.length <= maxDigestLength) {
+
+                    return algorithm;
                 }
             }
-
-            return null;  // no supported algorithm
-        }
-
-        if (expected == null ) {
-            return null;  // no expected algorithm, no supported algorithm
         }
 
-        /*
-         * Need to check RSA key length to match the length of hash value
-         */
+        return null;
+    }
+
+    /*
+     * Need to check key length to match the length of hash value
+     */
+    private static int getMaxDigestLength(PrivateKey signingKey) {
         int maxDigestLength = Integer.MAX_VALUE;
+
+        // only need to check RSA algorithm at present.
         if (signingKey != null &&
-                "rsa".equalsIgnoreCase(signingKey.getAlgorithm()) &&
-                expected.equalsIgnoreCase("rsa")) {
+                "rsa".equalsIgnoreCase(signingKey.getAlgorithm())) {
             /*
              * RSA keys of 512 bits have been shown to be practically
              * breakable, it does not make much sense to use the strong
@@ -284,25 +299,7 @@
                 // preferable hash algorithm.
         }
 
-        for (SignatureAndHashAlgorithm algorithm : algorithms) {
-            int signValue = algorithm.id & 0xFF;
-            if (expected.equalsIgnoreCase("rsa") &&
-                    signValue == SignatureAlgorithm.RSA.value) {
-                if (algorithm.hash.length <= maxDigestLength) {
-                    return algorithm;
-                }
-            } else if (
-                    (expected.equalsIgnoreCase("dsa") &&
-                        signValue == SignatureAlgorithm.DSA.value) ||
-                    (expected.equalsIgnoreCase("ecdsa") &&
-                        signValue == SignatureAlgorithm.ECDSA.value) ||
-                    (expected.equalsIgnoreCase("ec") &&
-                        signValue == SignatureAlgorithm.ECDSA.value)) {
-                return algorithm;
-            }
-        }
-
-        return null;
+        return maxDigestLength;
     }
 
     static enum HashAlgorithm {
@@ -415,12 +412,14 @@
             supports(HashAlgorithm.SHA1,        SignatureAlgorithm.ECDSA,
                     "SHA1withECDSA",        --p);
 
-            supports(HashAlgorithm.SHA224,      SignatureAlgorithm.DSA,
-                    "SHA224withDSA",        --p);
-            supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
-                    "SHA224withRSA",        --p);
-            supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
-                    "SHA224withECDSA",      --p);
+            if (Security.getProvider("SunMSCAPI") == null) {
+                supports(HashAlgorithm.SHA224,      SignatureAlgorithm.DSA,
+                        "SHA224withDSA",        --p);
+                supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
+                        "SHA224withRSA",        --p);
+                supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
+                        "SHA224withECDSA",      --p);
+            }
 
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.DSA,
                     "SHA256withDSA",        --p);
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
 /**
  * This class delegates to a primary or secondary keystore implementation.
  *
- * @since 1.9
+ * @since 9
  */
 
 public class KeyStoreDelegator extends KeyStoreSpi {
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyUtil.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyUtil.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -41,6 +41,8 @@
 import javax.crypto.spec.DHPublicKeySpec;
 import java.math.BigInteger;
 
+import sun.security.jca.JCAUtil;
+
 /**
  * A utility class to get key length, valiate keys, etc.
  */
@@ -143,8 +145,6 @@
 
     /**
      * Returns whether the specified provider is Oracle provider or not.
-     * <P>
-     * Note that this method is only apply to SunJCE and SunPKCS11 at present.
      *
      * @param  providerName
      *         the provider name
@@ -152,8 +152,11 @@
      *         {@code providerName} is Oracle provider
      */
     public static final boolean isOracleJCEProvider(String providerName) {
-        return providerName != null && (providerName.equals("SunJCE") ||
-                                        providerName.startsWith("SunPKCS11"));
+        return providerName != null &&
+                (providerName.equals("SunJCE") ||
+                    providerName.equals("SunMSCAPI") ||
+                    providerName.equals("OracleUcrypto") ||
+                    providerName.startsWith("SunPKCS11"));
     }
 
     /**
@@ -200,7 +203,7 @@
             byte[] encoded, boolean isFailOver) {
 
         if (random == null) {
-            random = new SecureRandom();
+            random = JCAUtil.getSecureRandom();
         }
         byte[] replacer = new byte[48];
         random.nextBytes(replacer);
--- a/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Tue Jan 26 09:11:58 2016 +0100
@@ -588,7 +588,7 @@
             }
 
             if (oidTable == null) {
-                oidTable = new HashMap<>(1);
+                oidTable = Collections.<String,ObjectIdentifier>emptyMap();
             }
             initOidTable = true;
         }
--- a/jdk/src/java.base/share/classes/sun/security/x509/CRLDistributionPointsExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLDistributionPointsExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,6 +29,7 @@
 import java.io.OutputStream;
 
 import java.util.*;
+import java.util.Collections;
 
 import sun.security.util.DerOutputStream;
 import sun.security.util.DerValue;
@@ -255,11 +256,12 @@
      */
     public void delete(String name) throws IOException {
         if (name.equalsIgnoreCase(POINTS)) {
-            distributionPoints = new ArrayList<DistributionPoint>();
+            distributionPoints =
+                    Collections.<DistributionPoint>emptyList();
         } else {
             throw new IOException("Attribute name [" + name +
-                                "] not recognized by " +
-                                "CertAttrSet:" + extensionName + ".");
+                                  "] not recognized by " +
+                                  "CertAttrSet:" + extensionName + '.');
         }
         encodeThis();
     }
--- a/jdk/src/java.base/share/classes/sun/security/x509/CRLNumberExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLNumberExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -157,11 +157,10 @@
      */
     public BigInteger get(String name) throws IOException {
         if (name.equalsIgnoreCase(NUMBER)) {
-            if (crlNumber == null) return null;
-            else return crlNumber;
+            return crlNumber;
         } else {
-          throw new IOException("Attribute name not recognized by"
-                                + " CertAttrSet:" + extensionName + ".");
+            throw new IOException("Attribute name not recognized by" +
+                                  " CertAttrSet:" + extensionName + '.');
         }
     }
 
--- a/jdk/src/java.base/share/classes/sun/security/x509/DNSName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/DNSName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -232,15 +232,15 @@
      * @throws UnsupportedOperationException if not supported for this name type
      */
     public int subtreeDepth() throws UnsupportedOperationException {
-        String subtree=name;
-        int i=1;
+        // subtree depth is always at least 1
+        int sum = 1;
 
-        /* count dots */
-        for (; subtree.lastIndexOf('.') >= 0; i++) {
-            subtree=subtree.substring(0,subtree.lastIndexOf('.'));
+        // count dots
+        for (int i = name.indexOf('.'); i >= 0; i = name.indexOf('.', i + 1)) {
+            ++sum;
         }
 
-        return i;
+        return sum;
     }
 
 }
--- a/jdk/src/java.base/share/classes/sun/security/x509/EDIPartyName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/EDIPartyName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -197,7 +197,7 @@
      */
     public int hashCode() {
         if (myhash == -1) {
-            myhash = 37 + party.hashCode();
+            myhash = 37 + (party == null ? 1 : party.hashCode());
             if (assigner != null) {
                 myhash = 37 * myhash + assigner.hashCode();
             }
--- a/jdk/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java	Tue Jan 26 09:11:58 2016 +0100
@@ -189,7 +189,7 @@
         // the list: if any subsequent entry matches or widens entry n,
         // remove entry n. If any subsequent entries narrow entry n, remove
         // the subsequent entries.
-        for (int i = 0; i < size(); i++) {
+        for (int i = 0; i < (size() - 1); i++) {
             GeneralNameInterface current = getGeneralNameInterface(i);
             boolean remove1 = false;
 
--- a/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -197,8 +197,10 @@
 
             // append a mask corresponding to the num of prefix bits specified
             int prefixLen = Integer.parseInt(name.substring(slashNdx+1));
-            if (prefixLen > 128)
-                throw new IOException("IPv6Address prefix is longer than 128");
+            if (prefixLen < 0 || prefixLen > 128) {
+                throw new IOException("IPv6Address prefix length (" +
+                        prefixLen + ") in out of valid range [0,128]");
+            }
 
             // create new bit array initialized to zeros
             BitArray bitArray = new BitArray(MASKSIZE * 8);
@@ -317,7 +319,8 @@
         if (!(obj instanceof IPAddressName))
             return false;
 
-        byte[] other = ((IPAddressName)obj).getBytes();
+        IPAddressName otherName = (IPAddressName)obj;
+        byte[] other = otherName.address;
 
         if (other.length != address.length)
             return false;
@@ -326,12 +329,10 @@
             // Two subnet addresses
             // Mask each and compare masked values
             int maskLen = address.length/2;
-            byte[] maskedThis = new byte[maskLen];
-            byte[] maskedOther = new byte[maskLen];
             for (int i=0; i < maskLen; i++) {
-                maskedThis[i] = (byte)(address[i] & address[i+maskLen]);
-                maskedOther[i] = (byte)(other[i] & other[i+maskLen]);
-                if (maskedThis[i] != maskedOther[i]) {
+                byte maskedThis = (byte)(address[i] & address[i+maskLen]);
+                byte maskedOther = (byte)(other[i] & other[i+maskLen]);
+                if (maskedThis != maskedOther) {
                     return false;
                 }
             }
@@ -400,7 +401,8 @@
         else if (((IPAddressName)inputName).equals(this))
             constraintType = NAME_MATCH;
         else {
-            byte[] otherAddress = ((IPAddressName)inputName).getBytes();
+            IPAddressName otherName = (IPAddressName)inputName;
+            byte[] otherAddress = otherName.address;
             if (otherAddress.length == 4 && address.length == 4)
                 // Two host addresses
                 constraintType = NAME_SAME_TYPE;
--- a/jdk/src/java.base/share/classes/sun/security/x509/IssuingDistributionPointExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IssuingDistributionPointExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -261,6 +261,7 @@
                 throw new IOException(
                     "Attribute value should be of type ReasonFlags.");
             }
+            revocationReasons = (ReasonFlags)obj;
 
         } else if (name.equalsIgnoreCase(INDIRECT_CRL)) {
             if (!(obj instanceof Boolean)) {
@@ -290,7 +291,6 @@
             }
             hasOnlyAttributeCerts = ((Boolean)obj).booleanValue();
 
-
         } else {
             throw new IOException("Attribute name [" + name +
                 "] not recognized by " +
--- a/jdk/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java	Tue Jan 26 09:11:58 2016 +0100
@@ -148,7 +148,7 @@
             return true;
         if (!(other instanceof KeyIdentifier))
             return false;
-        return java.util.Arrays.equals(octetString,
-                                       ((KeyIdentifier)other).getIdentifier());
+        byte[] otherString = ((KeyIdentifier)other).octetString;
+        return java.util.Arrays.equals(octetString, otherString);
     }
 }
--- a/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -102,7 +102,7 @@
     public PolicyMappingsExtension() {
         extensionId = PKIXExtensions.PolicyMappings_Id;
         critical = true;
-        maps = new ArrayList<CertificatePolicyMap>();
+        maps = Collections.<CertificatePolicyMap>emptyList();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,6 +33,7 @@
 import java.security.cert.CertificateNotYetValidException;
 import java.util.Date;
 import java.util.Enumeration;
+import java.util.Objects;
 
 import sun.security.util.*;
 
@@ -217,16 +218,17 @@
      */
     public void valid(Date now)
     throws CertificateNotYetValidException, CertificateExpiredException {
+        Objects.requireNonNull(now);
         /*
          * we use the internal Dates rather than the passed in Date
          * because someone could override the Date methods after()
          * and before() to do something entirely different.
          */
-        if (notBefore.after(now)) {
+        if (notBefore != null && notBefore.after(now)) {
             throw new CertificateNotYetValidException("NotBefore: " +
                                                       notBefore.toString());
         }
-        if (notAfter.before(now)) {
+        if (notAfter != null && notAfter.before(now)) {
             throw new CertificateExpiredException("NotAfter: " +
                                                   notAfter.toString());
         }
--- a/jdk/src/java.base/share/classes/sun/security/x509/RDN.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/RDN.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,6 +27,8 @@
 
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.Arrays;
+import java.util.StringJoiner;
 import java.util.*;
 
 import sun.security.util.*;
@@ -436,31 +438,19 @@
                                assertion[0].toRFC2253String(oidMap);
         }
 
-        StringBuilder relname = new StringBuilder();
-        if (!canonical) {
-            for (int i = 0; i < assertion.length; i++) {
-                if (i > 0) {
-                    relname.append('+');
-                }
-                relname.append(assertion[i].toRFC2253String(oidMap));
-            }
-        } else {
+        AVA[] toOutput = assertion;
+        if (canonical) {
             // order the string type AVA's alphabetically,
             // followed by the oid type AVA's numerically
-            List<AVA> avaList = new ArrayList<>(assertion.length);
-            for (int i = 0; i < assertion.length; i++) {
-                avaList.add(assertion[i]);
-            }
-            java.util.Collections.sort(avaList, AVAComparator.getInstance());
-
-            for (int i = 0; i < avaList.size(); i++) {
-                if (i > 0) {
-                    relname.append('+');
-                }
-                relname.append(avaList.get(i).toRFC2253CanonicalString());
-            }
+            toOutput = assertion.clone();
+            Arrays.sort(toOutput, AVAComparator.getInstance());
         }
-        return relname.toString();
+        StringJoiner sj = new StringJoiner("+");
+        for (AVA ava : toOutput) {
+            sj.add(canonical ? ava.toRFC2253CanonicalString()
+                             : ava.toRFC2253String(oidMap));
+        }
+        return sj.toString();
     }
 
 }
--- a/jdk/src/java.base/share/classes/sun/security/x509/SubjectInfoAccessExtension.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/SubjectInfoAccessExtension.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import java.util.Collections;
 import java.util.*;
 
 import sun.security.util.DerOutputStream;
@@ -200,7 +201,8 @@
      */
     public void delete(String name) throws IOException {
         if (name.equalsIgnoreCase(DESCRIPTIONS)) {
-            accessDescriptions = new ArrayList<AccessDescription>();
+            accessDescriptions =
+                Collections.<AccessDescription>emptyList();
         } else {
             throw new IOException("Attribute name [" + name +
                                 "] not recognized by " +
--- a/jdk/src/java.base/share/classes/sun/security/x509/URIName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/URIName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -165,7 +165,7 @@
             String host = uri.getSchemeSpecificPart();
             try {
                 DNSName hostDNS;
-                if (host.charAt(0) == '.') {
+                if (host.startsWith(".")) {
                     hostDNS = new DNSName(host.substring(1));
                 } else {
                     hostDNS = new DNSName(host);
--- a/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java	Tue Jan 26 09:11:58 2016 +0100
@@ -347,6 +347,8 @@
             for (int i = 0; i < names.length; i++) {
                 list.addAll(names[i].avas());
             }
+            list = Collections.unmodifiableList(list);
+            allAvaList = list;
         }
         return list;
     }
@@ -365,9 +367,6 @@
      */
     public boolean isEmpty() {
         int n = names.length;
-        if (n == 0) {
-            return true;
-        }
         for (int i = 0; i < n; i++) {
             if (names[i].assertion.length != 0) {
                 return false;
@@ -1103,12 +1102,8 @@
      * and speed recognition of common X.500 attributes.
      */
     static ObjectIdentifier intern(ObjectIdentifier oid) {
-        ObjectIdentifier interned = internedOIDs.get(oid);
-        if (interned != null) {
-            return interned;
-        }
-        internedOIDs.put(oid, oid);
-        return oid;
+        ObjectIdentifier interned = internedOIDs.putIfAbsent(oid, oid);
+        return (interned == null) ? oid : interned;
     }
 
     private static final Map<ObjectIdentifier,ObjectIdentifier> internedOIDs
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509AttributeName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509AttributeName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -47,7 +47,7 @@
      */
     public X509AttributeName(String name) {
         int i = name.indexOf(SEPARATOR);
-        if (i == (-1)) {
+        if (i < 0) {
             prefix = name;
         } else {
             prefix = name.substring(0, i);
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -762,9 +762,7 @@
     public byte[] getTBSCertList() throws CRLException {
         if (tbsCertList == null)
             throw new CRLException("Uninitialized CRL");
-        byte[] dup = new byte[tbsCertList.length];
-        System.arraycopy(tbsCertList, 0, dup, 0, dup.length);
-        return dup;
+        return tbsCertList.clone();
     }
 
     /**
@@ -775,9 +773,7 @@
     public byte[] getSignature() {
         if (signature == null)
             return null;
-        byte[] dup = new byte[signature.length];
-        System.arraycopy(signature, 0, dup, 0, dup.length);
-        return dup;
+        return signature.clone();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1001,9 +1001,7 @@
     public byte[] getSignature() {
         if (signature == null)
             return null;
-        byte[] dup = new byte[signature.length];
-        System.arraycopy(signature, 0, dup, 0, dup.length);
-        return dup;
+        return signature.clone();
     }
 
     /**
--- a/jdk/src/java.base/share/conf/security/java.security	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/conf/security/java.security	Tue Jan 26 09:11:58 2016 +0100
@@ -576,7 +576,7 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
-jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768
+jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768
 
 # Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
 # processing in JSSE implementation.
--- a/jdk/src/java.base/share/native/include/jvm.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/native/include/jvm.h	Tue Jan 26 09:11:58 2016 +0100
@@ -208,6 +208,9 @@
 JNIEXPORT void JNICALL
 JVM_SetMethodInfo(JNIEnv* env, jobject frame);
 
+JNIEXPORT jobjectArray JNICALL
+JVM_GetVmArguments(JNIEnv *env);
+
 /*
  * java.lang.Thread
  */
--- a/jdk/src/java.base/share/native/libjava/jni_util.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c	Tue Jan 26 09:11:58 2016 +0100
@@ -660,7 +660,8 @@
             */
                     if ((strcmp(encname, "8859_1") == 0) ||
                         (strcmp(encname, "ISO8859-1") == 0) ||
-                        (strcmp(encname, "ISO8859_1") == 0))
+                        (strcmp(encname, "ISO8859_1") == 0) ||
+                        (strcmp(encname, "ISO-8859-1") == 0))
                         fastEncoding = FAST_8859_1;
                     else if (strcmp(encname, "ISO646-US") == 0)
                         fastEncoding = FAST_646_US;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,34 @@
+# Copyright (c) 2011, 2015, 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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
 /**
  * Utility class with different datatransfer helper functions
  *
- * @since 1.9
+ * @since 9
  */
 public class DataFlavorUtil {
 
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  * to enrich it's functionality
  *
  * @author Petr Pchelko
- * @since 1.9
+ * @since 9
  */
 public interface DesktopDatatransferService {
 
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Jan 26 09:11:58 2016 +0100
@@ -235,6 +235,11 @@
         // this will not work if the user clicks on the "Preview" button
         // However if the printer is a StreamPrintService, its the right path.
         PrintService psvc = getPrintService();
+
+        if (psvc == null) {
+            throw new PrinterException("No print service found.");
+        }
+
         if (psvc instanceof StreamPrintService) {
             spoolToService(psvc, attributes);
             return;
--- a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java	Tue Jan 26 09:11:58 2016 +0100
@@ -965,7 +965,7 @@
      * <li>{@link #VALUE_RESOLUTION_VARIANT_SIZE_FIT}
      * <li>{@link #VALUE_RESOLUTION_VARIANT_DPI_FIT}
      * </ul>
-     * @since 1.9
+     * @since 9
      */
     public static final Key KEY_RESOLUTION_VARIANT =
         SunHints.KEY_RESOLUTION_VARIANT;
@@ -976,7 +976,7 @@
      * of the platform
      *
      * @see #KEY_RESOLUTION_VARIANT
-     * @since 1.9
+     * @since 9
      */
     public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
         SunHints.VALUE_RESOLUTION_VARIANT_DEFAULT;
@@ -986,7 +986,7 @@
      * is always used.
      *
      * @see #KEY_RESOLUTION_VARIANT
-     * @since 1.9
+     * @since 9
      */
     public static final Object VALUE_RESOLUTION_VARIANT_BASE =
         SunHints.VALUE_RESOLUTION_VARIANT_BASE;
@@ -997,7 +997,7 @@
      * context.
      *
      * @see #KEY_RESOLUTION_VARIANT
-     * @since 1.9
+     * @since 9
      */
     public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
         SunHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT;
@@ -1007,7 +1007,7 @@
      * chosen based only on the DPI of the screen.
      *
      * @see #KEY_RESOLUTION_VARIANT
-     * @since 1.9
+     * @since 9
      */
     public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
         SunHints.VALUE_RESOLUTION_VARIANT_DPI_FIT;
--- a/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java	Tue Jan 26 09:11:58 2016 +0100
@@ -321,12 +321,12 @@
         MEETEI_MAYEK    ('\uabf0', '\uabc0', '\uac00'),
         /**
          * The Sinhala range with the Sinhala digits.
-         * @since 1.9
+         * @since 9
          */
         SINHALA         ('\u0de6', '\u0d80', '\u0e00'),
         /**
          * The Myanmar Extended-B range with the Myanmar Tai Laing digits.
-         * @since 1.9
+         * @since 9
          */
         MYANMAR_TAI_LAING ('\ua9f0', '\ua9e0', '\uaa00');
 
--- a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -59,7 +59,7 @@
  * @see java.awt.Image
  * @see java.awt.image.MultiResolutionImage
  *
- * @since 1.9
+ * @since 9
  */
 public abstract class AbstractMultiResolutionImage extends java.awt.Image
         implements MultiResolutionImage {
@@ -96,7 +96,7 @@
      *
      * @return the base image of the set of multi-resolution images
      *
-     * @since 1.9
+     * @since 9
      */
     protected abstract Image getBaseImage();
 }
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -50,7 +50,7 @@
  * @see java.awt.image.MultiResolutionImage
  * @see java.awt.image.AbstractMultiResolutionImage
  *
- * @since 1.9
+ * @since 9
  */
 public class BaseMultiResolutionImage extends AbstractMultiResolutionImage {
 
@@ -66,7 +66,7 @@
      * @throws NullPointerException if the specified {@code resolutionVariants}
      *          contains one or more null elements
      *
-     * @since 1.9
+     * @since 9
      */
     public BaseMultiResolutionImage(Image... resolutionVariants) {
         this(0, resolutionVariants);
@@ -86,7 +86,7 @@
      *          negative or greater than or equal to {@code resolutionVariants}
      *          length.
      *
-     * @since 1.9
+     * @since 9
      */
     public BaseMultiResolutionImage(int baseImageIndex,
                                     Image... resolutionVariants) {
--- a/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -52,7 +52,7 @@
  * @see java.awt.Toolkit#getImage(java.lang.String filename)
  * @see java.awt.Toolkit#getImage(java.net.URL url)
  *
- * @since 1.9
+ * @since 9
  */
 public interface MultiResolutionImage {
 
@@ -67,7 +67,7 @@
      *         {@code destImageHeight} is less than or equal to zero, infinity,
      *         or NaN.
      *
-     * @since 1.9
+     * @since 9
      */
     Image getResolutionVariant(double destImageWidth, double destImageHeight);
 
@@ -78,7 +78,7 @@
      * Note that many implementations might return an unmodifiable list.
      * <p>
      * @return list of resolution variants.
-     * @since 1.9
+     * @since 9
      */
     public List<Image> getResolutionVariants();
 }
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * which does not imply the automatic analysis.
  *
  * @see BeanInfo#getPropertyDescriptors
- * @since 1.9
+ * @since 9
  *
  * @author Sergey A. Malenkov
  */
--- a/jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java	Tue Jan 26 09:11:58 2016 +0100
@@ -152,7 +152,7 @@
      *               and the {@code value} is the automatically generated property info
      * @param bound  the flag indicating whether it is possible to treat this property as a bound property
      *
-     * @since 1.9
+     * @since 9
      */
     IndexedPropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
         super(entry, bound);
--- a/jdk/src/java.desktop/share/classes/java/beans/JavaBean.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/beans/JavaBean.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * which does not imply the automatic analysis.
  *
  * @see BeanInfo#getBeanDescriptor
- * @since 1.9
+ * @since 9
  *
  * @author Sergey A. Malenkov
  */
--- a/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Tue Jan 26 09:11:58 2016 +0100
@@ -150,7 +150,7 @@
      *               and the {@code value} is the automatically generated property info
      * @param bound  the flag indicating whether it is possible to treat this property as a bound property
      *
-     * @since 1.9
+     * @since 9
      */
     PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
         String base = entry.getKey();
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java	Tue Jan 26 09:11:58 2016 +0100
@@ -43,7 +43,7 @@
  *
  * @see java.awt.Toolkit#getDefaultToolkit
  * @see java.util.ServiceLoader
- * @since 1.9
+ * @since 9
  */
 public abstract class AccessibilityProvider {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html	Tue Jan 26 09:11:58 2016 +0100
@@ -1194,7 +1194,7 @@
 ]&gt;
 </pre>
 
-@since 1.9
+@since 9
 
 </body>
 </html>
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
  * </li>
  * </ul>
  *
- * @since 1.9
+ * @since 9
  * @see   <a href="http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf">  TIFF 6.0 Specification</a>
  */
 public class BaselineTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  * <p> The definitions of the data types referenced by the field
  * definitions may be found in the {@link TIFFTag TIFFTag} class.
  *
- * @since 1.9
+ * @since 9
  * @see   ExifTIFFTagSet
  */
 public class ExifGPSTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,7 +31,7 @@
 /**
  * A class representing the tags found in an Exif Interoperability IFD.
  *
- * @since 1.9
+ * @since 9
  * @see   ExifTIFFTagSet
  */
 public class ExifInteroperabilityTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  * TIFFImageReadParam.addAllowedTagSet} method if Exif
  * support is desired.
  *
- * @since 1.9
+ * @since 9
  */
 public class ExifParentTIFFTagSet extends TIFFTagSet {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * <p> The definitions of the data types referenced by the field
  * definitions may be found in the {@link TIFFTag TIFFTag} class.
  *
- * @since 1.9
+ * @since 9
  */
 public class ExifTIFFTagSet extends TIFFTagSet {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,7 +31,7 @@
  * A class representing the extra tags found in a
  * <a href="http://tools.ietf.org/html/rfc2306"> TIFF-F</a> (RFC 2036) file.
  *
- * @since 1.9
+ * @since 9
  */
 public class FaxTIFFTagSet extends TIFFTagSet {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * <p>The definitions of the data types referenced by the field
  * definitions may be found in the {@link TIFFTag TIFFTag} class.</p>
  *
- * @since 1.9
+ * @since 9
  */
 public class GeoTIFFTagSet extends TIFFTagSet {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -95,7 +95,7 @@
  * or removing <code>TIFFField</code>s or <code>TIFFTagSet</code>s, it
  * <i>must</i> be synchronized externally.</p>
  *
- * @since 1.9
+ * @since 9
  * @see   IIOMetadata
  * @see   TIFFField
  * @see   TIFFTag
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Tue Jan 26 09:11:58 2016 +0100
@@ -257,7 +257,7 @@
  *
  * </table>
  *
- * @since 1.9
+ * @since 9
  * @see   TIFFDirectory
  * @see   TIFFTag
  */
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Tue Jan 26 09:11:58 2016 +0100
@@ -46,7 +46,7 @@
  * <code>ExifParentTIFFTagSet</code>, and <code>GeoTIFFTagSet</code>
  * are included.
  *
- * @since 1.9
+ * @since 9
  */
 public class TIFFImageReadParam extends ImageReadParam {
 
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Tue Jan 26 09:11:58 2016 +0100
@@ -40,7 +40,7 @@
  * tiff stream are defined in the {@link BaselineTIFFTagSet
  * BaselineTIFFTagSet} class.
  *
- * @since 1.9
+ * @since 9
  * @see   BaselineTIFFTagSet
  * @see   TIFFField
  * @see   TIFFTagSet
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
  * name, legal data types, and mnemonic names for some or all of ts
  * data values.
  *
- * @since 1.9
+ * @since 9
  * @see   TIFFTag
  */
 public class TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/package.html	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/package.html	Tue Jan 26 09:11:58 2016 +0100
@@ -46,6 +46,6 @@
 <br>
 <br>
 
-@since 1.9
+@since 9
 </body>
 </html>
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Tue Jan 26 09:11:58 2016 +0100
@@ -616,7 +616,7 @@
      * Returns the look and feel delegate that renders this component.
      *
      * @return the {@code ComponentUI} object that renders this component
-     * @since 1.9
+     * @since 9
      */
     @Transient
     public ComponentUI getUI() {
--- a/jdk/src/java.desktop/share/classes/javax/swing/SwingContainer.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingContainer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -45,7 +45,7 @@
  * with the {@code isContainer} attribute allow to directly specify
  * whether a Swing component is a container or not.
  *
- * @since 1.9
+ * @since 9
  *
  * @author Sergey A. Malenkov
  */
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java	Tue Jan 26 09:11:58 2016 +0100
@@ -3023,7 +3023,7 @@
 
         /**
          * {@inheritDoc}
-         * @since 1.9
+         * @since 9
          */
         @Override
         public void lockEdit() {
@@ -3032,7 +3032,7 @@
 
         /**
          * {@inheritDoc}
-         * @since 1.9
+         * @since 9
          */
         @Override
         public void unlockEdit() {
--- a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * {@code DesktopDatatransferService} interface.
  *
  * @author Petr Pchelko
- * @since 1.9
+ * @since 9
  */
 public class DesktopDatatransferServiceImpl implements DesktopDatatransferService {
 
--- a/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 
 /**
  * UndoableEdit support for undo/redo actions synchronization
- * @since 1.9
+ * @since 9
  */
 public interface UndoableEditLockSupport extends UndoableEdit {
     /**
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -243,14 +243,14 @@
         le_uint16 srSetCount = SWAPW(subRuleSetCount);
 
         if (coverageIndex < srSetCount) {
-            LEReferenceToArrayOf<Offset> subRuleSetTableOffsetArrayRef(base, success,
-                    &subRuleSetTableOffsetArray[coverageIndex], 1);
+            LEReferenceToArrayOf<Offset>
+                subRuleSetTableOffsetArrayRef(base, success, subRuleSetTableOffsetArray, srSetCount);
             if (LE_FAILURE(success)) {
                 return 0;
             }
             Offset subRuleSetTableOffset = SWAPW(subRuleSetTableOffsetArray[coverageIndex]);
-            LEReferenceTo<SubRuleSetTable>
-                 subRuleSetTable(base, success, (const SubRuleSetTable *) ((char *) this + subRuleSetTableOffset));
+            LEReferenceTo<SubRuleSetTable> subRuleSetTable(base, success, subRuleSetTableOffset);
+            if (LE_FAILURE(success)) { return 0; }
             le_uint16 subRuleCount = SWAPW(subRuleSetTable->subRuleCount);
             le_int32 position = glyphIterator->getCurrStreamPosition();
 
@@ -264,6 +264,7 @@
                     SWAPW(subRuleSetTable->subRuleTableOffsetArray[subRule]);
                 LEReferenceTo<SubRuleTable>
                      subRuleTable(subRuleSetTable, success, subRuleTableOffset);
+                if (LE_FAILURE(success)) { return 0; }
                 le_uint16 matchCount = SWAPW(subRuleTable->glyphCount) - 1;
                 le_uint16 substCount = SWAPW(subRuleTable->substCount);
                 LEReferenceToArrayOf<TTGlyphID> inputGlyphArray(base, success, subRuleTable->inputGlyphArray, matchCount+2);
@@ -304,8 +305,8 @@
     }
 
     if (coverageIndex >= 0) {
-        LEReferenceTo<ClassDefinitionTable> classDefinitionTable(base, success,
-                                                                 (const ClassDefinitionTable *) ((char *) this + SWAPW(classDefTableOffset)));
+        LEReferenceTo<ClassDefinitionTable> classDefinitionTable(base, success, SWAPW(classDefTableOffset));
+        if (LE_FAILURE(success)) { return 0; }
         le_uint16 scSetCount = SWAPW(subClassSetCount);
         le_int32 setClass = classDefinitionTable->getGlyphClass(classDefinitionTable,
                                                                 glyphIterator->getCurrGlyphID(),
@@ -313,13 +314,13 @@
 
         if (setClass < scSetCount) {
             LEReferenceToArrayOf<Offset>
-                 subClassSetTableOffsetArrayRef(base, success, subClassSetTableOffsetArray, setClass);
+                subClassSetTableOffsetArrayRef(base, success, subClassSetTableOffsetArray, scSetCount);
             if (LE_FAILURE(success)) { return 0; }
             if (subClassSetTableOffsetArray[setClass] != 0) {
 
                 Offset subClassSetTableOffset = SWAPW(subClassSetTableOffsetArray[setClass]);
-                LEReferenceTo<SubClassSetTable>
-                    subClassSetTable(base, success, (const SubClassSetTable *) ((char *) this + subClassSetTableOffset));
+                LEReferenceTo<SubClassSetTable> subClassSetTable(base, success, subClassSetTableOffset);
+                if (LE_FAILURE(success)) { return 0; }
                 le_uint16 subClassRuleCount = SWAPW(subClassSetTable->subClassRuleCount);
                 le_int32 position = glyphIterator->getCurrStreamPosition();
                 LEReferenceToArrayOf<Offset>
@@ -332,6 +333,7 @@
                         SWAPW(subClassSetTable->subClassRuleTableOffsetArray[scRule]);
                     LEReferenceTo<SubClassRuleTable>
                         subClassRuleTable(subClassSetTable, success, subClassRuleTableOffset);
+                    if (LE_FAILURE(success)) { return 0; }
                     le_uint16 matchCount = SWAPW(subClassRuleTable->glyphCount) - 1;
                     le_uint16 substCount = SWAPW(subClassRuleTable->substCount);
 
@@ -463,13 +465,13 @@
 
         if (coverageIndex < srSetCount) {
             LEReferenceToArrayOf<Offset>
-                chainSubRuleSetTableOffsetArrayRef(base, success, chainSubRuleSetTableOffsetArray, coverageIndex);
+                chainSubRuleSetTableOffsetArrayRef(base, success, chainSubRuleSetTableOffsetArray, srSetCount);
             if (LE_FAILURE(success)) {
                 return 0;
             }
             Offset chainSubRuleSetTableOffset = SWAPW(chainSubRuleSetTableOffsetArray[coverageIndex]);
-            LEReferenceTo<ChainSubRuleSetTable>
-                 chainSubRuleSetTable(base, success, (const ChainSubRuleSetTable *) ((char *) this + chainSubRuleSetTableOffset));
+            LEReferenceTo<ChainSubRuleSetTable> chainSubRuleSetTable(base, success, chainSubRuleSetTableOffset);
+            if (LE_FAILURE(success)) { return 0; }
             le_uint16 chainSubRuleCount = SWAPW(chainSubRuleSetTable->chainSubRuleCount);
             le_int32 position = glyphIterator->getCurrStreamPosition();
             GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
@@ -550,17 +552,17 @@
 
     if (coverageIndex >= 0) {
         LEReferenceTo<ClassDefinitionTable>
-             backtrackClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(backtrackClassDefTableOffset)));
+             backtrackClassDefinitionTable(base, success, SWAPW(backtrackClassDefTableOffset));
         LEReferenceTo<ClassDefinitionTable>
-             inputClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(inputClassDefTableOffset)));
+             inputClassDefinitionTable(base, success, SWAPW(inputClassDefTableOffset));
         LEReferenceTo<ClassDefinitionTable>
-             lookaheadClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(lookaheadClassDefTableOffset)));
+             lookaheadClassDefinitionTable(base, success, SWAPW(lookaheadClassDefTableOffset));
         le_uint16 scSetCount = SWAPW(chainSubClassSetCount);
         le_int32 setClass = inputClassDefinitionTable->getGlyphClass(inputClassDefinitionTable,
                                                                      glyphIterator->getCurrGlyphID(),
                                                                      success);
         LEReferenceToArrayOf<Offset>
-            chainSubClassSetTableOffsetArrayRef(base, success, chainSubClassSetTableOffsetArray, setClass);
+            chainSubClassSetTableOffsetArrayRef(base, success, chainSubClassSetTableOffsetArray, scSetCount);
         if (LE_FAILURE(success)) {
             return 0;
         }
@@ -568,7 +570,8 @@
         if (setClass < scSetCount && chainSubClassSetTableOffsetArray[setClass] != 0) {
             Offset chainSubClassSetTableOffset = SWAPW(chainSubClassSetTableOffsetArray[setClass]);
             LEReferenceTo<ChainSubClassSetTable>
-                 chainSubClassSetTable(base, success, (const ChainSubClassSetTable *) ((char *) this + chainSubClassSetTableOffset));
+                 chainSubClassSetTable(base, success, chainSubClassSetTableOffset);
+            if (LE_FAILURE(success)) { return 0; }
             le_uint16 chainSubClassRuleCount = SWAPW(chainSubClassSetTable->chainSubClassRuleCount);
             le_int32 position = glyphIterator->getCurrStreamPosition();
             GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
@@ -582,6 +585,7 @@
                     SWAPW(chainSubClassSetTable->chainSubClassRuleTableOffsetArray[scRule]);
                 LEReferenceTo<ChainSubClassRuleTable>
                      chainSubClassRuleTable(chainSubClassSetTable, success, chainSubClassRuleTableOffset);
+                if (LE_FAILURE(success)) { return 0; }
                 le_uint16 backtrackGlyphCount = SWAPW(chainSubClassRuleTable->backtrackGlyphCount);
                 LEReferenceToArrayOf<le_uint16>   backtrackClassArray(base, success, chainSubClassRuleTable->backtrackClassArray, backtrackGlyphCount);
                 if( LE_FAILURE(success) ) { return 0; }
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -46,7 +46,7 @@
     le_uint16 eeCount       = SWAPW(entryExitCount);
 
     LEReferenceToArrayOf<EntryExitRecord>
-        entryExitRecordsArrayRef(base, success, entryExitRecords, coverageIndex);
+        entryExitRecordsArrayRef(base, success, entryExitRecords, eeCount);
 
     if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) {
         glyphIterator->setCursiveGlyph();
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -41,11 +41,12 @@
 LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const
 {
     LEReferenceToArrayOf<FeatureRecord>
-        featureRecordArrayRef(base, success, featureRecordArray, featureIndex+1);
+        featureRecordArrayRef(base, success, featureRecordArray, SWAPW(featureCount));
 
-  if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
-    return LEReferenceTo<FeatureTable>();
-  }
+    if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
+        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
+        return LEReferenceTo<FeatureTable>();
+    }
 
     Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset;
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -76,11 +76,11 @@
     }
 
     if (flags & irfMarkFirst) {
-        firstGlyph = (le_uint32)currGlyph;
+        firstGlyph = currGlyph;
     }
 
     if (flags & irfMarkLast) {
-        lastGlyph = (le_uint32)currGlyph;
+        lastGlyph = currGlyph;
     }
 
     doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask), success);
@@ -118,7 +118,7 @@
         if (firstGlyph == lastGlyph) break;
         if (firstGlyph + 1 < firstGlyph) {
             success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
-        break;
+            break;
         }
         a = glyphStorage[firstGlyph];
         ia = glyphStorage.getCharIndex(firstGlyph, success);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h	Tue Jan 26 09:11:58 2016 +0100
@@ -76,8 +76,8 @@
     static UClassID getStaticClassID();
 
 protected:
-    le_uint32 firstGlyph;
-    le_uint32 lastGlyph;
+    le_int32 firstGlyph;
+    le_int32 lastGlyph;
 
     LEReferenceTo<IndicRearrangementSubtableHeader> indicRearrangementSubtableHeader;
     LEReferenceToArrayOf<IndicRearrangementStateEntry> entryTable;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -74,11 +74,11 @@
     }
 
     if (flags & irfMarkFirst) {
-        firstGlyph = (le_uint32)currGlyph;
+        firstGlyph = currGlyph;
     }
 
     if (flags & irfMarkLast) {
-        lastGlyph = (le_uint32)currGlyph;
+        lastGlyph = currGlyph;
     }
 
     doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask), success);
@@ -115,7 +115,7 @@
         if (firstGlyph == lastGlyph) break;
         if (firstGlyph + 1 < firstGlyph) {
             success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
-        break;
+            break;
         }
         a = glyphStorage[firstGlyph];
         ia = glyphStorage.getCharIndex(firstGlyph, success);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h	Tue Jan 26 09:11:58 2016 +0100
@@ -76,8 +76,8 @@
     static UClassID getStaticClassID();
 
 protected:
-    le_uint32 firstGlyph;
-    le_uint32 lastGlyph;
+    le_int32 firstGlyph;
+    le_int32 lastGlyph;
 
     LEReferenceToArrayOf<IndicRearrangementStateEntry2> entryTable;
     LEReferenceTo<IndicRearrangementSubtableHeader2> indicRearrangementSubtableHeader;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -42,6 +42,7 @@
   LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
 
   if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) {
+    success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
     return LEReferenceTo<LookupTable>();
   } else {
     return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success)));
@@ -53,6 +54,7 @@
   LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
 
   if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) {
+    success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
     return LEReferenceTo<LookupSubtable>();
   } else {
     return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success)));
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -93,7 +93,7 @@
     }
     LEReferenceTo<BaseRecord> baseRecord(base, success, &baseArray->baseRecordArray[baseCoverage * mcCount]);
     if( LE_FAILURE(success) ) { return 0; }
-    LEReferenceToArrayOf<Offset> baseAnchorTableOffsetArray(base, success, &(baseRecord->baseAnchorTableOffsetArray[0]), markClass+1);
+    LEReferenceToArrayOf<Offset> baseAnchorTableOffsetArray(base, success, &(baseRecord->baseAnchorTableOffsetArray[0]), mcCount);
 
     if( LE_FAILURE(success) ) { return 0; }
     Offset anchorTableOffset = SWAPW(baseRecord->baseAnchorTableOffsetArray[markClass]);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp	Tue Jan 26 09:11:58 2016 +0100
@@ -83,6 +83,7 @@
     LEGlyphID ligatureGlyph = findLigatureGlyph(&ligatureIterator);
     le_int32 ligatureCoverage = getBaseCoverage(base, (LEGlyphID) ligatureGlyph, success);
     LEReferenceTo<LigatureArray> ligatureArray(base, success, SWAPW(baseArrayOffset));
+    if (LE_FAILURE(success)) { return 0; }
     le_uint16 ligatureCount = SWAPW(ligatureArray->ligatureCount);
 
     if (ligatureCoverage < 0 || ligatureCoverage >= ligatureCount) {
@@ -95,6 +96,7 @@
     le_int32 markPosition = glyphIterator->getCurrStreamPosition();
     Offset ligatureAttachOffset = SWAPW(ligatureArray->ligatureAttachTableOffsetArray[ligatureCoverage]);
     LEReferenceTo<LigatureAttachTable> ligatureAttachTable(ligatureArray, success, ligatureAttachOffset);
+    if (LE_FAILURE(success)) { return 0; }
     le_int32 componentCount = SWAPW(ligatureAttachTable->componentCount);
     le_int32 component = ligatureIterator.getMarkComponent(markPosition);
 
@@ -104,10 +106,12 @@
     }
 
     LEReferenceTo<ComponentRecord> componentRecord(base, success, &ligatureAttachTable->componentRecordArray[component * mcCount]);
-    LEReferenceToArrayOf<Offset> ligatureAnchorTableOffsetArray(base, success, &(componentRecord->ligatureAnchorTableOffsetArray[0]), markClass+1);
+    if (LE_FAILURE(success)) { return 0; }
+    LEReferenceToArrayOf<Offset> ligatureAnchorTableOffsetArray(base, success, &(componentRecord->ligatureAnchorTableOffsetArray[0]), mcCount);
     if( LE_FAILURE(success) ) { return 0; }
     Offset anchorTableOffset = SWAPW(componentRecord->ligatureAnchorTableOffsetArray[markClass]);
     LEReferenceTo<AnchorTable> anchorTable(ligatureAttachTable, success, anchorTableOffset);
+    if (LE_FAILURE(success)) { return 0; }
     LEPoint ligatureAnchor, markAdvance, pixels;
 
     anchorTable->getAnchor(anchorTable, ligatureGlyph, fontInstance, ligatureAnchor, success);
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Tue Jan 26 09:11:58 2016 +0100
@@ -180,6 +180,7 @@
       int               *ip;
       unsigned char     *bp;
   } outbuf;
+  size_t outbufSize;
   jobject hOutputBuffer;
 };
 
@@ -233,6 +234,7 @@
     }
     if (src->hOutputBuffer) {
         assert(src->outbuf.ip == 0);
+        src->outbufSize = (*env)->GetArrayLength(env, src->hOutputBuffer);
         src->outbuf.ip = (int *)(*env)->GetPrimitiveArrayCritical
             (env, src->hOutputBuffer, 0);
         if (src->outbuf.ip == 0) {
@@ -677,8 +679,8 @@
                                               cinfo.output_scanline - 1);
           } else {
               if (hasalpha) {
-                  ip = jsrc.outbuf.ip + cinfo.image_width;
-                  bp = jsrc.outbuf.bp + cinfo.image_width * 4;
+                  ip = jsrc.outbuf.ip + jsrc.outbufSize;
+                  bp = jsrc.outbuf.bp + jsrc.outbufSize * 4;
                   while (ip > jsrc.outbuf.ip) {
                       pixel = (*--bp) << 24;
                       pixel |= (*--bp);
@@ -687,8 +689,8 @@
                       *--ip = pixel;
                   }
               } else {
-                  ip = jsrc.outbuf.ip + cinfo.image_width;
-                  bp = jsrc.outbuf.bp + cinfo.image_width * 3;
+                  ip = jsrc.outbuf.ip + jsrc.outbufSize;
+                  bp = jsrc.outbuf.bp + jsrc.outbufSize * 3;
                   while (ip > jsrc.outbuf.ip) {
                       pixel = (*--bp);
                       pixel |= (*--bp) << 8;
--- a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c	Tue Jan 26 09:11:58 2016 +0100
@@ -2545,9 +2545,11 @@
     for (i=0; i < t->nSamples; i++) {
 
         fld = GetDataFormat(it8, i);
+        if (fld != NULL) {
         if (cmsstrcasecmp(fld, cSample) == 0)
             return i;
     }
+    }
 
     return -1;
 
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Tue Jan 26 09:11:58 2016 +0100
@@ -23,13 +23,17 @@
  * questions.
  */
 
+#if 0
 CHANGES - changes for libpng
 
-Version 0.2
+version 0.1 [March 29, 1995]
+  initial work-in-progress release
+
+version 0.2 [April 1, 1995]
   added reader into png.h
   fixed small problems in stub file
 
-Version 0.3
+version 0.3 [April 8, 1995]
   added pull reader
   split up pngwrite.c to several files
   added pnglib.txt
@@ -38,9 +42,9 @@
   fixed some bugs in writer
   interfaced with zlib 0.5
   added K&R support
-  added check for 64 KB blocks for 16-bit machines
-
-Version 0.4
+  added check for 64 KB blocks for 16 bit machines
+
+version 0.4 [April 26, 1995]
   cleaned up code and commented code
   simplified time handling into png_time
   created png_color_16 and png_color_8 to handle color needs
@@ -51,28 +55,29 @@
   cleaned up zTXt reader and writer (using zlib's Reset functions)
   split transformations into pngrtran.c and pngwtran.c
 
-Version 0.5
+version 0.5 [April 30, 1995]
   interfaced with zlib 0.8
   fixed many reading and writing bugs
   saved using 3 spaces instead of tabs
 
-Version 0.6
+version 0.6 [May 1, 1995]
+  first beta release
   added png_large_malloc() and png_large_free()
   added png_size_t
   cleaned up some compiler warnings
   added png_start_read_image()
 
-Version 0.7
+version 0.7 [June 24, 1995]
   cleaned up lots of bugs
   finished dithering and other stuff
   added test program
   changed name from pnglib to libpng
 
-Version 0.71 [June, 1995]
+version 0.71 [June 26, 1995]
   changed pngtest.png for zlib 0.93
   fixed error in libpng.txt and example.c
 
-Version 0.8
+version 0.8 [August 20, 1995]
   cleaned up some bugs
   added png_set_filler()
   split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
@@ -115,7 +120,7 @@
   cleaned up documentation
   added callbacks for read/write and warning/error functions
 
-Version 0.89 [July, 1996]
+Version 0.89 [June 5, 1996]
   Added new initialization API to make libpng work better with shared libs
     we now have png_create_read_struct(), png_create_write_struct(),
     png_create_info_struct(), png_destroy_read_struct(), and
@@ -142,6 +147,9 @@
   New pngtest image also has interlacing and zTXt
   Updated documentation to reflect new API
 
+Version 0.89c [June 17, 1996]
+  Bug fixes.
+
 Version 0.90 [January, 1997]
   Made CRC errors/warnings on critical and ancillary chunks configurable
   libpng will use the zlib CRC routines by (compile-time) default
@@ -182,7 +190,7 @@
   Added new pCAL chunk read/write support
   Added experimental filter selection weighting (Greg Roelofs)
   Removed old png_set_rgbx() and png_set_xrgb() functions that have been
-     obsolete for about 2 years now (use png_set_filler() instead)
+    obsolete for about 2 years now (use png_set_filler() instead)
   Added macros to read 16- and 32-bit ints directly from buffer, to be
     used only on those systems that support it (namely PowerPC and 680x0)
     With some testing, this may become the default for MACOS/PPC systems.
@@ -464,7 +472,7 @@
 
 Version 1.0.3a [August 12, 1999]
   Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
-     if an attempt is made to read an interlaced image when it's not supported.
+    if an attempt is made to read an interlaced image when it's not supported.
   Added check if png_ptr->trans is defined before freeing it in pngread.c
   Modified the Y2K statement to include versions back to version 0.71
   Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
@@ -472,7 +480,7 @@
   Replaced leading blanks with tab characters in makefile.hux
   Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
   Changed (float)red and (float)green to (double)red, (double)green
-     in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
+    in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
   Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
   Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
   Updated documentation to refer to the PNG-1.2 specification.
@@ -515,7 +523,7 @@
   Added new png_expand functions to scripts/pngdef.pas and pngos2.def
   Added a demo read_user_transform_fn that examines the row filters in pngtest.c
 
-Version 1.0.4 [September 24, 1999]
+Version 1.0.4 [September 24, 1999, not distributed publicly]
   Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
   Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
   Made several minor corrections to pngtest.c
@@ -542,6 +550,7 @@
   Added a "png_check_version" function in png.c and pngtest.c that will generate
     a helpful compiler error if an old png.h is found in the search path.
   Changed type of png_user_transform_depth|channels from int to png_byte.
+  Added "Libpng is OSI Certified Open Source Software" statement to png.h
 
 Version 1.0.4d [October 6, 1999]
   Changed 0.45 to 0.45455 in png_set_sRGB()
@@ -928,7 +937,7 @@
 Version 1.0.8beta1 [July 8, 2000]
   Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
   Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
-     pngwutil.c.
+    pngwutil.c.
   Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
   Removed unused "#include <assert.h>" from png.c
   Added WindowsCE support.
@@ -936,12 +945,12 @@
 
 Version 1.0.8beta2 [July 10, 2000]
   Added project files to the wince directory and made further revisions
-     of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
+    of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
 
 Version 1.0.8beta3 [July 11, 2000]
   Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS()
-     for indexed-color input files to avoid potential double-freeing trans array
-     under some unusual conditions; problem was introduced in version 1.0.6f.
+    for indexed-color input files to avoid potential double-freeing trans array
+    under some unusual conditions; problem was introduced in version 1.0.6f.
   Further revisions to pngtest.c and files in the wince subdirectory.
 
 Version 1.0.8beta4 [July 14, 2000]
@@ -1113,16 +1122,16 @@
 
 Version 1.2.0beta4 [June 23, 2001]
   Check for missing profile length field in iCCP chunk and free chunk_data
-     in case of truncated iCCP chunk.
+    in case of truncated iCCP chunk.
   Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc
   Bumped dll-number from 2 to 3 in makefile.cygwin
   Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly
-     if user attempts to run it on an 8-bit display.
+    if user attempts to run it on an 8-bit display.
   Updated contrib/gregbook
   Use png_malloc instead of png_zalloc to allocate palette in pngset.c
   Updated makefile.ibmc
   Added some typecasts to eliminate gcc 3.0 warnings.  Changed prototypes
-     of png_write_oFFS width and height from png_uint_32 to png_int_32.
+    of png_write_oFFS width and height from png_uint_32 to png_int_32.
   Updated example.c
   Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c
 
@@ -1130,9 +1139,9 @@
   Revised contrib/gregbook
   Revised makefile.gcmmx
   Revised pnggccrd.c to conditionally compile some thread-unsafe code only
-     when PNG_THREAD_UNSAFE_OK is defined.
+    when PNG_THREAD_UNSAFE_OK is defined.
   Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with
-     value exceeding 2^bit_depth-1
+    value exceeding 2^bit_depth-1
   Revised makefile.sgi and makefile.sggcc
   Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c
   Removed restriction that do_invert_mono only operate on 1-bit opaque files
@@ -1473,8 +1482,9 @@
   Use png_malloc instead of png_zalloc to allocate the pallete.
 
 Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
-  Fixed buffer overflow vulnerability in png_handle_tRNS()
-  Fixed integer arithmetic overflow vulnerability in png_read_png().
+  Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
+  Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
+  Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
   Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
     duplicate chunk types to go undetected.
   Fixed some timestamps in the -config version
@@ -1517,7 +1527,7 @@
 
 Version 1.0.16rc5 and 1.2.6rc5 [August 10, 2004]
   Moved  "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED
-     section of png.h where they were inadvertently placed in version rc3.
+    section of png.h where they were inadvertently placed in version rc3.
 
 Version 1.2.6 and 1.0.16 [August 15, 2004]
   Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
@@ -2126,7 +2136,7 @@
     png_decompress_chunk(), and remove "chunkdata" from parameter list.
   Put a call to png_check_chunk_name() in png_read_chunk_header().
   Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
-  Removed two calls to png_check_chunk_name() occuring later in the process.
+  Removed two calls to png_check_chunk_name() occurring later in the process.
   Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
 
 Version 1.4.0beta25 [July 30, 2008]
@@ -2349,7 +2359,7 @@
 Version 1.4.0beta64 [June 24, 2009]
   Eliminated PNG_LEGACY_SUPPORTED code.
   Moved the various unknown chunk macro definitions outside of the
-     PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
+    PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
 
 Version 1.4.0beta65 [June 26, 2009]
   Added a reference to the libpng license in each file.
@@ -3771,8 +3781,9 @@
 
 Version 1.5.7beta05 [November 25, 2011]
   Removed "zTXt" from warning in generic chunk decompression function.
-  Validate time settings passed to pngset() and png_convert_to_rfc1123()
-    (Frank Busse).
+  Validate time settings passed to png_set_tIME() and png_convert_to_rfc1123()
+    (Frank Busse). Note: This prevented CVE-2015-7981 from affecting
+    libpng-1.5.7 and later.
   Added MINGW support to CMakeLists.txt
   Reject invalid compression flag or method when reading the iTXt chunk.
   Backed out 'simplified' API changes. The API seems too complex and there
@@ -3818,12 +3829,13 @@
     (the other two required headers aren't used).  Non-ANSI systems that don't
     have stddef.h or limits.h will have to provide an appropriate fake
     containing the relevant types and #defines.
-  The use of FAR/far has been eliminated and the definition of png_alloc_size_t
-    is now controlled by a flag so that 'small size_t' systems can select it
-    if necessary.  Libpng 1.6 may not currently work on such systems -- it
-    seems likely that it will ask 'malloc' for more than 65535 bytes with any
-    image that has a sufficiently large row size (rather than simply failing
-    to read such images).
+  Dropped support for 16-bit platforms. The use of FAR/far has been eliminated
+    and the definition of png_alloc_size_t is now controlled by a flag so
+    that 'small size_t' systems can select it if necessary.  Libpng 1.6 may
+    not currently work on such systems -- it seems likely that it will
+    ask 'malloc' for more than 65535 bytes with any image that has a
+    sufficiently large row size (rather than simply failing to read such
+    images).
   New tools directory containing tools used to generate libpng code.
   Fixed race conditions in parallel make builds. With higher degrees of
     parallelism during 'make' the use of the same temporary file names such
@@ -4435,7 +4447,7 @@
 
 Version 1.6.1beta03 [February 22, 2013]
   Fixed ALIGNED_MEMORY support.
-  Allow run-time ARM NEON checking to be disabled. A new configure option:
+  Added a new configure option:
     --enable-arm-neon=always will stop the run-time checks. New checks
     within arm/arm_init.c will cause the code not to be compiled unless
     __ARM_NEON__ is set. This should make it fail safe (if someone asks
@@ -4454,10 +4466,10 @@
 Version 1.6.1beta06 [March 4, 2013]
   Better documentation of unknown handling API interactions.
   Corrected Android builds and corrected libpng.vers with symbol
-    prefixing. This adds an API to set optimization options externally,
+    prefixing.  It also makes those tests compile and link on Android.
+  Added an API png_set_option() to set optimization options externally,
     providing an alternative and general solution for the non-portable
-    run-time tests used by the ARM Neon code.  It also makes those tests
-    compile and link on Android.
+    run-time tests used by the ARM Neon code, using the PNG_ARM_NEON option.
   The order of settings vs options in pnglibconf.h is reversed to allow
     settings to depend on options and options can now set (or override) the
     defaults for settings.
@@ -4549,13 +4561,14 @@
   Expanded manual paragraph about writing private chunks, particularly
     the need to call png_set_keep_unknown_chunks() when writing them.
   Avoid dereferencing NULL pointer possibly returned from
-     png_create_write_struct() (Andrew Church).
+    png_create_write_struct() (Andrew Church).
 
 Version 1.6.3beta05 [May 9, 2013]
   Calculate our own zlib windowBits when decoding rather than trusting the
     CMF bytes in the PNG datastream.
   Added an option to force maximum window size for inflating, which was
-    the behavior of libpng15 and earlier.
+    the behavior of libpng15 and earlier, via a new PNG_MAXIMUM_INFLATE_WINDOW
+    option for png_set_options().
   Added png-fix-itxt and png-fix-too-far-back to the built programs and
     removed warnings from the source code and timepng that are revealed as
     a result.
@@ -5138,17 +5151,326 @@
 
 Version 1.6.16rc01 [December 21, 2014]
   Restored a test on width that was removed from png.c at libpng-1.6.9
-    (Bug report by Alex Eubanks).
+    (Bug report by Alex Eubanks, CVE-2015-0973).
 
 Version 1.6.16rc02 [December 21, 2014]
   Undid the update to pngrutil.c in 1.6.16rc01.
 
 Version 1.6.16rc03 [December 21, 2014]
-  Fixed an overflow in png_combine_row with very wide interlaced images.
+  Fixed an overflow in png_combine_row() with very wide interlaced images
+    (Bug report and fix by John Bowler, CVE-2014-9495).
 
 Version 1.6.16 [December 22, 2014]
   No changes.
 
+Version 1.6.17beta01 [January 29, 2015]
+  Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
+  Corrected the width limit calculation in png_check_IHDR().
+  Removed user limits from pngfix. Also pass NULL pointers to
+    png_read_row to skip the unnecessary row de-interlace stuff.
+  Added testing of png_set_packing() to pngvalid.c
+  Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
+  Implement previously untested cases of libpng transforms in pngvalid.c
+  Fixed byte order in png_do_read_filler() with 16-bit input. Previously
+    the high and low bytes of the filler, from png_set_filler() or from
+    png_set_add_alpha(), were read in the wrong order.
+  Made the check for out-of-range values in png_set_tRNS() detect
+    values that are exactly 2^bit_depth, and work on 16-bit platforms.
+  Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
+  Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
+    pngset.c to avoid warnings about dead code.
+  Added "& 0xff" to many instances of expressions that are typecast
+    to (png_byte), to avoid Coverity warnings.
+
+Version 1.6.17beta02 [February 7, 2015]
+  Work around one more Coverity-scan dead-code warning.
+  Do not build png_product2() when it is unused.
+
+Version 1.6.17beta03 [February 17, 2015]
+  Display user limits in the output from pngtest.
+  Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
+    and 1-million-row default limits in pnglibconf.dfa, that can be reset
+    by the user at build time or run time.  This provides a more robust
+    defense against DOS and as-yet undiscovered overflows.
+
+Version 1.6.17beta04 [February 21, 2015]
+  Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
+  Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
+  Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
+
+Version 1.6.17beta05 [February 25, 2015]
+  Restored compiling of png_reciprocal2 with PNG_NO_16BIT.
+
+Version 1.6.17beta06 [February 27, 2015]
+  Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
+    of png.h.
+  Avoid runtime checks when converting integer to png_byte with
+    Visual Studio (Sergey Kosarevsky)
+
+Version 1.6.17rc01 [March 4, 2015]
+  No changes.
+
+Version 1.6.17rc02 [March 9, 2015]
+  Removed some comments that the configure script did not handle
+    properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
+  Free the unknown_chunks structure even when it contains no data.
+
+Version 1.6.17rc03 [March 12, 2015]
+  Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
+    for consistency, and remove some useless tests (Alexey Petruchik).
+
+Version 1.6.17rc04 [March 16, 2015]
+  Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
+    pnglibconf.* in "make clean" (Cosmin).
+  Fix bug in calculation of maxbits, in png_write_sBIT, introduced
+    in libpng-1.6.17beta01 (John Bowler).
+
+Version 1.6.17rc05 [March 21, 2015]
+  Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
+    is not supported (John Bowler).  This fixes an error introduced in
+    libpng-1.6.17beta06.
+  Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
+    the Coverity scan without them.
+
+Version 1.6.17rc06 [March 23, 2015]
+  Remove pnglibconf.dfn and pnglibconf.pre with "make clean".
+  Reformatted some "&0xff" instances to "& 0xff".
+  Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
+    value was wrong.  It's not clear if this affected the final stored
+    value; in the obvious code path the upper and lower 8-bits of the
+    alpha value were identical and the alpha was truncated to 8-bits
+    rather than dividing by 257 (John Bowler).
+
+Version 1.6.17 [March 26, 2015]
+  No changes.
+
+Version 1.6.18beta01 [April 1, 2015]
+  Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros.  They
+    have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
+    bug report by Andrew Church).
+  Fixed rgb_to_gray checks and added tRNS checks to pngvalid.c.  This
+    fixes some arithmetic errors that caused some tests to fail on
+    some 32-bit platforms (Bug reports by Peter Breitenlohner [i686]
+    and Petr Gajdos [i586]).
+
+Version 1.6.18beta02 [April 26, 2015]
+  Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
+    (Bug report by Viktor Szakats).
+
+Version 1.6.18beta03 [May 6, 2015]
+  Replaced "unexpected" with an integer (0xabadca11) in pngset.c
+    where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1.
+  Added contrib/examples/simpleover.c, to demonstrate how to handle
+    alpha compositing of multiple images, using the "simplified API"
+    and an example PNG generation tool, contrib/examples/genpng.c
+    (John Bowler).
+
+Version 1.6.18beta04 [May 20, 2015]
+  PNG_RELEASE_BUILD replaces tests where the code depended on the build base
+    type and can be defined on the command line, allowing testing in beta
+    builds (John Bowler).
+  Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
+  Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug
+    report from Christopher Ferris).
+
+Version 1.6.18beta05 [May 31, 2015]
+  Backport filter selection code from libpng-1.7.0beta51, to combine
+    sub_row, up_row, avg_row, and paeth_row into try_row and tst_row.
+  Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c
+    to avoid confusion with the libpng private macros.
+  Fixed old cut&paste bug in the weighted filter selection code in
+    pngwutil.c, introduced in libpng-0.95, March 1997.
+
+Version 1.6.18beta06 [June 1, 2015]
+  Removed WRITE_WEIGHTED_FILTERED code, to save a few kbytes of the
+    compiled library size. It never worked properly and as far as we can
+    tell, no one uses it. The png_set_filter_heuristics() and
+    png_set_filter_heuristics_fixed() APIs are retained but deprecated
+    and do nothing.
+
+Version 1.6.18beta07 [June 6, 2015]
+  Removed non-working progressive reader 'skip' function. This
+    function has apparently never been used. It was implemented
+    to support back-door modification of png_struct in libpng-1.4.x
+    but (because it does nothing and cannot do anything) was apparently
+    never tested (John Bowler).
+  Fixed cexcept.h in which GCC 5 now reports that one of the auto
+    variables in the Try macro needs to be volatile to prevent value
+    being lost over the setjmp (John Bowler).
+  Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler).
+  Fix g++ build breaks (John Bowler).
+  Quieted some Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
+    pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
+    would only work with iTXt chunks with length 255 or less.
+  Added #ifdef's to contrib/examples programs so people don't try
+    to compile them without the minimum required support enabled
+    (suggested by Flavio Medeiros).
+
+Version 1.6.18beta08 [June 30, 2015]
+  Eliminated the final two Coverity defects (insecure temporary file
+    handling in contrib/libtests/pngstest.c; possible overflow of
+    unsigned char in contrib/tools/png-fix-itxt.c). To use the "secure"
+    file handling, define PNG_USE_MKSTEMP, otherwise "tmpfile()" will
+    be used.
+  Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h
+
+Version 1.6.18beta09 [July 5, 2015]
+  Removed some useless typecasts from contrib/tools/png-fix-itxt.c
+  Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin).
+  Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*.  To
+    preserve API compatibility, the new defines all default to "extern"
+    (requested by Jan Nijtmans).
+
+Version 1.6.18rc01 [July 9, 2015]
+  Belatedly added Mans Rullgard and James Yu to the list of Contributing
+    Authors.
+
+Version 1.6.18rc02 [July 12, 2015]
+  Restored unused FILTER_HEURISTIC macros removed at libpng-1.6.18beta08
+    to png.h to avoid compatibility warnings.
+
+Version 1.6.18rc03 [July 15, 2015]
+  Minor changes to the man page
+
+Version 1.6.18 [July 23, 2015]
+  No changes.
+
+Version 1.6.19beta01 [July 30, 2015]
+  Updated obsolete information about the simplified API macros in the
+    manual pages (Bug report by Arc Riley).
+  Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
+  Rearranged png.h to put the major sections in the same order as
+    in libpng17.
+  Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and
+    PNG_WEIGHT_FACTOR macros.
+  Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
+    (Bug report by Viktor Szakats).  Several warnings remain and are
+    unavoidable, where we test for overflow.
+  Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
+  Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
+
+Version 1.6.19beta02 [August 19, 2015]
+  Moved config.h.in~ from the "libpng_autotools_files" list to the
+    "libpng_autotools_extra" list in autogen.sh because it was causing a
+    false positive for missing files (bug report by Robert C. Seacord).
+  Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
+    to suppress clang warnings (Bug report by Viktor Szakats).
+  Fixed some bad links in the man page.
+  Changed "n bit" to "n-bit" in comments.
+  Added signed/unsigned 16-bit safety net. This removes the dubious
+    0x8000 flag definitions on 16-bit systems. They aren't supported
+    yet the defs *probably* work, however it seems much safer to do this
+    and be advised if anyone, contrary to advice, is building libpng 1.6
+    on a 16-bit system. It also adds back various switch default clauses
+    for GCC; GCC errors out if they are not present (with an appropriately
+    high level of warnings).
+  Safely convert num_bytes to a png_byte in png_set_sig_bytes() (Robert
+    Seacord).
+  Fixed the recently reported 1's complement security issue by replacing
+    the value that is illegal in the PNG spec, in both signed and unsigned
+    values, with 0. Illegal unsigned values (anything greater than or equal
+    to  0x80000000) can still pass through, but since these are not illegal
+    in ANSI-C (unlike 0x80000000 in the signed case) the checking that
+    occurs later can catch them (John Bowler).
+
+Version 1.6.19beta03 [September 26, 2015]
+  Fixed png_save_int_32 when int is not 2's complement (John Bowler).
+  Updated libpng16 with all the recent test changes from libpng17,
+    including changes to pngvalid.c to ensure that the original,
+    distributed, version of contrib/visupng/cexcept.h can be used
+    (John Bowler).
+  pngvalid contains the correction to the use of SAVE/STORE_
+    UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
+    tests contain the --strict option to detect warnings and the
+    pngvalid-standard test has been corrected so that it does not
+    turn on progressive-read. There is a separate test which does
+    that. (John Bowler)
+  Also made some signed/unsigned fixes.
+  Make pngstest error limits version specific. Splitting the machine
+    generated error structs out to a file allows the values to be updated
+    without changing pngstest.c itself. Since libpng 1.6 and 1.7 have
+    slightly different error limits this simplifies maintenance. The
+    makepngs.sh script has also been updated to more accurately reflect
+    current problems in libpng 1.7 (John Bowler).
+  Incorporated new test PNG files into make check.  tests/pngstest-*
+    are changed so that the new test files are divided into 8 groups by
+    gamma and alpha channel.  These tests have considerably better code
+    and pixel-value coverage than contrib/pngsuite; however,coverage is
+    still incomplete (John Bowler).
+  Removed the '--strict' in 1.6 because of the double-gamma-correction
+    warning, updated pngstest-errors.h for the errors detected with the
+    new contrib/testspngs PNG test files (John Bowler).
+
+Version 1.6.19beta04 [October 15, 2015]
+  Worked around rgb-to-gray issues in libpng 1.6.  The previous
+    attempts to ignore the errors in the code aren't quite enough to
+    deal with the 'channel selection' encoding added to libpng 1.7; abort.
+    pngvalid.c is changed to drop this encoding in prior versions.
+  Fixed 'pow' macros in pngvalid.c. It is legal for 'pow' to be a
+    macro, therefore the argument list cannot contain preprocessing
+    directives.  Make sure pow is a function where this happens. This is
+    a minimal safe fix, the issue only arises in non-performance-critical
+    code (bug report by Curtis Leach, fix by John Bowler).
+  Added sPLT support to pngtest.c
+
+Version 1.6.19rc01 [October 23, 2015]
+  No changes.
+
+Version 1.6.19rc02 [October 31, 2015]
+  Prevent setting or writing over-length PLTE chunk (Cosmin Truta).
+  Silently truncate over-length PLTE chunk while reading.
+  Libpng incorrectly calculated the output rowbytes when the application
+    decreased either the number of channels or the bit depth (or both) in
+    a user transform.  This was safe; libpng overallocated buffer space
+   (potentially by quite a lot; up to 4 times the amount required) but,
+   from 1.5.4 on, resulted in a png_error (John Bowler).
+
+Version 1.6.19rc03 [November 3, 2015]
+  Fixed some inconsequential cut-and-paste typos in png_set_cHRM_XYZ_fixed().
+  Clarified COPYRIGHT information to state explicitly that versions
+    are derived from previous versions.
+  Removed much of the long list of previous versions from png.h and
+    libpng.3.
+
+Version 1.6.19rc04 [November 5, 2015]
+  Fixed new bug with CRC error after reading an over-length palette
+    (bug report by Cosmin Truta) (CVE-2015-8126).
+
+Version 1.6.19 [November 12, 2015]
+  Cleaned up coding style in png_handle_PLTE().
+
+Version 1.6.20beta01 [November 20, 2015]
+  Avoid potential pointer overflow/underflow in png_handle_sPLT() and
+    png_handle_pCAL() (Bug report by John Regehr).
+
+Version 1.6.20beta02 [November 23, 2015]
+  Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
+    not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
+    vulnerability.
+
+Version 1.6.20beta03 [November 24, 2015]
+  Backported tests from libpng-1.7.0beta69.
+
+Version 1.6.20rc01 [November 26, 2015]
+  Fixed an error in handling of bad zlib CMINFO field in pngfix, found by
+    American Fuzzy Lop, reported by Brian Carpenter.  inflate() doesn't
+    immediately fault a bad CMINFO field; instead a 'too far back' error
+    happens later (at least some times).  pngfix failed to limit CMINFO to
+    the allowed values but then assumed that window_bits was in range,
+    triggering an assert. The bug is mostly harmless; the PNG file cannot
+    be fixed.
+
+Version 1.6.20rc02 [November 29, 2015]
+  In libpng 1.6 zlib initialization was changed to use the window size
+    in the zlib stream, not a fixed value. This causes some invalid images,
+    where CINFO is too large, to display 'correctly' if the rest of the
+    data is valid.  This provides a workaround for zlib versions where the
+    error arises (ones that support the API change to use the window size
+    in the stream).
+
+Version 1.6.20 [December 3, 2015]
+  No changes.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
@@ -5156,3 +5478,4 @@
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
+#endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Tue Jan 26 09:11:58 2016 +0100
@@ -10,21 +10,18 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
-Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.2.5
-with the following individual added to the list of Contributing Authors
-
-   Cosmin Truta
-
-libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
-Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.0.6
-with the following individuals added to the list of Contributing Authors
+libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
+Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
 
    Simon-Pierre Cadieux
    Eric S. Raymond
+   Mans Rullgard
+   Cosmin Truta
    Gilles Vollant
+   James Yu
 
 and with the following additions to the disclaimer:
 
@@ -36,18 +33,20 @@
    the user.
 
 libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-0.96,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
 
    Tom Lane
    Glenn Randers-Pehrson
    Willem van Schaik
 
 libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996, 1997 Andreas Dilger
-Distributed according to the same disclaimer and license as libpng-0.88,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
 
    John Bowler
    Kevin Bracey
@@ -57,7 +56,7 @@
    Tom Tanner
 
 libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
 
 For the purposes of this copyright and license, "Contributing Authors"
 is defined as the following set of individuals:
@@ -80,13 +79,13 @@
 source code, or portions hereof, for any purpose, without fee, subject
 to the following restrictions:
 
-1. The origin of this source code must not be misrepresented.
+  1. The origin of this source code must not be misrepresented.
 
-2. Altered versions must be plainly marked as such and must not
-   be misrepresented as being the original source.
+  2. Altered versions must be plainly marked as such and must not
+     be misrepresented as being the original source.
 
-3. This Copyright notice may not be removed or altered from any
-   source or altered source distribution.
+  3. This Copyright notice may not be removed or altered from any
+     source or altered source distribution.
 
 The Contributing Authors and Group 42, Inc. specifically permit, without
 fee, and encourage the use of this source code as a component to
@@ -94,18 +93,20 @@
 source code in a product, acknowledgment is not required but would be
 appreciated.
 
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
 
 A "png_get_copyright" function is available, for convenient use in "about"
 boxes and the like:
 
-   printf("%s",png_get_copyright(NULL));
+   printf("%s", png_get_copyright(NULL));
 
 Also, the PNG logo (in PNG format, of course) is supplied in the
 files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
 
-Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is a
-certification mark of the Open Source Initiative.
+Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 22, 2014
+December 3, 2015
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README	Tue Jan 26 09:11:58 2016 +0100
@@ -1,4 +1,4 @@
-README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
+README for libpng version 1.6.20 - December 3, 2015 (shared library 16.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -134,7 +134,7 @@
 to others, if necessary.
 
 Please do not send suggestions on how to change PNG.  We have
-been discussing PNG for nineteen years now, and it is official and
+been discussing PNG for twenty years now, and it is official and
 finished.  If you have suggestions for libpng, however, I'll
 gladly listen.  Even if your suggestion is not used immediately,
 it may be used later.
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.16 [December 22, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -42,7 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -54,15 +54,20 @@
 void PNGAPI
 png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
 {
+   unsigned int nb = (unsigned int)num_bytes;
+
    png_debug(1, "in png_set_sig_bytes");
 
    if (png_ptr == NULL)
       return;
 
-   if (num_bytes > 8)
+   if (num_bytes < 0)
+      nb = 0;
+
+   if (nb > 8)
       png_error(png_ptr, "Too many bytes for PNG signature");
 
-   png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
+   png_ptr->sig_bytes = (png_byte)nb;
 }
 
 /* Checks whether the supplied bytes match the PNG signature.  We allow
@@ -129,7 +134,7 @@
 void /* PRIVATE */
 png_reset_crc(png_structrp png_ptr)
 {
-   /* The cast is safe because the crc is a 32 bit value. */
+   /* The cast is safe because the crc is a 32-bit value. */
    png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
 }
 
@@ -157,7 +162,7 @@
    }
 
    /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
-    * systems it is a 64 bit value.  crc32, however, returns 32 bits so the
+    * systems it is a 64-bit value.  crc32, however, returns 32 bits so the
     * following cast is safe.  'uInt' may be no more than 16 bits, so it is
     * necessary to perform a loop here.
     */
@@ -168,8 +173,10 @@
       do
       {
          uInt safe_length = (uInt)length;
+#ifndef __COVERITY__
          if (safe_length == 0)
             safe_length = (uInt)-1; /* evil, but safe */
+#endif
 
          crc = crc32(crc, ptr, safe_length);
 
@@ -269,15 +276,15 @@
       create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
 
 #     ifdef PNG_USER_CHUNK_CACHE_MAX
-         /* Added at libpng-1.2.43 and 1.4.0 */
-         create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
+      /* Added at libpng-1.2.43 and 1.4.0 */
+      create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
 #     endif
 
 #     ifdef PNG_USER_CHUNK_MALLOC_MAX
-         /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
-          * in png_struct regardless.
-          */
-         create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
+      /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
+       * in png_struct regardless.
+       */
+      create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
 #     endif
 #  endif
 
@@ -301,7 +308,9 @@
 
 #  ifdef PNG_SETJMP_SUPPORTED
       if (!setjmp(create_jmp_buf))
+#  endif
       {
+#  ifdef PNG_SETJMP_SUPPORTED
          /* Temporarily fake out the longjmp information until we have
           * successfully completed this function.  This only works if we have
           * setjmp() support compiled in, but it is safe - this stuff should
@@ -310,8 +319,6 @@
          create_struct.jmp_buf_ptr = &create_jmp_buf;
          create_struct.jmp_buf_size = 0; /*stack allocation*/
          create_struct.longjmp_fn = longjmp;
-#  else
-      {
 #  endif
          /* Call the general version checker (shared with read and write code):
           */
@@ -330,10 +337,10 @@
                create_struct.zstream.opaque = png_ptr;
 
 #              ifdef PNG_SETJMP_SUPPORTED
-                  /* Eliminate the local error handling: */
-                  create_struct.jmp_buf_ptr = NULL;
-                  create_struct.jmp_buf_size = 0;
-                  create_struct.longjmp_fn = 0;
+               /* Eliminate the local error handling: */
+               create_struct.jmp_buf_ptr = NULL;
+               create_struct.jmp_buf_size = 0;
+               create_struct.longjmp_fn = 0;
 #              endif
 
                *png_ptr = create_struct;
@@ -439,6 +446,8 @@
       free(info_ptr);
       info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
          (sizeof *info_ptr)));
+      if (info_ptr == NULL)
+         return;
       *ptr_ptr = info_ptr;
    }
 
@@ -504,9 +513,10 @@
    /* Free any tRNS entry */
    if (((mask & PNG_FREE_TRNS) & info_ptr->free_me) != 0)
    {
+      info_ptr->valid &= ~PNG_INFO_tRNS;
       png_free(png_ptr, info_ptr->trans_alpha);
       info_ptr->trans_alpha = NULL;
-      info_ptr->valid &= ~PNG_INFO_tRNS;
+      info_ptr->num_trans = 0;
    }
 #endif
 
@@ -572,20 +582,17 @@
 
       else
       {
-         if (info_ptr->splt_palettes_num != 0)
+         int i;
+
+         for (i = 0; i < info_ptr->splt_palettes_num; i++)
          {
-            int i;
-
-            for (i = 0; i < info_ptr->splt_palettes_num; i++)
-            {
-               png_free(png_ptr, info_ptr->splt_palettes[i].name);
-               png_free(png_ptr, info_ptr->splt_palettes[i].entries);
-            }
-
-            png_free(png_ptr, info_ptr->splt_palettes);
-            info_ptr->splt_palettes = NULL;
-            info_ptr->splt_palettes_num = 0;
+            png_free(png_ptr, info_ptr->splt_palettes[i].name);
+            png_free(png_ptr, info_ptr->splt_palettes[i].entries);
          }
+
+         png_free(png_ptr, info_ptr->splt_palettes);
+         info_ptr->splt_palettes = NULL;
+         info_ptr->splt_palettes_num = 0;
          info_ptr->valid &= ~PNG_INFO_sPLT;
       }
    }
@@ -605,15 +612,12 @@
       {
          int i;
 
-         if (info_ptr->unknown_chunks_num != 0)
-         {
-            for (i = 0; i < info_ptr->unknown_chunks_num; i++)
-               png_free(png_ptr, info_ptr->unknown_chunks[i].data);
-
-            png_free(png_ptr, info_ptr->unknown_chunks);
-            info_ptr->unknown_chunks = NULL;
-            info_ptr->unknown_chunks_num = 0;
-         }
+         for (i = 0; i < info_ptr->unknown_chunks_num; i++)
+            png_free(png_ptr, info_ptr->unknown_chunks[i].data);
+
+         png_free(png_ptr, info_ptr->unknown_chunks);
+         info_ptr->unknown_chunks = NULL;
+         info_ptr->unknown_chunks_num = 0;
       }
    }
 #endif
@@ -694,22 +698,23 @@
 }
 #  endif
 
-#ifdef PNG_SAVE_INT_32_SUPPORTED
-/* The png_save_int_32 function assumes integers are stored in two's
- * complement format.  If this isn't the case, then this routine needs to
- * be modified to write data in two's complement format.  Note that,
- * the following works correctly even if png_int_32 has more than 32 bits
- * (compare the more complex code required on read for sign extension.)
+#  ifdef PNG_SAVE_INT_32_SUPPORTED
+/* PNG signed integers are saved in 32-bit 2's complement format.  ANSI C-90
+ * defines a cast of a signed integer to an unsigned integer either to preserve
+ * the value, if it is positive, or to calculate:
+ *
+ *     (UNSIGNED_MAX+1) + integer
+ *
+ * Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
+ * negative integral value is added the result will be an unsigned value
+ * correspnding to the 2's complement representation.
  */
 void PNGAPI
 png_save_int_32(png_bytep buf, png_int_32 i)
 {
-   buf[0] = (png_byte)((i >> 24) & 0xff);
-   buf[1] = (png_byte)((i >> 16) & 0xff);
-   buf[2] = (png_byte)((i >> 8) & 0xff);
-   buf[3] = (png_byte)(i & 0xff);
+   png_save_uint_32(buf, i);
 }
-#endif
+#  endif
 
 #  ifdef PNG_TIME_RFC1123_SUPPORTED
 /* Convert the supplied time into an RFC 1123 string suitable for use in
@@ -753,6 +758,7 @@
       APPEND(':');
       APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second);
       APPEND_STRING(" +0000"); /* This reliably terminates the buffer */
+      PNG_UNUSED (pos)
 
 #     undef APPEND
 #     undef APPEND_NUMBER
@@ -762,7 +768,7 @@
    return 1;
 }
 
-#     if PNG_LIBPNG_VER < 10700
+#    if PNG_LIBPNG_VER < 10700
 /* To do: remove the following from libpng-1.7 */
 /* Original API that uses a private buffer in png_struct.
  * Deprecated because it causes png_struct to carry a spurious temporary
@@ -783,7 +789,7 @@
 
    return NULL;
 }
-#     endif
+#    endif /* LIBPNG_VER < 10700 */
 #  endif /* TIME_RFC1123 */
 
 #endif /* READ || WRITE */
@@ -797,14 +803,14 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.6.16 - December 22, 2014" PNG_STRING_NEWLINE \
-     "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
-     "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
-     "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
-     PNG_STRING_NEWLINE;
+      "libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
+      "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+      "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
+      "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
+      PNG_STRING_NEWLINE;
 #  else
-      return "libpng version 1.6.16 - December 22, 2014\
-      Copyright (c) 1998-2014 Glenn Randers-Pehrson\
+   return "libpng version 1.6.20 - December 3, 2015\
+      Copyright (c) 1998-2015 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
 #  endif
@@ -842,9 +848,9 @@
 #ifdef __STDC__
    return PNG_HEADER_VERSION_STRING
 #  ifndef PNG_READ_SUPPORTED
-   "     (NO READ SUPPORT)"
+      " (NO READ SUPPORT)"
 #  endif
-   PNG_STRING_NEWLINE;
+      PNG_STRING_NEWLINE;
 #else
    return PNG_HEADER_VERSION_STRING;
 #endif
@@ -900,9 +906,9 @@
 
    for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
    {
-      palette[i].red = (png_byte)v;
-      palette[i].green = (png_byte)v;
-      palette[i].blue = (png_byte)v;
+      palette[i].red = (png_byte)(v & 0xff);
+      palette[i].green = (png_byte)(v & 0xff);
+      palette[i].blue = (png_byte)(v & 0xff);
    }
 }
 #endif
@@ -975,8 +981,6 @@
    return((png_uint_32)PNG_LIBPNG_VER);
 }
 
-
-
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 /* Ensure that png_ptr->zstream.msg holds some appropriate error message string.
  * If it doesn't 'ret' is used to set it to something appropriate, even in cases
@@ -1119,10 +1123,10 @@
       errmsg = "gamma value out of range";
 
 #  ifdef PNG_READ_gAMA_SUPPORTED
-      /* Allow the application to set the gamma value more than once */
-      else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
-         (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
-         errmsg = "duplicate";
+   /* Allow the application to set the gamma value more than once */
+   else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
+      (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
+      errmsg = "duplicate";
 #  endif
 
    /* Do nothing if the colorspace is already invalid */
@@ -1163,31 +1167,31 @@
          PNG_INFO_iCCP);
 
 #     ifdef PNG_COLORSPACE_SUPPORTED
-         /* Clean up the iCCP profile now if it won't be used. */
-         png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
+      /* Clean up the iCCP profile now if it won't be used. */
+      png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
 #     else
-         PNG_UNUSED(png_ptr)
+      PNG_UNUSED(png_ptr)
 #     endif
    }
 
    else
    {
 #     ifdef PNG_COLORSPACE_SUPPORTED
-         /* Leave the INFO_iCCP flag set if the pngset.c code has already set
-          * it; this allows a PNG to contain a profile which matches sRGB and
-          * yet still have that profile retrievable by the application.
-          */
-         if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
-            info_ptr->valid |= PNG_INFO_sRGB;
-
-         else
-            info_ptr->valid &= ~PNG_INFO_sRGB;
-
-         if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
-            info_ptr->valid |= PNG_INFO_cHRM;
-
-         else
-            info_ptr->valid &= ~PNG_INFO_cHRM;
+      /* Leave the INFO_iCCP flag set if the pngset.c code has already set
+       * it; this allows a PNG to contain a profile which matches sRGB and
+       * yet still have that profile retrievable by the application.
+       */
+      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
+         info_ptr->valid |= PNG_INFO_sRGB;
+
+      else
+         info_ptr->valid &= ~PNG_INFO_sRGB;
+
+      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+         info_ptr->valid |= PNG_INFO_cHRM;
+
+      else
+         info_ptr->valid &= ~PNG_INFO_cHRM;
 #     endif
 
       if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
@@ -1209,7 +1213,7 @@
    png_colorspace_sync_info(png_ptr, info_ptr);
 }
 #endif
-#endif
+#endif /* GAMMA */
 
 #ifdef PNG_COLORSPACE_SUPPORTED
 /* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for
@@ -1268,16 +1272,17 @@
 
    /* Check xy and, implicitly, z.  Note that wide gamut color spaces typically
     * have end points with 0 tristimulus values (these are impossible end
-    * points, but they are used to cover the possible colors.)
+    * points, but they are used to cover the possible colors).  We check
+    * xy->whitey against 5, not 0, to avoid a possible integer overflow.
     */
-   if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
-   if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
+   if (xy->redx   < 0 || xy->redx > PNG_FP_1) return 1;
+   if (xy->redy   < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
    if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
    if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
-   if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
-   if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
+   if (xy->bluex  < 0 || xy->bluex > PNG_FP_1) return 1;
+   if (xy->bluey  < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
    if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
-   if (xy->whitey < 0 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
+   if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
 
    /* The reverse calculation is more difficult because the original tristimulus
     * value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
@@ -1735,7 +1740,6 @@
           */
          colorspace->flags |= PNG_COLORSPACE_INVALID;
          png_error(png_ptr, "internal error checking chromaticities");
-         break;
    }
 
    return 0; /* failed */
@@ -1763,7 +1767,6 @@
       default:
          colorspace->flags |= PNG_COLORSPACE_INVALID;
          png_error(png_ptr, "internal error checking chromaticities");
-         break;
    }
 
    return 0; /* failed */
@@ -2089,8 +2092,8 @@
    temp = png_get_uint_32(profile+12); /* profile/device class */
    switch (temp)
    {
-      case 0x73636E72: /* 'scnr' */
-      case 0x6D6E7472: /* 'mntr' */
+      case 0x73636e72: /* 'scnr' */
+      case 0x6d6e7472: /* 'mntr' */
       case 0x70727472: /* 'prtr' */
       case 0x73706163: /* 'spac' */
          /* All supported */
@@ -2101,7 +2104,7 @@
          return png_icc_profile_error(png_ptr, colorspace, name, temp,
             "invalid embedded Abstract ICC profile");
 
-      case 0x6C696E6B: /* 'link' */
+      case 0x6c696e6b: /* 'link' */
          /* DeviceLink profiles cannot be interpreted in a non-device specific
           * fashion, if an app uses the AToB0Tag in the profile the results are
           * undefined unless the result is sent to the intended device,
@@ -2111,7 +2114,7 @@
          return png_icc_profile_error(png_ptr, colorspace, name, temp,
             "unexpected DeviceLink ICC profile class");
 
-      case 0x6E6D636C: /* 'nmcl' */
+      case 0x6e6d636c: /* 'nmcl' */
          /* A NamedColor profile is also device specific, however it doesn't
           * contain an AToB0 tag that is open to misinterpretation.  Almost
           * certainly it will fail the tests below.
@@ -2137,8 +2140,8 @@
    temp = png_get_uint_32(profile+20);
    switch (temp)
    {
-      case 0x58595A20: /* 'XYZ ' */
-      case 0x4C616220: /* 'Lab ' */
+      case 0x58595a20: /* 'XYZ ' */
+      case 0x4c616220: /* 'Lab ' */
          break;
 
       default:
@@ -2194,7 +2197,8 @@
    return 1; /* success, maybe with warnings */
 }
 
-#if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
+#ifdef PNG_sRGB_SUPPORTED
+#if PNG_sRGB_PROFILE_CHECKS >= 0
 /* Information about the known ICC sRGB profiles */
 static const struct
 {
@@ -2307,8 +2311,8 @@
          }
 
          /* Length *and* intent must match */
-         if (length == png_sRGB_checks[i].length &&
-            intent == png_sRGB_checks[i].intent)
+         if (length == (png_uint_32) png_sRGB_checks[i].length &&
+            intent == (png_uint_32) png_sRGB_checks[i].intent)
          {
             /* Now calculate the adler32 if not done already. */
             if (adler == 0)
@@ -2352,8 +2356,8 @@
                    */
                   else if (png_sRGB_checks[i].have_md5 == 0)
                   {
-                     png_chunk_report(png_ptr, "out-of-date sRGB profile with"
-                        " no signature",
+                     png_chunk_report(png_ptr,
+                        "out-of-date sRGB profile with no signature",
                         PNG_CHUNK_WARNING);
                   }
 
@@ -2366,8 +2370,8 @@
           * way.  This probably indicates a data error or uninformed hacking.
           * Fall through to "no match".
           */
-         png_chunk_report(png_ptr, "Not recognizing known sRGB profile that"
-             " has been edited",
+         png_chunk_report(png_ptr,
+             "Not recognizing known sRGB profile that has been edited",
              PNG_CHUNK_WARNING);
          break;
 # endif
@@ -2377,9 +2381,8 @@
 
    return 0; /* no match */
 }
-#endif
-
-#ifdef PNG_sRGB_SUPPORTED
+#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
+
 void /* PRIVATE */
 png_icc_set_sRGB(png_const_structrp png_ptr,
    png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
@@ -2393,7 +2396,7 @@
       (void)png_colorspace_set_sRGB(png_ptr, colorspace,
          (int)/*already checked*/png_get_uint_32(profile+64));
 }
-#endif /* READ_sRGB */
+#endif /* sRGB */
 
 int /* PRIVATE */
 png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
@@ -2485,7 +2488,7 @@
          png_error(png_ptr, "internal error handling cHRM->XYZ");
    }
 }
-#endif
+#endif /* READ_RGB_TO_GRAY */
 
 #endif /* COLORSPACE */
 
@@ -2514,18 +2517,19 @@
       png_warning(png_ptr, "Image width is zero in IHDR");
       error = 1;
    }
-   else if (width > PNG_UINT_31_MAX)
+
+   if (width > PNG_UINT_31_MAX)
    {
       png_warning(png_ptr, "Invalid image width in IHDR");
       error = 1;
    }
 
-   else if (png_gt(width,
-                   (PNG_SIZE_MAX >> 3) /* 8-byte RGBA pixels */
-                   - 48                /* big_row_buf hack */
-                   - 1                 /* filter byte */
-                   - 7*8               /* rounding width to multiple of 8 pix */
-                   - 8))               /* extra max_pixel_depth pad */
+   if (png_gt(((width + 7) & (~7)),
+       ((PNG_SIZE_MAX
+           - 48        /* big_row_buf hack */
+           - 1)        /* filter byte */
+           / 8)        /* 8-byte RGBA pixels */
+           - 1))       /* extra max_pixel_depth pad */
    {
       /* The size of the row must be within the limits of this architecture.
        * Because the read code can perform arbitrary transformations the
@@ -2541,17 +2545,15 @@
       png_warning(png_ptr, "Image width is too large for this architecture");
       error = 1;
    }
-   else
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+   if (width > png_ptr->user_width_max)
+#else
+   if (width > PNG_USER_WIDTH_MAX)
+#endif
    {
-#     ifdef PNG_SET_USER_LIMITS_SUPPORTED
-      if (width > png_ptr->user_width_max)
-#     else
-      if (width > PNG_USER_WIDTH_MAX)
-#     endif
-      {
-         png_warning(png_ptr, "Image width exceeds user limit in IHDR");
-         error = 1;
-      }
+      png_warning(png_ptr, "Image width exceeds user limit in IHDR");
+      error = 1;
    }
 
    if (height == 0)
@@ -2559,22 +2561,21 @@
       png_warning(png_ptr, "Image height is zero in IHDR");
       error = 1;
    }
-   else if (height > PNG_UINT_31_MAX)
+
+   if (height > PNG_UINT_31_MAX)
    {
       png_warning(png_ptr, "Invalid image height in IHDR");
       error = 1;
    }
-   else
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+   if (height > png_ptr->user_height_max)
+#else
+   if (height > PNG_USER_HEIGHT_MAX)
+#endif
    {
-#     ifdef PNG_SET_USER_LIMITS_SUPPORTED
-      if (height > png_ptr->user_height_max)
-#     else
-      if (height > PNG_USER_HEIGHT_MAX)
-#     endif
-      {
-         png_warning(png_ptr, "Image height exceeds user limit in IHDR");
-         error = 1;
-      }
+      png_warning(png_ptr, "Image height exceeds user limit in IHDR");
+      error = 1;
    }
 
    /* Check other values */
@@ -2613,7 +2614,7 @@
       error = 1;
    }
 
-#  ifdef PNG_MNG_FEATURES_SUPPORTED
+#ifdef PNG_MNG_FEATURES_SUPPORTED
    /* Accept filter_method 64 (intrapixel differencing) only if
     * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
     * 2. Libpng did not read a PNG signature (this filter_method is only
@@ -2646,13 +2647,13 @@
       }
    }
 
-#  else
+#else
    if (filter_type != PNG_FILTER_TYPE_BASE)
    {
       png_warning(png_ptr, "Unknown filter method in IHDR");
       error = 1;
    }
-#  endif
+#endif
 
    if (error == 1)
       png_error(png_ptr, "Invalid IHDR data");
@@ -2878,7 +2879,7 @@
 
       if (fp >= DBL_MIN && fp <= DBL_MAX)
       {
-         int exp_b10;       /* A base 10 exponent */
+         int exp_b10;   /* A base 10 exponent */
          double base;   /* 10^exp_b10 */
 
          /* First extract a base 10 exponent of the number,
@@ -2926,7 +2927,7 @@
           */
 
          {
-            int czero, clead, cdigits;
+            unsigned int czero, clead, cdigits;
             char exponent[10];
 
             /* Allow up to two leading zeros - this will not lengthen
@@ -2956,7 +2957,7 @@
                 * of the loop don't break the number into parts so
                 * that the final digit is rounded.
                 */
-               if (cdigits+czero-clead+1 < (int)precision)
+               if (cdigits+czero+1 < precision+clead)
                   fp = modf(fp, &d);
 
                else
@@ -3062,14 +3063,14 @@
                   *ascii++ = (char)(48 + (int)d), ++cdigits;
                }
             }
-            while (cdigits+czero-clead < (int)precision && fp > DBL_MIN);
+            while (cdigits+czero < precision+clead && fp > DBL_MIN);
 
             /* The total output count (max) is now 4+precision */
 
             /* Check for an exponent, if we don't need one we are
              * done and just need to terminate the string.  At
              * this point exp_b10==(-1) is effectively if flag - it got
-             * to '-1' because of the decrement after outputing
+             * to '-1' because of the decrement after outputting
              * the decimal point above (the exponent required is
              * *not* -1!)
              */
@@ -3077,7 +3078,7 @@
             {
                /* The following only happens if we didn't output the
                 * leading zeros above for negative exponent, so this
-                * doest add to the digit requirement.  Note that the
+                * doesn't add to the digit requirement.  Note that the
                 * two zeros here can only be output if the two leading
                 * zeros were *not* output, so this doesn't increase
                 * the output count.
@@ -3130,7 +3131,7 @@
             /* Need another size check here for the exponent digits, so
              * this need not be considered above.
              */
-            if ((int)size > cdigits)
+            if (size > cdigits)
             {
                while (cdigits > 0) *ascii++ = exponent[--cdigits];
 
@@ -3178,7 +3179,7 @@
 
       /* Avoid overflow here on the minimum integer. */
       if (fp < 0)
-         *ascii++ = 45, --size, num = -fp;
+         *ascii++ = 45, num = -fp;
       else
          num = fp;
 
@@ -3234,7 +3235,7 @@
    png_error(png_ptr, "ASCII conversion buffer too small");
 }
 #   endif /* FIXED_POINT */
-#endif /* READ_SCAL */
+#endif /* SCAL */
 
 #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
    !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
@@ -3252,7 +3253,7 @@
       png_fixed_error(png_ptr, text);
 
 #  ifndef PNG_ERROR_TEXT_SUPPORTED
-      PNG_UNUSED(text)
+   PNG_UNUSED(text)
 #  endif
 
    return (png_fixed_point)r;
@@ -3433,29 +3434,29 @@
 #endif
 
 #ifdef PNG_READ_GAMMA_SUPPORTED
-#if defined(PNG_16BIT_SUPPORTED) || !defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
+#ifdef PNG_16BIT_SUPPORTED
 /* A local convenience routine. */
 static png_fixed_point
 png_product2(png_fixed_point a, png_fixed_point b)
 {
    /* The required result is 1/a * 1/b; the following preserves accuracy. */
-#    ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
    double r = a * 1E-5;
    r *= b;
    r = floor(r+.5);
 
    if (r <= 2147483647. && r >= -2147483648.)
       return (png_fixed_point)r;
-#    else
+#else
    png_fixed_point res;
 
    if (png_muldiv(&res, a, b, 100000) != 0)
       return res;
-#    endif
+#endif
 
    return 0; /* overflow */
 }
-#endif /* 16BIT || !FLOATING_ARITHMETIC */
+#endif /* 16BIT */
 
 /* The inverse of the above. */
 png_fixed_point
@@ -3463,12 +3464,15 @@
 {
    /* The required result is 1/a * 1/b; the following preserves accuracy. */
 #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
-   double r = 1E15/a;
-   r /= b;
-   r = floor(r+.5);
-
-   if (r <= 2147483647. && r >= -2147483648.)
-      return (png_fixed_point)r;
+   if (a != 0 && b != 0)
+   {
+      double r = 1E15/a;
+      r /= b;
+      r = floor(r+.5);
+
+      if (r <= 2147483647. && r >= -2147483648.)
+         return (png_fixed_point)r;
+   }
 #else
    /* This may overflow because the range of png_fixed_point isn't symmetric,
     * but this API is only used for the product of file and screen gamma so it
@@ -3706,7 +3710,7 @@
    if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
    {
       /* Obtain a 4-bit approximation */
-      png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf];
+      png_uint_32 e = png_32bit_exp[(x >> 12) & 0x0f];
 
       /* Incorporate the low 12 bits - these decrease the returned value by
        * multiplying by a number less than 1 if the bit is set.  The multiplier
@@ -3759,7 +3763,7 @@
     * step.
     */
    x -= x >> 8;
-   return (png_byte)((x + 0x7fffffU) >> 24);
+   return (png_byte)(((x + 0x7fffffU) >> 24) & 0xff);
 }
 
 #ifdef PNG_16BIT_SUPPORTED
@@ -3820,7 +3824,7 @@
 #     endif
    }
 
-   return (png_byte)value;
+   return (png_byte)(value & 0xff);
 }
 
 #ifdef PNG_16BIT_SUPPORTED
@@ -4042,7 +4046,7 @@
 
    else
       for (i=0; i<256; ++i)
-         table[i] = (png_byte)i;
+         table[i] = (png_byte)(i & 0xff);
 }
 
 /* Used from png_read_destroy and below to release the memory used by the gamma
@@ -4182,7 +4186,8 @@
       *
       */
      if (sig_bit > 0 && sig_bit < 16U)
-        shift = (png_byte)(16U - sig_bit); /* shift == insignificant bits */
+        /* shift == insignificant bits */
+        shift = (png_byte)((16U - sig_bit) & 0xff);
 
      else
         shift = 0; /* keep all 16 bits */
@@ -4251,7 +4256,7 @@
       int setting = (2 + (onoff != 0)) << option;
       int current = png_ptr->options;
 
-      png_ptr->options = (png_byte)((current & ~mask) | setting);
+      png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff);
 
       return (current & mask) >> option;
    }
@@ -4267,7 +4272,7 @@
  * contrib/tools/makesRGB.c.  The actual sRGB transfer curve defined in the
  * specification (see the article at http://en.wikipedia.org/wiki/SRGB)
  * is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
- * The sRGB to linear table is exact (to the nearest 16 bit linear fraction).
+ * The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
  * The inverse (linear to sRGB) table has accuracies as follows:
  *
  * For all possible (255*65535+1) input values:
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.16, December 22, 2014
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * libpng version 1.6.20, December 3, 2015
+ *
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -38,17 +39,137 @@
  *
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
- *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
+ *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
+ *   libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
+ *     Glenn Randers-Pehrson.
  *   See also "Contributing Authors", below.
+ */
+
+/*
+ * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  *
- * Note about libpng version numbers:
+ * If you modify libpng you may insert additional notices immediately following
+ * this sentence.
+ *
+ * This code is released under the libpng license.
+ *
+ * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
+ * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+ * derived from libpng-1.0.6, and are distributed according to the same
+ * disclaimer and license as libpng-1.0.6 with the following individuals
+ * added to the list of Contributing Authors:
+ *
+ *    Simon-Pierre Cadieux
+ *    Eric S. Raymond
+ *    Mans Rullgard
+ *    Cosmin Truta
+ *    Gilles Vollant
+ *    James Yu
+ *
+ * and with the following additions to the disclaimer:
+ *
+ *    There is no warranty against interference with your enjoyment of the
+ *    library or against infringement.  There is no warranty that our
+ *    efforts or the library will fulfill any of your particular purposes
+ *    or needs.  This library is provided with all faults, and the entire
+ *    risk of satisfactory quality, performance, accuracy, and effort is with
+ *    the user.
+ *
+ * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+ * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+ * libpng-0.96, and are distributed according to the same disclaimer and
+ * license as libpng-0.96, with the following individuals added to the list
+ * of Contributing Authors:
+ *
+ *    Tom Lane
+ *    Glenn Randers-Pehrson
+ *    Willem van Schaik
+ *
+ * libpng versions 0.89, June 1996, through 0.96, May 1997, are
+ * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+ * and are distributed according to the same disclaimer and license as
+ * libpng-0.88, with the following individuals added to the list of
+ * Contributing Authors:
+ *
+ *    John Bowler
+ *    Kevin Bracey
+ *    Sam Bushell
+ *    Magnus Holmgren
+ *    Greg Roelofs
+ *    Tom Tanner
+ *
+ * libpng versions 0.5, May 1995, through 0.88, January 1996, are
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+ *
+ * For the purposes of this copyright and license, "Contributing Authors"
+ * is defined as the following set of individuals:
  *
- *   Due to various miscommunications, unforeseen code incompatibilities
- *   and occasional factors outside the authors' control, version numbering
- *   on the library has not always been consistent and straightforward.
- *   The following table summarizes matters since version 0.89c, which was
- *   the first widely used release:
+ *    Andreas Dilger
+ *    Dave Martindale
+ *    Guy Eric Schalnat
+ *    Paul Schmidt
+ *    Tim Wegner
+ *
+ * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
+ * and Group 42, Inc. disclaim all warranties, expressed or implied,
+ * including, without limitation, the warranties of merchantability and of
+ * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
+ * assume no liability for direct, indirect, incidental, special, exemplary,
+ * or consequential damages, which may result from the use of the PNG
+ * Reference Library, even if advised of the possibility of such damage.
+ *
+ * Permission is hereby granted to use, copy, modify, and distribute this
+ * source code, or portions hereof, for any purpose, without fee, subject
+ * to the following restrictions:
+ *
+ *   1. The origin of this source code must not be misrepresented.
+ *
+ *   2. Altered versions must be plainly marked as such and must not
+ *      be misrepresented as being the original source.
+ *
+ *   3. This Copyright notice may not be removed or altered from any
+ *      source or altered source distribution.
+ *
+ * The Contributing Authors and Group 42, Inc. specifically permit, without
+ * fee, and encourage the use of this source code as a component to
+ * supporting the PNG file format in commercial products.  If you use this
+ * source code in a product, acknowledgment is not required but would be
+ * appreciated.
+ *
+ * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+ */
+
+/*
+ * A "png_get_copyright" function is available, for convenient use in "about"
+ * boxes and the like:
+ *
+ *    printf("%s", png_get_copyright(NULL));
+ *
+ * Also, the PNG logo (in PNG format, of course) is supplied in the
+ * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+ */
+
+/*
+ * Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
+ * a certification mark of the Open Source Initiative. OSI has not addressed
+ * the additional disclaimers inserted at version 1.0.7.
+ */
+
+/*
+ * The contributing authors would like to thank all those who helped
+ * with testing, bug fixes, and patience.  This wouldn't have been
+ * possible without all of you.
+ *
+ * Thanks to Frank J. T. Wojcik for helping with the documentation.
+ */
+
+/* Note about libpng version numbers:
+ *
+ *    Due to various miscommunications, unforeseen code incompatibilities
+ *    and occasional factors outside the authors' control, version numbering
+ *    on the library has not always been consistent and straightforward.
+ *    The following table summarizes matters since version 0.89c, which was
+ *    the first widely used release:
  *
  *    source                 png.h  png.h  shared-lib
  *    version                string   int  version
@@ -86,310 +207,48 @@
  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
  *    1.0.7                    1    10007  (still compatible)
- *    1.0.8beta1-4             1    10008  2.1.0.8beta1-4
- *    1.0.8rc1                 1    10008  2.1.0.8rc1
- *    1.0.8                    1    10008  2.1.0.8
- *    1.0.9beta1-6             1    10009  2.1.0.9beta1-6
- *    1.0.9rc1                 1    10009  2.1.0.9rc1
- *    1.0.9beta7-10            1    10009  2.1.0.9beta7-10
- *    1.0.9rc2                 1    10009  2.1.0.9rc2
- *    1.0.9                    1    10009  2.1.0.9
- *    1.0.10beta1              1    10010  2.1.0.10beta1
- *    1.0.10rc1                1    10010  2.1.0.10rc1
- *    1.0.10                   1    10010  2.1.0.10
- *    1.0.11beta1-3            1    10011  2.1.0.11beta1-3
- *    1.0.11rc1                1    10011  2.1.0.11rc1
- *    1.0.11                   1    10011  2.1.0.11
- *    1.0.12beta1-2            2    10012  2.1.0.12beta1-2
- *    1.0.12rc1                2    10012  2.1.0.12rc1
- *    1.0.12                   2    10012  2.1.0.12
- *    1.1.0a-f                 -    10100  2.1.1.0a-f (branch abandoned)
- *    1.2.0beta1-2             2    10200  2.1.2.0beta1-2
- *    1.2.0beta3-5             3    10200  3.1.2.0beta3-5
- *    1.2.0rc1                 3    10200  3.1.2.0rc1
- *    1.2.0                    3    10200  3.1.2.0
- *    1.2.1beta1-4             3    10201  3.1.2.1beta1-4
- *    1.2.1rc1-2               3    10201  3.1.2.1rc1-2
- *    1.2.1                    3    10201  3.1.2.1
- *    1.2.2beta1-6            12    10202  12.so.0.1.2.2beta1-6
- *    1.0.13beta1             10    10013  10.so.0.1.0.13beta1
- *    1.0.13rc1               10    10013  10.so.0.1.0.13rc1
- *    1.2.2rc1                12    10202  12.so.0.1.2.2rc1
- *    1.0.13                  10    10013  10.so.0.1.0.13
- *    1.2.2                   12    10202  12.so.0.1.2.2
- *    1.2.3rc1-6              12    10203  12.so.0.1.2.3rc1-6
- *    1.2.3                   12    10203  12.so.0.1.2.3
- *    1.2.4beta1-3            13    10204  12.so.0.1.2.4beta1-3
- *    1.0.14rc1               13    10014  10.so.0.1.0.14rc1
- *    1.2.4rc1                13    10204  12.so.0.1.2.4rc1
- *    1.0.14                  10    10014  10.so.0.1.0.14
- *    1.2.4                   13    10204  12.so.0.1.2.4
- *    1.2.5beta1-2            13    10205  12.so.0.1.2.5beta1-2
- *    1.0.15rc1-3             10    10015  10.so.0.1.0.15rc1-3
- *    1.2.5rc1-3              13    10205  12.so.0.1.2.5rc1-3
- *    1.0.15                  10    10015  10.so.0.1.0.15
- *    1.2.5                   13    10205  12.so.0.1.2.5
- *    1.2.6beta1-4            13    10206  12.so.0.1.2.6beta1-4
- *    1.0.16                  10    10016  10.so.0.1.0.16
- *    1.2.6                   13    10206  12.so.0.1.2.6
- *    1.2.7beta1-2            13    10207  12.so.0.1.2.7beta1-2
- *    1.0.17rc1               10    10017  12.so.0.1.0.17rc1
- *    1.2.7rc1                13    10207  12.so.0.1.2.7rc1
- *    1.0.17                  10    10017  12.so.0.1.0.17
- *    1.2.7                   13    10207  12.so.0.1.2.7
- *    1.2.8beta1-5            13    10208  12.so.0.1.2.8beta1-5
- *    1.0.18rc1-5             10    10018  12.so.0.1.0.18rc1-5
- *    1.2.8rc1-5              13    10208  12.so.0.1.2.8rc1-5
- *    1.0.18                  10    10018  12.so.0.1.0.18
- *    1.2.8                   13    10208  12.so.0.1.2.8
- *    1.2.9beta1-3            13    10209  12.so.0.1.2.9beta1-3
- *    1.2.9beta4-11           13    10209  12.so.0.9[.0]
- *    1.2.9rc1                13    10209  12.so.0.9[.0]
- *    1.2.9                   13    10209  12.so.0.9[.0]
- *    1.2.10beta1-7           13    10210  12.so.0.10[.0]
- *    1.2.10rc1-2             13    10210  12.so.0.10[.0]
- *    1.2.10                  13    10210  12.so.0.10[.0]
- *    1.4.0beta1-5            14    10400  14.so.0.0[.0]
- *    1.2.11beta1-4           13    10211  12.so.0.11[.0]
- *    1.4.0beta7-8            14    10400  14.so.0.0[.0]
- *    1.2.11                  13    10211  12.so.0.11[.0]
- *    1.2.12                  13    10212  12.so.0.12[.0]
- *    1.4.0beta9-14           14    10400  14.so.0.0[.0]
- *    1.2.13                  13    10213  12.so.0.13[.0]
- *    1.4.0beta15-36          14    10400  14.so.0.0[.0]
- *    1.4.0beta37-87          14    10400  14.so.14.0[.0]
- *    1.4.0rc01               14    10400  14.so.14.0[.0]
- *    1.4.0beta88-109         14    10400  14.so.14.0[.0]
- *    1.4.0rc02-08            14    10400  14.so.14.0[.0]
- *    1.4.0                   14    10400  14.so.14.0[.0]
- *    1.4.1beta01-03          14    10401  14.so.14.1[.0]
- *    1.4.1rc01               14    10401  14.so.14.1[.0]
- *    1.4.1beta04-12          14    10401  14.so.14.1[.0]
- *    1.4.1                   14    10401  14.so.14.1[.0]
- *    1.4.2                   14    10402  14.so.14.2[.0]
- *    1.4.3                   14    10403  14.so.14.3[.0]
- *    1.4.4                   14    10404  14.so.14.4[.0]
- *    1.5.0beta01-58          15    10500  15.so.15.0[.0]
- *    1.5.0rc01-07            15    10500  15.so.15.0[.0]
- *    1.5.0                   15    10500  15.so.15.0[.0]
- *    1.5.1beta01-11          15    10501  15.so.15.1[.0]
- *    1.5.1rc01-02            15    10501  15.so.15.1[.0]
- *    1.5.1                   15    10501  15.so.15.1[.0]
- *    1.5.2beta01-03          15    10502  15.so.15.2[.0]
- *    1.5.2rc01-03            15    10502  15.so.15.2[.0]
- *    1.5.2                   15    10502  15.so.15.2[.0]
- *    1.5.3beta01-10          15    10503  15.so.15.3[.0]
- *    1.5.3rc01-02            15    10503  15.so.15.3[.0]
- *    1.5.3beta11             15    10503  15.so.15.3[.0]
- *    1.5.3 [omitted]
- *    1.5.4beta01-08          15    10504  15.so.15.4[.0]
- *    1.5.4rc01               15    10504  15.so.15.4[.0]
- *    1.5.4                   15    10504  15.so.15.4[.0]
- *    1.5.5beta01-08          15    10505  15.so.15.5[.0]
- *    1.5.5rc01               15    10505  15.so.15.5[.0]
- *    1.5.5                   15    10505  15.so.15.5[.0]
- *    1.5.6beta01-07          15    10506  15.so.15.6[.0]
- *    1.5.6rc01-03            15    10506  15.so.15.6[.0]
- *    1.5.6                   15    10506  15.so.15.6[.0]
- *    1.5.7beta01-05          15    10507  15.so.15.7[.0]
- *    1.5.7rc01-03            15    10507  15.so.15.7[.0]
- *    1.5.7                   15    10507  15.so.15.7[.0]
- *    1.6.0beta01-40          16    10600  16.so.16.0[.0]
- *    1.6.0rc01-08            16    10600  16.so.16.0[.0]
- *    1.6.0                   16    10600  16.so.16.0[.0]
- *    1.6.1beta01-09          16    10601  16.so.16.1[.0]
- *    1.6.1rc01               16    10601  16.so.16.1[.0]
- *    1.6.1                   16    10601  16.so.16.1[.0]
- *    1.6.2beta01             16    10602  16.so.16.2[.0]
- *    1.6.2rc01-06            16    10602  16.so.16.2[.0]
- *    1.6.2                   16    10602  16.so.16.2[.0]
- *    1.6.3beta01-11          16    10603  16.so.16.3[.0]
- *    1.6.3rc01               16    10603  16.so.16.3[.0]
- *    1.6.3                   16    10603  16.so.16.3[.0]
- *    1.6.4beta01-02          16    10604  16.so.16.4[.0]
- *    1.6.4rc01               16    10604  16.so.16.4[.0]
- *    1.6.4                   16    10604  16.so.16.4[.0]
- *    1.6.5                   16    10605  16.so.16.5[.0]
- *    1.6.6                   16    10606  16.so.16.6[.0]
- *    1.6.7beta01-04          16    10607  16.so.16.7[.0]
- *    1.6.7rc01-03            16    10607  16.so.16.7[.0]
- *    1.6.7                   16    10607  16.so.16.7[.0]
- *    1.6.8beta01-02          16    10608  16.so.16.8[.0]
- *    1.6.8rc01-02            16    10608  16.so.16.8[.0]
- *    1.6.8                   16    10608  16.so.16.8[.0]
- *    1.6.9beta01-04          16    10609  16.so.16.9[.0]
- *    1.6.9rc01-02            16    10609  16.so.16.9[.0]
- *    1.6.9                   16    10609  16.so.16.9[.0]
- *    1.6.10beta01-03         16    10610  16.so.16.10[.0]
- *    1.6.10rc01-03           16    10610  16.so.16.10[.0]
- *    1.6.10                  16    10610  16.so.16.10[.0]
- *    1.6.11beta01-06         16    10611  16.so.16.11[.0]
- *    1.6.11rc01-02           16    10611  16.so.16.11[.0]
- *    1.6.11                  16    10611  16.so.16.11[.0]
- *    1.6.12rc01-03           16    10612  16.so.16.12[.0]
- *    1.6.12                  16    10612  16.so.16.12[.0]
- *    1.6.13beta01-04         16    10613  16.so.16.13[.0]
- *    1.6.13rc01-02           16    10613  16.so.16.13[.0]
- *    1.6.13                  16    10613  16.so.16.13[.0]
- *    1.6.14beta01-07         16    10614  16.so.16.14[.0]
- *    1.6.14rc01-02           16    10614  16.so.16.14[.0]
- *    1.6.14                  16    10614  16.so.16.14[.0]
- *    1.6.15beta01-08         16    10615  16.so.16.15[.0]
- *    1.6.15rc01-03           16    10615  16.so.16.15[.0]
- *    1.6.15                  16    10615  16.so.16.15[.0]
- *    1.6.16beta01-03         16    10616  16.so.16.16[.0]
- *    1.6.16rc01-02           16    10616  16.so.16.16[.0]
- *    1.6.16                  16    10616  16.so.16.16[.0]
+ *    ...
+ *    1.0.19                  10    10019  10.so.0.19[.0]
+ *    ...
+ *    1.2.53                  13    10253  12.so.0.53[.0]
+ *    ...
+ *    1.5.23                  15    10523  15.so.15.23[.0]
+ *    ...
+ *    1.6.20                  16    10620  16.so.16.20[.0]
  *
- *   Henceforth the source version will match the shared-library major
- *   and minor numbers; the shared-library major version number will be
- *   used for changes in backward compatibility, as it is intended.  The
- *   PNG_LIBPNG_VER macro, which is not used within libpng but is available
- *   for applications, is an unsigned integer of the form xyyzz corresponding
- *   to the source version x.y.z (leading zeros in y and z).  Beta versions
- *   were given the previous public release number plus a letter, until
- *   version 1.0.6j; from then on they were given the upcoming public
- *   release number plus "betaNN" or "rcNN".
- *
- *   Binary incompatibility exists only when applications make direct access
- *   to the info_ptr or png_ptr members through png.h, and the compiled
- *   application is loaded with a different version of the library.
- *
- *   DLLNUM will change each time there are forward or backward changes
- *   in binary compatibility (e.g., when a new feature is added).
- *
- * See libpng-manual.txt or libpng.3 for more information.  The PNG
- * specification is available as a W3C Recommendation and as an ISO
- * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
- */
-
-/*
- * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
- *
- * If you modify libpng you may insert additional notices immediately following
- * this sentence.
- *
- * This code is released under the libpng license.
- *
- * libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
- * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.2.5
- * with the following individual added to the list of Contributing Authors:
- *
- *    Cosmin Truta
- *
- * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
- * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.0.6
- * with the following individuals added to the list of Contributing Authors:
- *
- *    Simon-Pierre Cadieux
- *    Eric S. Raymond
- *    Gilles Vollant
- *
- * and with the following additions to the disclaimer:
- *
- *    There is no warranty against interference with your enjoyment of the
- *    library or against infringement.  There is no warranty that our
- *    efforts or the library will fulfill any of your particular purposes
- *    or needs.  This library is provided with all faults, and the entire
- *    risk of satisfactory quality, performance, accuracy, and effort is with
- *    the user.
- *
- * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-0.96,
- * with the following individuals added to the list of Contributing Authors:
- *
- *    Tom Lane
- *    Glenn Randers-Pehrson
- *    Willem van Schaik
+ *    Henceforth the source version will match the shared-library major
+ *    and minor numbers; the shared-library major version number will be
+ *    used for changes in backward compatibility, as it is intended.  The
+ *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
+ *    for applications, is an unsigned integer of the form xyyzz corresponding
+ *    to the source version x.y.z (leading zeros in y and z).  Beta versions
+ *    were given the previous public release number plus a letter, until
+ *    version 1.0.6j; from then on they were given the upcoming public
+ *    release number plus "betaNN" or "rcNN".
  *
- * libpng versions 0.89, June 1996, through 0.96, May 1997, are
- * Copyright (c) 1996, 1997 Andreas Dilger
- * Distributed according to the same disclaimer and license as libpng-0.88,
- * with the following individuals added to the list of Contributing Authors:
- *
- *    John Bowler
- *    Kevin Bracey
- *    Sam Bushell
- *    Magnus Holmgren
- *    Greg Roelofs
- *    Tom Tanner
- *
- * libpng versions 0.5, May 1995, through 0.88, January 1996, are
- * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
- *
- * For the purposes of this copyright and license, "Contributing Authors"
- * is defined as the following set of individuals:
- *
- *    Andreas Dilger
- *    Dave Martindale
- *    Guy Eric Schalnat
- *    Paul Schmidt
- *    Tim Wegner
- *
- * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
- * and Group 42, Inc. disclaim all warranties, expressed or implied,
- * including, without limitation, the warranties of merchantability and of
- * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
- * assume no liability for direct, indirect, incidental, special, exemplary,
- * or consequential damages, which may result from the use of the PNG
- * Reference Library, even if advised of the possibility of such damage.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * source code, or portions hereof, for any purpose, without fee, subject
- * to the following restrictions:
+ *    Binary incompatibility exists only when applications make direct access
+ *    to the info_ptr or png_ptr members through png.h, and the compiled
+ *    application is loaded with a different version of the library.
  *
- *   1. The origin of this source code must not be misrepresented.
- *
- *   2. Altered versions must be plainly marked as such and must not
- *      be misrepresented as being the original source.
- *
- *   3. This Copyright notice may not be removed or altered from
- *      any source or altered source distribution.
+ *    DLLNUM will change each time there are forward or backward changes
+ *    in binary compatibility (e.g., when a new feature is added).
  *
- * The Contributing Authors and Group 42, Inc. specifically permit, without
- * fee, and encourage the use of this source code as a component to
- * supporting the PNG file format in commercial products.  If you use this
- * source code in a product, acknowledgment is not required but would be
- * appreciated.
- */
-
-/*
- * A "png_get_copyright" function is available, for convenient use in "about"
- * boxes and the like:
- *
- *     printf("%s", png_get_copyright(NULL));
- *
- * Also, the PNG logo (in PNG format, of course) is supplied in the
- * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
- */
-
-/*
- * Libpng is OSI Certified Open Source Software.  OSI Certified is a
- * certification mark of the Open Source Initiative.
- */
-
-/*
- * The contributing authors would like to thank all those who helped
- * with testing, bug fixes, and patience.  This wouldn't have been
- * possible without all of you.
- *
- * Thanks to Frank J. T. Wojcik for helping with the documentation.
+ * See libpng.txt or libpng.3 for more information.  The PNG specification
+ * is available as a W3C Recommendation and as an ISO Specification,
+ * <http://www.w3.org/TR/2003/REC-PNG-20031110/
  */
 
 /*
  * Y2K compliance in libpng:
  * =========================
  *
- *    December 22, 2014
+ *    December 3, 2015
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.6.16 are Y2K compliant.  It is my belief that
+ *    upward through 1.6.20 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
@@ -451,9 +310,9 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.16"
+#define PNG_LIBPNG_VER_STRING "1.6.20"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.6.16 - December 22, 2014\n"
+     " libpng version 1.6.20 - December 3, 2015\n"
 
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_DLLNUM  16
@@ -461,7 +320,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 16
+#define PNG_LIBPNG_VER_RELEASE 20
 
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -492,7 +351,7 @@
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
-#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
+#define PNG_LIBPNG_VER 10620 /* 1.6.20 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -549,17 +408,22 @@
 
 /* This file is arranged in several sections:
  *
- * 1. Any configuration options that can be specified by for the application
+ * 1. [omitted]
+ * 2. Any configuration options that can be specified by for the application
  *    code when it is built.  (Build time configuration is in pnglibconf.h)
- * 2. Type definitions (base types are defined in pngconf.h), structure
+ * 3. Type definitions (base types are defined in pngconf.h), structure
  *    definitions.
- * 3. Exported library functions.
- * 4. Simplified API.
+ * 4. Exported library functions.
+ * 5. Simplified API.
+ * 6. Implementation options.
  *
  * The library source code has additional files (principally pngpriv.h) that
  * allow configuration of the library.
  */
-/* Section 1: run time configuration
+
+/* Section 1: [omitted] */
+
+/* Section 2: run time configuration
  * See pnglibconf.h for build time configuration
  *
  * Run time configuration allows the application to choose between
@@ -589,7 +453,7 @@
  * Otherwise the calls are mapped to png_error.
  */
 
-/* Section 2: type definitions, including structures and compile time
+/* Section 3: type definitions, including structures and compile time
  * constants.
  * See pngconf.h for base types that vary by machine/system
  */
@@ -597,7 +461,7 @@
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_16;
+typedef char* png_libpng_version_1_6_20;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
@@ -913,7 +777,9 @@
 #define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
 #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
 #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
+#if INT_MAX >= 0x8000 /* else this might break */
 #define PNG_INFO_IDAT 0x8000   /* ESR, 1.0.6 */
+#endif
 
 /* This is used for the transformation routines, as some of them
  * change these values for the row.  It also should enable using
@@ -1017,7 +883,9 @@
 #define PNG_TRANSFORM_GRAY_TO_RGB   0x2000      /* read only */
 /* Added to libpng-1.5.4 */
 #define PNG_TRANSFORM_EXPAND_16     0x4000      /* read only */
+#if INT_MAX >= 0x8000 /* else this might break */
 #define PNG_TRANSFORM_SCALE_16      0x8000      /* read only */
+#endif
 
 /* Flags for MNG supported features */
 #define PNG_FLAG_MNG_EMPTY_PLTE     0x01
@@ -1034,7 +902,7 @@
     png_alloc_size_t));
 typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
 
-/* Section 3: exported functions
+/* Section 4: exported functions
  * Here are the function definitions most commonly used.  This is not
  * the place to find out how to use libpng.  See libpng-manual.txt for the
  * full explanation, see example.c for the summary.  This just provides
@@ -1407,13 +1275,13 @@
 #endif
 
 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
-/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
+/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
 PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
     int flags));
 /* The values of the PNG_FILLER_ defines should NOT be changed */
 #  define PNG_FILLER_BEFORE 0
 #  define PNG_FILLER_AFTER 1
-/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
+/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
 PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
     png_uint_32 filler, int flags));
 #endif /* READ_FILLER || WRITE_FILLER */
@@ -1606,6 +1474,7 @@
 #define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */
 #define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */
 
+#ifdef PNG_WRITE_SUPPORTED
 /* These functions give the user control over the scan-line filtering in
  * libpng and the compression methods used by zlib.  These functions are
  * mainly useful for testing, as the defaults should work with most users.
@@ -1619,6 +1488,7 @@
  */
 PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
     int filters));
+#endif /* WRITE */
 
 /* Flags for png_set_filter() to say which filters to use.  The flags
  * are chosen so that they don't conflict with real filter types
@@ -1644,35 +1514,8 @@
 #define PNG_FILTER_VALUE_PAETH 4
 #define PNG_FILTER_VALUE_LAST  5
 
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
-/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
- * defines, either the default (minimum-sum-of-absolute-differences), or
- * the experimental method (weighted-minimum-sum-of-absolute-differences).
- *
- * Weights are factors >= 1.0, indicating how important it is to keep the
- * filter type consistent between rows.  Larger numbers mean the current
- * filter is that many times as likely to be the same as the "num_weights"
- * previous filters.  This is cumulative for each previous row with a weight.
- * There needs to be "num_weights" values in "filter_weights", or it can be
- * NULL if the weights aren't being specified.  Weights have no influence on
- * the selection of the first row filter.  Well chosen weights can (in theory)
- * improve the compression for a given image.
- *
- * Costs are factors >= 1.0 indicating the relative decoding costs of a
- * filter type.  Higher costs indicate more decoding expense, and are
- * therefore less likely to be selected over a filter with lower computational
- * costs.  There needs to be a value in "filter_costs" for each valid filter
- * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
- * setting the costs.  Costs try to improve the speed of decompression without
- * unduly increasing the compressed image size.
- *
- * A negative weight or cost indicates the default value is to be used, and
- * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
- * The default values for both weights and costs are currently 1.0, but may
- * change if good general weighting/cost heuristics can be found.  If both
- * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
- * to the UNWEIGHTED method, but with added encoding time/computation.
- */
+#ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
 PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
     int heuristic_method, int num_weights, png_const_doublep filter_weights,
     png_const_doublep filter_costs))
@@ -1682,15 +1525,12 @@
     png_const_fixed_point_p filter_costs))
 #endif /* WRITE_WEIGHTED_FILTER */
 
-/* Heuristic used for row filter selection.  These defines should NOT be
- * changed.
- */
+/* The following are no longer used and will be removed from libpng-1.7: */
 #define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */
 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */
 #define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
 #define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */
 
-#ifdef PNG_WRITE_SUPPORTED
 /* Set the library compression level.  Currently, valid values range from
  * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
  * (0 - no compression, 9 - "maximal" compression).  Note that tests have
@@ -1698,6 +1538,7 @@
  * for PNG images, and do considerably fewer caclulations.  In the future,
  * these values may not correspond directly to the zlib compression levels.
  */
+#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
 PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
     int level));
 
@@ -1715,7 +1556,7 @@
 
 PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
     int method));
-#endif
+#endif /* WRITE_CUSTOMIZE_COMPRESSION */
 
 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
 /* Also set zlib parameters for compressing non-IDAT chunks */
@@ -1737,6 +1578,7 @@
 PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
     int method));
 #endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
+#endif /* WRITE */
 
 /* These next functions are called for input/output, memory, and error
  * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
@@ -1847,7 +1689,7 @@
  *
  * The integer return from the callback function is interpreted thus:
  *
- * negative: An error occured, png_chunk_error will be called.
+ * negative: An error occurred; png_chunk_error will be called.
  *     zero: The chunk was not handled, the chunk will be saved. A critical
  *           chunk will cause an error at this point unless it is to be saved.
  * positive: The chunk was handled, libpng will ignore/discard it.
@@ -2692,26 +2534,28 @@
            * (png_uint_16)(alpha)                         \
            + (png_uint_16)(bg)*(png_uint_16)(255          \
            - (png_uint_16)(alpha)) + 128);                \
-       (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
+       (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
 
 #  define png_composite_16(composite, fg, alpha, bg)       \
      { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg)  \
            * (png_uint_32)(alpha)                          \
            + (png_uint_32)(bg)*(65535                      \
            - (png_uint_32)(alpha)) + 32768);               \
-       (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
+       (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
 
 #else  /* Standard method using integer division */
 
-#  define png_composite(composite, fg, alpha, bg)                          \
-     (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +  \
-     (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
-     127) / 255)
+#  define png_composite(composite, fg, alpha, bg)                        \
+     (composite) =                                                       \
+         (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) +  \
+         (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
+         127) / 255))
 
 #  define png_composite_16(composite, fg, alpha, bg)                         \
-     (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
-     (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) +         \
-     32767) / 65535)
+     (composite) =                                                           \
+         (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
+         (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) +     \
+         32767) / 65535))
 #endif /* READ_COMPOSITE_NODIV */
 
 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
@@ -2762,7 +2606,7 @@
 
 #  define PNG_get_int_32(buf) \
      ((png_int_32)((*(buf) & 0x80) \
-      ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
+      ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
       : (png_int_32)png_get_uint_32(buf)))
 
    /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
@@ -2782,10 +2626,17 @@
 #  endif
 #endif
 
-#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
-    defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
+PNG_EXPORT(242, void, png_set_check_for_invalid_index,
+    (png_structrp png_ptr, int allowed));
+#  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
+    png_const_infop info_ptr));
+#  endif
+#endif /* CHECK_FOR_INVALID_INDEX */
+
 /*******************************************************************************
- *  SIMPLIFIED API
+ * Section 5: SIMPLIFIED API
  *******************************************************************************
  *
  * Please read the documentation in libpng-manual.txt (TODO: write said
@@ -2801,8 +2652,9 @@
  *
  * To read a PNG file using the simplified API:
  *
- * 1) Declare a 'png_image' structure (see below) on the stack and set the
- *    version field to PNG_IMAGE_VERSION.
+ * 1) Declare a 'png_image' structure (see below) on the stack, set the
+ *    version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
+ *    (this is REQUIRED, your program may crash if you don't do it.)
  * 2) Call the appropriate png_image_begin_read... function.
  * 3) Set the png_image 'format' member to the required sample format.
  * 4) Allocate a buffer for the image and, if required, the color-map.
@@ -2829,6 +2681,9 @@
  * when it is being read or defines the in-memory format of an image that you
  * need to write:
  */
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
+    defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+
 #define PNG_IMAGE_VERSION 1
 
 typedef struct png_control *png_controlp;
@@ -2928,7 +2783,7 @@
  * called to read or write the color-map and set the format correctly for the
  * image data.  Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
  *
- * NOTE: libpng can be built with particular features disabled, if you see
+ * NOTE: libpng can be built with particular features disabled. If you see
  * compiler errors because the definition of one of the following flags has been
  * compiled out it is because libpng does not have the required support.  It is
  * possible, however, for the libpng configuration to enable the format on just
@@ -2940,7 +2795,7 @@
  */
 #define PNG_FORMAT_FLAG_ALPHA    0x01U /* format with an alpha channel */
 #define PNG_FORMAT_FLAG_COLOR    0x02U /* color format: otherwise grayscale */
-#define PNG_FORMAT_FLAG_LINEAR   0x04U /* 2 byte channels else 1 byte */
+#define PNG_FORMAT_FLAG_LINEAR   0x04U /* 2-byte channels else 1-byte */
 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
 
 #ifdef PNG_FORMAT_BGR_SUPPORTED
@@ -3227,9 +3082,11 @@
  *
  * With all APIs row_stride is handled as in the read APIs - it is the spacing
  * from one row to the next in component sized units (1 or 2 bytes) and if
- * negative indicates a bottom-up row layout in the buffer.
+ * negative indicates a bottom-up row layout in the buffer.  If row_stride is zero,
+ * libpng will calculate it for you from the image width and number of channels.
  *
- * Note that the write API does not support interlacing or sub-8-bit pixels.
+ * Note that the write API does not support interlacing, sub-8-bit pixels, indexed
+ * PNG (color_type 3) or most ancillary chunks.
  */
 #endif /* STDIO */
 #endif /* SIMPLIFIED_WRITE */
@@ -3238,17 +3095,8 @@
  ******************************************************************************/
 #endif /* SIMPLIFIED_{READ|WRITE} */
 
-#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
-PNG_EXPORT(242, void, png_set_check_for_invalid_index,
-    (png_structrp png_ptr, int allowed));
-#  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
-PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
-    png_const_infop info_ptr));
-#  endif
-#endif /* CHECK_FOR_INVALID_INDEX */
-
 /*******************************************************************************
- *  IMPLEMENTATION OPTIONS
+ * Section 6: IMPLEMENTATION OPTIONS
  *******************************************************************************
  *
  * Support for arbitrary implementation-specific optimizations.  The API allows
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.16,December 22, 2014
+ * libpng version 1.6.20, December 3, 2015
  *
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -39,9 +39,7 @@
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
- */
-
-/* Any machine specific code is near the front of this file, so if you
+ * Any machine specific code is near the front of this file, so if you
  * are configuring libpng for a machine, you may want to read the section
  * starting here down to where it starts to typedef png_color, png_text,
  * and png_info.
@@ -50,26 +48,6 @@
 #ifndef PNGCONF_H
 #define PNGCONF_H
 
-/* To do: Do all of this in scripts/pnglibconf.dfa */
-#ifdef PNG_SAFE_LIMITS_SUPPORTED
-#  ifdef PNG_USER_WIDTH_MAX
-#    undef PNG_USER_WIDTH_MAX
-#    define PNG_USER_WIDTH_MAX 1000000L
-#  endif
-#  ifdef PNG_USER_HEIGHT_MAX
-#    undef PNG_USER_HEIGHT_MAX
-#    define PNG_USER_HEIGHT_MAX 1000000L
-#  endif
-#  ifdef PNG_USER_CHUNK_MALLOC_MAX
-#    undef PNG_USER_CHUNK_MALLOC_MAX
-#    define PNG_USER_CHUNK_MALLOC_MAX 4000000L
-#  endif
-#  ifdef PNG_USER_CHUNK_CACHE_MAX
-#    undef PNG_USER_CHUNK_CACHE_MAX
-#    define PNG_USER_CHUNK_CACHE_MAX 128
-#  endif
-#endif
-
 #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
 
 /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
@@ -113,7 +91,7 @@
  */
 #define PNG_CONST const /* backward compatibility only */
 
-/* This controls optimization of the reading of 16 and 32 bit values
+/* This controls optimization of the reading of 16-bit and 32-bit values
  * from PNG files.  It can be set on a per-app-file basis - it
  * just changes whether a macro is used when the function is called.
  * The library builder sets the default; if read functions are not
@@ -345,11 +323,11 @@
     * table entries, so we discard it here.  See the .dfn files in the
     * scripts directory.
     */
+
 #ifndef PNG_EXPORTA
-
-#  define PNG_EXPORTA(ordinal, type, name, args, attributes)\
-      PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
-        extern attributes)
+#  define PNG_EXPORTA(ordinal, type, name, args, attributes) \
+      PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
+      PNG_LINKAGE_API attributes)
 #endif
 
 /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
@@ -357,7 +335,7 @@
  */
 #define PNG_EMPTY /*empty list*/
 
-#define PNG_EXPORT(ordinal, type, name, args)\
+#define PNG_EXPORT(ordinal, type, name, args) \
    PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
 
 /* Use PNG_REMOVED to comment out a removed interface. */
@@ -530,7 +508,7 @@
 #if CHAR_BIT == 8 && UCHAR_MAX == 255
    typedef unsigned char png_byte;
 #else
-#  error "libpng requires 8 bit bytes"
+#  error "libpng requires 8-bit bytes"
 #endif
 
 #if INT_MIN == -32768 && INT_MAX == 32767
@@ -538,7 +516,7 @@
 #elif SHRT_MIN == -32768 && SHRT_MAX == 32767
    typedef short png_int_16;
 #else
-#  error "libpng requires a signed 16 bit type"
+#  error "libpng requires a signed 16-bit type"
 #endif
 
 #if UINT_MAX == 65535
@@ -546,7 +524,7 @@
 #elif USHRT_MAX == 65535
    typedef unsigned short png_uint_16;
 #else
-#  error "libpng requires an unsigned 16 bit type"
+#  error "libpng requires an unsigned 16-bit type"
 #endif
 
 #if INT_MIN < -2147483646 && INT_MAX > 2147483646
@@ -554,7 +532,7 @@
 #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
    typedef long int png_int_32;
 #else
-#  error "libpng requires a signed 32 bit (or more) type"
+#  error "libpng requires a signed 32-bit (or more) type"
 #endif
 
 #if UINT_MAX > 4294967294
@@ -562,7 +540,7 @@
 #elif ULONG_MAX > 4294967294
    typedef unsigned long int png_uint_32;
 #else
-#  error "libpng requires an unsigned 32 bit (or more) type"
+#  error "libpng requires an unsigned 32-bit (or more) type"
 #endif
 
 /* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,12 +29,11 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
+ * Last changed in libpng 1.6.8 [December 19, 2013]
  * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
- * Last changed in libpng 1.6.8 [December 19, 2013]
- *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -827,14 +827,20 @@
 {
    png_debug1(1, "in %s retrieval function", "IHDR");
 
-   if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
-       height == NULL || bit_depth == NULL || color_type == NULL)
+   if (png_ptr == NULL || info_ptr == NULL)
       return (0);
 
-   *width = info_ptr->width;
-   *height = info_ptr->height;
-   *bit_depth = info_ptr->bit_depth;
-   *color_type = info_ptr->color_type;
+   if (width != NULL)
+       *width = info_ptr->width;
+
+   if (height != NULL)
+       *height = info_ptr->height;
+
+   if (bit_depth != NULL)
+       *bit_depth = info_ptr->bit_depth;
+
+   if (color_type != NULL)
+       *color_type = info_ptr->color_type;
 
    if (compression_type != NULL)
       *compression_type = info_ptr->compression_type;
@@ -1163,21 +1169,21 @@
    if (png_ptr == NULL)
       return 0;
 
-#  ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_SUPPORTED
       if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
-#  endif
+#endif
    {
-#     ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
          return png_ptr->IDAT_read_size;
-#     else
+#else
          return PNG_IDAT_READ_SIZE;
-#     endif
+#endif
    }
 
-#  ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_SUPPORTED
       else
          return png_ptr->zbuffer_size;
-#  endif
+#endif
 }
 
 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,12 +29,11 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
+ * Last changed in libpng 1.6.1 [March 28, 2013]
  * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
- * Last changed in libpng 1.6.1 [March 28, 2013]
- *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  * file and, per its terms, should not be removed:
  */
 
-/* libpng version 1.6.16,December 22, 2014 */
+/* libpng version 1.6.20, December 3, 2015 */
 
 /* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
 
@@ -129,13 +129,10 @@
 #define PNG_READ_tIME_SUPPORTED
 #define PNG_READ_tRNS_SUPPORTED
 #define PNG_READ_zTXt_SUPPORTED
-/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
 /*#undef PNG_SAVE_INT_32_SUPPORTED*/
 #define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
 #define PNG_SEQUENTIAL_READ_SUPPORTED
 #define PNG_SETJMP_SUPPORTED
-#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
-#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
 #define PNG_SET_OPTION_SUPPORTED
 #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
 #define PNG_SET_USER_LIMITS_SUPPORTED
@@ -161,6 +158,7 @@
 /*#undef PNG_WRITE_BGR_SUPPORTED*/
 /*#undef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED*/
 /*#undef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED*/
+/*#undef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED*/
 /*#undef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED*/
 /*#undef PNG_WRITE_FILLER_SUPPORTED*/
 /*#undef PNG_WRITE_FILTER_SUPPORTED*/
@@ -219,11 +217,14 @@
 /* end of options */
 /* settings */
 #define PNG_API_RULE 0
-#define PNG_COST_SHIFT 3
 #define PNG_DEFAULT_READ_MACROS 1
 #define PNG_GAMMA_THRESHOLD_FIXED 5000
 #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
 #define PNG_INFLATE_BUF_SIZE 1024
+#define PNG_LINKAGE_API extern
+#define PNG_LINKAGE_CALLBACK extern
+#define PNG_LINKAGE_DATA extern
+#define PNG_LINKAGE_FUNCTION extern
 #define PNG_MAX_GAMMA_8 11
 #define PNG_QUANTIZE_BLUE_BITS 5
 #define PNG_QUANTIZE_GREEN_BITS 5
@@ -234,7 +235,6 @@
 #define PNG_USER_CHUNK_MALLOC_MAX 0
 #define PNG_USER_HEIGHT_MAX 1000000
 #define PNG_USER_WIDTH_MAX 1000000
-#define PNG_WEIGHT_SHIFT 8
 #define PNG_ZBUF_SIZE 8192
 #define PNG_ZLIB_VERNUM 0
 #define PNG_Z_DEFAULT_COMPRESSION (-1)
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c	Tue Jan 26 09:11:58 2016 +0100
@@ -69,7 +69,7 @@
 }
 
 /* Allocate memory.  For reasonable files, size should never exceed
- * 64K.  However, zlib may allocate more then 64K if you don't tell
+ * 64K.  However, zlib may allocate more than 64K if you don't tell
  * it not to.  See zconf.h and png.h for more information.  zlib does
  * need to allocate exactly 64K, so whatever you call here must
  * have the ability to do that.
@@ -105,6 +105,9 @@
    PNG_UNUSED(png_ptr)
 #endif
 
+   /* Some compilers complain that this is always true.  However, it
+    * can be false when integer overflow happens.
+    */
    if (size > 0 && size <= PNG_SIZE_MAX
 #     ifdef PNG_MAX_MALLOC_64K
          && size <= 65536U
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -47,7 +47,6 @@
 #define PNG_READ_SIG_MODE   0
 #define PNG_READ_CHUNK_MODE 1
 #define PNG_READ_IDAT_MODE  2
-#define PNG_SKIP_MODE       3
 #define PNG_READ_tEXt_MODE  4
 #define PNG_READ_zTXt_MODE  5
 #define PNG_READ_DONE_MODE  6
@@ -106,32 +105,14 @@
 png_uint_32 PNGAPI
 png_process_data_skip(png_structrp png_ptr)
 {
-   png_uint_32 remaining = 0;
-
-   if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE &&
-      png_ptr->skip_length > 0)
-   {
-      /* At the end of png_process_data the buffer size must be 0 (see the loop
-       * above) so we can detect a broken call here:
-       */
-      if (png_ptr->buffer_size != 0)
-         png_error(png_ptr,
-            "png_process_data_skip called inside png_process_data");
-
-      /* If is impossible for there to be a saved buffer at this point -
-       * otherwise we could not be in SKIP mode.  This will also happen if
-       * png_process_skip is called inside png_process_data (but only very
-       * rarely.)
-       */
-      if (png_ptr->save_buffer_size != 0)
-         png_error(png_ptr, "png_process_data_skip called with saved data");
-
-      remaining = png_ptr->skip_length;
-      png_ptr->skip_length = 0;
-      png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-   }
-
-   return remaining;
+  /* TODO: Deprecate and remove this API.
+   * Somewhere the implementation of this seems to have been lost,
+   * or abandoned.  It was only to support some internal back-door access
+   * to png_struct) in libpng-1.4.x.
+   */
+   png_app_warning(png_ptr,
+"png_process_data_skip is not implemented in any current version of libpng");
+   return 0;
 }
 
 /* What we do with the incoming data depends on what we were previously
@@ -163,12 +144,6 @@
          break;
       }
 
-      case PNG_SKIP_MODE:
-      {
-         png_push_crc_finish(png_ptr);
-         break;
-      }
-
       default:
       {
          png_ptr->buffer_size = 0;
@@ -187,7 +162,7 @@
 png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
 {
    png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
-             num_to_check = 8 - num_checked;
+       num_to_check = 8 - num_checked;
 
    if (png_ptr->buffer_size < num_to_check)
    {
@@ -467,69 +442,6 @@
    png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
 }
 
-void /* PRIVATE */
-png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
-{
-   png_ptr->process_mode = PNG_SKIP_MODE;
-   png_ptr->skip_length = skip;
-}
-
-void /* PRIVATE */
-png_push_crc_finish(png_structrp png_ptr)
-{
-   if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
-   {
-      png_size_t save_size = png_ptr->save_buffer_size;
-      png_uint_32 skip_length = png_ptr->skip_length;
-
-      /* We want the smaller of 'skip_length' and 'save_buffer_size', but
-       * they are of different types and we don't know which variable has the
-       * fewest bits.  Carefully select the smaller and cast it to the type of
-       * the larger - this cannot overflow.  Do not cast in the following test
-       * - it will break on either 16 or 64 bit platforms.
-       */
-      if (skip_length < save_size)
-         save_size = (png_size_t)skip_length;
-
-      else
-         skip_length = (png_uint_32)save_size;
-
-      png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
-
-      png_ptr->skip_length -= skip_length;
-      png_ptr->buffer_size -= save_size;
-      png_ptr->save_buffer_size -= save_size;
-      png_ptr->save_buffer_ptr += save_size;
-   }
-   if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
-   {
-      png_size_t save_size = png_ptr->current_buffer_size;
-      png_uint_32 skip_length = png_ptr->skip_length;
-
-      /* We want the smaller of 'skip_length' and 'current_buffer_size', here,
-       * the same problem exists as above and the same solution.
-       */
-      if (skip_length < save_size)
-         save_size = (png_size_t)skip_length;
-
-      else
-         skip_length = (png_uint_32)save_size;
-
-      png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
-
-      png_ptr->skip_length -= skip_length;
-      png_ptr->buffer_size -= save_size;
-      png_ptr->current_buffer_size -= save_size;
-      png_ptr->current_buffer_ptr += save_size;
-   }
-   if (png_ptr->skip_length == 0)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_LT(4)
-      png_crc_finish(png_ptr, 0);
-      png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-   }
-}
-
 void PNGCBAPI
 png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
 {
@@ -612,13 +524,11 @@
       if (png_ptr->save_buffer == NULL)
       {
          png_free(png_ptr, old_buffer);
-         old_buffer = NULL;
          png_error(png_ptr, "Insufficient memory for save_buffer");
       }
 
       memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
       png_free(png_ptr, old_buffer);
-      old_buffer = NULL;
       png_ptr->save_buffer_max = new_max;
    }
    if (png_ptr->current_buffer_size)
@@ -681,7 +591,7 @@
        * are of different types and we don't know which variable has the fewest
        * bits.  Carefully select the smaller and cast it to the type of the
        * larger - this cannot overflow.  Do not cast in the following test - it
-       * will break on either 16 or 64 bit platforms.
+       * will break on either 16-bit or 64-bit platforms.
        */
       if (idat_size < save_size)
          save_size = (png_size_t)idat_size;
@@ -724,6 +634,7 @@
       png_ptr->current_buffer_size -= save_size;
       png_ptr->current_buffer_ptr += save_size;
    }
+
    if (png_ptr->idat_size == 0)
    {
       PNG_PUSH_SAVE_BUFFER_IF_LT(4)
@@ -754,7 +665,7 @@
     * or the stream marked as finished.
     */
    while (png_ptr->zstream.avail_in > 0 &&
-      !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+      (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
    {
       int ret;
 
@@ -779,7 +690,7 @@
        * change the current behavior (see comments in inflate.c
        * for why this doesn't happen at present with zlib 1.2.5).
        */
-      ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH);
+      ret = PNG_INFLATE(png_ptr, Z_SYNC_FLUSH);
 
       /* Check for any failure before proceeding. */
       if (ret != Z_OK && ret != Z_STREAM_END)
@@ -1064,6 +975,7 @@
       }
    }
    else
+#endif
    {
       png_push_have_row(png_ptr, png_ptr->row_buf + 1);
       png_read_push_finish_row(png_ptr);
@@ -1073,6 +985,7 @@
 void /* PRIVATE */
 png_read_push_finish_row(png_structrp png_ptr)
 {
+#ifdef PNG_READ_INTERLACING_SUPPORTED
    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 
    /* Start of interlace block */
@@ -1097,6 +1010,7 @@
    if (png_ptr->row_number < png_ptr->num_rows)
       return;
 
+#ifdef PNG_READ_INTERLACING_SUPPORTED
    if (png_ptr->interlaced != 0)
    {
       png_ptr->row_number = 0;
@@ -1131,6 +1045,7 @@
 
       } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
    }
+#endif /* READ_INTERLACING */
 }
 
 void /* PRIVATE */
@@ -1155,6 +1070,7 @@
          (int)png_ptr->pass);
 }
 
+#ifdef PNG_READ_INTERLACING_SUPPORTED
 void PNGAPI
 png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
     png_const_bytep new_row)
@@ -1169,6 +1085,7 @@
    if (new_row != NULL)
       png_combine_row(png_ptr, old_row, 1/*blocky display*/);
 }
+#endif /* READ_INTERLACING */
 
 void PNGAPI
 png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,13 +29,11 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
- * Last changed in libpng 1.6.10 [March 6, 1014]]
- *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
@@ -148,8 +146,12 @@
     * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
     * off.
     *
-    * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
-    * check both variants.
+    * Note that gcc-4.9 defines __ARM_NEON instead of the deprecated
+    * __ARM_NEON__, so we check both variants.
+    *
+    * To disable ARM_NEON optimizations entirely, and skip compiling the
+    * associated assembler code, pass --enable-arm-neon=no to configure
+    * or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.
     */
 #  if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
    defined(PNG_ALIGNED_MEMORY_SUPPORTED)
@@ -278,17 +280,18 @@
  * always be used to declare an extern data or function object in this file.
  */
 #ifndef PNG_INTERNAL_DATA
-#  define PNG_INTERNAL_DATA(type, name, array) extern type name array
+#  define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array
 #endif
 
 #ifndef PNG_INTERNAL_FUNCTION
 #  define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
-      extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
+      PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
 #endif
 
 #ifndef PNG_INTERNAL_CALLBACK
 #  define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
-      extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
+      PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\
+         PNG_EMPTY attributes)
 #endif
 
 /* If floating or fixed point APIs are disabled they may still be compiled
@@ -326,48 +329,27 @@
 #  define PNG_DLL_EXPORT
 #endif
 
+/* This is a global switch to set the compilation for an installed system
+ * (a release build).  It can be set for testing debug builds to ensure that
+ * they will compile when the build type is switched to RC or STABLE, the
+ * default is just to use PNG_LIBPNG_BUILD_BASE_TYPE.  Set this in CPPFLAGS
+ * with either:
+ *
+ *   -DPNG_RELEASE_BUILD Turns on the release compile path
+ *   -DPNG_RELEASE_BUILD=0 Turns it off
+ * or in your pngusr.h with
+ *   #define PNG_RELEASE_BUILD=1 Turns on the release compile path
+ *   #define PNG_RELEASE_BUILD=0 Turns it off
+ */
+#ifndef PNG_RELEASE_BUILD
+#  define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
+#endif
+
 /* SECURITY and SAFETY:
  *
- * By default libpng is built without any internal limits on image size,
- * individual heap (png_malloc) allocations or the total amount of memory used.
- * If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used
- * (unless individually overridden).  These limits are believed to be fairly
- * safe, but builders of secure systems should verify the values against the
- * real system capabilities.
- */
-#ifdef PNG_SAFE_LIMITS_SUPPORTED
-   /* 'safe' limits */
-#  ifndef PNG_USER_WIDTH_MAX
-#     define PNG_USER_WIDTH_MAX 1000000
-#  endif
-#  ifndef PNG_USER_HEIGHT_MAX
-#     define PNG_USER_HEIGHT_MAX 1000000
-#  endif
-#  ifndef PNG_USER_CHUNK_CACHE_MAX
-#     define PNG_USER_CHUNK_CACHE_MAX 128
-#  endif
-#  ifndef PNG_USER_CHUNK_MALLOC_MAX
-#     define PNG_USER_CHUNK_MALLOC_MAX 8000000
-#  endif
-#else
-   /* values for no limits */
-#  ifndef PNG_USER_WIDTH_MAX
-#     define PNG_USER_WIDTH_MAX 0x7fffffff
-#  endif
-#  ifndef PNG_USER_HEIGHT_MAX
-#     define PNG_USER_HEIGHT_MAX 0x7fffffff
-#  endif
-#  ifndef PNG_USER_CHUNK_CACHE_MAX
-#     define PNG_USER_CHUNK_CACHE_MAX 0
-#  endif
-#  ifndef PNG_USER_CHUNK_MALLOC_MAX
-#     define PNG_USER_CHUNK_MALLOC_MAX 0
-#  endif
-#endif
-
-/* Moved to pngpriv.h at libpng-1.5.0 */
-/* NOTE: some of these may have been used in external applications as
- * these definitions were exposed in pngconf.h prior to 1.5.
+ * libpng is built with support for internal limits on image dimensions and
+ * memory usage.  These are documented in scripts/pnglibconf.dfa of the
+ * source and recorded in the machine generated header file pnglibconf.h.
  */
 
 /* If you are running on a machine where you cannot allocate more
@@ -610,21 +592,17 @@
 #define PNG_RGB_TO_GRAY_WARN  0x400000
 #define PNG_RGB_TO_GRAY       0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
 #define PNG_ENCODE_ALPHA      0x800000 /* Added to libpng-1.5.4 */
-#define PNG_ADD_ALPHA         0x1000000 /* Added to libpng-1.2.7 */
-#define PNG_EXPAND_tRNS       0x2000000 /* Added to libpng-1.2.9 */
-#define PNG_SCALE_16_TO_8     0x4000000 /* Added to libpng-1.5.4 */
-                       /*   0x8000000 unused */
-                       /*  0x10000000 unused */
-                       /*  0x20000000 unused */
-                       /*  0x40000000 unused */
+#define PNG_ADD_ALPHA        0x1000000 /* Added to libpng-1.2.7 */
+#define PNG_EXPAND_tRNS      0x2000000 /* Added to libpng-1.2.9 */
+#define PNG_SCALE_16_TO_8    0x4000000 /* Added to libpng-1.5.4 */
+                       /*    0x8000000 unused */
+                       /*   0x10000000 unused */
+                       /*   0x20000000 unused */
+                       /*   0x40000000 unused */
 /* Flags for png_create_struct */
 #define PNG_STRUCT_PNG   0x0001
 #define PNG_STRUCT_INFO  0x0002
 
-/* Scaling factor for filter heuristic weighting calculations */
-#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
-#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
-
 /* Flags for the png_ptr->flags rather than declaring a byte for each one */
 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
 #define PNG_FLAG_ZSTREAM_INITIALIZED      0x0002 /* Added to libpng-1.6.0 */
@@ -715,7 +693,7 @@
 /* The fixed point conversion performs range checking and evaluates
  * its argument multiple times, so must be used with care.  The
  * range checking uses the PNG specification values for a signed
- * 32 bit fixed point value except that the values are deliberately
+ * 32-bit fixed point value except that the values are deliberately
  * rounded-to-zero to an integral value - 21474 (21474.83 is roughly
  * (2^31-1) * 100000). 's' is a string that describes the value being
  * converted.
@@ -808,15 +786,17 @@
  * macro will fail on top-bit-set values because of the sign extension.
  */
 #define PNG_CHUNK_FROM_STRING(s)\
-   PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
+   PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
 
 /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
  * signed and the argument is a (char[])  This macro will fail miserably on
  * systems where (char) is more than 8 bits.
  */
 #define PNG_STRING_FROM_CHUNK(s,c)\
-   (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\
-   ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c)))
+   (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
+   ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
+   ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
+   ((char*)(s))[3]=(char)((c & 0xff)))
 
 /* Do the same but terminate with a null character. */
 #define PNG_CSTRING_FROM_CHUNK(s,c)\
@@ -860,7 +840,7 @@
     */
 #endif
 
-/* This is used for 16 bit gamma tables -- only the top level pointers are
+/* This is used for 16-bit gamma tables -- only the top level pointers are
  * const; this could be changed:
  */
 typedef const png_uint_16p * png_const_uint_16pp;
@@ -878,8 +858,9 @@
 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
 PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
 
-#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
-   ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
+#define PNG_sRGB_FROM_LINEAR(linear) \
+  ((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \
+   + ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)))
    /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
     * encoded value with maximum error 0.646365.  Note that the input is not a
     * 16-bit value; it has been multiplied by 255! */
@@ -1262,6 +1243,14 @@
 /* Initialize the row buffers, etc. */
 PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
 
+#if PNG_ZLIB_VERNUM >= 0x1240
+PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
+      PNG_EMPTY);
+#  define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
+#else /* Zlib < 1.2.4 */
+#  define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
+#endif /* Zlib < 1.2.4 */
+
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
 /* Optional call to update the users info structure */
 PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
@@ -1436,10 +1425,6 @@
 PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
     png_inforp info_ptr),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr,
-    png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr),
-    PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
     PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -91,7 +91,7 @@
          /* In stable builds only warn if an application error can be completely
           * handled.
           */
-#        if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#        if PNG_RELEASE_BUILD
             png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
 #        endif
 #     endif
@@ -842,8 +842,7 @@
          /* Zero length IDATs are legal after the last IDAT has been
           * read, but not after other chunks have been read.
           */
-         if ((length > 0) ||
-             (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+         if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
             png_benign_error(png_ptr, "Too many IDATs found");
 
          png_crc_finish(png_ptr, length);
@@ -1072,9 +1071,9 @@
    /* Tell libpng to strip 16-bit/color files down to 8 bits per color.
     */
    if ((transforms & PNG_TRANSFORM_SCALE_16) != 0)
-     /* Added at libpng-1.5.4. "strip_16" produces the same result that it
-      * did in earlier versions, while "scale_16" is now more accurate.
-      */
+      /* Added at libpng-1.5.4. "strip_16" produces the same result that it
+       * did in earlier versions, while "scale_16" is now more accurate.
+       */
 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
       png_set_scale_16(png_ptr);
 #else
@@ -1238,7 +1237,7 @@
 
       for (iptr = 0; iptr < info_ptr->height; iptr++)
          info_ptr->row_pointers[iptr] = png_voidcast(png_bytep,
-            png_malloc(png_ptr, info_ptr->rowbytes));
+             png_malloc(png_ptr, info_ptr->rowbytes));
    }
 
    png_read_image(png_ptr, info_ptr->row_pointers);
@@ -1712,10 +1711,11 @@
          value *= 257;
          break;
 
+#ifdef __GNUC__
       default:
          png_error(display->image->opaque->png_ptr,
             "unexpected encoding (internal error)");
-         break;
+#endif
    }
 
    return value;
@@ -1852,6 +1852,7 @@
             y = (y + 128) >> 8;
             y *= 255;
             y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
+            alpha = PNG_DIV257(alpha);
             encoding = P_sRGB;
          }
 
@@ -2314,8 +2315,14 @@
                      output_processing = PNG_CMAP_NONE;
                      break;
                   }
-
+#ifdef __COVERITY__
+                 /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
+                  * here.
+                  */
+                  back_alpha = 255;
+#else
                   back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
+#endif
                }
 
                /* output_processing means that the libpng-processed row will be
@@ -2440,7 +2447,14 @@
                 */
                background_index = i;
                png_create_colormap_entry(display, i++, back_r, back_g, back_b,
-                  output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
+#ifdef __COVERITY__
+                 /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
+                  * here.
+                  */ 255U,
+#else
+                  output_encoding == P_LINEAR ? 65535U : 255U,
+#endif
+                  output_encoding);
 
                /* For non-opaque input composite on the sRGB background - this
                 * requires inverting the encoding for each component.  The input
@@ -2852,7 +2866,6 @@
       default:
          png_error(png_ptr, "invalid PNG color type");
          /*NOT REACHED*/
-         break;
    }
 
    /* Now deal with the output processing */
@@ -2862,10 +2875,6 @@
 
    switch (data_encoding)
    {
-      default:
-         png_error(png_ptr, "bad data option (internal error)");
-         break;
-
       case P_sRGB:
          /* Change to 8-bit sRGB */
          png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
@@ -2875,6 +2884,11 @@
          if (png_ptr->bit_depth > 8)
             png_set_scale_16(png_ptr);
          break;
+
+#ifdef __GNUC__
+      default:
+         png_error(png_ptr, "bad data option (internal error)");
+#endif
    }
 
    if (cmap_entries > 256 || cmap_entries > image->colormap_entries)
@@ -3274,7 +3288,7 @@
       png_uint_32  width = image->width;
       ptrdiff_t    step_row = display->row_bytes;
       unsigned int channels =
-         (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
+          (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
       int pass;
 
       for (pass = 0; pass < passes; ++pass)
@@ -3425,10 +3439,6 @@
     */
    switch (info_ptr->bit_depth)
    {
-      default:
-         png_error(png_ptr, "unexpected bit depth");
-         break;
-
       case 8:
          /* 8-bit sRGB gray values with an alpha channel; the alpha channel is
           * to be removed by composing on a background: either the row if
@@ -3646,6 +3656,11 @@
             }
          }
          break;
+
+#ifdef __GNUC__
+      default:
+         png_error(png_ptr, "unexpected bit depth");
+#endif
    }
 
    return 1;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -54,7 +54,7 @@
  * reads from a file pointer.  Note that this routine sometimes gets called
  * with very small lengths, so you should implement some kind of simple
  * buffering if you are using unbuffered reads.  This should never be asked
- * to read more then 64K on a 16 bit machine.
+ * to read more than 64K on a 16-bit machine.
  */
 void /* PRIVATE */
 png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -422,7 +422,7 @@
 /* Dither file to 8-bit.  Supply a palette, the current number
  * of elements in the palette, the maximum number of elements
  * allowed, and a histogram if possible.  If the current number
- * of colors is greater then the maximum number, the palette will be
+ * of colors is greater than the maximum number, the palette will be
  * modified to fit in the maximum number.  "full_quantize" indicates
  * whether we need a quantizing cube set up for RGB images, or if we
  * simply are reducing the number of colors in a paletted image.
@@ -1004,7 +1004,6 @@
 
       default:
          png_error(png_ptr, "invalid error action to rgb_to_gray");
-         break;
    }
 
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -2025,7 +2024,7 @@
 #     endif
 
 #  else
-      /* No 16 bit support: force chopping 16-bit input down to 8, in this case
+      /* No 16-bit support: force chopping 16-bit input down to 8, in this case
        * the app program can chose if both APIs are available by setting the
        * correct scaling to use.
        */
@@ -2126,10 +2125,10 @@
 defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
    {
-      if (info_ptr->bit_depth < png_ptr->user_transform_depth)
+      if (png_ptr->user_transform_depth != 0)
          info_ptr->bit_depth = png_ptr->user_transform_depth;
 
-      if (info_ptr->channels < png_ptr->user_transform_channels)
+      if (png_ptr->user_transform_channels != 0)
          info_ptr->channels = png_ptr->user_transform_channels;
    }
 #endif
@@ -2385,7 +2384,7 @@
                if (++channel >= channels)
                   channel = 0;
                *bp++ = (png_byte)(value >> 8);
-               *bp++ = (png_byte)(value & 0xff);
+               *bp++ = (png_byte)value;
             }
             break;
          }
@@ -2410,8 +2409,8 @@
 
       while (sp < ep)
       {
-         /* The input is an array of 16 bit components, these must be scaled to
-          * 8 bits each.  For a 16 bit value V the required value (from the PNG
+         /* The input is an array of 16-bit components, these must be scaled to
+          * 8 bits each.  For a 16-bit value V the required value (from the PNG
           * specification) is:
           *
           *    (V * 255) / 65535
@@ -2432,7 +2431,7 @@
           *
           * The approximate differs from the exact answer only when (vlo-vhi) is
           * 128; it then gives a correction of +1 when the exact correction is
-          * 0.  This gives 128 errors.  The exact answer (correct for all 16 bit
+          * 0.  This gives 128 errors.  The exact answer (correct for all 16-bit
           * input values) is:
           *
           *    error = (vlo-vhi+128)*65535 >> 24;
@@ -2690,9 +2689,9 @@
    png_uint_32 row_width = row_info->width;
 
 #ifdef PNG_READ_16BIT_SUPPORTED
-   png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
+   png_byte hi_filler = (png_byte)(filler>>8);
 #endif
-   png_byte lo_filler = (png_byte)(filler & 0xff);
+   png_byte lo_filler = (png_byte)filler;
 
    png_debug(1, "in png_do_read_filler");
 
@@ -2743,13 +2742,13 @@
             png_bytep dp = sp  + (png_size_t)row_width * 2;
             for (i = 1; i < row_width; i++)
             {
+               *(--dp) = lo_filler;
                *(--dp) = hi_filler;
-               *(--dp) = lo_filler;
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
             }
+            *(--dp) = lo_filler;
             *(--dp) = hi_filler;
-            *(--dp) = lo_filler;
             row_info->channels = 2;
             row_info->pixel_depth = 32;
             row_info->rowbytes = row_width * 4;
@@ -2764,8 +2763,8 @@
             {
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
+               *(--dp) = lo_filler;
                *(--dp) = hi_filler;
-               *(--dp) = lo_filler;
             }
             row_info->channels = 2;
             row_info->pixel_depth = 32;
@@ -2824,8 +2823,8 @@
             png_bytep dp = sp  + (png_size_t)row_width * 2;
             for (i = 1; i < row_width; i++)
             {
+               *(--dp) = lo_filler;
                *(--dp) = hi_filler;
-               *(--dp) = lo_filler;
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
@@ -2833,8 +2832,8 @@
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
             }
+            *(--dp) = lo_filler;
             *(--dp) = hi_filler;
-            *(--dp) = lo_filler;
             row_info->channels = 4;
             row_info->pixel_depth = 64;
             row_info->rowbytes = row_width * 8;
@@ -2853,8 +2852,8 @@
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
                *(--dp) = *(--sp);
+               *(--dp) = lo_filler;
                *(--dp) = hi_filler;
-               *(--dp) = lo_filler;
             }
 
             row_info->channels = 4;
@@ -3115,10 +3114,11 @@
             for (i = 0; i < row_width; i++)
             {
                png_uint_16 red, green, blue, w;
-
-               red   = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
-               green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
-               blue  = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
+               png_byte hi,lo;
+
+               hi=*(sp)++; lo=*(sp)++; red   = (png_uint_16)((hi << 8) | (lo));
+               hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
+               hi=*(sp)++; lo=*(sp)++; blue  = (png_uint_16)((hi << 8) | (lo));
 
                if (red == green && red == blue)
                {
@@ -3132,16 +3132,16 @@
 
                else
                {
-                  png_uint_16 red_1   = png_ptr->gamma_16_to_1[(red&0xff)
+                  png_uint_16 red_1   = png_ptr->gamma_16_to_1[(red & 0xff)
                       >> png_ptr->gamma_shift][red>>8];
                   png_uint_16 green_1 =
-                      png_ptr->gamma_16_to_1[(green&0xff) >>
+                      png_ptr->gamma_16_to_1[(green & 0xff) >>
                       png_ptr->gamma_shift][green>>8];
-                  png_uint_16 blue_1  = png_ptr->gamma_16_to_1[(blue&0xff)
+                  png_uint_16 blue_1  = png_ptr->gamma_16_to_1[(blue & 0xff)
                       >> png_ptr->gamma_shift][blue>>8];
                   png_uint_16 gray16  = (png_uint_16)((rc*red_1 + gc*green_1
                       + bc*blue_1 + 16384)>>15);
-                  w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
+                  w = png_ptr->gamma_16_from_1[(gray16 & 0xff) >>
                       png_ptr->gamma_shift][gray16 >> 8];
                   rgb_error |= 1;
                }
@@ -3166,17 +3166,18 @@
             for (i = 0; i < row_width; i++)
             {
                png_uint_16 red, green, blue, gray16;
-
-               red   = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
-               green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
-               blue  = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
+               png_byte hi,lo;
+
+               hi=*(sp)++; lo=*(sp)++; red   = (png_uint_16)((hi << 8) | (lo));
+               hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
+               hi=*(sp)++; lo=*(sp)++; blue  = (png_uint_16)((hi << 8) | (lo));
 
                if (red != green || red != blue)
                   rgb_error |= 1;
 
-               /* From 1.5.5 in the 16 bit case do the accurate conversion even
+               /* From 1.5.5 in the 16-bit case do the accurate conversion even
                 * in the 'fast' case - this is because this is where the code
-                * ends up when handling linear 16 bit data.
+                * ends up when handling linear 16-bit data.
                 */
                gray16  = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
                   15);
@@ -3341,7 +3342,7 @@
                         if ((png_uint_16)((*sp >> shift) & 0x0f)
                             == png_ptr->trans_color.gray)
                         {
-                           unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
                            tmp |= png_ptr->background.gray << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
@@ -3351,7 +3352,7 @@
                            unsigned int p = (*sp >> shift) & 0x0f;
                            unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
                               0x0f;
-                           unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
                            tmp |= g << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
@@ -3377,7 +3378,7 @@
                         if ((png_uint_16)((*sp >> shift) & 0x0f)
                             == png_ptr->trans_color.gray)
                         {
-                           unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+                           unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
                            tmp |= png_ptr->background.gray << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
@@ -3695,7 +3696,8 @@
                         if (optimize != 0)
                            w = v;
                         else
-                           w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
+                           w = gamma_16_from_1[(v & 0xff) >>
+                               gamma_shift][v >> 8];
                         *sp = (png_byte)((w >> 8) & 0xff);
                         *(sp + 1) = (png_byte)(w & 0xff);
                      }
@@ -3859,7 +3861,7 @@
                         v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
                         png_composite_16(w, v, a, png_ptr->background_1.red);
                         if (optimize == 0)
-                           w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
                                 8];
                         *sp = (png_byte)((w >> 8) & 0xff);
                         *(sp + 1) = (png_byte)(w & 0xff);
@@ -3867,7 +3869,7 @@
                         v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
                         png_composite_16(w, v, a, png_ptr->background_1.green);
                         if (optimize == 0)
-                           w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
                                 8];
 
                         *(sp + 2) = (png_byte)((w >> 8) & 0xff);
@@ -3876,7 +3878,7 @@
                         v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
                         png_composite_16(w, v, a, png_ptr->background_1.blue);
                         if (optimize == 0)
-                           w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+                           w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
                                 8];
 
                         *(sp + 4) = (png_byte)((w >> 8) & 0xff);
@@ -4485,7 +4487,7 @@
 
                for (i = 0; i < row_width; i++)
                {
-                  if (*sp == gray)
+                  if ((*sp & 0xffU) == gray)
                      *dp-- = 0;
 
                   else
@@ -4503,7 +4505,8 @@
                dp = row + (row_info->rowbytes << 1) - 1;
                for (i = 0; i < row_width; i++)
                {
-                  if (*(sp - 1) == gray_high && *(sp) == gray_low)
+                  if ((*(sp - 1) & 0xffU) == gray_high &&
+                      (*(sp) & 0xffU) == gray_low)
                   {
                      *dp-- = 0;
                      *dp-- = 0;
@@ -4865,7 +4868,7 @@
       /* Because PNG_COMPOSE does the gamma transform if there is something to
        * do (if there is an alpha channel or transparency.)
        */
-       !((png_ptr->transformations & PNG_COMPOSE) &&
+       !((png_ptr->transformations & PNG_COMPOSE) != 0 &&
        ((png_ptr->num_trans != 0) ||
        (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)) &&
 #endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.20 [December 3, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -117,7 +117,13 @@
       return uval;
 
    uval = (uval ^ 0xffffffff) + 1;  /* 2's complement: -x = ~x+1 */
-   return -(png_int_32)uval;
+   if ((uval & 0x80000000) == 0) /* no overflow */
+       return -(png_int_32)uval;
+   /* The following has to be safe; this function only gets called on PNG data
+    * and if we get here that data is invalid.  0 is the most safe value and
+    * if not then an attacker would surely just generate a PNG with 0 instead.
+    */
+   return 0;
 }
 
 /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
@@ -126,7 +132,7 @@
 {
    /* ANSI-C requires an int value to accomodate at least 16 bits so this
     * works and allows the compiler not to worry about possible narrowing
-    * on 32 bit systems.  (Pre-ANSI systems did not make integers smaller
+    * on 32-bit systems.  (Pre-ANSI systems did not make integers smaller
     * than 16 bits either.)
     */
    unsigned int val =
@@ -369,7 +375,7 @@
        * are minimal.
        */
       (void)png_safecat(msg, (sizeof msg), 4, " using zstream");
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
       png_chunk_warning(png_ptr, msg);
       png_ptr->zowner = 0;
 #else
@@ -399,10 +405,16 @@
 
       if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
           PNG_OPTION_ON)
+      {
          window_bits = 15;
+         png_ptr->zstream_start = 0; /* fixed window size */
+      }
 
       else
+      {
          window_bits = 0;
+         png_ptr->zstream_start = 1;
+      }
 # else
 #   define window_bits 0
 # endif
@@ -451,6 +463,31 @@
 #endif
 }
 
+#if PNG_ZLIB_VERNUM >= 0x1240
+/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
+ * in this case some zlib versions skip validation of the CINFO field and, in
+ * certain circumstances, libpng may end up displaying an invalid image, in
+ * contrast to implementations that call zlib in the normal way (e.g. libpng
+ * 1.5).
+ */
+int /* PRIVATE */
+png_zlib_inflate(png_structrp png_ptr, int flush)
+{
+   if (png_ptr->zstream_start && png_ptr->zstream.avail_in > 0)
+   {
+      if ((*png_ptr->zstream.next_in >> 4) > 7)
+      {
+         png_ptr->zstream.msg = "invalid window size (libpng)";
+         return Z_DATA_ERROR;
+      }
+
+      png_ptr->zstream_start = 0;
+   }
+
+   return inflate(&png_ptr->zstream, flush);
+}
+#endif /* Zlib >= 1.2.4 */
+
 #ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
 /* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
  * allow the caller to do multiple calls if required.  If the 'finish' flag is
@@ -544,7 +581,7 @@
           * the previous chunk of input data.  Tell zlib if we have reached the
           * end of the output buffer.
           */
-         ret = inflate(&png_ptr->zstream, avail_out > 0 ? Z_NO_FLUSH :
+         ret = PNG_INFLATE(png_ptr, avail_out > 0 ? Z_NO_FLUSH :
              (finish ? Z_FINISH : Z_SYNC_FLUSH));
       } while (ret == Z_OK);
 
@@ -603,7 +640,7 @@
     */
    png_alloc_size_t limit = PNG_SIZE_MAX;
 
-# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
+# ifdef PNG_SET_USER_LIMITS_SUPPORTED
    if (png_ptr->user_chunk_malloc_max > 0 &&
        png_ptr->user_chunk_malloc_max < limit)
       limit = png_ptr->user_chunk_malloc_max;
@@ -698,7 +735,6 @@
                    * success)
                    */
                   png_free(png_ptr, text);
-                  text = NULL;
 
                   /* This really is very benign, but it's still an error because
                    * the extra space may otherwise be used as a Trojan Horse.
@@ -794,7 +830,7 @@
           * the available output is produced; this allows reading of truncated
           * streams.
           */
-         ret = inflate(&png_ptr->zstream,
+         ret = PNG_INFLATE(png_ptr,
             *chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
       }
       while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
@@ -895,7 +931,7 @@
 png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_color palette[PNG_MAX_PALETTE_LENGTH];
-   int num, i;
+   int max_palette_length, num, i;
 #ifdef PNG_POINTER_INDEXING_SUPPORTED
    png_colorp pal_ptr;
 #endif
@@ -956,6 +992,19 @@
    /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
    num = (int)length / 3;
 
+   /* If the palette has 256 or fewer entries but is too large for the bit
+    * depth, we don't issue an error, to preserve the behavior of previous
+    * libpng versions. We silently truncate the unused extra palette entries
+    * here.
+    */
+   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+      max_palette_length = (1 << png_ptr->bit_depth);
+   else
+      max_palette_length = PNG_MAX_PALETTE_LENGTH;
+
+   if (num > max_palette_length)
+      num = max_palette_length;
+
 #ifdef PNG_POINTER_INDEXING_SUPPORTED
    for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
    {
@@ -988,7 +1037,7 @@
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
 #endif
    {
-      png_crc_finish(png_ptr, 0);
+      png_crc_finish(png_ptr, (int) length - num * 3);
    }
 
 #ifndef PNG_READ_OPT_PLTE_SUPPORTED
@@ -1175,11 +1224,13 @@
       return;
 
    for (i=0; i<truelen; ++i)
+   {
       if (buf[i] == 0 || buf[i] > sample_depth)
       {
          png_chunk_benign_error(png_ptr, "invalid");
          return;
       }
+   }
 
    if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
    {
@@ -1490,10 +1541,10 @@
                                     finished = 1;
 
 #                                   ifdef PNG_sRGB_SUPPORTED
-                                       /* Check for a match against sRGB */
-                                       png_icc_set_sRGB(png_ptr,
-                                          &png_ptr->colorspace, profile,
-                                          png_ptr->zstream.adler);
+                                    /* Check for a match against sRGB */
+                                    png_icc_set_sRGB(png_ptr,
+                                       &png_ptr->colorspace, profile,
+                                       png_ptr->zstream.adler);
 #                                   endif
 
                                     /* Steal the profile for info_ptr. */
@@ -1543,8 +1594,10 @@
                                  else if (size > 0)
                                     errmsg = "truncated";
 
+#ifndef __COVERITY__
                                  else
                                     errmsg = png_ptr->zstream.msg;
+#endif
                               }
 
                               /* else png_icc_check_tag_table output an error */
@@ -1676,7 +1729,7 @@
    ++entry_start;
 
    /* A sample depth should follow the separator, and we should be on it  */
-   if (entry_start > buffer + length - 2)
+   if (length < 2U || entry_start > buffer + (length - 2U))
    {
       png_warning(png_ptr, "malformed sPLT chunk");
       return;
@@ -1701,8 +1754,8 @@
 
    if (dl > max_dl)
    {
-       png_warning(png_ptr, "sPLT chunk too long");
-       return;
+      png_warning(png_ptr, "sPLT chunk too long");
+      return;
    }
 
    new_palette.nentries = (png_int_32)(data_length / entry_size);
@@ -1712,8 +1765,8 @@
 
    if (new_palette.entries == NULL)
    {
-       png_warning(png_ptr, "sPLT chunk requires too much memory");
-       return;
+      png_warning(png_ptr, "sPLT chunk requires too much memory");
+      return;
    }
 
 #ifdef PNG_POINTER_INDEXING_SUPPORTED
@@ -1843,7 +1896,8 @@
          return;
       }
 
-      if (length > png_ptr->num_palette || length > PNG_MAX_PALETTE_LENGTH ||
+      if (length > (unsigned int) png_ptr->num_palette ||
+         length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
          length == 0)
       {
          png_crc_finish(png_ptr, length);
@@ -2006,7 +2060,8 @@
 
    num = length / 2 ;
 
-   if (num != png_ptr->num_palette || num > PNG_MAX_PALETTE_LENGTH)
+   if (num != (unsigned int) png_ptr->num_palette ||
+       num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "invalid");
@@ -2178,7 +2233,7 @@
    /* We need to have at least 12 bytes after the purpose string
     * in order to get the parameter information.
     */
-   if (endptr <= buf + 12)
+   if (endptr - buf <= 12)
    {
       png_chunk_benign_error(png_ptr, "invalid");
       return;
@@ -2741,14 +2796,14 @@
       png_ptr->unknown_chunk.data = NULL;
    }
 
-#  ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
-      if (png_ptr->user_chunk_malloc_max > 0 &&
-          png_ptr->user_chunk_malloc_max < limit)
-         limit = png_ptr->user_chunk_malloc_max;
+#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
+   if (png_ptr->user_chunk_malloc_max > 0 &&
+       png_ptr->user_chunk_malloc_max < limit)
+      limit = png_ptr->user_chunk_malloc_max;
 
 #  elif PNG_USER_CHUNK_MALLOC_MAX > 0
-      if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-         limit = PNG_USER_CHUNK_MALLOC_MAX;
+   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
+      limit = PNG_USER_CHUNK_MALLOC_MAX;
 #  endif
 
    if (length <= limit)
@@ -2811,7 +2866,7 @@
     */
 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 #     ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
-         keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
+   keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
 #     endif
 #  endif
 
@@ -2820,153 +2875,153 @@
     * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
     */
 #  ifdef PNG_READ_USER_CHUNKS_SUPPORTED
-      /* The user callback takes precedence over the chunk keep value, but the
-       * keep value is still required to validate a save of a critical chunk.
-       */
-      if (png_ptr->read_user_chunk_fn != NULL)
+   /* The user callback takes precedence over the chunk keep value, but the
+    * keep value is still required to validate a save of a critical chunk.
+    */
+   if (png_ptr->read_user_chunk_fn != NULL)
+   {
+      if (png_cache_unknown_chunk(png_ptr, length) != 0)
       {
-         if (png_cache_unknown_chunk(png_ptr, length) != 0)
+         /* Callback to user unknown chunk handler */
+         int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
+            &png_ptr->unknown_chunk);
+
+         /* ret is:
+          * negative: An error occurred; png_chunk_error will be called.
+          *     zero: The chunk was not handled, the chunk will be discarded
+          *           unless png_set_keep_unknown_chunks has been used to set
+          *           a 'keep' behavior for this particular chunk, in which
+          *           case that will be used.  A critical chunk will cause an
+          *           error at this point unless it is to be saved.
+          * positive: The chunk was handled, libpng will ignore/discard it.
+          */
+         if (ret < 0)
+            png_chunk_error(png_ptr, "error in user chunk");
+
+         else if (ret == 0)
          {
-            /* Callback to user unknown chunk handler */
-            int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
-               &png_ptr->unknown_chunk);
-
-            /* ret is:
-             * negative: An error occured, png_chunk_error will be called.
-             *     zero: The chunk was not handled, the chunk will be discarded
-             *           unless png_set_keep_unknown_chunks has been used to set
-             *           a 'keep' behavior for this particular chunk, in which
-             *           case that will be used.  A critical chunk will cause an
-             *           error at this point unless it is to be saved.
-             * positive: The chunk was handled, libpng will ignore/discard it.
+            /* If the keep value is 'default' or 'never' override it, but
+             * still error out on critical chunks unless the keep value is
+             * 'always'  While this is weird it is the behavior in 1.4.12.
+             * A possible improvement would be to obey the value set for the
+             * chunk, but this would be an API change that would probably
+             * damage some applications.
+             *
+             * The png_app_warning below catches the case that matters, where
+             * the application has not set specific save or ignore for this
+             * chunk or global save or ignore.
              */
-            if (ret < 0)
-               png_chunk_error(png_ptr, "error in user chunk");
-
-            else if (ret == 0)
+            if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
             {
-               /* If the keep value is 'default' or 'never' override it, but
-                * still error out on critical chunks unless the keep value is
-                * 'always'  While this is weird it is the behavior in 1.4.12.
-                * A possible improvement would be to obey the value set for the
-                * chunk, but this would be an API change that would probably
-                * damage some applications.
-                *
-                * The png_app_warning below catches the case that matters, where
-                * the application has not set specific save or ignore for this
-                * chunk or global save or ignore.
-                */
-               if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
+#              ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+               if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
                {
-#                 ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
-                     if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
-                     {
-                        png_chunk_warning(png_ptr, "Saving unknown chunk:");
-                        png_app_warning(png_ptr,
-                           "forcing save of an unhandled chunk;"
-                           " please call png_set_keep_unknown_chunks");
-                           /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
-                     }
-#                 endif
-                  keep = PNG_HANDLE_CHUNK_IF_SAFE;
+                  png_chunk_warning(png_ptr, "Saving unknown chunk:");
+                  png_app_warning(png_ptr,
+                     "forcing save of an unhandled chunk;"
+                     " please call png_set_keep_unknown_chunks");
+                     /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
                }
-            }
-
-            else /* chunk was handled */
-            {
-               handled = 1;
-               /* Critical chunks can be safely discarded at this point. */
-               keep = PNG_HANDLE_CHUNK_NEVER;
+#              endif
+               keep = PNG_HANDLE_CHUNK_IF_SAFE;
             }
          }
 
-         else
-            keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
+         else /* chunk was handled */
+         {
+            handled = 1;
+            /* Critical chunks can be safely discarded at this point. */
+            keep = PNG_HANDLE_CHUNK_NEVER;
+         }
       }
 
       else
-         /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
+         keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
+   }
+
+   else
+   /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
 #  endif /* READ_USER_CHUNKS */
 
 #  ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
+   {
+      /* keep is currently just the per-chunk setting, if there was no
+       * setting change it to the global default now (not that this may
+       * still be AS_DEFAULT) then obtain the cache of the chunk if required,
+       * if not simply skip the chunk.
+       */
+      if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
+         keep = png_ptr->unknown_default;
+
+      if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
+         (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
+          PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
       {
-         /* keep is currently just the per-chunk setting, if there was no
-          * setting change it to the global default now (not that this may
-          * still be AS_DEFAULT) then obtain the cache of the chunk if required,
-          * if not simply skip the chunk.
-          */
-         if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
-            keep = png_ptr->unknown_default;
-
-         if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
-            (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
-             PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
-         {
-            if (png_cache_unknown_chunk(png_ptr, length) == 0)
-               keep = PNG_HANDLE_CHUNK_NEVER;
-         }
-
-         else
-            png_crc_finish(png_ptr, length);
+         if (png_cache_unknown_chunk(png_ptr, length) == 0)
+            keep = PNG_HANDLE_CHUNK_NEVER;
       }
+
+      else
+         png_crc_finish(png_ptr, length);
+   }
 #  else
 #     ifndef PNG_READ_USER_CHUNKS_SUPPORTED
 #        error no method to support READ_UNKNOWN_CHUNKS
 #     endif
 
-      {
-         /* If here there is no read callback pointer set and no support is
-          * compiled in to just save the unknown chunks, so simply skip this
-          * chunk.  If 'keep' is something other than AS_DEFAULT or NEVER then
-          * the app has erroneously asked for unknown chunk saving when there
-          * is no support.
-          */
-         if (keep > PNG_HANDLE_CHUNK_NEVER)
-            png_app_error(png_ptr, "no unknown chunk support available");
-
-         png_crc_finish(png_ptr, length);
-      }
+   {
+      /* If here there is no read callback pointer set and no support is
+       * compiled in to just save the unknown chunks, so simply skip this
+       * chunk.  If 'keep' is something other than AS_DEFAULT or NEVER then
+       * the app has erroneously asked for unknown chunk saving when there
+       * is no support.
+       */
+      if (keep > PNG_HANDLE_CHUNK_NEVER)
+         png_app_error(png_ptr, "no unknown chunk support available");
+
+      png_crc_finish(png_ptr, length);
+   }
 #  endif
 
 #  ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-      /* Now store the chunk in the chunk list if appropriate, and if the limits
-       * permit it.
-       */
-      if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
-         (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
-          PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
-      {
+   /* Now store the chunk in the chunk list if appropriate, and if the limits
+    * permit it.
+    */
+   if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
+      (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
+       PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
+   {
 #     ifdef PNG_USER_LIMITS_SUPPORTED
-         switch (png_ptr->user_chunk_cache_max)
-         {
-            case 2:
-               png_ptr->user_chunk_cache_max = 1;
-               png_chunk_benign_error(png_ptr, "no space in chunk cache");
-               /* FALL THROUGH */
-            case 1:
-               /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
-                * chunk being skipped, now there will be a hard error below.
-                */
-               break;
-
-            default: /* not at limit */
-               --(png_ptr->user_chunk_cache_max);
-               /* FALL THROUGH */
-            case 0: /* no limit */
-#     endif /* USER_LIMITS */
-               /* Here when the limit isn't reached or when limits are compiled
-                * out; store the chunk.
-                */
-               png_set_unknown_chunks(png_ptr, info_ptr,
-                  &png_ptr->unknown_chunk, 1);
-               handled = 1;
-#     ifdef PNG_USER_LIMITS_SUPPORTED
-               break;
-         }
-#     endif
+      switch (png_ptr->user_chunk_cache_max)
+      {
+         case 2:
+            png_ptr->user_chunk_cache_max = 1;
+            png_chunk_benign_error(png_ptr, "no space in chunk cache");
+            /* FALL THROUGH */
+         case 1:
+            /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
+             * chunk being skipped, now there will be a hard error below.
+             */
+            break;
+
+         default: /* not at limit */
+            --(png_ptr->user_chunk_cache_max);
+            /* FALL THROUGH */
+         case 0: /* no limit */
+#  endif /* USER_LIMITS */
+            /* Here when the limit isn't reached or when limits are compiled
+             * out; store the chunk.
+             */
+            png_set_unknown_chunks(png_ptr, info_ptr,
+               &png_ptr->unknown_chunk, 1);
+            handled = 1;
+#  ifdef PNG_USER_LIMITS_SUPPORTED
+            break;
       }
+#  endif
+   }
 #  else /* no store support: the chunk must be handled by the user callback */
-      PNG_UNUSED(info_ptr)
+   PNG_UNUSED(info_ptr)
 #  endif
 
    /* Regardless of the error handling below the cached data (if any) can be
@@ -3068,13 +3123,13 @@
       end_ptr = dp + PNG_ROWBYTES(pixel_depth, row_width) - 1;
       end_byte = *end_ptr;
 #     ifdef PNG_READ_PACKSWAP_SUPPORTED
-         if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
-            /* little-endian byte */
-            end_mask = 0xff << end_mask;
-
-         else /* big-endian byte */
+      if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+         /* little-endian byte */
+         end_mask = 0xff << end_mask;
+
+      else /* big-endian byte */
 #     endif
-         end_mask = 0xff >> end_mask;
+      end_mask = 0xff >> end_mask;
       /* end_mask is now the bits to *keep* from the destination row */
    }
 
@@ -3232,12 +3287,12 @@
          png_uint_32 mask;
 
 #        ifdef PNG_READ_PACKSWAP_SUPPORTED
-            if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
-               mask = MASK(pass, pixel_depth, display, 0);
-
-            else
+         if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+            mask = MASK(pass, pixel_depth, display, 0);
+
+         else
 #        endif
-            mask = MASK(pass, pixel_depth, display, 1);
+         mask = MASK(pass, pixel_depth, display, 1);
 
          for (;;)
          {
@@ -3838,15 +3893,15 @@
       p = b - c;
       pc = a - c;
 
-#     ifdef PNG_USE_ABS
-         pa = abs(p);
-         pb = abs(pc);
-         pc = abs(p + pc);
-#     else
-         pa = p < 0 ? -p : p;
-         pb = pc < 0 ? -pc : pc;
-         pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#     endif
+#ifdef PNG_USE_ABS
+      pa = abs(p);
+      pb = abs(pc);
+      pc = abs(p + pc);
+#else
+      pa = p < 0 ? -p : p;
+      pb = pc < 0 ? -pc : pc;
+      pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
 
       /* Find the best predictor, the least of pa, pb, pc favoring the earlier
        * ones in the case of a tie.
@@ -3893,15 +3948,15 @@
       p = b - c;
       pc = a - c;
 
-#     ifdef PNG_USE_ABS
-         pa = abs(p);
-         pb = abs(pc);
-         pc = abs(p + pc);
-#     else
-         pa = p < 0 ? -p : p;
-         pb = pc < 0 ? -pc : pc;
-         pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#     endif
+#ifdef PNG_USE_ABS
+      pa = abs(p);
+      pb = abs(pc);
+      pc = abs(p + pc);
+#else
+      pa = p < 0 ? -p : p;
+      pb = pc < 0 ? -pc : pc;
+      pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
 
       if (pb < pa) pa = pb, a = b;
       if (pc < pa) a = c;
@@ -4043,7 +4098,7 @@
        *
        * TODO: deal more elegantly with truncated IDAT lists.
        */
-      ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
+      ret = PNG_INFLATE(png_ptr, Z_NO_FLUSH);
 
       /* Take the unconsumed output back. */
       if (output != NULL)
@@ -4306,18 +4361,18 @@
 #ifdef PNG_READ_EXPAND_16_SUPPORTED
    if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
    {
-#     ifdef PNG_READ_EXPAND_SUPPORTED
-         /* In fact it is an error if it isn't supported, but checking is
-          * the safe way.
-          */
-         if ((png_ptr->transformations & PNG_EXPAND) != 0)
-         {
-            if (png_ptr->bit_depth < 16)
-               max_pixel_depth *= 2;
-         }
-         else
-#     endif
-         png_ptr->transformations &= ~PNG_EXPAND_16;
+#  ifdef PNG_READ_EXPAND_SUPPORTED
+      /* In fact it is an error if it isn't supported, but checking is
+       * the safe way.
+       */
+      if ((png_ptr->transformations & PNG_EXPAND) != 0)
+      {
+         if (png_ptr->bit_depth < 16)
+            max_pixel_depth *= 2;
+      }
+      else
+#  endif
+      png_ptr->transformations &= ~PNG_EXPAND_16;
    }
 #endif
 
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -151,12 +151,12 @@
       png_fixed(png_ptr, red_X, "cHRM Red X"),
       png_fixed(png_ptr, red_Y, "cHRM Red Y"),
       png_fixed(png_ptr, red_Z, "cHRM Red Z"),
-      png_fixed(png_ptr, green_X, "cHRM Red X"),
-      png_fixed(png_ptr, green_Y, "cHRM Red Y"),
-      png_fixed(png_ptr, green_Z, "cHRM Red Z"),
-      png_fixed(png_ptr, blue_X, "cHRM Red X"),
-      png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
-      png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
+      png_fixed(png_ptr, green_X, "cHRM Green X"),
+      png_fixed(png_ptr, green_Y, "cHRM Green Y"),
+      png_fixed(png_ptr, green_Z, "cHRM Green Z"),
+      png_fixed(png_ptr, blue_X, "cHRM Blue X"),
+      png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
+      png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
 }
 #  endif /* FLOATING_POINT */
 
@@ -218,6 +218,7 @@
    if (info_ptr->hist == NULL)
    {
       png_warning(png_ptr, "Insufficient memory for hIST chunk data");
+
       return;
    }
 
@@ -299,7 +300,7 @@
    png_debug1(1, "in %s storage function", "pCAL");
 
    if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
-      || (nparams > 0 && params == NULL))
+       || (nparams > 0 && params == NULL))
       return;
 
    length = strlen(purpose) + 1;
@@ -329,6 +330,7 @@
    if (info_ptr->pcal_purpose == NULL)
    {
       png_warning(png_ptr, "Insufficient memory for pCAL purpose");
+
       return;
    }
 
@@ -350,6 +352,7 @@
    if (info_ptr->pcal_units == NULL)
    {
       png_warning(png_ptr, "Insufficient memory for pCAL units");
+
       return;
    }
 
@@ -361,6 +364,7 @@
    if (info_ptr->pcal_params == NULL)
    {
       png_warning(png_ptr, "Insufficient memory for pCAL params");
+
       return;
    }
 
@@ -377,6 +381,7 @@
       if (info_ptr->pcal_params[i] == NULL)
       {
          png_warning(png_ptr, "Insufficient memory for pCAL parameter");
+
          return;
       }
 
@@ -426,6 +431,7 @@
    if (info_ptr->scal_s_width == NULL)
    {
       png_warning(png_ptr, "Memory allocation failed while processing sCAL");
+
       return;
    }
 
@@ -444,6 +450,7 @@
       info_ptr->scal_s_width = NULL;
 
       png_warning(png_ptr, "Memory allocation failed while processing sCAL");
+
       return;
    }
 
@@ -534,12 +541,17 @@
     png_const_colorp palette, int num_palette)
 {
 
+   png_uint_32 max_palette_length;
+
    png_debug1(1, "in %s storage function", "PLTE");
 
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
+   max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
+      (1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
+
+   if (num_palette < 0 || num_palette > (int) max_palette_length)
    {
       if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
          png_error(png_ptr, "Invalid palette length");
@@ -547,6 +559,7 @@
       else
       {
          png_warning(png_ptr, "Invalid palette length");
+
          return;
       }
    }
@@ -559,7 +572,6 @@
       ))
    {
       png_error(png_ptr, "Invalid palette");
-      return;
    }
 
    /* It may not actually be necessary to set png_ptr->palette here;
@@ -572,8 +584,8 @@
    png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
 
    /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
-    * of num_palette entries, in case of an invalid PNG file that has
-    * too-large sample values.
+    * of num_palette entries, in case of an invalid PNG file or incorrect
+    * call to png_set_PLTE() with too-large sample values.
     */
    png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
        PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
@@ -683,6 +695,7 @@
    if (new_iccp_name == NULL)
    {
       png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
+
       return;
    }
 
@@ -693,9 +706,9 @@
    if (new_iccp_profile == NULL)
    {
       png_free(png_ptr, new_iccp_name);
-      new_iccp_name = NULL;
       png_benign_error(png_ptr,
           "Insufficient memory to process iCCP profile");
+
       return;
    }
 
@@ -729,7 +742,7 @@
 {
    int i;
 
-   png_debug1(1, "in %lx storage function", png_ptr == NULL ? "unexpected" :
+   png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
       (unsigned long)png_ptr->chunk_name);
 
    if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
@@ -771,6 +784,7 @@
       {
          png_chunk_report(png_ptr, "too many text chunks",
             PNG_CHUNK_WRITE_ERROR);
+
          return 1;
       }
 
@@ -826,7 +840,7 @@
          else
             lang_key_len = 0;
       }
-#  else /* PNG_iTXt_SUPPORTED */
+#  else /* iTXt */
       {
          png_chunk_report(png_ptr, "iTXt chunk not supported",
             PNG_CHUNK_WRITE_ERROR);
@@ -859,6 +873,7 @@
       {
          png_chunk_report(png_ptr, "text chunk: out of memory",
                PNG_CHUNK_WRITE_ERROR);
+
          return 1;
       }
 
@@ -932,6 +947,7 @@
        mod_time->second > 60)
    {
       png_warning(png_ptr, "Ignoring invalid time value");
+
       return;
    }
 
@@ -948,6 +964,7 @@
    png_debug1(1, "in %s storage function", "tRNS");
 
    if (png_ptr == NULL || info_ptr == NULL)
+
       return;
 
    if (trans_alpha != NULL)
@@ -973,16 +990,21 @@
 
    if (trans_color != NULL)
    {
-      int sample_max = (1 << info_ptr->bit_depth);
+#ifdef PNG_WARNINGS_SUPPORTED
+      if (info_ptr->bit_depth < 16)
+      {
+         int sample_max = (1 << info_ptr->bit_depth) - 1;
 
-      if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
-          trans_color->gray > sample_max) ||
-          (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
-          (trans_color->red > sample_max ||
-          trans_color->green > sample_max ||
-          trans_color->blue > sample_max)))
-         png_warning(png_ptr,
-            "tRNS chunk has out-of-range samples for bit_depth");
+         if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+             trans_color->gray > sample_max) ||
+             (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+             (trans_color->red > sample_max ||
+             trans_color->green > sample_max ||
+             trans_color->blue > sample_max)))
+            png_warning(png_ptr,
+               "tRNS chunk has out-of-range samples for bit_depth");
+      }
+#endif
 
       info_ptr->trans_color = *trans_color;
 
@@ -1029,6 +1051,7 @@
    {
       /* Out of memory or too many chunks */
       png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
+
       return;
    }
 
@@ -1144,7 +1167,7 @@
    png_unknown_chunkp np;
 
    if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
-      unknowns == NULL)
+       unknowns == NULL)
       return;
 
    /* Check for the failure cases where support has been disabled at compile
@@ -1158,6 +1181,7 @@
       if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
       {
          png_app_error(png_ptr, "no unknown chunk support on read");
+
          return;
       }
 #  endif
@@ -1166,6 +1190,7 @@
       if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
       {
          png_app_error(png_ptr, "no unknown chunk support on write");
+
          return;
       }
 #  endif
@@ -1183,6 +1208,7 @@
    {
       png_chunk_report(png_ptr, "too many unknown chunks",
          PNG_CHUNK_WRITE_ERROR);
+
       return;
    }
 
@@ -1260,8 +1286,7 @@
          check_location(png_ptr, location);
    }
 }
-#endif
-
+#endif /* STORE_UNKNOWN_CHUNKS */
 
 #ifdef PNG_MNG_FEATURES_SUPPORTED
 png_uint_32 PNGAPI
@@ -1292,6 +1317,7 @@
       if (memcmp(list, add, 4) == 0)
       {
          list[4] = (png_byte)keep;
+
          return count;
       }
    }
@@ -1319,6 +1345,7 @@
    if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
    {
       png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
+
       return;
    }
 
@@ -1368,6 +1395,7 @@
           * which can be switched off.
           */
          png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
+
          return;
       }
 
@@ -1383,6 +1411,7 @@
    if (num_chunks + old_num_chunks > UINT_MAX/5)
    {
       png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
+
       return;
    }
 
@@ -1520,23 +1549,30 @@
          {
             png_warning(png_ptr,
               "Compression buffer size cannot be changed because it is in use");
+
             return;
          }
 
+#ifndef __COVERITY__
+         /* Some compilers complain that this is always false.  However, it
+          * can be true when integer overflow happens.
+          */
          if (size > ZLIB_IO_MAX)
          {
             png_warning(png_ptr,
                "Compression buffer size limited to system maximum");
             size = ZLIB_IO_MAX; /* must fit */
          }
+#endif
 
-         else if (size < 6)
+         if (size < 6)
          {
             /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
              * if this is permitted.
              */
             png_warning(png_ptr,
                "Compression buffer size cannot be reduced below 6");
+
             return;
          }
 
@@ -1565,7 +1601,7 @@
 {
    /* Images with dimensions larger than these limits will be
     * rejected by png_set_IHDR().  To accept any PNG datastream
-    * regardless of dimensions, set both limits to 0x7ffffffL.
+    * regardless of dimensions, set both limits to 0x7fffffff.
     */
    if (png_ptr == NULL)
       return;
@@ -1578,8 +1614,8 @@
 void PNGAPI
 png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
 {
-    if (png_ptr != NULL)
-       png_ptr->user_chunk_cache_max = user_chunk_cache_max;
+   if (png_ptr != NULL)
+      png_ptr->user_chunk_cache_max = user_chunk_cache_max;
 }
 
 /* This function was added to libpng 1.4.1 */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h	Tue Jan 26 09:11:58 2016 +0100
@@ -29,12 +29,11 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
- * Last changed in libpng 1.6.1 [March 28, 2013]
- *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
@@ -129,7 +128,7 @@
 #endif /* COLORSPACE */
 
 #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
-/* A colorspace is all the above plus, potentially, profile information,
+/* A colorspace is all the above plus, potentially, profile information;
  * however at present libpng does not use the profile internally so it is only
  * stored in the png_info struct (if iCCP is supported.)  The rendering intent
  * is retained here and is checked.
@@ -248,16 +247,18 @@
    png_uint_32 row_number;    /* current row in interlace pass */
    png_uint_32 chunk_name;    /* PNG_CHUNK() id of current chunk */
    png_bytep prev_row;        /* buffer to save previous (unfiltered) row.
-                               * This is a pointer into big_prev_row
+                               * While reading this is a pointer into
+                               * big_prev_row; while writing it is separately
+                               * allocated if needed.
                                */
    png_bytep row_buf;         /* buffer to save current (unfiltered) row.
-                               * This is a pointer into big_row_buf
+                               * While reading, this is a pointer into
+                               * big_row_buf; while writing it is separately
+                               * allocated.
                                */
-#ifdef PNG_WRITE_SUPPORTED
-   png_bytep sub_row;         /* buffer to save "sub" row when filtering */
-   png_bytep up_row;          /* buffer to save "up" row when filtering */
-   png_bytep avg_row;         /* buffer to save "avg" row when filtering */
-   png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+   png_bytep try_row;    /* buffer to save trial row when filtering */
+   png_bytep tst_row;    /* buffer to save best trial row when filtering */
 #endif
    png_size_t info_rowbytes;  /* Added in 1.5.4: cache of updated row bytes */
 
@@ -290,6 +291,9 @@
                               /* pixel depth used for the row buffers */
    png_byte transformed_pixel_depth;
                               /* pixel depth after read/write transforms */
+#if PNG_ZLIB_VERNUM >= 0x1240
+   png_byte zstream_start;    /* at start of an input zlib stream */
+#endif /* Zlib >= 1.2.4 */
 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
    png_uint_16 filler;           /* filler bytes for pixel expansion */
 #endif
@@ -375,17 +379,7 @@
    png_bytep quantize_index; /* index translation for palette files */
 #endif
 
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-   png_byte heuristic_method;        /* heuristic for row filter selection */
-   png_byte num_prev_filters;        /* number of weights for previous rows */
-   png_bytep prev_filters;           /* filter type(s) of previous row(s) */
-   png_uint_16p filter_weights;      /* weight(s) for previous line(s) */
-   png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */
-   png_uint_16p filter_costs;        /* relative filter calculation cost */
-   png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */
-#endif
-
-   /* Options */
+/* Options */
 #ifdef PNG_SET_OPTION_SUPPORTED
    png_byte options;           /* On/off state (up to 4 options) */
 #endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.5.25 [December 3, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -89,10 +89,11 @@
    defined PNG_READ_sBIT_SUPPORTED &&\
    defined PNG_READ_sCAL_SUPPORTED &&\
    defined PNG_READ_sRGB_SUPPORTED &&\
+   defined PNG_READ_sPLT_SUPPORTED &&\
    defined PNG_READ_tEXt_SUPPORTED &&\
    defined PNG_READ_tIME_SUPPORTED &&\
    defined PNG_READ_zTXt_SUPPORTED &&\
-   defined PNG_WRITE_INTERLACING_SUPPORTED
+   (defined PNG_WRITE_INTERLACING_SUPPORTED || PNG_LIBPNG_VER >= 10700)
 
 #ifdef PNG_ZLIB_HEADER
 #  include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
@@ -129,6 +130,10 @@
 #  define SINGLE_ROWBUF_ALLOC  /* Makes buffer overruns easier to nail */
 #endif
 
+#ifndef PNG_UNUSED
+#  define PNG_UNUSED(param) (void)param;
+#endif
+
 /* Turn on CPU timing
 #define PNGTEST_TIMING
 */
@@ -146,6 +151,22 @@
 #define PNG_tIME_STRING_LENGTH 29
 static int tIME_chunk_present = 0;
 static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
+
+#if PNG_LIBPNG_VER < 10619
+#define png_convert_to_rfc1123_buffer(ts, t) tIME_to_str(read_ptr, ts, t)
+
+static int
+tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t)
+{
+    png_const_charp str = png_convert_to_rfc1123(png_ptr, t);
+
+    if (str == NULL)
+        return 0;
+
+    strcpy(ts, str);
+    return 1;
+}
+#endif /* older libpng */
 #endif
 
 static int verbose = 0;
@@ -213,16 +234,14 @@
 
 
 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-/* Example of using user transform callback (we don't transform anything,
- * but merely examine the row filters.  We set this to 256 rather than
- * 5 in case illegal filter values are present.)
+/* Example of using a user transform callback (doesn't do anything at present).
  */
-static png_uint_32 filters_used[256];
 static void PNGCBAPI
-count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
+read_user_callback(png_structp png_ptr, png_row_infop row_info, png_bytep data)
 {
-   if (png_ptr != NULL && row_info != NULL)
-      ++filters_used[*(data - 1)];
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(row_info)
+   PNG_UNUSED(data)
 }
 #endif
 
@@ -497,7 +516,7 @@
 #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
 
 /* Allocate memory.  For reasonable files, size should never exceed
- * 64K.  However, zlib may allocate more then 64K if you don't tell
+ * 64K.  However, zlib may allocate more than 64K if you don't tell
  * it not to.  See zconf.h and png.h for more information.  zlib does
  * need to allocate exactly 64K, so whatever you call here must
  * have the ability to do that.
@@ -593,6 +612,7 @@
    }
 
    /* Unlink the element from the list. */
+   if (pinformation != NULL)
    {
       memory_infop *ppinfo = &pinformation;
 
@@ -609,8 +629,7 @@
             /* We must free the list element too, but first kill
                the memory that is to be freed. */
             memset(ptr, 0x55, pinfo->size);
-            if (pinfo != NULL)
-               free(pinfo);
+            free(pinfo);
             pinfo = NULL;
             break;
          }
@@ -820,7 +839,7 @@
  */
 #ifdef PNG_TEXT_SUPPORTED
 static void
-pngtest_check_text_support(png_const_structp png_ptr, png_textp text_ptr,
+pngtest_check_text_support(png_structp png_ptr, png_textp text_ptr,
    int num_text)
 {
    while (num_text > 0)
@@ -833,6 +852,8 @@
          case PNG_TEXT_COMPRESSION_zTXt:
 #           ifndef PNG_WRITE_zTXt_SUPPORTED
                ++unsupported_chunks;
+               /* In libpng 1.7 this now does an app-error, so stop it: */
+               text_ptr[num_text].compression = PNG_TEXT_COMPRESSION_NONE;
 #           endif
             break;
 
@@ -840,6 +861,7 @@
          case PNG_ITXT_COMPRESSION_zTXt:
 #           ifndef PNG_WRITE_iTXt_SUPPORTED
                ++unsupported_chunks;
+               text_ptr[num_text].compression = PNG_TEXT_COMPRESSION_NONE;
 #           endif
             break;
 
@@ -866,16 +888,19 @@
    png_structp write_ptr;
    png_infop write_info_ptr;
    png_infop write_end_info_ptr;
+#ifdef PNG_WRITE_FILTER_SUPPORTED
    int interlace_preserved = 1;
-#else
+#endif /* WRITE_FILTER */
+#else /* !WRITE */
    png_structp write_ptr = NULL;
    png_infop write_info_ptr = NULL;
    png_infop write_end_info_ptr = NULL;
-#endif
+#endif /* !WRITE */
    png_bytep row_buf;
    png_uint_32 y;
    png_uint_32 width, height;
-   int num_pass = 1, pass;
+   volatile int num_passes;
+   int pass;
    int bit_depth, color_type;
 
    row_buf = NULL;
@@ -1028,14 +1053,7 @@
    }
 
 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-   {
-      int i;
-
-      for (i = 0; i<256; i++)
-         filters_used[i] = 0;
-
-      png_set_read_user_transform_fn(read_ptr, count_filters);
-   }
+   png_set_read_user_transform_fn(read_ptr, read_user_callback);
 #endif
 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
    zero_samples = 0;
@@ -1082,27 +1100,27 @@
       {
          png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
             color_type, interlace_type, compression_type, filter_type);
-#ifndef PNG_READ_INTERLACING_SUPPORTED
-         /* num_pass will not be set below, set it here if the image is
-          * interlaced: what happens is that write interlacing is *not* turned
-          * on an the partial interlaced rows are written directly.
+         /* num_passes may not be available below if interlace support is not
+          * provided by libpng for both read and write.
           */
          switch (interlace_type)
          {
             case PNG_INTERLACE_NONE:
-               num_pass = 1;
+               num_passes = 1;
                break;
 
             case PNG_INTERLACE_ADAM7:
-               num_pass = 7;
-                break;
+               num_passes = 7;
+               break;
 
             default:
-                png_error(read_ptr, "invalid interlace type");
-                /*NOT REACHED*/
+               png_error(read_ptr, "invalid interlace type");
+               /*NOT REACHED*/
          }
-#endif
       }
+
+      else
+         png_error(read_ptr, "png_get_IHDR failed");
    }
 #ifdef PNG_FIXED_POINT_SUPPORTED
 #ifdef PNG_cHRM_SUPPORTED
@@ -1273,6 +1291,19 @@
 #endif
 #endif
 #endif
+
+#ifdef PNG_sPLT_SUPPORTED
+   {
+       png_sPLT_tp entries;
+
+       int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries);
+       if (num_entries)
+       {
+           png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries);
+       }
+   }
+#endif
+
 #ifdef PNG_TEXT_SUPPORTED
    {
       png_textp text_ptr;
@@ -1394,21 +1425,49 @@
 #endif /* SINGLE_ROWBUF_ALLOC */
    pngtest_debug("Writing row data");
 
-#ifdef PNG_READ_INTERLACING_SUPPORTED
-   num_pass = png_set_interlace_handling(read_ptr);
-   if (png_set_interlace_handling(write_ptr) != num_pass)
-      png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
-#endif
+#if defined(PNG_READ_INTERLACING_SUPPORTED) &&\
+   defined(PNG_WRITE_INTERLACING_SUPPORTED)
+   /* Both must be defined for libpng to be able to handle the interlace,
+    * otherwise it gets handled below by simply reading and writing the passes
+    * directly.
+    */
+   if (png_set_interlace_handling(read_ptr) != num_passes)
+      png_error(write_ptr,
+            "png_set_interlace_handling(read): wrong pass count ");
+   if (png_set_interlace_handling(write_ptr) != num_passes)
+      png_error(write_ptr,
+            "png_set_interlace_handling(write): wrong pass count ");
+#else /* png_set_interlace_handling not called on either read or write */
+#  define calc_pass_height
+#endif /* not using libpng interlace handling */
 
 #ifdef PNGTEST_TIMING
    t_stop = (float)clock();
    t_misc += (t_stop - t_start);
    t_start = t_stop;
 #endif
-   for (pass = 0; pass < num_pass; pass++)
+   for (pass = 0; pass < num_passes; pass++)
    {
+#     ifdef calc_pass_height
+         png_uint_32 pass_height;
+
+         if (num_passes == 7) /* interlaced */
+         {
+            if (PNG_PASS_COLS(width, pass) > 0)
+               pass_height = PNG_PASS_ROWS(height, pass);
+
+            else
+               pass_height = 0;
+         }
+
+         else /* not interlaced */
+            pass_height = height;
+#     else
+#        define pass_height height
+#     endif
+
       pngtest_debug1("Writing row data for pass %d", pass);
-      for (y = 0; y < height; y++)
+      for (y = 0; y < pass_height; y++)
       {
 #ifndef SINGLE_ROWBUF_ALLOC
          pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
@@ -1598,7 +1657,7 @@
    }
 
 #  ifdef PNG_WRITE_SUPPORTED
-      /* If there we no write support nothing was written! */
+      /* If there is no write support nothing was written! */
       else if (unsupported_chunks > 0)
       {
          fprintf(STDERR, "\n  %s: unsupported chunks (%d)%s",
@@ -1629,7 +1688,8 @@
       return (1);
    }
 
-#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
+#if defined (PNG_WRITE_SUPPORTED) /* else nothing was written */ &&\
+    defined (PNG_WRITE_FILTER_SUPPORTED)
    if (interlace_preserved != 0) /* else the files will be changed */
    {
       for (;;)
@@ -1706,7 +1766,7 @@
          }
       }
    }
-#endif /* WRITE */
+#endif /* WRITE && WRITE_FILTER */
 
    FCLOSE(fpin);
    FCLOSE(fpout);
@@ -1729,6 +1789,8 @@
    int multiple = 0;
    int ierror = 0;
 
+   png_structp dummy_ptr;
+
    fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
    fprintf(STDERR, "   with zlib   version %s\n", ZLIB_VERSION);
    fprintf(STDERR, "%s", png_get_copyright(NULL));
@@ -1843,26 +1905,17 @@
          kerror = test_one_file(argv[i], outname);
          if (kerror == 0)
          {
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-            int k;
-#endif
 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
             fprintf(STDERR, "\n PASS (%lu zero samples)\n",
                (unsigned long)zero_samples);
 #else
             fprintf(STDERR, " PASS\n");
 #endif
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-            for (k = 0; k<256; k++)
-               if (filters_used[k] != 0)
-                  fprintf(STDERR, " Filter %d was used %lu times\n",
-                     k, (unsigned long)filters_used[k]);
-#endif
 #ifdef PNG_TIME_RFC1123_SUPPORTED
-         if (tIME_chunk_present != 0)
-            fprintf(STDERR, " tIME = %s\n", tIME_string);
+            if (tIME_chunk_present != 0)
+               fprintf(STDERR, " tIME = %s\n", tIME_string);
 
-         tIME_chunk_present = 0;
+            tIME_chunk_present = 0;
 #endif /* TIME_RFC1123 */
          }
 
@@ -1934,21 +1987,12 @@
          {
             if (verbose == 1 || i == 2)
             {
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-                int k;
-#endif
 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
                 fprintf(STDERR, "\n PASS (%lu zero samples)\n",
                    (unsigned long)zero_samples);
 #else
                 fprintf(STDERR, " PASS\n");
 #endif
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-                for (k = 0; k<256; k++)
-                   if (filters_used[k] != 0)
-                      fprintf(STDERR, " Filter %d was used %lu times\n",
-                         k, (unsigned long)filters_used[k]);
-#endif
 #ifdef PNG_TIME_RFC1123_SUPPORTED
              if (tIME_chunk_present != 0)
                 fprintf(STDERR, " tIME = %s\n", tIME_string);
@@ -2022,6 +2066,24 @@
    else
       fprintf(STDERR, " libpng FAILS test\n");
 
+   dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+   fprintf(STDERR, " Default limits:\n");
+   fprintf(STDERR, "  width_max  = %lu\n",
+      (unsigned long) png_get_user_width_max(dummy_ptr));
+   fprintf(STDERR, "  height_max = %lu\n",
+      (unsigned long) png_get_user_height_max(dummy_ptr));
+   if (png_get_chunk_cache_max(dummy_ptr) == 0)
+      fprintf(STDERR, "  cache_max  = unlimited\n");
+   else
+      fprintf(STDERR, "  cache_max  = %lu\n",
+         (unsigned long) png_get_chunk_cache_max(dummy_ptr));
+   if (png_get_chunk_malloc_max(dummy_ptr) == 0)
+      fprintf(STDERR, "  malloc_max = unlimited\n");
+   else
+      fprintf(STDERR, "  malloc_max = %lu\n",
+         (unsigned long) png_get_chunk_malloc_max(dummy_ptr));
+   png_destroy_read_struct(&dummy_ptr, NULL, NULL);
+
    return (int)(ierror != 0);
 }
 #else
@@ -2036,4 +2098,4 @@
 #endif
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -58,7 +58,7 @@
 #endif
 
 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-/* Turn on 16 bit byte swapping */
+/* Turn on 16-bit byte swapping */
 void PNGAPI
 png_set_swap(png_structrp png_ptr)
 {
@@ -341,7 +341,7 @@
 
 #ifdef PNG_16BIT_SUPPORTED
 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-/* Swaps byte order on 16 bit depth images */
+/* Swaps byte order on 16-bit depth images */
 void /* PRIVATE */
 png_do_swap(png_row_infop row_info, png_bytep row)
 {
@@ -732,7 +732,7 @@
              */
             for (; rp > png_ptr->row_buf; rp--)
             {
-              if (*rp >> padding != 0)
+              if ((*rp >> padding) != 0)
                  png_ptr->num_palette_max = 1;
               padding = 0;
             }
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,7 @@
  * writes to a file pointer.  Note that this routine sometimes gets called
  * with very small lengths, so you should implement some kind of simple
  * buffering if you are using unbuffered writes.  This should never be asked
- * to write more than 64K on a 16 bit machine.
+ * to write more than 64K on a 16-bit machine.
  */
 
 void /* PRIVATE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -118,43 +118,44 @@
 
    if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
    {
-   /* Write PNG signature */
-   png_write_sig(png_ptr);
+      /* Write PNG signature */
+      png_write_sig(png_ptr);
 
 #ifdef PNG_MNG_FEATURES_SUPPORTED
-   if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
-       png_ptr->mng_features_permitted != 0)
-   {
-      png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
-      png_ptr->mng_features_permitted = 0;
-   }
+      if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
+          png_ptr->mng_features_permitted != 0)
+      {
+         png_warning(png_ptr,
+             "MNG features are not allowed in a PNG datastream");
+         png_ptr->mng_features_permitted = 0;
+      }
 #endif
 
-   /* Write IHDR information. */
-   png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
-       info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
-       info_ptr->filter_type,
+      /* Write IHDR information. */
+      png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
+          info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
+          info_ptr->filter_type,
 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
-       info_ptr->interlace_type
+          info_ptr->interlace_type
 #else
-       0
+          0
 #endif
-      );
+         );
 
-   /* The rest of these check to see if the valid field has the appropriate
-    * flag set, and if it does, writes the chunk.
-    *
-    * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
-    * the chunks will be written if the WRITE routine is there and information
-    * is available in the COLORSPACE.  (See png_colorspace_sync_info in png.c
-    * for where the valid flags get set.)
-    *
-    * Under certain circumstances the colorspace can be invalidated without
-    * syncing the info_struct 'valid' flags; this happens if libpng detects and
-    * error and calls png_error while the color space is being set, yet the
-    * application continues writing the PNG.  So check the 'invalid' flag here
-    * too.
-    */
+      /* The rest of these check to see if the valid field has the appropriate
+       * flag set, and if it does, writes the chunk.
+       *
+       * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
+       * the chunks will be written if the WRITE routine is there and
+       * information * is available in the COLORSPACE. (See
+       * png_colorspace_sync_info in png.c for where the valid flags get set.)
+       *
+       * Under certain circumstances the colorspace can be invalidated without
+       * syncing the info_struct 'valid' flags; this happens if libpng detects
+       * an error and calls png_error while the color space is being set, yet
+       * the application continues writing the PNG.  So check the 'invalid'
+       * flag here too.
+       */
 #ifdef PNG_GAMMA_SUPPORTED
 #  ifdef PNG_WRITE_gAMA_SUPPORTED
       if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
@@ -165,50 +166,50 @@
 #endif
 
 #ifdef PNG_COLORSPACE_SUPPORTED
-   /* Write only one of sRGB or an ICC profile.  If a profile was supplied
-    * and it matches one of the known sRGB ones issue a warning.
-    */
+      /* Write only one of sRGB or an ICC profile.  If a profile was supplied
+       * and it matches one of the known sRGB ones issue a warning.
+       */
 #  ifdef PNG_WRITE_iCCP_SUPPORTED
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
-          (info_ptr->valid & PNG_INFO_iCCP) != 0)
-      {
-#        ifdef PNG_WRITE_sRGB_SUPPORTED
-            if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
-               png_app_warning(png_ptr,
-                  "profile matches sRGB but writing iCCP instead");
-#        endif
+         if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+             (info_ptr->valid & PNG_INFO_iCCP) != 0)
+         {
+#    ifdef PNG_WRITE_sRGB_SUPPORTED
+               if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
+                  png_app_warning(png_ptr,
+                     "profile matches sRGB but writing iCCP instead");
+#     endif
 
-         png_write_iCCP(png_ptr, info_ptr->iccp_name,
-            info_ptr->iccp_profile);
-      }
+            png_write_iCCP(png_ptr, info_ptr->iccp_name,
+               info_ptr->iccp_profile);
+         }
 #     ifdef PNG_WRITE_sRGB_SUPPORTED
          else
 #     endif
 #  endif
 
 #  ifdef PNG_WRITE_sRGB_SUPPORTED
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
-          (info_ptr->valid & PNG_INFO_sRGB) != 0)
-         png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
+         if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+             (info_ptr->valid & PNG_INFO_sRGB) != 0)
+            png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
 #  endif /* WRITE_sRGB */
 #endif /* COLORSPACE */
 
 #ifdef PNG_WRITE_sBIT_SUPPORTED
-   if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
-      png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
+         if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
+            png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
 #endif
 
 #ifdef PNG_COLORSPACE_SUPPORTED
 #  ifdef PNG_WRITE_cHRM_SUPPORTED
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
-         (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
-         (info_ptr->valid & PNG_INFO_cHRM) != 0)
-         png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
+         if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+             (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
+             (info_ptr->valid & PNG_INFO_cHRM) != 0)
+            png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
 #  endif
 #endif
 
 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
-      write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
+         write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
 #endif
 
       png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
@@ -233,7 +234,7 @@
       png_write_PLTE(png_ptr, info_ptr->palette,
           (png_uint_32)info_ptr->num_palette);
 
-   else if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) !=0)
+   else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       png_error(png_ptr, "Valid palette required for paletted images");
 
 #ifdef PNG_WRITE_tRNS_SUPPORTED
@@ -244,8 +245,13 @@
       if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
           info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       {
-         int j;
-         for (j = 0; j<(int)info_ptr->num_trans; j++)
+         int j, jend;
+
+         jend = info_ptr->num_trans;
+         if (jend > PNG_MAX_PALETTE_LENGTH)
+            jend = PNG_MAX_PALETTE_LENGTH;
+
+         for (j = 0; j<jend; ++j)
             info_ptr->trans_alpha[j] =
                (png_byte)(255 - info_ptr->trans_alpha[j]);
       }
@@ -566,7 +572,7 @@
       /* App warnings are warnings in release (or release candidate) builds but
        * are errors during development.
        */
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
       png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
 #endif
 
@@ -666,8 +672,8 @@
 
          for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
          {
-            *(rp)     = (png_byte)((*rp       - *(rp + 1)) & 0xff);
-            *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
+            *(rp)     = (png_byte)(*rp       - *(rp + 1));
+            *(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
          }
       }
 
@@ -693,10 +699,10 @@
             png_uint_32 s2   = (*(rp + 4) << 8) | *(rp + 5);
             png_uint_32 red  = (png_uint_32)((s0 - s1) & 0xffffL);
             png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
-            *(rp    ) = (png_byte)((red >> 8) & 0xff);
-            *(rp + 1) = (png_byte)(red & 0xff);
-            *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
-            *(rp + 5) = (png_byte)(blue & 0xff);
+            *(rp    ) = (png_byte)(red >> 8);
+            *(rp + 1) = (png_byte)red;
+            *(rp + 4) = (png_byte)(blue >> 8);
+            *(rp + 5) = (png_byte)blue;
          }
       }
 #endif /* WRITE_16BIT */
@@ -877,7 +883,7 @@
     * which is also the output depth.
     */
    if (row_info.pixel_depth != png_ptr->pixel_depth ||
-      row_info.pixel_depth != png_ptr->transformed_pixel_depth)
+       row_info.pixel_depth != png_ptr->transformed_pixel_depth)
       png_error(png_ptr, "internal write transform logic error");
 
 #ifdef PNG_MNG_FEATURES_SUPPORTED
@@ -945,10 +951,6 @@
 }
 #endif /* WRITE_FLUSH */
 
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-static void png_reset_filter_heuristics(png_structrp png_ptr);/* forward decl */
-#endif
-
 /* Free any memory used in png_ptr struct without freeing the struct itself. */
 static void
 png_write_destroy(png_structrp png_ptr)
@@ -965,24 +967,11 @@
    png_ptr->row_buf = NULL;
 #ifdef PNG_WRITE_FILTER_SUPPORTED
    png_free(png_ptr, png_ptr->prev_row);
-   png_free(png_ptr, png_ptr->sub_row);
-   png_free(png_ptr, png_ptr->up_row);
-   png_free(png_ptr, png_ptr->avg_row);
-   png_free(png_ptr, png_ptr->paeth_row);
+   png_free(png_ptr, png_ptr->try_row);
+   png_free(png_ptr, png_ptr->tst_row);
    png_ptr->prev_row = NULL;
-   png_ptr->sub_row = NULL;
-   png_ptr->up_row = NULL;
-   png_ptr->avg_row = NULL;
-   png_ptr->paeth_row = NULL;
-#endif
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-   /* Use this to save a little code space, it doesn't free the filter_costs */
-   png_reset_filter_heuristics(png_ptr);
-   png_free(png_ptr, png_ptr->filter_costs);
-   png_free(png_ptr, png_ptr->inv_filter_costs);
-   png_ptr->filter_costs = NULL;
-   png_ptr->inv_filter_costs = NULL;
+   png_ptr->try_row = NULL;
+   png_ptr->tst_row = NULL;
 #endif
 
 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
@@ -1072,211 +1061,85 @@
 #endif /* WRITE_FILTER */
       }
 
+#ifdef PNG_WRITE_FILTER_SUPPORTED
       /* If we have allocated the row_buf, this means we have already started
        * with the image and we should have allocated all of the filter buffers
        * that have been selected.  If prev_row isn't already allocated, then
        * it is too late to start using the filters that need it, since we
        * will be missing the data in the previous row.  If an application
        * wants to start and stop using particular filters during compression,
-       * it should start out with all of the filters, and then add and
-       * remove them after the start of compression.
+       * it should start out with all of the filters, and then remove them
+       * or add them back after the start of compression.
+       *
+       * NOTE: this is a nasty constraint on the code, because it means that the
+       * prev_row buffer must be maintained even if there are currently no
+       * 'prev_row' requiring filters active.
        */
       if (png_ptr->row_buf != NULL)
       {
-#ifdef PNG_WRITE_FILTER_SUPPORTED
-         if ((png_ptr->do_filter & PNG_FILTER_SUB) != 0 &&
-             png_ptr->sub_row == NULL)
-         {
-            png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
-                (png_ptr->rowbytes + 1));
-            png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
-         }
+         int num_filters;
+         png_alloc_size_t buf_size;
 
-         if ((png_ptr->do_filter & PNG_FILTER_UP) != 0 &&
-              png_ptr->up_row == NULL)
+         /* Repeat the checks in png_write_start_row; 1 pixel high or wide
+          * images cannot benefit from certain filters.  If this isn't done here
+          * the check below will fire on 1 pixel high images.
+          */
+         if (png_ptr->height == 1)
+            filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+         if (png_ptr->width == 1)
+            filters &= ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+         if ((filters & (PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH)) != 0
+            && png_ptr->prev_row == NULL)
          {
-            if (png_ptr->prev_row == NULL)
-            {
-               png_warning(png_ptr, "Can't add Up filter after starting");
-               png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
-                   ~PNG_FILTER_UP);
-            }
-
-            else
-            {
-               png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
-                   (png_ptr->rowbytes + 1));
-               png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
-            }
+            /* This is the error case, however it is benign - the previous row
+             * is not available so the filter can't be used.  Just warn here.
+             */
+            png_app_warning(png_ptr,
+               "png_set_filter: UP/AVG/PAETH cannot be added after start");
+            filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
          }
 
-         if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0 &&
-              png_ptr->avg_row == NULL)
-         {
-            if (png_ptr->prev_row == NULL)
-            {
-               png_warning(png_ptr, "Can't add Average filter after starting");
-               png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
-                   ~PNG_FILTER_AVG);
-            }
+         num_filters = 0;
+
+         if (filters & PNG_FILTER_SUB)
+            num_filters++;
 
-            else
-            {
-               png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
-                   (png_ptr->rowbytes + 1));
-               png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
-            }
-         }
+         if (filters & PNG_FILTER_UP)
+            num_filters++;
+
+         if (filters & PNG_FILTER_AVG)
+            num_filters++;
+
+         if (filters & PNG_FILTER_PAETH)
+            num_filters++;
 
-         if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0 &&
-             png_ptr->paeth_row == NULL)
-         {
-            if (png_ptr->prev_row == NULL)
-            {
-               png_warning(png_ptr, "Can't add Paeth filter after starting");
-               png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH);
-            }
+         /* Allocate needed row buffers if they have not already been
+          * allocated.
+          */
+         buf_size = PNG_ROWBYTES(png_ptr->usr_channels * png_ptr->usr_bit_depth,
+             png_ptr->width) + 1;
+
+         if (png_ptr->try_row == NULL)
+            png_ptr->try_row = png_voidcast(png_bytep,
+               png_malloc(png_ptr, buf_size));
 
-            else
-            {
-               png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
-                   (png_ptr->rowbytes + 1));
-               png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
-            }
+         if (num_filters > 1)
+         {
+            if (png_ptr->tst_row == NULL)
+               png_ptr->tst_row = png_voidcast(png_bytep,
+                  png_malloc(png_ptr, buf_size));
          }
-
-         if (png_ptr->do_filter == PNG_NO_FILTERS)
-#endif /* WRITE_FILTER */
-            png_ptr->do_filter = PNG_FILTER_NONE;
       }
+      png_ptr->do_filter = (png_byte)filters;
+#endif
    }
    else
       png_error(png_ptr, "Unknown custom filter method");
 }
 
-/* This allows us to influence the way in which libpng chooses the "best"
- * filter for the current scanline.  While the "minimum-sum-of-absolute-
- * differences metric is relatively fast and effective, there is some
- * question as to whether it can be improved upon by trying to keep the
- * filtered data going to zlib more consistent, hopefully resulting in
- * better compression.
- */
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED      /* GRR 970116 */
-/* Convenience reset API. */
-static void
-png_reset_filter_heuristics(png_structrp png_ptr)
-{
-   /* Clear out any old values in the 'weights' - this must be done because if
-    * the app calls set_filter_heuristics multiple times with different
-    * 'num_weights' values we would otherwise potentially have wrong sized
-    * arrays.
-    */
-   png_ptr->num_prev_filters = 0;
-   png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
-   if (png_ptr->prev_filters != NULL)
-   {
-      png_bytep old = png_ptr->prev_filters;
-      png_ptr->prev_filters = NULL;
-      png_free(png_ptr, old);
-   }
-   if (png_ptr->filter_weights != NULL)
-   {
-      png_uint_16p old = png_ptr->filter_weights;
-      png_ptr->filter_weights = NULL;
-      png_free(png_ptr, old);
-   }
-
-   if (png_ptr->inv_filter_weights != NULL)
-   {
-      png_uint_16p old = png_ptr->inv_filter_weights;
-      png_ptr->inv_filter_weights = NULL;
-      png_free(png_ptr, old);
-   }
-
-   /* Leave the filter_costs - this array is fixed size. */
-}
-
-static int
-png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
-   int num_weights)
-{
-   if (png_ptr == NULL)
-      return 0;
-
-   /* Clear out the arrays */
-   png_reset_filter_heuristics(png_ptr);
-
-   /* Check arguments; the 'reset' function makes the correct settings for the
-    * unweighted case, but we must handle the weight case by initializing the
-    * arrays for the caller.
-    */
-   if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-   {
-      int i;
-
-      if (num_weights > 0)
-      {
-         png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
-             (png_uint_32)((sizeof (png_byte)) * num_weights));
-
-         /* To make sure that the weighting starts out fairly */
-         for (i = 0; i < num_weights; i++)
-         {
-            png_ptr->prev_filters[i] = 255;
-         }
-
-         png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
-             (png_uint_32)((sizeof (png_uint_16)) * num_weights));
-
-         png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
-             (png_uint_32)((sizeof (png_uint_16)) * num_weights));
-
-         for (i = 0; i < num_weights; i++)
-         {
-            png_ptr->inv_filter_weights[i] =
-            png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
-         }
-
-         /* Safe to set this now */
-         png_ptr->num_prev_filters = (png_byte)num_weights;
-      }
-
-      /* If, in the future, there are other filter methods, this would
-       * need to be based on png_ptr->filter.
-       */
-      if (png_ptr->filter_costs == NULL)
-      {
-         png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
-             (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
-
-         png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
-             (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
-      }
-
-      for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
-      {
-         png_ptr->inv_filter_costs[i] =
-         png_ptr->filter_costs[i] = PNG_COST_FACTOR;
-      }
-
-      /* All the arrays are inited, safe to set this: */
-      png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_WEIGHTED;
-
-      /* Return the 'ok' code. */
-      return 1;
-   }
-   else if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT ||
-      heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
-   {
-      return 1;
-   }
-   else
-   {
-      png_warning(png_ptr, "Unknown filter heuristic method");
-      return 0;
-   }
-}
-
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
 /* Provide floating and fixed point APIs */
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 void PNGAPI
@@ -1284,52 +1147,11 @@
     int num_weights, png_const_doublep filter_weights,
     png_const_doublep filter_costs)
 {
-   png_debug(1, "in png_set_filter_heuristics");
-
-   /* The internal API allocates all the arrays and ensures that the elements of
-    * those arrays are set to the default value.
-    */
-   if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
-      return;
-
-   /* If using the weighted method copy in the weights. */
-   if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-   {
-      int i;
-      for (i = 0; i < num_weights; i++)
-      {
-         if (filter_weights[i] <= 0.0)
-         {
-            png_ptr->inv_filter_weights[i] =
-            png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
-         }
-
-         else
-         {
-            png_ptr->inv_filter_weights[i] =
-                (png_uint_16)(PNG_WEIGHT_FACTOR*filter_weights[i]+.5);
-
-            png_ptr->filter_weights[i] =
-                (png_uint_16)(PNG_WEIGHT_FACTOR/filter_weights[i]+.5);
-         }
-      }
-
-      /* Here is where we set the relative costs of the different filters.  We
-       * should take the desired compression level into account when setting
-       * the costs, so that Paeth, for instance, has a high relative cost at low
-       * compression levels, while it has a lower relative cost at higher
-       * compression settings.  The filter types are in order of increasing
-       * relative cost, so it would be possible to do this with an algorithm.
-       */
-      for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) if (filter_costs[i] >= 1.0)
-      {
-         png_ptr->inv_filter_costs[i] =
-             (png_uint_16)(PNG_COST_FACTOR / filter_costs[i] + .5);
-
-         png_ptr->filter_costs[i] =
-             (png_uint_16)(PNG_COST_FACTOR * filter_costs[i] + .5);
-      }
-   }
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(heuristic_method)
+   PNG_UNUSED(num_weights)
+   PNG_UNUSED(filter_weights)
+   PNG_UNUSED(filter_costs)
 }
 #endif /* FLOATING_POINT */
 
@@ -1339,67 +1161,16 @@
     int num_weights, png_const_fixed_point_p filter_weights,
     png_const_fixed_point_p filter_costs)
 {
-   png_debug(1, "in png_set_filter_heuristics_fixed");
-
-   /* The internal API allocates all the arrays and ensures that the elements of
-    * those arrays are set to the default value.
-    */
-   if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
-      return;
-
-   /* If using the weighted method copy in the weights. */
-   if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-   {
-      int i;
-      for (i = 0; i < num_weights; i++)
-      {
-         if (filter_weights[i] <= 0)
-         {
-            png_ptr->inv_filter_weights[i] =
-            png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
-         }
-
-         else
-         {
-            png_ptr->inv_filter_weights[i] = (png_uint_16)
-               ((PNG_WEIGHT_FACTOR*filter_weights[i]+PNG_FP_HALF)/PNG_FP_1);
-
-            png_ptr->filter_weights[i] = (png_uint_16)((PNG_WEIGHT_FACTOR*
-               PNG_FP_1+(filter_weights[i]/2))/filter_weights[i]);
-         }
-      }
-
-      /* Here is where we set the relative costs of the different filters.  We
-       * should take the desired compression level into account when setting
-       * the costs, so that Paeth, for instance, has a high relative cost at low
-       * compression levels, while it has a lower relative cost at higher
-       * compression settings.  The filter types are in order of increasing
-       * relative cost, so it would be possible to do this with an algorithm.
-       */
-      for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
-         if (filter_costs[i] >= PNG_FP_1)
-      {
-         png_uint_32 tmp;
-
-         /* Use a 32 bit unsigned temporary here because otherwise the
-          * intermediate value will be a 32 bit *signed* integer (ANSI rules)
-          * and this will get the wrong answer on division.
-          */
-         tmp = PNG_COST_FACTOR*PNG_FP_1 + (filter_costs[i]/2);
-         tmp /= filter_costs[i];
-
-         png_ptr->inv_filter_costs[i] = (png_uint_16)tmp;
-
-         tmp = PNG_COST_FACTOR * filter_costs[i] + PNG_FP_HALF;
-         tmp /= PNG_FP_1;
-
-         png_ptr->filter_costs[i] = (png_uint_16)tmp;
-      }
-   }
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(heuristic_method)
+   PNG_UNUSED(num_weights)
+   PNG_UNUSED(filter_weights)
+   PNG_UNUSED(filter_costs)
 }
 #endif /* FIXED_POINT */
 #endif /* WRITE_WEIGHTED_FILTER */
 
+#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
 void PNGAPI
 png_set_compression_level(png_structrp png_ptr, int level)
 {
@@ -1445,8 +1216,8 @@
    if (png_ptr == NULL)
       return;
 
-   /* Prior to 1.6.0 this would warn but then set the window_bits value, this
-    * meant that negative window bits values could be selected which would cause
+   /* Prior to 1.6.0 this would warn but then set the window_bits value. This
+    * meant that negative window bits values could be selected that would cause
     * libpng to write a non-standard PNG file with raw deflate or gzip
     * compressed IDAT or ancillary chunks.  Such files can be read and there is
     * no warning on read, so this seems like a very bad idea.
@@ -1482,6 +1253,7 @@
 
    png_ptr->zlib_method = method;
 }
+#endif /* WRITE_CUSTOMIZE_COMPRESSION */
 
 /* The following were added to libpng-1.5.4 */
 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
@@ -1642,14 +1414,14 @@
     * alpha channel.
     */
    if ((transforms & (PNG_TRANSFORM_STRIP_FILLER_AFTER|
-      PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
+       PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
    {
 #ifdef PNG_WRITE_FILLER_SUPPORTED
       if ((transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) != 0)
       {
          if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
             png_app_error(png_ptr,
-               "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
+                "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
 
          /* Continue if ignored - this is the pre-1.6.10 behavior */
          png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
@@ -1678,7 +1450,7 @@
       png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
 #endif
 
-   /* Swap bits of 1, 2, 4 bit packed pixel formats */
+   /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
    if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
 #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
       png_set_packswap(png_ptr);
@@ -1708,13 +1480,13 @@
 
 
 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
+# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
 /* Initialize the write structure - general purpose utility. */
 static int
 png_image_write_init(png_imagep image)
 {
    png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
-          png_safe_error, png_safe_warning);
+       png_safe_error, png_safe_warning);
 
    if (png_ptr != NULL)
    {
@@ -1723,7 +1495,7 @@
       if (info_ptr != NULL)
       {
          png_controlp control = png_voidcast(png_controlp,
-            png_malloc_warn(png_ptr, (sizeof *control)));
+             png_malloc_warn(png_ptr, (sizeof *control)));
 
          if (control != NULL)
          {
@@ -1770,12 +1542,12 @@
 png_write_image_16bit(png_voidp argument)
 {
    png_image_write_control *display = png_voidcast(png_image_write_control*,
-      argument);
+       argument);
    png_imagep image = display->image;
    png_structrp png_ptr = image->opaque->png_ptr;
 
    png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
-      display->first_row);
+       display->first_row);
    png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
    png_uint_16p row_end;
    const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
@@ -1784,17 +1556,18 @@
 
    if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
    {
-#     ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-         if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
-         {
-            aindex = -1;
-            ++input_row; /* To point to the first component */
-            ++output_row;
-         }
-
+#   ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+      if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
+      {
+         aindex = -1;
+         ++input_row; /* To point to the first component */
+         ++output_row;
+      }
          else
+            aindex = channels;
+#     else
+         aindex = channels;
 #     endif
-         aindex = channels;
    }
 
    else
@@ -1876,7 +1649,7 @@
  * calculation can be done to 15 bits of accuracy; however, the output needs to
  * be scaled in the range 0..255*65535, so include that scaling here.
  */
-#define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
+#   define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
 
 static png_byte
 png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
@@ -1927,12 +1700,12 @@
 png_write_image_8bit(png_voidp argument)
 {
    png_image_write_control *display = png_voidcast(png_image_write_control*,
-      argument);
+       argument);
    png_imagep image = display->image;
    png_structrp png_ptr = image->opaque->png_ptr;
 
    png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
-      display->first_row);
+       display->first_row);
    png_bytep output_row = png_voidcast(png_bytep, display->local_row);
    png_uint_32 y = image->height;
    const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
@@ -1942,17 +1715,17 @@
       png_bytep row_end;
       int aindex;
 
-#     ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-         if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
-         {
-            aindex = -1;
-            ++input_row; /* To point to the first component */
-            ++output_row;
-         }
+#   ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+      if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
+      {
+         aindex = -1;
+         ++input_row; /* To point to the first component */
+         ++output_row;
+      }
 
-         else
-#     endif
-         aindex = channels;
+      else
+#   endif
+      aindex = channels;
 
       /* Use row_end in place of a loop counter: */
       row_end = output_row + image->width * (channels+1);
@@ -1986,7 +1759,7 @@
          } /* while out_ptr < row_end */
 
          png_write_row(png_ptr, png_voidcast(png_const_bytep,
-            display->local_row));
+             display->local_row));
          input_row += display->row_bytes/(sizeof (png_uint_16));
       } /* while y */
    }
@@ -2025,25 +1798,25 @@
    const png_imagep image = display->image;
    const void *cmap = display->colormap;
    const int entries = image->colormap_entries > 256 ? 256 :
-      (int)image->colormap_entries;
+       (int)image->colormap_entries;
 
    /* NOTE: the caller must check for cmap != NULL and entries != 0 */
    const png_uint_32 format = image->format;
    const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
 
-#  if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
+#   if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
       defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
       const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
-         (format & PNG_FORMAT_FLAG_ALPHA) != 0;
-#  else
+          (format & PNG_FORMAT_FLAG_ALPHA) != 0;
+#   else
 #     define afirst 0
-#  endif
+#   endif
 
-#  ifdef PNG_FORMAT_BGR_SUPPORTED
+#   ifdef PNG_FORMAT_BGR_SUPPORTED
       const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
-#  else
+#   else
 #     define bgr 0
-#  endif
+#   endif
 
    int i, num_trans;
    png_color palette[256];
@@ -2068,11 +1841,11 @@
             if (channels >= 3) /* RGB */
             {
                palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
-                  entry[(2 ^ bgr)]);
+                   entry[(2 ^ bgr)]);
                palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
-                  entry[1]);
+                   entry[1]);
                palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
-                  entry[bgr]);
+                   entry[bgr]);
             }
 
             else /* Gray */
@@ -2148,12 +1921,12 @@
       }
    }
 
-#  ifdef afirst
+#   ifdef afirst
 #     undef afirst
-#  endif
-#  ifdef bgr
+#   endif
+#   ifdef bgr
 #     undef bgr
-#  endif
+#   endif
 
    png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
       entries);
@@ -2181,10 +1954,10 @@
    int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
    int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
 
-#  ifdef PNG_BENIGN_ERRORS_SUPPORTED
+#   ifdef PNG_BENIGN_ERRORS_SUPPORTED
       /* Make sure we error out on any bad situation */
       png_set_benign_errors(png_ptr, 0/*error*/);
-#  endif
+#   endif
 
    /* Default the 'row_stride' parameter if required. */
    if (display->row_stride == 0)
@@ -2253,7 +2026,7 @@
    /* Now set up the data transformations (*after* the header is written),
     * remove the handled transformations from the 'format' flags for checking.
     *
-    * First check for a little endian system if writing 16 bit files.
+    * First check for a little endian system if writing 16-bit files.
     */
    if (write_16bit != 0)
    {
@@ -2263,23 +2036,23 @@
          png_set_swap(png_ptr);
    }
 
-#  ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
+#   ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
       if ((format & PNG_FORMAT_FLAG_BGR) != 0)
       {
          if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
             png_set_bgr(png_ptr);
          format &= ~PNG_FORMAT_FLAG_BGR;
       }
-#  endif
+#   endif
 
-#  ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+#   ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
       if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
       {
          if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
             png_set_swap_alpha(png_ptr);
          format &= ~PNG_FORMAT_FLAG_AFIRST;
       }
-#  endif
+#   endif
 
    /* If there are 16 or fewer color-map entries we wrote a lower bit depth
     * above, but the application data is still byte packed.
@@ -2315,7 +2088,9 @@
        * it about 50 times.  The speed-up in pngstest was about 10-20% of the
        * total (user) time on a heavily loaded system.
        */
+#   ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
       png_set_compression_level(png_ptr, 3);
+#   endif
    }
 
    /* Check for the cases that currently require a pre-transform on the row
@@ -2478,6 +2253,6 @@
    else
       return 0;
 }
-#endif /* STDIO */
+# endif /* STDIO */
 #endif /* SIMPLIFIED_WRITE */
 #endif /* WRITE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -99,7 +99,8 @@
          case 2:
          {
             png_bytep sp, dp;
-            int shift, v;
+            unsigned int shift;
+            int v;
             png_uint_32 i;
             png_uint_32 row_width = row_info->width;
 
@@ -138,7 +139,8 @@
          case 4:
          {
             png_bytep sp, dp;
-            int shift, v;
+            unsigned int shift;
+            int v;
             png_uint_32 i;
             png_uint_32 row_width = row_info->width;
 
@@ -450,7 +452,7 @@
                *(dp++) = *(sp++);
                */
                sp+=3; dp = sp;
-               *(dp++) = (png_byte)(255 - *(sp++));
+               *dp = (png_byte)(255 - *(sp++));
             }
          }
 
@@ -474,7 +476,7 @@
                */
                sp+=6; dp = sp;
                *(dp++) = (png_byte)(255 - *(sp++));
-               *(dp++) = (png_byte)(255 - *(sp++));
+               *dp     = (png_byte)(255 - *(sp++));
             }
          }
 #endif /* WRITE_16BIT */
@@ -512,7 +514,7 @@
                */
                sp+=2; dp = sp;
                *(dp++) = (png_byte)(255 - *(sp++));
-               *(dp++) = (png_byte)(255 - *(sp++));
+               *dp     = (png_byte)(255 - *(sp++));
             }
          }
 #endif /* WRITE_16BIT */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c	Tue Jan 26 09:11:58 2016 +0100
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -51,10 +51,10 @@
 void PNGAPI
 png_save_uint_32(png_bytep buf, png_uint_32 i)
 {
-   buf[0] = (png_byte)((i >> 24) & 0xff);
-   buf[1] = (png_byte)((i >> 16) & 0xff);
-   buf[2] = (png_byte)((i >> 8) & 0xff);
-   buf[3] = (png_byte)(i & 0xff);
+   buf[0] = (png_byte)(i >> 24);
+   buf[1] = (png_byte)(i >> 16);
+   buf[2] = (png_byte)(i >> 8);
+   buf[3] = (png_byte)(i     );
 }
 
 /* Place a 16-bit number into a buffer in PNG byte order.
@@ -64,8 +64,8 @@
 void PNGAPI
 png_save_uint_16(png_bytep buf, unsigned int i)
 {
-   buf[0] = (png_byte)((i >> 8) & 0xff);
-   buf[1] = (png_byte)(i & 0xff);
+   buf[0] = (png_byte)(i >> 8);
+   buf[1] = (png_byte)(i     );
 }
 #endif
 
@@ -207,7 +207,7 @@
    if (png_ptr == NULL)
       return;
 
-   /* On 64 bit architectures 'length' may not fit in a png_uint_32. */
+   /* On 64-bit architectures 'length' may not fit in a png_uint_32. */
    if (length > PNG_UINT_31_MAX)
       png_error(png_ptr, "length exceeds PNG maximum");
 
@@ -336,7 +336,7 @@
        */
       (void)png_safecat(msg, (sizeof msg), 10, " using zstream");
 #endif
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
          png_warning(png_ptr, msg);
 
          /* Attempt sane error recovery */
@@ -723,7 +723,7 @@
 
    while (*key && key_len < 79)
    {
-      png_byte ch = (png_byte)(0xff & *key++);
+      png_byte ch = (png_byte)*key++;
 
       if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
          *new_key++ = ch, ++key_len, space = 0;
@@ -899,7 +899,7 @@
    interlace_type=PNG_INTERLACE_NONE;
 #endif
 
-   /* Save the relevent information */
+   /* Save the relevant information */
    png_ptr->bit_depth = (png_byte)bit_depth;
    png_ptr->color_type = (png_byte)color_type;
    png_ptr->interlaced = (png_byte)interlace_type;
@@ -950,17 +950,20 @@
 png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
     png_uint_32 num_pal)
 {
-   png_uint_32 i;
+   png_uint_32 max_palette_length, i;
    png_const_colorp pal_ptr;
    png_byte buf[3];
 
    png_debug(1, "in png_write_PLTE");
 
+   max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
+      (1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
+
    if ((
 #ifdef PNG_MNG_FEATURES_SUPPORTED
        (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
 #endif
-       num_pal == 0) || num_pal > 256)
+       num_pal == 0) || num_pal > max_palette_length)
    {
       if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       {
@@ -1472,7 +1475,7 @@
 
    else if (color_type == PNG_COLOR_TYPE_GRAY)
    {
-      /* One 16 bit value */
+      /* One 16-bit value */
       if (tran->gray >= (1 << png_ptr->bit_depth))
       {
          png_app_warning(png_ptr,
@@ -1487,7 +1490,7 @@
 
    else if (color_type == PNG_COLOR_TYPE_RGB)
    {
-      /* Three 16 bit values */
+      /* Three 16-bit values */
       png_save_uint_16(buf, tran->red);
       png_save_uint_16(buf + 2, tran->green);
       png_save_uint_16(buf + 4, tran->blue);
@@ -1793,7 +1796,7 @@
       png_write_compressed_data_out(png_ptr, &comp);
 
    else
-      png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.input_len);
+      png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.output_len);
 
    png_write_chunk_end(png_ptr);
 }
@@ -1989,6 +1992,10 @@
    png_alloc_size_t buf_size;
    int usr_pixel_depth;
 
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+   png_byte filters;
+#endif
+
    png_debug(1, "in png_write_start_row");
 
    usr_pixel_depth = png_ptr->usr_channels * png_ptr->usr_bit_depth;
@@ -1999,50 +2006,54 @@
    png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
 
    /* Set up row buffer */
-   png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
+   png_ptr->row_buf = png_voidcast(png_bytep, png_malloc(png_ptr, buf_size));
 
    png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
 
 #ifdef PNG_WRITE_FILTER_SUPPORTED
-   /* Set up filtering buffer, if using this filter */
-   if (png_ptr->do_filter & PNG_FILTER_SUB)
-   {
-      png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, png_ptr->rowbytes + 1);
-
-      png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
-   }
-
-   /* We only need to keep the previous row if we are using one of these. */
-   if ((png_ptr->do_filter &
-      (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
+   filters = png_ptr->do_filter;
+
+   if (png_ptr->height == 1)
+      filters &= 0xff & ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+   if (png_ptr->width == 1)
+      filters &= 0xff & ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+   if (filters == 0)
+      filters = PNG_FILTER_NONE;
+
+   png_ptr->do_filter = filters;
+
+   if (((filters & (PNG_FILTER_SUB | PNG_FILTER_UP | PNG_FILTER_AVG |
+       PNG_FILTER_PAETH)) != 0) && png_ptr->try_row == NULL)
    {
-      /* Set up previous row buffer */
-      png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
-
-      if ((png_ptr->do_filter & PNG_FILTER_UP) != 0)
-      {
-         png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
-            png_ptr->rowbytes + 1);
-
-         png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
-      }
-
-      if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0)
-      {
-         png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
-             png_ptr->rowbytes + 1);
-
-         png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
-      }
-
-      if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0)
-      {
-         png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
-             png_ptr->rowbytes + 1);
-
-         png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
-      }
+      int num_filters = 0;
+
+      png_ptr->try_row = png_voidcast(png_bytep, png_malloc(png_ptr, buf_size));
+
+      if (filters & PNG_FILTER_SUB)
+         num_filters++;
+
+      if (filters & PNG_FILTER_UP)
+         num_filters++;
+
+      if (filters & PNG_FILTER_AVG)
+         num_filters++;
+
+      if (filters & PNG_FILTER_PAETH)
+         num_filters++;
+
+      if (num_filters > 1)
+         png_ptr->tst_row = png_voidcast(png_bytep, png_malloc(png_ptr,
+             buf_size));
    }
+
+   /* We only need to keep the previous row if we are using one of the following
+    * filters.
+    */
+   if ((filters & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
+      png_ptr->prev_row = png_voidcast(png_bytep,
+         png_calloc(png_ptr, buf_size));
 #endif /* WRITE_FILTER */
 
 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
@@ -2188,7 +2199,7 @@
          {
             png_bytep sp;
             png_bytep dp;
-            int shift;
+            unsigned int shift;
             int d;
             int value;
             png_uint_32 i;
@@ -2226,7 +2237,7 @@
          {
             png_bytep sp;
             png_bytep dp;
-            int shift;
+            unsigned int shift;
             int d;
             int value;
             png_uint_32 i;
@@ -2263,7 +2274,7 @@
          {
             png_bytep sp;
             png_bytep dp;
-            int shift;
+            unsigned int shift;
             int d;
             int value;
             png_uint_32 i;
@@ -2338,50 +2349,181 @@
 }
 #endif
 
+
 /* This filters the row, chooses which filter to use, if it has not already
  * been specified by the application, and then writes the row out with the
  * chosen filter.
  */
-static void
+static void /* PRIVATE */
 png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
    png_size_t row_bytes);
 
-#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
-#define PNG_HISHIFT 10
-#define PNG_LOMASK ((png_uint_32)0xffffL)
-#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT))
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+static png_size_t /* PRIVATE */
+png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
+    const png_size_t row_bytes, const png_size_t lmins)
+{
+   png_bytep rp, dp, lp;
+   png_size_t i;
+   png_size_t sum = 0;
+   int v;
+
+   png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
+
+   for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
+        i++, rp++, dp++)
+   {
+      v = *dp = *rp;
+      sum += (v < 128) ? v : 256 - v;
+   }
+
+   for (lp = png_ptr->row_buf + 1; i < row_bytes;
+      i++, rp++, lp++, dp++)
+   {
+      v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
+      sum += (v < 128) ? v : 256 - v;
+
+      if (sum > lmins)  /* We are already worse, don't continue. */
+        break;
+   }
+
+   return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
+    const png_size_t lmins)
+{
+   png_bytep rp, dp, pp;
+   png_size_t i;
+   png_size_t sum = 0;
+   int v;
+
+   png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
+
+   for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+       pp = png_ptr->prev_row + 1; i < row_bytes;
+       i++, rp++, pp++, dp++)
+   {
+      v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
+      sum += (v < 128) ? v : 256 - v;
+
+      if (sum > lmins)  /* We are already worse, don't continue. */
+        break;
+   }
+
+   return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
+      const png_size_t row_bytes, const png_size_t lmins)
+{
+   png_bytep rp, dp, pp, lp;
+   png_uint_32 i;
+   png_size_t sum = 0;
+   int v;
+
+   png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
+
+   for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+        pp = png_ptr->prev_row + 1; i < bpp; i++)
+   {
+      v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
+
+      sum += (v < 128) ? v : 256 - v;
+   }
+
+   for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
+   {
+      v = *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
+          & 0xff);
+
+      sum += (v < 128) ? v : 256 - v;
+
+      if (sum > lmins)  /* We are already worse, don't continue. */
+        break;
+   }
+
+   return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
+    const png_size_t row_bytes, const png_size_t lmins)
+{
+   png_bytep rp, dp, pp, cp, lp;
+   png_size_t i;
+   png_size_t sum = 0;
+   int v;
+
+   png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
+
+   for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+       pp = png_ptr->prev_row + 1; i < bpp; i++)
+   {
+      v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
+
+      sum += (v < 128) ? v : 256 - v;
+   }
+
+   for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
+        i++)
+   {
+      int a, b, c, pa, pb, pc, p;
+
+      b = *pp++;
+      c = *cp++;
+      a = *lp++;
+
+      p = b - c;
+      pc = a - c;
+
+#ifdef PNG_USE_ABS
+      pa = abs(p);
+      pb = abs(pc);
+      pc = abs(p + pc);
+#else
+      pa = p < 0 ? -p : p;
+      pb = pc < 0 ? -pc : pc;
+      pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
+
+      p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
+
+      v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
+
+      sum += (v < 128) ? v : 256 - v;
+
+      if (sum > lmins)  /* We are already worse, don't continue. */
+        break;
+   }
+
+   return (sum);
+}
+#endif /* WRITE_FILTER */
+
 void /* PRIVATE */
 png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 {
-   png_bytep best_row;
-#ifdef PNG_WRITE_FILTER_SUPPORTED
-   png_bytep prev_row, row_buf;
-   png_uint_32 mins, bpp;
+#ifndef PNG_WRITE_FILTER_SUPPORTED
+   png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
+#else
    png_byte filter_to_do = png_ptr->do_filter;
+   png_bytep row_buf;
+   png_bytep best_row;
+   png_uint_32 bpp;
+   png_size_t mins;
    png_size_t row_bytes = row_info->rowbytes;
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-   int num_p_filters = png_ptr->num_prev_filters;
-#endif
 
    png_debug(1, "in png_write_find_filter");
 
-#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-  if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
-  {
-     /* These will never be selected so we need not test them. */
-     filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
-  }
-#endif
-
    /* Find out how many bytes offset each pixel is */
    bpp = (row_info->pixel_depth + 7) >> 3;
 
-   prev_row = png_ptr->prev_row;
-#endif
-   best_row = png_ptr->row_buf;
-#ifdef PNG_WRITE_FILTER_SUPPORTED
-   row_buf = best_row;
-   mins = PNG_MAXSUM;
+   row_buf = png_ptr->row_buf;
+   mins = PNG_SIZE_MAX - 256/* so we can detect potential overflow of the
+                               running sum */;
 
    /* The prediction method we use is to find which method provides the
     * smallest value when summing the absolute values of the distances
@@ -2411,57 +2553,37 @@
    /* We don't need to test the 'no filter' case if this is the only filter
     * that has been chosen, as it doesn't actually do anything to the data.
     */
+   best_row = png_ptr->row_buf;
+
+
    if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
    {
       png_bytep rp;
-      png_uint_32 sum = 0;
+      png_size_t sum = 0;
       png_size_t i;
       int v;
 
-      for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
+      if (PNG_SIZE_MAX/128 <= row_bytes)
       {
-         v = *rp;
-         sum += (v < 128) ? v : 256 - v;
-      }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         png_uint_32 sumhi, sumlo;
-         int j;
-         sumlo = sum & PNG_LOMASK;
-         sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
-
-         /* Reduce the sum if we match any of the previous rows */
-         for (j = 0; j < num_p_filters; j++)
+         for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
          {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
-            {
-               sumlo = (sumlo * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               sumhi = (sumhi * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
+            /* Check for overflow */
+            if (sum > PNG_SIZE_MAX/128 - 256)
+               break;
+
+            v = *rp;
+            sum += (v < 128) ? v : 256 - v;
          }
-
-         /* Factor in the cost of this filter (this is here for completeness,
-          * but it makes no sense to have a "cost" for the NONE filter, as
-          * it has the minimum possible computational cost - none).
-          */
-         sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
-             PNG_COST_SHIFT;
-
-         sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
-             PNG_COST_SHIFT;
-
-         if (sumhi > PNG_HIMASK)
-            sum = PNG_MAXSUM;
-
-         else
-            sum = (sumhi << PNG_HISHIFT) + sumlo;
       }
-#endif
+      else /* Overflow is not possible */
+      {
+         for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
+         {
+            v = *rp;
+            sum += (v < 128) ? v : 256 - v;
+         }
+      }
+
       mins = sum;
    }
 
@@ -2469,553 +2591,109 @@
    if (filter_to_do == PNG_FILTER_SUB)
    /* It's the only filter so no testing is needed */
    {
-      png_bytep rp, lp, dp;
-      png_size_t i;
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
-           i++, rp++, dp++)
-      {
-         *dp = *rp;
-      }
-
-      for (lp = row_buf + 1; i < row_bytes;
-         i++, rp++, lp++, dp++)
-      {
-         *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
-      }
-
-      best_row = png_ptr->sub_row;
+      (void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
+      best_row = png_ptr->try_row;
    }
 
    else if ((filter_to_do & PNG_FILTER_SUB) != 0)
    {
-      png_bytep rp, dp, lp;
-      png_uint_32 sum = 0, lmins = mins;
-      png_size_t i;
-      int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      /* We temporarily increase the "minimum sum" by the factor we
-       * would reduce the sum of this filter, so that we can do the
-       * early exit comparison without scaling the sum each time.
-       */
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 lmhi, lmlo;
-         lmlo = lmins & PNG_LOMASK;
-         lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
-            {
-               lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
-             PNG_COST_SHIFT;
-
-         lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
-             PNG_COST_SHIFT;
-
-         if (lmhi > PNG_HIMASK)
-            lmins = PNG_MAXSUM;
-
-         else
-            lmins = (lmhi << PNG_HISHIFT) + lmlo;
-      }
-#endif
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
-           i++, rp++, dp++)
-      {
-         v = *dp = *rp;
-
-         sum += (v < 128) ? v : 256 - v;
-      }
-
-      for (lp = row_buf + 1; i < row_bytes;
-         i++, rp++, lp++, dp++)
-      {
-         v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-
-         if (sum > lmins)  /* We are already worse, don't continue. */
-            break;
-      }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 sumhi, sumlo;
-         sumlo = sum & PNG_LOMASK;
-         sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
-            {
-               sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
-             PNG_COST_SHIFT;
-
-         sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
-             PNG_COST_SHIFT;
-
-         if (sumhi > PNG_HIMASK)
-            sum = PNG_MAXSUM;
-
-         else
-            sum = (sumhi << PNG_HISHIFT) + sumlo;
-      }
-#endif
+      png_size_t sum;
+      png_size_t lmins = mins;
+
+      sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
 
       if (sum < mins)
       {
          mins = sum;
-         best_row = png_ptr->sub_row;
+         best_row = png_ptr->try_row;
+         if (png_ptr->tst_row != NULL)
+         {
+            png_ptr->try_row = png_ptr->tst_row;
+            png_ptr->tst_row = best_row;
+         }
       }
    }
 
    /* Up filter */
    if (filter_to_do == PNG_FILTER_UP)
    {
-      png_bytep rp, dp, pp;
-      png_size_t i;
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
-          pp = prev_row + 1; i < row_bytes;
-          i++, rp++, pp++, dp++)
-      {
-         *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
-      }
-
-      best_row = png_ptr->up_row;
+      (void) png_setup_up_row(png_ptr, row_bytes, mins);
+      best_row = png_ptr->try_row;
    }
 
    else if ((filter_to_do & PNG_FILTER_UP) != 0)
    {
-      png_bytep rp, dp, pp;
-      png_uint_32 sum = 0, lmins = mins;
-      png_size_t i;
-      int v;
-
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 lmhi, lmlo;
-         lmlo = lmins & PNG_LOMASK;
-         lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
-            {
-               lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
-             PNG_COST_SHIFT;
-
-         lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
-             PNG_COST_SHIFT;
-
-         if (lmhi > PNG_HIMASK)
-            lmins = PNG_MAXSUM;
-
-         else
-            lmins = (lmhi << PNG_HISHIFT) + lmlo;
-      }
-#endif
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
-          pp = prev_row + 1; i < row_bytes; i++)
-      {
-         v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-
-         if (sum > lmins)  /* We are already worse, don't continue. */
-            break;
-      }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 sumhi, sumlo;
-         sumlo = sum & PNG_LOMASK;
-         sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
-            {
-               sumlo = (sumlo * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               sumhi = (sumhi * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
-             PNG_COST_SHIFT;
-
-         sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
-             PNG_COST_SHIFT;
-
-         if (sumhi > PNG_HIMASK)
-            sum = PNG_MAXSUM;
-
-         else
-            sum = (sumhi << PNG_HISHIFT) + sumlo;
-      }
-#endif
+      png_size_t sum;
+      png_size_t lmins = mins;
+
+      sum = png_setup_up_row(png_ptr, row_bytes, lmins);
 
       if (sum < mins)
       {
          mins = sum;
-         best_row = png_ptr->up_row;
+         best_row = png_ptr->try_row;
+         if (png_ptr->tst_row != NULL)
+         {
+            png_ptr->try_row = png_ptr->tst_row;
+            png_ptr->tst_row = best_row;
+         }
       }
    }
 
    /* Avg filter */
    if (filter_to_do == PNG_FILTER_AVG)
    {
-      png_bytep rp, dp, pp, lp;
-      png_uint_32 i;
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
-           pp = prev_row + 1; i < bpp; i++)
-      {
-         *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
-      }
-
-      for (lp = row_buf + 1; i < row_bytes; i++)
-      {
-         *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
-                 & 0xff);
-      }
-      best_row = png_ptr->avg_row;
+      (void) png_setup_avg_row(png_ptr, bpp, row_bytes, mins);
+      best_row = png_ptr->try_row;
    }
 
    else if ((filter_to_do & PNG_FILTER_AVG) != 0)
    {
-      png_bytep rp, dp, pp, lp;
-      png_uint_32 sum = 0, lmins = mins;
-      png_size_t i;
-      int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 lmhi, lmlo;
-         lmlo = lmins & PNG_LOMASK;
-         lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG)
-            {
-               lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
-             PNG_COST_SHIFT;
-
-         lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
-             PNG_COST_SHIFT;
-
-         if (lmhi > PNG_HIMASK)
-            lmins = PNG_MAXSUM;
-
-         else
-            lmins = (lmhi << PNG_HISHIFT) + lmlo;
-      }
-#endif
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
-           pp = prev_row + 1; i < bpp; i++)
-      {
-         v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-      }
-
-      for (lp = row_buf + 1; i < row_bytes; i++)
-      {
-         v = *dp++ =
-             (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-
-         if (sum > lmins)  /* We are already worse, don't continue. */
-            break;
-      }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 sumhi, sumlo;
-         sumlo = sum & PNG_LOMASK;
-         sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
-            {
-               sumlo = (sumlo * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               sumhi = (sumhi * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
-             PNG_COST_SHIFT;
-
-         sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
-             PNG_COST_SHIFT;
-
-         if (sumhi > PNG_HIMASK)
-            sum = PNG_MAXSUM;
-
-         else
-            sum = (sumhi << PNG_HISHIFT) + sumlo;
-      }
-#endif
+      png_size_t sum;
+      png_size_t lmins = mins;
+
+      sum= png_setup_avg_row(png_ptr, bpp, row_bytes, lmins);
 
       if (sum < mins)
       {
          mins = sum;
-         best_row = png_ptr->avg_row;
+         best_row = png_ptr->try_row;
+         if (png_ptr->tst_row != NULL)
+         {
+            png_ptr->try_row = png_ptr->tst_row;
+            png_ptr->tst_row = best_row;
+         }
       }
    }
 
    /* Paeth filter */
    if ((filter_to_do == PNG_FILTER_PAETH) != 0)
    {
-      png_bytep rp, dp, pp, cp, lp;
-      png_size_t i;
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
-          pp = prev_row + 1; i < bpp; i++)
-      {
-         *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-      }
-
-      for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
-      {
-         int a, b, c, pa, pb, pc, p;
-
-         b = *pp++;
-         c = *cp++;
-         a = *lp++;
-
-         p = b - c;
-         pc = a - c;
-
-#ifdef PNG_USE_ABS
-         pa = abs(p);
-         pb = abs(pc);
-         pc = abs(p + pc);
-#else
-         pa = p < 0 ? -p : p;
-         pb = pc < 0 ? -pc : pc;
-         pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
-
-         p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
-
-         *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
-      }
-      best_row = png_ptr->paeth_row;
+      (void) png_setup_paeth_row(png_ptr, bpp, row_bytes, mins);
+      best_row = png_ptr->try_row;
    }
 
    else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
    {
-      png_bytep rp, dp, pp, cp, lp;
-      png_uint_32 sum = 0, lmins = mins;
-      png_size_t i;
-      int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 lmhi, lmlo;
-         lmlo = lmins & PNG_LOMASK;
-         lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
-            {
-               lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
-             PNG_COST_SHIFT;
-
-         lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
-             PNG_COST_SHIFT;
-
-         if (lmhi > PNG_HIMASK)
-            lmins = PNG_MAXSUM;
-
-         else
-            lmins = (lmhi << PNG_HISHIFT) + lmlo;
-      }
-#endif
-
-      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
-          pp = prev_row + 1; i < bpp; i++)
-      {
-         v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-      }
-
-      for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
-      {
-         int a, b, c, pa, pb, pc, p;
-
-         b = *pp++;
-         c = *cp++;
-         a = *lp++;
-
-#ifndef PNG_SLOW_PAETH
-         p = b - c;
-         pc = a - c;
-#ifdef PNG_USE_ABS
-         pa = abs(p);
-         pb = abs(pc);
-         pc = abs(p + pc);
-#else
-         pa = p < 0 ? -p : p;
-         pb = pc < 0 ? -pc : pc;
-         pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
-         p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
-#else /* SLOW_PAETH */
-         p = a + b - c;
-         pa = abs(p - a);
-         pb = abs(p - b);
-         pc = abs(p - c);
-
-         if (pa <= pb && pa <= pc)
-            p = a;
-
-         else if (pb <= pc)
-            p = b;
-
-         else
-            p = c;
-#endif /* SLOW_PAETH */
-
-         v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
-
-         sum += (v < 128) ? v : 256 - v;
-
-         if (sum > lmins)  /* We are already worse, don't continue. */
-            break;
-      }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-      if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
-      {
-         int j;
-         png_uint_32 sumhi, sumlo;
-         sumlo = sum & PNG_LOMASK;
-         sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
-         for (j = 0; j < num_p_filters; j++)
-         {
-            if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
-            {
-               sumlo = (sumlo * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-
-               sumhi = (sumhi * png_ptr->filter_weights[j]) >>
-                   PNG_WEIGHT_SHIFT;
-            }
-         }
-
-         sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
-             PNG_COST_SHIFT;
-
-         sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
-             PNG_COST_SHIFT;
-
-         if (sumhi > PNG_HIMASK)
-            sum = PNG_MAXSUM;
-
-         else
-            sum = (sumhi << PNG_HISHIFT) + sumlo;
-      }
-#endif
+      png_size_t sum;
+      png_size_t lmins = mins;
+
+      sum = png_setup_paeth_row(png_ptr, bpp, row_bytes, lmins);
 
       if (sum < mins)
       {
-         best_row = png_ptr->paeth_row;
+         best_row = png_ptr->try_row;
+         if (png_ptr->tst_row != NULL)
+         {
+            png_ptr->try_row = png_ptr->tst_row;
+            png_ptr->tst_row = best_row;
+         }
       }
    }
-#endif /* WRITE_FILTER */
 
    /* Do the actual writing of the filtered row data from the chosen filter. */
    png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
 
-#ifdef PNG_WRITE_FILTER_SUPPORTED
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-   /* Save the type of filter we picked this time for future calculations */
-   if (png_ptr->num_prev_filters > 0)
-   {
-      int j;
-
-      for (j = 1; j < num_p_filters; j++)
-      {
-         png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1];
-      }
-
-      png_ptr->prev_filters[j] = best_row[0];
-   }
-#endif
 #endif /* WRITE_FILTER */
 }
 
@@ -3031,6 +2709,7 @@
 
    png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
 
+#ifdef PNG_WRITE_FILTER_SUPPORTED
    /* Swap the current and previous rows */
    if (png_ptr->prev_row != NULL)
    {
@@ -3040,6 +2719,7 @@
       png_ptr->prev_row = png_ptr->row_buf;
       png_ptr->row_buf = tptr;
    }
+#endif /* WRITE_FILTER */
 
    /* Finish row - updates counters and flushes zlib if last row */
    png_write_finish_row(png_ptr);
--- a/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c	Tue Jan 26 09:11:58 2016 +0100
@@ -103,6 +103,7 @@
     if (png_get_gAMA(png_ptr, info_ptr, &gamma))
         png_set_gamma(png_ptr, 2.2, gamma);
 
+    png_set_interlace_handling(png_ptr);
     png_read_update_info(png_ptr, info_ptr);
 
     rowbytes = png_get_rowbytes(png_ptr, info_ptr);
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Tue Jan 26 09:11:58 2016 +0100
@@ -1156,8 +1156,8 @@
             continue;
         }
         pattern = (*FcNameParse)((FcChar8 *)fcName);
+        (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
         if (pattern == NULL) {
-            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1175,7 +1175,6 @@
         fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
         if (fontset == NULL) {
             (*FcPatternDestroy)(pattern);
-            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1207,7 +1206,6 @@
             }
             (*FcPatternDestroy)(pattern);
             (*FcFontSetDestroy)(fontset);
-            (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
             closeFontConfig(libfontconfig, JNI_FALSE);
             return;
         }
@@ -1249,8 +1247,6 @@
                 free(file);
                 (*FcPatternDestroy)(pattern);
                 (*FcFontSetDestroy)(fontset);
-                (*env)->ReleaseStringUTFChars(env,
-                                              fcNameStr, (const char*)fcName);
                 closeFontConfig(libfontconfig, JNI_FALSE);
                 return;
             }
@@ -1298,6 +1294,16 @@
         if (includeFallbacks) {
             fcFontArr =
                 (*env)->NewObjectArray(env, fontCount, fcFontClass, NULL);
+            if (IS_NULL(fcFontArr)) {
+                free(family);
+                free(fullname);
+                free(styleStr);
+                free(file);
+                (*FcPatternDestroy)(pattern);
+                (*FcFontSetDestroy)(fontset);
+                closeFontConfig(libfontconfig, JNI_FALSE);
+                return;
+            }
             (*env)->SetObjectField(env,fcCompFontObj, fcAllFontsID, fcFontArr);
         }
         fn=0;
@@ -1306,18 +1312,23 @@
             if (family[j] != NULL) {
                 jobject fcFont =
                     (*env)->NewObject(env, fcFontClass, fcFontCons);
+                if (IS_NULL(fcFont)) break;
                 jstr = (*env)->NewStringUTF(env, (const char*)family[j]);
+                if (IS_NULL(jstr)) break;
                 (*env)->SetObjectField(env, fcFont, familyNameID, jstr);
                 if (file[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)file[j]);
+                    if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, fontFileID, jstr);
                 }
                 if (styleStr[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)styleStr[j]);
+                    if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, styleNameID, jstr);
                 }
                 if (fullname[j] != NULL) {
                     jstr = (*env)->NewStringUTF(env, (const char*)fullname[j]);
+                    if (IS_NULL(jstr)) break;
                     (*env)->SetObjectField(env, fcFont, fullNameID, jstr);
                 }
                 if (fn==0) {
@@ -1331,7 +1342,6 @@
                 }
             }
         }
-        (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName);
         (*FcFontSetDestroy)(fontset);
         (*FcPatternDestroy)(pattern);
         free(family);
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Tue Jan 26 09:11:58 2016 +0100
@@ -423,7 +423,7 @@
      * @exception  IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
      * @exception  IllegalArgumentException if pattern is an empty string
      *
-     * @since 1.9
+     * @since 9
      *
      */
     public FileHandler(String pattern, long limit, int count, boolean append)
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Tue Jan 26 09:11:58 2016 +0100
@@ -2548,7 +2548,7 @@
      * caller does not have LoggingPermission("control").
      * @throws NullPointerException if the listener is null.
      *
-     * @since 1.9
+     * @since 9
      */
     public LogManager addConfigurationListener(Runnable listener) {
         final Runnable r = Objects.requireNonNull(listener);
@@ -2575,7 +2575,7 @@
      * @throws SecurityException if a security manager exists and if the
      * caller does not have LoggingPermission("control").
      *
-     * @since 1.9
+     * @since 9
      */
     public void removeConfigurationListener(Runnable listener) {
         final Runnable key = Objects.requireNonNull(listener);
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java	Tue Jan 26 09:11:58 2016 +0100
@@ -138,7 +138,7 @@
 
     /**
      * Event time.
-     * @since 1.9
+     * @since 9
      */
     private Instant instant;
 
@@ -158,7 +158,7 @@
      *               The event time instant can be reconstructed using
      * <code>Instant.ofEpochSecond(millis/1000, (millis % 1000) * 1000_000 + nanoAdjustment)</code>
      *              <p>
-     *              Since: 1.9
+     *              Since: 9
      * @serialField thrown Throwable The Throwable (if any) associated with log
      *              message
      * @serialField loggerName String Name of the source Logger
@@ -207,7 +207,7 @@
      * The sequence property will be initialized with a new unique value.
      * These sequence values are allocated in increasing order within a VM.
      * <p>
-     * Since JDK 1.9, the event time is represented by an {@link Instant}.
+     * Since JDK 9, the event time is represented by an {@link Instant}.
      * The instant property will be initialized to the {@linkplain
      * Instant#now() current instant}, using the best available
      * {@linkplain Clock#systemUTC() clock} on the system.
@@ -505,7 +505,7 @@
      *
      * @return the instant that the event occurred.
      *
-     * @since 1.9
+     * @since 9
      */
     public Instant getInstant() {
         return instant;
@@ -525,7 +525,7 @@
      * @throws ArithmeticException if numeric overflow would occur while
      *         calling {@link Instant#toEpochMilli() instant.toEpochMilli()}.
      *
-     * @since 1.9
+     * @since 9
      */
     public void setInstant(Instant instant) {
         instant.toEpochMilli();
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1300,7 +1300,7 @@
      *                  can be {@code null}.
      * @param   msg     The string message (or a key in the message catalog)
      * @param   params  Parameters to the message (optional, may be none).
-     * @since 1.9
+     * @since 9
      */
     public void logrb(Level level, ResourceBundle bundle, String msg, Object... params) {
         if (!isLoggable(level)) {
@@ -1417,7 +1417,7 @@
      *                  can be {@code null}.
      * @param   msg     The string message (or a key in the message catalog)
      * @param   thrown  Throwable associated with the log message.
-     * @since 1.9
+     * @since 9
      */
     public void logrb(Level level, ResourceBundle bundle, String msg,
             Throwable thrown) {
--- a/jdk/src/java.logging/share/classes/sun/util/logging/internal/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -50,6 +50,6 @@
  * @see sun.util.logging.PlatformLogger.Bridge
  * @see jdk.internal.logger
  *
- * @since 1.9
+ * @since 9
  */
 package sun.util.logging.internal;
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java	Tue Jan 26 09:11:58 2016 +0100
@@ -590,7 +590,7 @@
      * @return {@code true} if the thread is a daemon thread,
      *         {@code false} otherwise.
      * @see Thread#isDaemon
-     * @since 1.9
+     * @since 9
      */
     public boolean isDaemon() {
          return daemon;
@@ -602,7 +602,7 @@
      *
      * @return The priority of the thread associated with this
      *         {@code ThreadInfo}.
-     * @since 1.9
+     * @since 9
      */
     public int getPriority() {
          return priority;
--- a/jdk/src/java.management/share/classes/javax/management/ConstructorParameters.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/ConstructorParameters.java	Tue Jan 26 09:11:58 2016 +0100
@@ -62,7 +62,7 @@
  * the JMX introspection will give an absolute precedence to the latter one.
  * </p>
  *
- * @since 1.9
+ * @since 9
  */
 @Documented @Target(CONSTRUCTOR) @Retention(RUNTIME)
 public @interface ConstructorParameters {
--- a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -37,6 +37,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.logging.Level;
 
@@ -142,7 +143,7 @@
                 skipSpace(in);
                 val = buf.toString();
             }
-            atts.put(att.toLowerCase(), val);
+            atts.put(att.toLowerCase(Locale.ENGLISH), val);
             skipSpace(in);
         }
         return atts;
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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 java.security.AccessController;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
@@ -283,7 +284,7 @@
             throw new RuntimeOperationsException(iae, msg);
         }
 
-        final String lowerInStr = inStr.toLowerCase();
+        final String lowerInStr = inStr.toLowerCase(Locale.ENGLISH);
         if (!lowerInStr.startsWith("<descriptor>")
             || !lowerInStr.endsWith("</descriptor>")) {
             throw new XMLParseException("No <descriptor>, </descriptor> pair");
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -38,6 +38,7 @@
 import java.net.MalformedURLException;
 import java.net.UnknownHostException;
 import java.util.BitSet;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 /**
@@ -168,7 +169,7 @@
         final int protoStart = requiredPrefixLength;
         final int protoEnd = indexOf(serviceURL, ':', protoStart);
         this.protocol =
-            serviceURL.substring(protoStart, protoEnd).toLowerCase();
+            serviceURL.substring(protoStart, protoEnd).toLowerCase(Locale.ENGLISH);
 
         if (!serviceURL.regionMatches(protoEnd, "://", 0, 3)) {
             throw new MalformedURLException("Missing \"://\" after " +
@@ -328,7 +329,7 @@
                 throw new MalformedURLException("More than one [[...]]");
         }
 
-        this.protocol = protocol.toLowerCase();
+        this.protocol = protocol.toLowerCase(Locale.ENGLISH);
         this.host = host;
         this.port = port;
 
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -359,7 +359,6 @@
                              "connectionId=" + connectionId
                              +", className=" + className
                              +", name=" + name
-                             +", params=" + objects(values)
                              +", signature=" + strings(signature));
 
             return (ObjectInstance)
@@ -425,7 +424,6 @@
                  +", className=" + className
                  +", name=" + name
                  +", loaderName=" + loaderName
-                 +", params=" + objects(values)
                  +", signature=" + strings(signature));
 
             return (ObjectInstance)
@@ -717,7 +715,7 @@
             if (debug) logger.debug("setAttribute",
                              "connectionId=" + connectionId
                              +", name="+name
-                             +", attribute="+attr);
+                             +", attribute name="+attr.getName());
 
             doPrivilegedOperation(
               SET_ATTRIBUTE,
@@ -768,7 +766,7 @@
             if (debug) logger.debug("setAttributes",
                              "connectionId=" + connectionId
                              +", name="+name
-                             +", attributes="+attrlist);
+                             +", attribute names="+RMIConnector.getAttributesNames(attrlist));
 
             return (AttributeList)
                 doPrivilegedOperation(
@@ -823,7 +821,6 @@
                              "connectionId=" + connectionId
                              +", name="+name
                              +", operationName="+operationName
-                             +", params="+objects(values)
                              +", signature="+strings(signature));
 
             return
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java	Tue Jan 26 09:11:58 2016 +0100
@@ -65,6 +65,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
+import java.util.stream.Collectors;
 import javax.management.Attribute;
 import javax.management.AttributeList;
 import javax.management.AttributeNotFoundException;
@@ -689,9 +690,7 @@
             if (logger.debugOn())
                 logger.debug("createMBean(String,ObjectName,Object[],String[])",
                         "className=" + className + ", name="
-                        + name + ", params="
-                        + objects(params) + ", signature="
-                        + strings(signature));
+                        + name + ", signature=" + strings(signature));
 
             final MarshalledObject<Object[]> sParams =
                     new MarshalledObject<Object[]>(params);
@@ -730,8 +729,7 @@
             if (logger.debugOn()) logger.debug(
                     "createMBean(String,ObjectName,ObjectName,Object[],String[])",
                     "className=" + className + ", name=" + name + ", loaderName="
-                    + loaderName + ", params=" + objects(params)
-                    + ", signature=" + strings(signature));
+                    + loaderName + ", signature=" + strings(signature));
 
             final MarshalledObject<Object[]> sParams =
                     new MarshalledObject<Object[]>(params);
@@ -931,8 +929,8 @@
                 IOException {
 
             if (logger.debugOn()) logger.debug("setAttribute",
-                    "name=" + name + ", attribute="
-                    + attribute);
+                    "name=" + name + ", attribute name="
+                    + attribute.getName());
 
             final MarshalledObject<Attribute> sAttribute =
                     new MarshalledObject<Attribute>(attribute);
@@ -954,9 +952,11 @@
                 ReflectionException,
                 IOException {
 
-            if (logger.debugOn()) logger.debug("setAttributes",
-                    "name=" + name + ", attributes="
-                    + attributes);
+            if (logger.debugOn()) {
+                logger.debug("setAttributes",
+                    "name=" + name + ", attribute names="
+                    + getAttributesNames(attributes));
+            }
 
             final MarshalledObject<AttributeList> sAttributes =
                     new MarshalledObject<AttributeList>(attributes);
@@ -989,7 +989,6 @@
             if (logger.debugOn()) logger.debug("invoke",
                     "name=" + name
                     + ", operationName=" + operationName
-                    + ", params=" + objects(params)
                     + ", signature=" + strings(signature));
 
             final MarshalledObject<Object[]> sParams =
@@ -2246,4 +2245,12 @@
     private static String strings(final String[] strs) {
         return objects(strs);
     }
+
+    static String getAttributesNames(AttributeList attributes) {
+        return attributes != null ?
+                attributes.asList().stream()
+                        .map(Attribute::getName)
+                        .collect(Collectors.joining(", ", "[", "]"))
+                : "[]";
+    }
 }
--- a/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -115,17 +115,10 @@
         "Memory usage exceeds collection usage threshold"
     };
 
-    private MBeanNotificationInfo[] notifInfo = null;
     public MBeanNotificationInfo[] getNotificationInfo() {
-        synchronized (this) {
-            if (notifInfo == null) {
-                 notifInfo = new MBeanNotificationInfo[1];
-                 notifInfo[0] = new MBeanNotificationInfo(notifTypes,
-                                                          notifName,
-                                                          "Memory Notification");
-            }
-        }
-        return notifInfo;
+        return new MBeanNotificationInfo[] {
+            new MBeanNotificationInfo(notifTypes, notifName, "Memory Notification")
+        };
     }
 
     private static String getNotifMsg(String notifType) {
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,9 +30,12 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.Serializable;
 import java.lang.management.ManagementFactory;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.ServerSocket;
 import java.net.UnknownHostException;
 import java.rmi.NoSuchObjectException;
 import java.rmi.Remote;
@@ -40,6 +43,7 @@
 import java.rmi.registry.Registry;
 import java.rmi.server.RMIClientSocketFactory;
 import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
 import java.rmi.server.RemoteObject;
 import java.rmi.server.UnicastRemoteObject;
 import java.security.KeyStore;
@@ -60,6 +64,8 @@
 import javax.management.remote.rmi.RMIConnectorServer;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManagerFactory;
 import javax.rmi.ssl.SslRMIClientSocketFactory;
 import javax.rmi.ssl.SslRMIServerSocketFactory;
@@ -107,6 +113,8 @@
 
         public static final String PORT =
                 "com.sun.management.jmxremote.port";
+        public static final String HOST =
+                "com.sun.management.jmxremote.host";
         public static final String RMI_PORT =
                 "com.sun.management.jmxremote.rmi.port";
         public static final String CONFIG_FILE_NAME =
@@ -424,10 +432,14 @@
             checkAccessFile(accessFileName);
         }
 
+        final String bindAddress =
+                props.getProperty(PropertyNames.HOST);
+
         if (log.debugOn()) {
             log.debug("startRemoteConnectorServer",
                     Agent.getText("jmxremote.ConnectorBootstrap.starting") +
                     "\n\t" + PropertyNames.PORT + "=" + port +
+                    (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
                     "\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
                     "\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
                     "\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
@@ -458,7 +470,7 @@
                     sslConfigFileName, enabledCipherSuitesList,
                     enabledProtocolsList, sslNeedClientAuth,
                     useAuthentication, loginConfigName,
-                    passwordFileName, accessFileName);
+                    passwordFileName, accessFileName, bindAddress);
             cs = data.jmxConnectorServer;
             url = data.jmxRemoteURL;
             log.config("startRemoteConnectorServer",
@@ -628,12 +640,13 @@
             String sslConfigFileName,
             String[] enabledCipherSuites,
             String[] enabledProtocols,
-            boolean sslNeedClientAuth) {
+            boolean sslNeedClientAuth,
+            String bindAddress) {
         if (sslConfigFileName == null) {
-            return new SslRMIServerSocketFactory(
+            return new HostAwareSslSocketFactory(
                     enabledCipherSuites,
                     enabledProtocols,
-                    sslNeedClientAuth);
+                    sslNeedClientAuth, bindAddress);
         } else {
             checkRestrictedFile(sslConfigFileName);
             try {
@@ -687,11 +700,11 @@
                 SSLContext ctx = SSLContext.getInstance("SSL");
                 ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
 
-                return new SslRMIServerSocketFactory(
+                return new HostAwareSslSocketFactory(
                         ctx,
                         enabledCipherSuites,
                         enabledProtocols,
-                        sslNeedClientAuth);
+                        sslNeedClientAuth, bindAddress);
             } catch (Exception e) {
                 throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
             }
@@ -711,7 +724,8 @@
             boolean useAuthentication,
             String loginConfigName,
             String passwordFileName,
-            String accessFileName)
+            String accessFileName,
+            String bindAddress)
             throws IOException, MalformedURLException {
 
         /* Make sure we use non-guessable RMI object IDs.  Otherwise
@@ -719,7 +733,7 @@
          * IDs.  */
         System.setProperty("java.rmi.server.randomIDs", "true");
 
-        JMXServiceURL url = new JMXServiceURL("rmi", null, rmiPort);
+        JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
 
         Map<String, Object> env = new HashMap<>();
 
@@ -727,6 +741,8 @@
 
         env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
 
+        boolean useSocketFactory = bindAddress != null && !useSsl;
+
         if (useAuthentication) {
             if (loginConfigName != null) {
                 env.put("jmx.remote.x.login.config", loginConfigName);
@@ -751,7 +767,7 @@
             csf = new SslRMIClientSocketFactory();
             ssf = createSslRMIServerSocketFactory(
                     sslConfigFileName, enabledCipherSuites,
-                    enabledProtocols, sslNeedClientAuth);
+                    enabledProtocols, sslNeedClientAuth, bindAddress);
         }
 
         if (useSsl) {
@@ -761,6 +777,12 @@
                     ssf);
         }
 
+        if (useSocketFactory) {
+            ssf = new HostAwareSocketFactory(bindAddress);
+            env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+                    ssf);
+        }
+
         JMXConnectorServer connServer = null;
         try {
             connServer =
@@ -780,6 +802,10 @@
             registry =
                     new SingleEntryRegistry(port, csf, ssf,
                     "jmxrmi", exporter.firstExported);
+        } else if (useSocketFactory) {
+            registry =
+                    new SingleEntryRegistry(port, csf, ssf,
+                    "jmxrmi", exporter.firstExported);
         } else {
             registry =
                     new SingleEntryRegistry(port,
@@ -813,4 +839,172 @@
     private static final ClassLogger log =
         new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
                         "ConnectorBootstrap");
+
+    private static class HostAwareSocketFactory implements RMIServerSocketFactory {
+
+        private final String bindAddress;
+
+        private HostAwareSocketFactory(String bindAddress) {
+             this.bindAddress = bindAddress;
+        }
+
+        @Override
+        public ServerSocket createServerSocket(int port) throws IOException {
+            if (bindAddress == null) {
+                return new ServerSocket(port);
+            } else {
+                try {
+                    InetAddress addr = InetAddress.getByName(bindAddress);
+                    return new ServerSocket(port, 0, addr);
+                } catch (UnknownHostException e) {
+                    return new ServerSocket(port);
+                }
+            }
+        }
+    }
+
+    private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
+
+        private final String bindAddress;
+        private final String[] enabledCipherSuites;
+        private final String[] enabledProtocols;
+        private final boolean needClientAuth;
+        private final SSLContext context;
+
+        private HostAwareSslSocketFactory(String[] enabledCipherSuites,
+                                          String[] enabledProtocols,
+                                          boolean sslNeedClientAuth,
+                                          String bindAddress) throws IllegalArgumentException {
+            this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
+        }
+
+        private HostAwareSslSocketFactory(SSLContext ctx,
+                                          String[] enabledCipherSuites,
+                                          String[] enabledProtocols,
+                                          boolean sslNeedClientAuth,
+                                          String bindAddress) throws IllegalArgumentException {
+            this.context = ctx;
+            this.bindAddress = bindAddress;
+            this.enabledProtocols = enabledProtocols;
+            this.enabledCipherSuites = enabledCipherSuites;
+            this.needClientAuth = sslNeedClientAuth;
+            checkValues(ctx, enabledCipherSuites, enabledProtocols);
+        }
+
+        @Override
+        public ServerSocket createServerSocket(int port) throws IOException {
+            if (bindAddress != null) {
+                try {
+                    InetAddress addr = InetAddress.getByName(bindAddress);
+                    return new SslServerSocket(port, 0, addr, context,
+                                               enabledCipherSuites, enabledProtocols, needClientAuth);
+                } catch (UnknownHostException e) {
+                    return new SslServerSocket(port, context,
+                                               enabledCipherSuites, enabledProtocols, needClientAuth);
+                }
+            } else {
+                return new SslServerSocket(port, context,
+                                           enabledCipherSuites, enabledProtocols, needClientAuth);
+            }
+        }
+
+        private static void checkValues(SSLContext context,
+                                        String[] enabledCipherSuites,
+                                        String[] enabledProtocols) throws IllegalArgumentException {
+            // Force the initialization of the default at construction time,
+            // rather than delaying it to the first time createServerSocket()
+            // is called.
+            //
+            final SSLSocketFactory sslSocketFactory =
+                    context == null ?
+                        (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
+            SSLSocket sslSocket = null;
+            if (enabledCipherSuites != null || enabledProtocols != null) {
+                try {
+                    sslSocket = (SSLSocket) sslSocketFactory.createSocket();
+                } catch (Exception e) {
+                    final String msg = "Unable to check if the cipher suites " +
+                            "and protocols to enable are supported";
+                    throw (IllegalArgumentException)
+                    new IllegalArgumentException(msg).initCause(e);
+                }
+            }
+
+            // Check if all the cipher suites and protocol versions to enable
+            // are supported by the underlying SSL/TLS implementation and if
+            // true create lists from arrays.
+            //
+            if (enabledCipherSuites != null) {
+                sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+            }
+            if (enabledProtocols != null) {
+                sslSocket.setEnabledProtocols(enabledProtocols);
+            }
+        }
+    }
+
+    private static class SslServerSocket extends ServerSocket {
+
+        private static SSLSocketFactory defaultSSLSocketFactory;
+        private final String[] enabledCipherSuites;
+        private final String[] enabledProtocols;
+        private final boolean needClientAuth;
+        private final SSLContext context;
+
+        private SslServerSocket(int port,
+                                SSLContext ctx,
+                                String[] enabledCipherSuites,
+                                String[] enabledProtocols,
+                                boolean needClientAuth) throws IOException {
+            super(port);
+            this.enabledProtocols = enabledProtocols;
+            this.enabledCipherSuites = enabledCipherSuites;
+            this.needClientAuth = needClientAuth;
+            this.context = ctx;
+        }
+
+        private SslServerSocket(int port,
+                                int backlog,
+                                InetAddress bindAddr,
+                                SSLContext ctx,
+                                String[] enabledCipherSuites,
+                                String[] enabledProtocols,
+                                boolean needClientAuth) throws IOException {
+            super(port, backlog, bindAddr);
+            this.enabledProtocols = enabledProtocols;
+            this.enabledCipherSuites = enabledCipherSuites;
+            this.needClientAuth = needClientAuth;
+            this.context = ctx;
+        }
+
+        @Override
+        public Socket accept() throws IOException {
+            final SSLSocketFactory sslSocketFactory =
+                    context == null ?
+                        getDefaultSSLSocketFactory() : context.getSocketFactory();
+            Socket socket = super.accept();
+            SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
+                    socket, socket.getInetAddress().getHostName(),
+                    socket.getPort(), true);
+            sslSocket.setUseClientMode(false);
+            if (enabledCipherSuites != null) {
+                sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+            }
+            if (enabledProtocols != null) {
+                sslSocket.setEnabledProtocols(enabledProtocols);
+            }
+            sslSocket.setNeedClientAuth(needClientAuth);
+            return sslSocket;
+        }
+
+        private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
+            if (defaultSSLSocketFactory == null) {
+                defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+                return defaultSSLSocketFactory;
+            } else {
+                return defaultSSLSocketFactory;
+            }
+        }
+
+    }
 }
--- a/jdk/src/java.management/share/conf/management.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/conf/management.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -316,3 +316,16 @@
 
 # For a non-default password file location use the following line
 # com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=<host-or-interface-name>
+#      Specifies the local interface on which the JMX RMI agent will bind.
+#      This is useful when running on machines which have several
+#      interfaces defined. It makes it possible to listen to a specific
+#      subnet accessible through that interface.
+#
+#      The format of the value for that property is any string accepted
+#      by java.net.InetAddress.getByName(String).
+#
--- a/jdk/src/java.management/share/native/include/jmm.h	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/native/include/jmm.h	Tue Jan 26 09:11:58 2016 +0100
@@ -227,16 +227,10 @@
   jint         (JNICALL *GetOptionalSupport)     (JNIEnv *env,
                                                   jmmOptionalSupport* support_ptr);
 
-  /* This is used by JDK 6 and earlier.
-   * For JDK 7 and after, use GetInputArgumentArray.
-   */
-  jobject      (JNICALL *GetInputArguments)      (JNIEnv *env);
-
   jint         (JNICALL *GetThreadInfo)          (JNIEnv *env,
                                                   jlongArray ids,
                                                   jint maxDepth,
                                                   jobjectArray infoArray);
-  jobjectArray (JNICALL *GetInputArgumentArray)  (JNIEnv *env);
 
   jobjectArray (JNICALL *GetMemoryPools)         (JNIEnv* env, jobject mgr);
 
--- a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c	Tue Jan 26 09:11:58 2016 +0100
@@ -112,7 +112,7 @@
 Java_sun_management_VMManagementImpl_getVmArguments0
   (JNIEnv *env, jobject dummy)
 {
-    return jmm_interface->GetInputArgumentArray(env);
+    return JVM_GetVmArguments(env);
 }
 
 JNIEXPORT jlong JNICALL
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  * Provider class for the JdkLDAP provider.
  * Supports LDAP cert store.
  *
- * @since   1.9
+ * @since   9
  */
 public final class JdkLDAP extends Provider {
 
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,7 @@
  * Core implementation of a LDAP Cert Store.
  * @see java.security.cert.CertStore
  *
- * @since       1.9
+ * @since       9
  */
 final class LDAPCertStoreImpl {
 
--- a/jdk/src/java.prefs/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.prefs/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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,7 +31,6 @@
 import java.util.Timer;
 import java.util.TimerTask;
 import java.lang.ref.WeakReference;
-import sun.misc.ManagedLocalsThread;
 
 
 /*
@@ -344,7 +343,8 @@
     {
         if (timer == null) {
             timer = new Timer(true); // daemon
-            Thread flushThread = new ManagedLocalsThread() {
+            Thread flushThread =
+                new Thread(null, null, "Flush Thread", 0, false) {
                 @Override
                 public void run() {
                     flushWorld();
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -29,7 +29,6 @@
 import java.io.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.misc.ManagedLocalsThread;
 // These imports needed only as a workaround for a JavaDoc bug
 import java.lang.Integer;
 import java.lang.Long;
@@ -1515,7 +1514,11 @@
      * A single background thread ("the event notification thread") monitors
      * the event queue and delivers events that are placed on the queue.
      */
-    private static class EventDispatchThread extends ManagedLocalsThread {
+    private static class EventDispatchThread extends Thread {
+        private EventDispatchThread() {
+            super(null, null, "Event Dispatch Thread", 0, false);
+        }
+
         public void run() {
             while(true) {
                 // Wait on eventQueue till an event is present
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -30,7 +30,6 @@
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.security.PrivilegedActionException;
-import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -443,7 +442,8 @@
         // Add shutdown hook to flush cached prefs on normal termination
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
-                Runtime.getRuntime().addShutdownHook(new ManagedLocalsThread() {
+                Runtime.getRuntime().addShutdownHook(
+                    new Thread(null, null, "Sync Timer Thread", 0, false) {
                     public void run() {
                         syncTimer.cancel();
                         syncWorld();
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
  * The key material of an {@code EncryptionKey} is defined as the value
  * of the {@code keyValue} above.
  *
- * @since 1.9
+ * @since 9
  */
 public final class EncryptionKey implements SecretKey {
 
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -45,7 +45,7 @@
  *    }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public final class KerberosCredMessage implements Destroyable {
 
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/Krb5KeyExchangeService.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/Krb5KeyExchangeService.java	Tue Jan 26 09:11:58 2016 +0100
@@ -65,7 +65,7 @@
 /**
  * The provider for TLS_KRB_ cipher suites.
  *
- * @since 1.9
+ * @since 9
  */
 public class Krb5KeyExchangeService implements ClientKeyExchangeService {
 
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1538,7 +1538,7 @@
      * prior to returning the {@code PooledConnection} back to the cache</li>
      * </ul>
      * @throws SQLException if an error occurs
-     * @since 1.9
+     * @since 9
      * @see endRequest
      * @see javax.sql.PooledConnection
      */
@@ -1580,7 +1580,7 @@
      * prior to returning the {@code PooledConnection} back to the cache</li>
      * </ul>
      * @throws SQLException if an error occurs
-     * @since 1.9
+     * @since 9
      * @see beginRequest
      * @see javax.sql.PooledConnection
      */
@@ -1614,7 +1614,7 @@
      * this method is called on a closed {@code connection}; or
      * the {@code timeout} value is less than 0.
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
+     * @since 9
      * @see ShardingKey
      * @see ShardingKeyBuilder
      */
@@ -1645,7 +1645,7 @@
      * this method is called on a closed {@code connection}; the {@code shardingkey}
      * is {@code null}; or the {@code timeout} value is less than 0.
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
+     * @since 9
      * @see ShardingKey
      * @see ShardingKeyBuilder
      */
@@ -1671,7 +1671,7 @@
      * the {@code shardingkey} is {@code null}; or
      * a {@code superSharedingKey} is specified without a {@code shardingKey}
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
+     * @since 9
      * @see ShardingKey
      * @see ShardingKeyBuilder
      */
@@ -1694,7 +1694,7 @@
      * this method is called on a closed {@code connection}; or the
      * {@code shardkingKey} is {@code null}
      * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
+     * @since 9
      * @see ShardingKey
      * @see ShardingKeyBuilder
      */
--- a/jdk/src/java.sql/share/classes/java/sql/ConnectionBuilder.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/java/sql/ConnectionBuilder.java	Tue Jan 26 09:11:58 2016 +0100
@@ -49,7 +49,7 @@
  *                       .build();
  * }</pre>
  *
- * @since 1.9
+ * @since 9
  *
  */
 public interface ConnectionBuilder  {
--- a/jdk/src/java.sql/share/classes/java/sql/DatabaseMetaData.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/java/sql/DatabaseMetaData.java	Tue Jan 26 09:11:58 2016 +0100
@@ -3694,7 +3694,7 @@
      * @return {@code true} if this database supports sharding;
      *         {@code false} otherwise
      * @exception SQLException if a database access error occurs
-     * @since 1.9
+     * @since 9
      */
     default boolean supportsSharding() throws SQLException {
         return false;
--- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java	Tue Jan 26 09:11:58 2016 +0100
@@ -449,7 +449,7 @@
      * to which the current caller has access.
      *
      * @return the stream of JDBC Drivers loaded by the caller's class loader
-     * @since 1.9
+     * @since 9
      */
     @CallerSensitive
     public static Stream<Driver> drivers() {
--- a/jdk/src/java.sql/share/classes/java/sql/ShardingKey.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/java/sql/ShardingKey.java	Tue Jan 26 09:11:58 2016 +0100
@@ -69,7 +69,7 @@
  * }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ShardingKey {
 
--- a/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,8 @@
 package javax.sql;
 
 import java.sql.SQLException;
-import java.io.PrintWriter;
 import java.sql.SQLFeatureNotSupportedException;
+import java.sql.ShardingKeyBuilder;
 import java.util.logging.Logger;
 
 /**
@@ -128,4 +128,20 @@
      * @since 1.7
      */
     public Logger getParentLogger() throws SQLFeatureNotSupportedException;
+
+    //------------------------- JDBC 4.3 -----------------------------------
+
+    /**
+     * Creates a new {@code ShardingKeyBuilder} instance
+     * @implSpec
+     * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
+     * @return The ShardingKeyBuilder instance that was created
+     * @throws SQLException if an error occurs creating the builder
+     * @throws SQLFeatureNotSupportedException if the driver does not support this method
+     * @since 9
+     * @see ShardingKeyBuilder
+    */
+    default ShardingKeyBuilder createShardingKeyBuilder() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
+  };
 }
--- a/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package javax.sql;
 
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 
 
 /**
@@ -70,4 +71,20 @@
    */
   PooledConnection getPooledConnection(String user, String password)
     throws SQLException;
+
+  //------------------------- JDBC 4.3 -----------------------------------
+
+  /**
+   * Creates a new {@code PooledConnectionBuilder} instance
+   * @implSpec
+   * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
+   * @return The ConnectionBuilder instance that was created
+   * @throws SQLException if an error occurs creating the builder
+   * @throws SQLFeatureNotSupportedException if the driver does not support sharding
+   * @since 9
+   * @see PooledConnectionBuilder
+   */
+  default PooledConnectionBuilder createPooledConnectionBuilder() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createPooledConnectionBuilder not implemented");
+  };
  }
--- a/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -29,7 +29,6 @@
 import java.sql.ConnectionBuilder;
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
-import java.sql.ShardingKeyBuilder;
 import java.sql.Wrapper;
 
 /**
@@ -119,25 +118,11 @@
    * @return The ConnectionBuilder instance that was created
    * @throws SQLException if an error occurs creating the builder
    * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-   * @since 1.9
-   * @see createConnectionBuilder
+   * @since 9
+   * @see ConnectionBuilder
    */
   default ConnectionBuilder createConnectionBuilder() throws SQLException {
         throw new SQLFeatureNotSupportedException("createConnectionBuilder not implemented");
   };
 
-  /**
-   * Create a new {@code ShardingKeyBuilder} instance
-   * @implSpec
-   * The default implementation will throw a {@code SQLFeatureNotSupportedException}
-   * @return The ShardingKeyBuilder instance that was created
-   * @throws SQLException if an error occurs creating the builder
-   * @throws SQLFeatureNotSupportedException if the driver does not support this method
-   * @since 1.9
-   * @see ShardingKeyBuilder
-   */
-  default ShardingKeyBuilder  createShardingKeyBuilder()
-          throws SQLException {
-        throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
-  };
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.sql/share/classes/javax/sql/PooledConnectionBuilder.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, 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 javax.sql;
+
+import java.sql.SQLException;
+import java.sql.ShardingKey;
+
+/**
+ * A builder created from a {@code ConnectionPoolDataSource} object,
+ * used to establish a connection to the database that the
+ * {@code data source} object represents.  The connection
+ * properties that were specified for the {@code data source} are used as the
+ * default values by the {@code PooledConnectionBuilder}.
+ * <p>The following example illustrates the use of {@code PooledConnectionBuilder}
+ * to create a {@link XAConnection}:
+ *
+ * <pre>{@code
+ *     ConnectionPoolDataSource ds = new MyConnectionPoolDataSource();
+ *     ShardingKey superShardingKey = ds.createShardingKeyBuilder()
+ *                           .subkey("EASTERN_REGION", JDBCType.VARCHAR)
+ *                           .build();
+ *     ShardingKey shardingKey = ds.createShardingKeyBuilder()
+ *                           .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
+ *                           .build();
+ *     PooledConnection con = ds.createPooledConnectionBuilder()
+ *                       .user("rafa")
+ *                       .password("tennis")
+ *                       .setShardingKey(shardingKey)
+ *                       .setSuperShardingKey(superShardingKey)
+ *                       .build();
+ * }</pre>
+ *
+ * @since 9
+ *
+ */
+public interface PooledConnectionBuilder  {
+
+    /**
+     * Specifies the username to be used when creating a connection
+     *
+     * @param username the database user on whose behalf the connection is being
+     * made
+     * @return the same {@code PooledConnectionBuilder} instance
+     */
+    PooledConnectionBuilder user(String username);
+
+    /**
+     * Specifies the password to be used when creating a connection
+     *
+     * @param password the password to use for this connection. May be {@code null}
+     * @return the same {@code PooledConnectionBuilder} instance
+     */
+    PooledConnectionBuilder password(String password);
+
+    /**
+     * Specifies a {@code shardingKey} to be used when creating a connection
+     *
+     * @param shardingKey the ShardingKey. May be {@code null}
+     * @return the same {@code PooledConnectionBuilder} instance
+     * @see java.sql.ShardingKey
+     * @see java.sql.ShardingKeyBuilder
+     */
+    PooledConnectionBuilder shardingKey(ShardingKey shardingKey);
+
+    /**
+     * Specifies a {@code superShardingKey} to be used when creating a connection
+     *
+     * @param superShardingKey the SuperShardingKey. May be {@code null}
+     * @return the same {@code PooledConnectionBuilder} instance
+     * @see java.sql.ShardingKey
+     * @see java.sql.ShardingKeyBuilder
+     */
+    PooledConnectionBuilder superShardingKey(ShardingKey superShardingKey);
+
+    /**
+     * Returns an instance of the object defined by this builder.
+     *
+     * @return The built object
+     * @throws java.sql.SQLException If an error occurs building the object
+     */
+    PooledConnection build() throws SQLException;
+
+}
--- a/jdk/src/java.sql/share/classes/javax/sql/XAConnection.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnection.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -52,121 +52,4 @@
      * @since 1.4
      */
     javax.transaction.xa.XAResource getXAResource() throws SQLException;
-
-    // JDBC 4.3
-
-    /**
-     * Sets and validates the sharding keys for this connection.
-     *
-     * @implSpec The default implementation will throw a
-     * {@code SQLFeatureNotSupportedException}.
-     *
-     * @apiNote This method validates that the sharding keys are valid for the
-     * {@code Connection}. The timeout value indicates how long the driver
-     * should wait for the {@code Connection} to verify that the sharding key is
-     * valid before {@code setShardingKeyIfValid} returns false.
-     * @param shardingKey the sharding key to be validated against this
-     * connection
-     * @param superShardingKey the super sharding key to be validated against
-     * this connection. The super sharding key may be {@code null}.
-     * @param timeout time in seconds before which the validation process is
-     * expected to be completed, otherwise the validation process is aborted. A
-     * value of 0 indicates the validation process will not time out.
-     * @return true if the connection is valid and the sharding keys are valid
-     * and set on this connection; false if the sharding keys are not valid or
-     * the timeout period expires before the operation completes.
-     * @throws SQLException if an error occurs while performing this validation;
-     * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified
-     * without a {@code shardingKey}; this method is called on a closed
-     * {@code connection}; or the {@code timeout} value is less than 0.
-     * @throws SQLFeatureNotSupportedException if the driver does not support
-     * sharding
-     * @since 1.9
-     * @see ShardingKey
-     * @see ShardingKeyBuilder
-     */
-    default boolean setShardingKeyIfValid(ShardingKey shardingKey,
-            ShardingKey superShardingKey, int timeout)
-            throws SQLException {
-        throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
-    }
-
-    /**
-     * Sets and validates the sharding key for this connection.
-     * @implSpec
-     * The default implementation will throw a
-     * {@code SQLFeatureNotSupportedException}.
-     * @apiNote
-     * This method validates  that the sharding key is valid for the
-     * {@code Connection}. The timeout value indicates how long the driver
-     * should wait for the {@code Connection} to verify that the sharding key
-     * is valid before {@code setShardingKeyIfValid} returns false.
-     * @param shardingKey the sharding key to be validated against this connection
-     * @param timeout time in seconds before which the validation process is expected to
-     * be completed,else the validation process is aborted. A value of 0 indicates
-     * the validation process will not time out.
-     * @return true if the connection is valid and the sharding key is valid to be
-     * set on this connection; false if the sharding key is not valid or
-     * the timeout period expires before the operation completes.
-     * @throws SQLException if there is an error while performing this validation;
-     * this method is called on a closed {@code connection}; the {@code shardingkey}
-     * is {@code null}; or the {@code timeout} value is less than 0.
-     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
-     * @see ShardingKey
-     * @see ShardingKeyBuilder
-     */
-    default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout)
-            throws SQLException {
-        throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
-    }
-
-    /**
-     * Specifies a shardingKey and superShardingKey to use with this Connection
-     * @implSpec
-     * The default implementation will throw a
-     * {@code SQLFeatureNotSupportedException}.
-     * @apiNote
-     * This method sets the specified sharding keys but does not require a
-     * round trip to the database to validate that the sharding keys are valid
-     * for the {@code Connection}.
-     * @param shardingKey the sharding key to set on this connection.
-     * @param superShardingKey the super sharding key to set on this connection.
-     * The super sharding key may be {@code null}
-     * @throws SQLException if an error  occurs setting the sharding keys;
-     * this method is called on a closed {@code connection};
-     * the {@code shardingkey} is {@code null}; or
-     * a {@code superSharedingKey} is specified without a {@code shardingKey}
-     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
-     * @see ShardingKey
-     * @see ShardingKeyBuilder
-     */
-    default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey)
-            throws SQLException {
-        throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
-    }
-
-    /**
-     * Specifies a shardingKey to use with this Connection
-     * @implSpec
-     * The default implementation will throw a
-     * {@code SQLFeatureNotSupportedException}.
-     * @apiNote
-     * This method sets the specified sharding key but does not require a
-     * round trip to the database to validate that the sharding key is valid
-     * for the {@code Connection}.
-     * @param shardingKey the sharding key to set on this connection.
-     * @throws SQLException if an error  occurs setting the sharding key;
-     * this method is called on a closed {@code connection}; or the
-     * {@code shardkingKey} is {@code null}
-     * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-     * @since 1.9
-     * @see ShardingKey
-     * @see ShardingKeyBuilder
-     */
-    default void setShardingKey(ShardingKey shardingKey)
-            throws SQLException {
-        throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
-    }
 }
--- a/jdk/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -37,7 +37,7 @@
  * to create a {@link XAConnection}:
  *
  * <pre>{@code
- *     DataSource ds = new MyDataSource();
+ *     XADataSource ds = new MyXADataSource();
  *     ShardingKey superShardingKey = ds.createShardingKeyBuilder()
  *                           .subkey("EASTERN_REGION", JDBCType.VARCHAR)
  *                           .build();
@@ -52,7 +52,7 @@
  *                       .build();
  * }</pre>
  *
- * @since 1.9
+ * @since 9
  *
  */
 public interface XAConnectionBuilder  {
--- a/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -87,28 +87,14 @@
    * Creates a new {@code XAConnectionBuilder} instance
    * @implSpec
    * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
-   * @return The ConnectionBuilder instance that was created
+   * @return The XAConnectionBuilder instance that was created
    * @throws SQLException if an error occurs creating the builder
    * @throws SQLFeatureNotSupportedException if the driver does not support sharding
-   * @since 1.9
+   * @since 9
    * @see XAConnectionBuilder
    */
   default XAConnectionBuilder createXAConnectionBuilder() throws SQLException {
         throw new SQLFeatureNotSupportedException("createXAConnectionBuilder not implemented");
   };
 
-  /**
-   * Creates a new {@code ShardingKeyBuilder} instance
-   * @implSpec
-   * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
-   * @return The ShardingKeyBuilder instance that was created
-   * @throws SQLException if an error occurs creating the builder
-   * @throws SQLFeatureNotSupportedException if the driver does not support this method
-   * @since 1.9
-   * @see ShardingKeyBuilder
-   */
-  default ShardingKeyBuilder createShardingKeyBuilder()
-          throws SQLException {
-        throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
-  };
  }
--- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  * fails in the target VM. If there is a communication error,
  * a regular IOException will be thrown.
  *
- * @since 1.9
+ * @since 9
  */
 public class AttachOperationFailedException extends IOException {
 
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -35,6 +35,7 @@
 import javax.crypto.spec.*;
 
 import sun.nio.ch.DirectBuffer;
+import sun.security.jca.JCAUtil;
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
@@ -379,7 +380,7 @@
                 }
                 // generate random IV
                 if (random == null) {
-                    random = new SecureRandom();
+                    random = JCAUtil.getSecureRandom();
                 }
                 iv = new byte[blockSize];
                 random.nextBytes(iv);
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -470,49 +470,49 @@
                 algorithm.equals("TlsRsaPremasterSecret");
         Exception failover = null;
 
-        SecureRandom secureRandom = random;
-        if (secureRandom == null && isTlsRsaPremasterSecret) {
-            secureRandom = new SecureRandom();
-        }
-
         // Should C_Unwrap be preferred for non-TLS RSA premaster secret?
         if (token.supportsRawSecretKeyImport()) {
             // XXX implement unwrap using C_Unwrap() for all keys
             implInit(Cipher.DECRYPT_MODE, p11Key);
-            if (wrappedKey.length > maxInputSize) {
-                throw new InvalidKeyException("Key is too long for unwrapping");
-            }
+            try {
+                if (wrappedKey.length > maxInputSize) {
+                    throw new InvalidKeyException("Key is too long for unwrapping");
+                }
 
-            byte[] encoded = null;
-            implUpdate(wrappedKey, 0, wrappedKey.length);
-            try {
-                encoded = doFinal();
-            } catch (BadPaddingException e) {
-                if (isTlsRsaPremasterSecret) {
-                    failover = e;
-                } else {
+                byte[] encoded = null;
+                implUpdate(wrappedKey, 0, wrappedKey.length);
+                try {
+                    encoded = doFinal();
+                } catch (BadPaddingException e) {
+                    if (isTlsRsaPremasterSecret) {
+                        failover = e;
+                    } else {
+                        throw new InvalidKeyException("Unwrapping failed", e);
+                    }
+                } catch (IllegalBlockSizeException e) {
+                    // should not occur, handled with length check above
                     throw new InvalidKeyException("Unwrapping failed", e);
                 }
-            } catch (IllegalBlockSizeException e) {
-                // should not occur, handled with length check above
-                throw new InvalidKeyException("Unwrapping failed", e);
-            }
+
+                if (isTlsRsaPremasterSecret) {
+                    if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
+                        throw new IllegalStateException(
+                                "No TlsRsaPremasterSecretParameterSpec specified");
+                    }
 
-            if (isTlsRsaPremasterSecret) {
-                if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
-                    throw new IllegalStateException(
-                            "No TlsRsaPremasterSecretParameterSpec specified");
+                    // polish the TLS premaster secret
+                    TlsRsaPremasterSecretParameterSpec psps =
+                            (TlsRsaPremasterSecretParameterSpec)spec;
+                    encoded = KeyUtil.checkTlsPreMasterSecretKey(
+                            psps.getClientVersion(), psps.getServerVersion(),
+                            random, encoded, (failover != null));
                 }
 
-                // polish the TLS premaster secret
-                TlsRsaPremasterSecretParameterSpec psps =
-                        (TlsRsaPremasterSecretParameterSpec)spec;
-                encoded = KeyUtil.checkTlsPreMasterSecretKey(
-                        psps.getClientVersion(), psps.getServerVersion(),
-                        secureRandom, encoded, (failover != null));
+                return ConstructKeys.constructKey(encoded, algorithm, type);
+            } finally {
+                // Restore original mode
+                implInit(Cipher.UNWRAP_MODE, p11Key);
             }
-
-            return ConstructKeys.constructKey(encoded, algorithm, type);
         } else {
             Session s = null;
             SecretKey secretKey = null;
@@ -540,20 +540,13 @@
                 }
 
                 if (isTlsRsaPremasterSecret) {
-                    byte[] replacer = new byte[48];
-                    if (failover == null) {
-                        // Does smart compiler dispose this operation?
-                        secureRandom.nextBytes(replacer);
-                    }
-
                     TlsRsaPremasterSecretParameterSpec psps =
                             (TlsRsaPremasterSecretParameterSpec)spec;
 
-                    // Please use the tricky failover and replacer byte array
-                    // as the parameters so that smart compiler won't dispose
-                    // the unused variable .
+                    // Please use the tricky failover as the parameter so that
+                    // smart compiler won't dispose the unused variable.
                     secretKey = polishPreMasterSecretKey(token, s,
-                            failover, replacer, secretKey,
+                            failover, secretKey,
                             psps.getClientVersion(), psps.getServerVersion());
                 }
 
@@ -572,29 +565,27 @@
 
     private static SecretKey polishPreMasterSecretKey(
             Token token, Session session,
-            Exception failover, byte[] replacer, SecretKey secretKey,
+            Exception failover, SecretKey unwrappedKey,
             int clientVersion, int serverVersion) {
 
-        if (failover != null) {
-            CK_VERSION version = new CK_VERSION(
-                    (clientVersion >>> 8) & 0xFF, clientVersion & 0xFF);
-            try {
-                CK_ATTRIBUTE[] attributes = token.getAttributes(
-                        O_GENERATE, CKO_SECRET_KEY,
-                        CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]);
-                long keyID = token.p11.C_GenerateKey(session.id(),
-                    // new CK_MECHANISM(CKM_TLS_PRE_MASTER_KEY_GEN, version),
-                        new CK_MECHANISM(CKM_SSL3_PRE_MASTER_KEY_GEN, version),
-                        attributes);
-                return P11Key.secretKey(session,
-                        keyID, "TlsRsaPremasterSecret", 48 << 3, attributes);
-            } catch (PKCS11Exception e) {
-                throw new ProviderException(
-                        "Could not generate premaster secret", e);
-            }
+        SecretKey newKey;
+        CK_VERSION version = new CK_VERSION(
+                (clientVersion >>> 8) & 0xFF, clientVersion & 0xFF);
+        try {
+            CK_ATTRIBUTE[] attributes = token.getAttributes(
+                    O_GENERATE, CKO_SECRET_KEY,
+                    CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]);
+            long keyID = token.p11.C_GenerateKey(session.id(),
+                    new CK_MECHANISM(CKM_SSL3_PRE_MASTER_KEY_GEN, version),
+                    attributes);
+            newKey = P11Key.secretKey(session,
+                    keyID, "TlsRsaPremasterSecret", 48 << 3, attributes);
+        } catch (PKCS11Exception e) {
+            throw new ProviderException(
+                    "Could not generate premaster secret", e);
         }
 
-        return secretKey;
+        return (failover == null) ? unwrappedKey : newKey;
     }
 
 }
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/CipherContextRef.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/CipherContextRef.java	Tue Jan 26 09:11:58 2016 +0100
@@ -41,7 +41,7 @@
 /**
  * Internal class for context resource clean up.
  *
- * @since 1.9
+ * @since 9
  */
 final class CipherContextRef extends PhantomReference<NativeCipher>
     implements Comparable<CipherContextRef> {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java	Tue Jan 26 09:11:58 2016 +0100
@@ -49,7 +49,7 @@
  * where <Service> can be "MessageDigest", "Cipher", etc. and <Algorithm>
  * reprepresents the value that's passed into the various getInstance() calls.
  *
- * @since   1.9
+ * @since   9
  */
 final class Config {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java	Tue Jan 26 09:11:58 2016 +0100
@@ -48,7 +48,7 @@
  * as possible AES-GCM-ICVlen values, so we allow all 6 values.
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public final class GCMParameters extends AlgorithmParametersSpi {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -38,6 +38,8 @@
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.spec.IvParameterSpec;
 
+import sun.security.jca.JCAUtil;
+
 /**
  * Cipher wrapper class utilizing ucrypto APIs. This class currently supports
  * - AES/ECB/NOPADDING
@@ -46,7 +48,7 @@
  * - AES/CFB128/NOPADDING
  * (Support for GCM mode is inside the child class NativeGCMCipher)
  *
- * @since 1.9
+ * @since 9
  */
 class NativeCipher extends CipherSpi {
 
@@ -288,7 +290,10 @@
                 if (encrypt) {
                     // generate IV if none supplied for encryption
                     ivBytes = new byte[blockSize];
-                    new SecureRandom().nextBytes(ivBytes);
+                    if (random == null) {
+                        random = JCAUtil.getSecureRandom();
+                    }
+                    random.nextBytes(ivBytes);
                 } else {
                     throw new InvalidAlgorithmParameterException
                             ("Parameters required for decryption");
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Tue Jan 26 09:11:58 2016 +0100
@@ -59,7 +59,7 @@
  * - AES/CBC/PKCS5PADDING
  * - AES/CFB128/PKCS5PADDING
  *
- * @since 1.9
+ * @since 9
  */
 public class NativeCipherWithJavaPadding extends CipherSpi {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,7 +36,7 @@
  * MessageDigest implementation class. This class currently supports
  * MD5, SHA1, SHA256, SHA384, and SHA512
  *
- * @since 1.9
+ * @since 9
  */
 public abstract class NativeDigest extends MessageDigestSpi
         implements Cloneable {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,11 +36,13 @@
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.spec.GCMParameterSpec;
 
+import sun.security.jca.JCAUtil;
+
 /**
  * Cipher wrapper class utilizing ucrypto APIs. This class currently supports
  * - AES/GCM/NoPADDING
  *
- * @since 1.9
+ * @since 9
  */
 class NativeGCMCipher extends NativeCipher {
 
@@ -200,7 +202,10 @@
 
                 // generate IV if none supplied for encryption
                 ivBytes = new byte[blockSize];
-                new SecureRandom().nextBytes(ivBytes);
+                if (random == null) {
+                    random = JCAUtil.getSecureRandom();
+                }
+                random.nextBytes(ivBytes);
             } else {
                 throw new InvalidAlgorithmParameterException("Parameters required for decryption");
             }
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  * Wrapper class for native keys needed for using ucrypto APIs.
  * This class currently supports native RSA private/public keys.
  *
- * @since 1.9
+ * @since 9
  */
 abstract class NativeKey implements Key {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -63,6 +63,7 @@
 import javax.crypto.spec.SecretKeySpec;
 
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
+import sun.security.jca.JCAUtil;
 import sun.security.util.KeyUtil;
 
 /**
@@ -71,7 +72,7 @@
  * - RSA/ECB/NOPADDING
  * - RSA/ECB/PKCS1PADDING
  *
- * @since 1.9
+ * @since 9
  */
 public class NativeRSACipher extends CipherSpi {
     // fields set in constructor
@@ -201,6 +202,9 @@
                         "No Parameters can be specified");
             }
             spec = params;
+            if (random == null) {
+                random = JCAUtil.getSecureRandom();
+            }
             this.random = random;   // for TLS RSA premaster secret
         }
         boolean doEncrypt = (opmode == Cipher.ENCRYPT_MODE || opmode == Cipher.WRAP_MODE);
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -44,7 +44,7 @@
  * Ucrypto-private KeyFactory class for generating native keys
  * needed for using ucrypto APIs.
  *
- * @since 1.9
+ * @since 9
  */
 public final class NativeRSAKeyFactory extends KeyFactorySpi {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java	Tue Jan 26 09:11:58 2016 +0100
@@ -59,7 +59,7 @@
  *   . SHA384withRSA
  *   . SHA512withRSA
  *
- * @since 1.9
+ * @since 9
  */
 class NativeRSASignature extends SignatureSpi {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  * object of this class indicates that a function call to the underlying
  * native calls returned a value not equal to CRYPTO_SUCCESS.
  *
- * @since 1.9
+ * @since 9
  */
 public final class UcryptoException extends ProviderException {
 
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,7 +30,7 @@
 /**
  * Enum for representing the ucrypto mechanisms.
  *
- * @since 1.9
+ * @since 9
  */
 // Check /usr/include/libsoftcrypto.h for updates
 public enum UcryptoMech {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
 /**
  * OracleUcrypto provider main class.
  *
- * @since 1.9
+ * @since 9
  */
 public final class UcryptoProvider extends Provider {
 
--- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -373,22 +373,22 @@
                             }
                             SocketChannel chan = schan.accept();
 
-                            // Set TCP_NODELAY, if appropriate
-                            if (ServerConfig.noDelay()) {
-                                chan.socket().setTcpNoDelay(true);
-                            }
-
-                            if (chan == null) {
-                                continue; /* cancel something ? */
+                            // optimist there's a channel
+                            if (chan != null) {
+                                // Set TCP_NODELAY, if appropriate
+                                if (ServerConfig.noDelay()) {
+                                    chan.socket().setTcpNoDelay(true);
+                                }
+                                chan.configureBlocking (false);
+                                SelectionKey newkey =
+                                    chan.register (selector, SelectionKey.OP_READ);
+                                HttpConnection c = new HttpConnection ();
+                                c.selectionKey = newkey;
+                                c.setChannel (chan);
+                                newkey.attach (c);
+                                requestStarted (c);
+                                allConnections.add (c);
                             }
-                            chan.configureBlocking (false);
-                            SelectionKey newkey = chan.register (selector, SelectionKey.OP_READ);
-                            HttpConnection c = new HttpConnection ();
-                            c.selectionKey = newkey;
-                            c.setChannel (chan);
-                            newkey.attach (c);
-                            requestStarted (c);
-                            allConnections.add (c);
                         } else {
                             try {
                                 if (key.isReadable()) {
--- a/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Tue Jan 26 09:11:58 2016 +0100
@@ -73,7 +73,7 @@
      * Retreives the message digest algorithm that is used to generate
      * the message imprint to be sent to the TSA server.
      *
-     * @since 1.9
+     * @since 9
      * @return The non-null string of the message digest algorithm name.
      */
     public default String getTSADigestAlg() {
--- a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java	Tue Jan 26 09:11:58 2016 +0100
@@ -77,7 +77,7 @@
  * }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public final class JarSigner {
 
@@ -85,7 +85,7 @@
      * A mutable builder class that can create an immutable {@code JarSigner}
      * from various signing-related parameters.
      *
-     * @since 1.9
+     * @since 9
      */
     public static class Builder {
 
--- a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSignerException.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSignerException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * This exception is thrown when {@link JarSigner#sign} fails.
  *
- * @since 1.9
+ * @since 9
  */
 public class JarSignerException extends RuntimeException {
 
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -43,7 +43,7 @@
 class EventRequestManagerImpl extends MirrorImpl
                                        implements EventRequestManager
 {
-    List<? extends EventRequest>[] requestLists;
+    private final List<? extends EventRequest>[] requestLists;
     private static int methodExitEventCmd = 0;
 
     static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
@@ -83,7 +83,7 @@
         return System.identityHashCode(this);
     }
 
-    abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
+    private abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
         int id;
 
         /*
@@ -734,7 +734,7 @@
         }
         requestLists = new List[highest+1];
         for (int i=0; i <= highest; i++) {
-            requestLists[i] = new ArrayList<>();
+            requestLists[i] = Collections.synchronizedList(new ArrayList<>());
         }
     }
 
@@ -933,22 +933,27 @@
     }
 
     List<? extends EventRequest> unmodifiableRequestList(int eventCmd) {
-        return Collections.unmodifiableList(requestList(eventCmd));
+        // No need of explicit synchronization for requestList here.
+        // It is taken care internally by SynchronizedList class.
+        return Collections.unmodifiableList(new ArrayList<>(requestList(eventCmd)));
     }
 
     EventRequest request(int eventCmd, int requestId) {
         List<? extends EventRequest> rl = requestList(eventCmd);
-        for (int i = rl.size() - 1; i >= 0; i--) {
-            EventRequestImpl er = (EventRequestImpl)rl.get(i);
-            if (er.id == requestId) {
-                return er;
+        synchronized(rl) {   // Refer Collections.synchronizedList javadoc.
+            Iterator<? extends EventRequest> itr = rl.iterator();
+            while (itr.hasNext()){
+                EventRequestImpl er = (EventRequestImpl)itr.next();
+                if (er.id == requestId)
+                    return er;
             }
         }
         return null;
     }
 
-    List<? extends EventRequest>  requestList(int eventCmd) {
+    private List<? extends EventRequest>  requestList(int eventCmd) {
         return requestLists[eventCmd];
     }
 
 }
+
--- a/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Tue Jan 26 09:11:58 2016 +0100
@@ -96,7 +96,7 @@
         ERGONOMIC,
         /**
          * The VM option was set using the attach framework.
-         * @since 1.9
+         * @since 9
          */
         ATTACH_ON_DEMAND,
         /**
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -343,7 +343,7 @@
                                                    "Diagnostic Framework Notification");
             }
         }
-        return notifInfo;
+        return notifInfo.clone();
     }
 
     private static long seqNumber = 0;
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -81,17 +81,12 @@
         GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION
     };
 
-    private MBeanNotificationInfo[] notifInfo = null;
     public MBeanNotificationInfo[] getNotificationInfo() {
-        synchronized (this) {
-            if (notifInfo == null) {
-                 notifInfo = new MBeanNotificationInfo[1];
-                 notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes,
-                                                          notifName,
-                                                          "GC Notification");
-            }
-        }
-        return notifInfo;
+        return new MBeanNotificationInfo[]{
+            new MBeanNotificationInfo(gcNotifTypes,
+            notifName,
+            "GC Notification")
+        };
     }
 
     private static long seqNumber = 0;
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -40,7 +40,7 @@
      *    <li>Format: "RAW"
      *    <li>Encoded form: the raw key bytes, not in any ASN.1 encoding
      *    </ul>
-     * @deprecated as of 1.9, replaced by {@link #KRB5_GET_SESSION_KEY_EX}
+     * @deprecated as of 9, replaced by {@link #KRB5_GET_SESSION_KEY_EX}
      * which returns an instance of
      * {@link javax.security.auth.kerberos.EncryptionKey}
      * that implements the {@link javax.crypto.SecretKey} interface and
@@ -53,7 +53,7 @@
      * established Kerberos 5 security context. The return value is an
      * instance of {@link javax.security.auth.kerberos.EncryptionKey}.
      *
-     * @since 1.9
+     * @since 9
      */
     KRB5_GET_SESSION_KEY_EX,
     /**
@@ -83,7 +83,7 @@
      * is about to send to an acceptor. The return type is an instance of
      * {@link javax.security.auth.kerberos.KerberosCredMessage}.
      *
-     * @since 1.9
+     * @since 9
      */
     KRB5_GET_KRB_CRED,
 }
--- a/jdk/test/ProblemList.txt	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/ProblemList.txt	Tue Jan 26 09:11:58 2016 +0100
@@ -159,6 +159,9 @@
 # 8042215
 javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java			generic-all
 
+# 8147985
+sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java generic-all
+
 ############################################################################
 
 # jdk_net
--- a/jdk/test/TEST.groups	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/TEST.groups	Tue Jan 26 09:11:58 2016 +0100
@@ -31,8 +31,8 @@
     -java/util/zip/TestLocalTime.java \
     :jdk_util \
     -java/util/WeakHashMap/GCDuringIteration.java \
-    -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java
-    -java/util/concurrent/forkjoin/FJExceptionTableLeak.java
+    -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
+    -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     sun/nio/cs/ISO8859x.java \
     java/nio/Buffer \
     com/sun/crypto/provider/Cipher \
@@ -43,7 +43,7 @@
     java/util/zip/TestLocalTime.java \
     java/util/WeakHashMap/GCDuringIteration.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
-    java/util/concurrent/forkjoin/FJExceptionTableLeak.java
+    java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
     :jdk_nio \
     -sun/nio/cs/ISO8859x.java \
--- a/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,6 @@
 import javax.crypto.spec.*;
 import java.math.*;
 import java.io.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/oracle/security/ucrypto/TestGCMKeyAndIvCheck.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/oracle/security/ucrypto/TestGCMKeyAndIvCheck.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,7 +32,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.math.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/oracle/security/ucrypto/TestGCMWithSBE.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/oracle/security/ucrypto/TestGCMWithSBE.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,7 +32,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.math.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.security.Provider;
-import com.sun.crypto.provider.*;
 
 public class Test4513830 {
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,6 @@
 import javax.crypto.spec.*;
 import java.math.*;
 import java.io.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestGCMKeyAndIvCheck.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestGCMKeyAndIvCheck.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,7 +36,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.math.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestGHASH.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestGHASH.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
 /*
  * @test
  * @bug 8069072
+ * @modules java.base/com.sun.crypto.provider
  * @summary Test vectors for com.sun.crypto.provider.GHASH.
  *
  * Single iteration to verify software-only GHASH algorithm.
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.security.Provider;
-import com.sun.crypto.provider.*;
 
 public class TestISO10126Padding {
     private static final String ALGO = "AES";
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestKATForECB_IV.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestKATForECB_IV.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.math.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.math.*;
-import com.sun.crypto.provider.*;
 
 import java.util.*;
 
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestShortBuffer.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestShortBuffer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,6 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.security.Provider;
-import com.sun.crypto.provider.*;
 
 public class TestShortBuffer {
     private static final String ALGO = "AES";
--- a/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -33,7 +33,6 @@
 import java.io.*;
 import javax.crypto.*;
 import javax.crypto.spec.*;
-import com.sun.crypto.provider.*;
 
 public class PerformanceTest {
 
@@ -81,8 +80,6 @@
 
         byte[] in;
 
-        SunJCE jce = new SunJCE();
-        Security.addProvider(jce);
         col = new StringBuffer();
 
         printHeadings();
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh	Tue Jan 26 09:11:58 2016 +0100
@@ -121,7 +121,8 @@
 jdbFailIfNotPresent 'System\..*end of test'
 
 # make sure we had at least one full GC
-debuggeeFailIfNotPresent 'Full GC'
+# Prior to JDK9-B95, the pattern was 'Full GC'
+debuggeeMatchRegexp '^.*?\bPause Full\b\(System.gc\(\)\)\b.*?$'
 
 # check for error message due to thread ID change
 debuggeeFailIfPresent \
--- a/jdk/test/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *          with a lower-case letter
  *
  * @author Jaroslav Bachorik
- * @modules java.management
+ * @modules java.management/com.sun.jmx.mbeanserver
  * @run clean SimpleIntrospectorTest
  * @run build SimpleIntrospectorTest BeanClass
  * @run main SimpleIntrospectorTest
--- a/jdk/test/com/sun/jndi/dns/Test6991580.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/jndi/dns/Test6991580.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,10 @@
 
 /**
  * @test
- * @bug 6991580 8080108
+ * @bug 6991580 8080108 8133035
  * @requires os.family != "windows"
  * @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
+ * @modules jdk.naming.dns/com.sun.jndi.dns
  * @build IPv6NameserverPlatformParsingTest
  * @run main/manual Test6991580
  */
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,8 @@
  * @summary Check that GarbageCollectionNotification contents are reasonable
  * @author  Frederic Parain
  * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
- * @modules jdk.management
+ * @modules java.management/sun.management
+ *          jdk.management
  * @run     main/othervm GarbageCollectionNotificationContentTest
  */
 
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,8 @@
  * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
  * @author  Frederic Parain
  * @requires vm.opt.ExplicitGCInvokesConcurrent == null | vm.opt.ExplicitGCInvokesConcurrent == false
- * @modules jdk.management
+ * @modules java.management/sun.management
+ *          jdk.management
  * @run     main/othervm GarbageCollectionNotificationTest
  */
 
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,8 @@
 /*
  * @test
  * @bug 8028994
+ * @ignore 8147477
+ * @ignore 8147494
  * @author Staffan Larsen
  * @library /lib/testlibrary
  * @modules jdk.attach/sun.tools.attach
@@ -62,7 +64,7 @@
             ProcessBuilder pb = ProcessTools.
                 createJavaProcessBuilder(
                     "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
-                    "-XX:+PrintGCDetails",
+                    "-XX:+UseCodeAging",
                     "-XX:+UseCerealGC",         // Should be ignored.
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
                     "-cp", System.getProperty("test.class.path"),
@@ -97,7 +99,7 @@
             // Not set, so should be default
             checkOrigin("ManagementServer", Origin.DEFAULT);
             // Set on the command line
-            checkOrigin("PrintGCDetails", Origin.VM_CREATION);
+            checkOrigin("UseCodeAging", Origin.VM_CREATION);
             // Set in _JAVA_OPTIONS
             checkOrigin("TraceExceptions", Origin.ENVIRON_VAR);
             // Set in JAVA_TOOL_OPTIONS
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
  * @author  Mandy Chung
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails GetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError GetVMOption
  */
 
 import com.sun.management.HotSpotDiagnosticMXBean;
@@ -38,7 +38,7 @@
 import javax.management.MBeanServer;
 
 public class GetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_OPTION = "BadOption";
     private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
@@ -58,7 +58,7 @@
     }
 
     private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
-        VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption option = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,7 +30,7 @@
  * @author  Jaroslav Bachorik
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails SetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError SetVMOption
  */
 
 import java.lang.management.ManagementFactory;
@@ -40,7 +40,7 @@
 import com.sun.management.VMOption.Origin;
 
 public class SetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_VALUE = "yes";
     private static final String NEW_VALUE = "false";
@@ -51,7 +51,7 @@
         mbean =
             ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
-        VMOption option = findPrintGCDetailsOption();
+        VMOption option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
@@ -61,14 +61,14 @@
                 option.getOrigin() + " expected: VM_CREATION");
         }
         if (!option.isWriteable()) {
-            throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
+            throw new RuntimeException("Expected " + HEAP_DUMP_ON_OOM +
                 " to be writeable");
         }
 
         // set VM option to a new value
-        mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);
+        mbean.setVMOption(HEAP_DUMP_ON_OOM, NEW_VALUE);
 
-        option = findPrintGCDetailsOption();
+        option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + NEW_VALUE);
@@ -77,7 +77,7 @@
             throw new RuntimeException("Unexpected origin: " +
                 option.getOrigin() + " expected: MANAGEMENT");
         }
-        VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption o = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equals(o.getValue())) {
             throw new RuntimeException("Unmatched value: " +
                 option.getValue() + " expected: " + o.getValue());
@@ -123,17 +123,17 @@
         }
     }
 
-    public static VMOption findPrintGCDetailsOption() {
+    public static VMOption findHeapDumpOnOomOption() {
         List<VMOption> options = mbean.getDiagnosticOptions();
         VMOption gcDetails = null;
         for (VMOption o : options) {
-            if (o.getName().equals(PRINT_GC_DETAILS)) {
+            if (o.getName().equals(HEAP_DUMP_ON_OOM)) {
                  gcDetails = o;
                  break;
             }
         }
         if (gcDetails == null) {
-            throw new RuntimeException("VM option " + PRINT_GC_DETAILS +
+            throw new RuntimeException("VM option " + HEAP_DUMP_ON_OOM +
                 " not found");
         }
         return gcDetails;
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -40,6 +40,7 @@
  * @summary Cover the logXX and LogEvent.valueOf APIs of BootstrapLogger
  *          and logXX APIs of SimpleConsoleLogger.
  * @modules java.base/jdk.internal.logger
+ *          java.base/sun.util.logging
  * @build BootstrapLoggerUtils LogStream
  * @run main/othervm BootstrapLoggerAPIsTest
  */
--- a/jdk/test/java/lang/invoke/AccessControlTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/invoke/AccessControlTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -23,9 +23,7 @@
 
 /* @test
  * @summary test access checking by java.lang.invoke.MethodHandles.Lookup
- * @library ../../../..
- * @build test.java.lang.invoke.AccessControlTest
- * @build test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote
+ * @compile AccessControlTest.java AccessControlTest_subpkg/Acquaintance_remote.java
  * @run testng/othervm test.java.lang.invoke.AccessControlTest
  */
 
--- a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -38,6 +38,7 @@
  * @bug 8060483 8066746
  * @key randomness
  * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @modules java.base/sun.invoke.util
  * @summary unit tests for MethodHandles.explicitCastArguments()
  * @run main ExplicitCastArgumentsTest
  */
--- a/jdk/test/java/lang/invoke/lambda/LambdaAsm.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAsm.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,7 @@
  * @summary ensures that j.l.i.InvokerByteCodeGenerator and ASM visitMethodInsn
  * generate  bytecodes with correct constant pool references
  * @modules java.base/jdk.internal.org.objectweb.asm
- *          jdk.compiler/com.sun.tools.classfile
+ *          jdk.jdeps/com.sun.tools.classfile
  * @compile -XDignore.symbol.file LambdaAsm.java LUtils.java
  * @run main/othervm LambdaAsm
  */
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -100,7 +100,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
         opts.addAll(Arrays.asList(testOpts));
         opts.add(classMain);
 
--- a/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java	Tue Jan 26 09:11:58 2016 +0100
@@ -66,7 +66,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
 
         if (clearGcOpts) {
             opts = Utils.removeGcOpts(opts);
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Tue Jan 26 09:11:58 2016 +0100
@@ -48,8 +48,8 @@
 
 runOne InputArgument 
 
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument -XX:+UseFastJNIAccessors
 runOne "-Dprops=one two three" InputArgument "-Dprops=one two three"
 
 exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/PhantomReferentClearing.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2015, 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 8071507
+ * @summary Test that PhantomReferences are cleared when notified.
+ * @run main/othervm PhantomReferentClearing
+ */
+
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PhantomReferentClearing {
+
+    private static final long ENQUEUE_TIMEOUT = 1000;   // 1 sec, in millis
+
+    // P1 & P2 are PhantomReference objects
+    // O1 & O2 are objects
+    //
+    // -> is a strong reference
+    // => is a referent reference
+    //
+    //   root -> P1
+    //   root -> P2
+    //   root -> O1
+    //   root -> O2
+    //   O1 -> O2
+    //   P1 => O1
+    //   P2 => O2
+    //
+    // (1) Remove root -> O1 and collect.  P1 notified, P2 !notified.
+    // (2) Remove root -> O2 and collect.
+    //
+    // If phantom references are cleared when notified, as proposed by
+    // 8071507, then P2 should be notified, and the test passes.
+    //
+    // Otherwise, P2 does not get notified because it remains reachable
+    // from O1, which is being retained by P1.  This fails the test.
+
+    private static final ReferenceQueue<Object> Q1 = new ReferenceQueue<>();
+    private static final ReferenceQueue<Object> Q2 = new ReferenceQueue<>();
+
+    private static volatile Object O2 = new Object();
+    private static volatile List<Object> O1 = new ArrayList<>();
+    static {
+        O1.add(O2);
+    }
+
+    private static final PhantomReference<Object> P1 = new PhantomReference<>(O1, Q1);
+    private static final PhantomReference<Object> P2 = new PhantomReference<>(O2, Q2);
+
+    public static void main(String[] args) throws InterruptedException {
+
+        // Collect, and verify neither P1 or P2 notified.
+        System.gc();
+        if (Q1.remove(ENQUEUE_TIMEOUT) != null) {
+            throw new RuntimeException("P1 already notified");
+        } else if (Q2.poll() != null) {
+            throw new RuntimeException("P2 already notified");
+        }
+
+        // Delete root -> O1, collect, verify P1 notified, P2 not notified.
+        O1 = null;
+        System.gc();
+        if (Q1.remove(ENQUEUE_TIMEOUT) == null) {
+            throw new RuntimeException("P1 not notified by O1 deletion");
+        } else if (Q2.remove(ENQUEUE_TIMEOUT) != null) {
+            throw new RuntimeException("P2 notified by O1 deletion.");
+        }
+
+        // Delete root -> O2, collect. P2 should be notified.
+        O2 = null;
+        System.gc();
+        if (Q2.remove(ENQUEUE_TIMEOUT) == null) {
+            throw new RuntimeException("P2 not notified by O2 deletion");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/ReachabilityFenceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015, 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 8133348
+ * @summary Tests if reachabilityFence is working
+ *
+ * @run main/othervm -Xint                   -Dpremature=false ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=1 -Dpremature=true  ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=2 -Dpremature=true  ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=3 -Dpremature=true  ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=4 -Dpremature=true  ReachabilityFenceTest
+ */
+
+import java.lang.ref.Reference;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ReachabilityFenceTest {
+
+    /*
+     * Implementation notes:
+     *
+     * This test has positive and negative parts.
+     *
+     * Negative test is "nonFenced", and it tests that absent of reachabilityFence, the object can
+     * be prematurely finalized -- this validates the test itself. Not every VM mode is expected to
+     * prematurely finalize the objects, and -Dpremature option communicates that to test. If a VM mode
+     * passes the negative test, then our understanding of what could happen is correct, and we can
+     * go forward.
+     *
+     * Positive test is "fenced", and it checks that given the reachabilityFence at the end of the block,
+     * the object cannot be finalized. There is no sense running a positive test when premature finalization
+     * is not expected. It is a job for negative test to verify that invariant.
+     *
+     * The test methods should be appropriately compiled, therefore we do several iterations.
+     */
+
+    // Enough to OSR and compile
+    static final int LOOP_ITERS = Integer.getInteger("LOOP_ITERS", 50000);
+
+    // Enough after which to start triggering GC and finalization
+    static final int WARMUP_LOOP_ITERS = LOOP_ITERS - Integer.getInteger("GC_ITERS", 100);
+
+    // Enough to switch from an OSR'ed method to compiled method
+    static final int MAIN_ITERS = 3;
+
+    static final boolean PREMATURE_FINALIZATION = Boolean.getBoolean("premature");
+
+    public static void main(String... args) {
+        // Negative test
+        boolean finalized = false;
+        for (int c = 0; !finalized && c < MAIN_ITERS; c++) {
+            finalized |= nonFenced();
+        }
+
+        if (PREMATURE_FINALIZATION && !finalized) {
+            throw new IllegalStateException("The object had never been finalized before timeout reached.");
+        }
+
+        if (!PREMATURE_FINALIZATION && finalized) {
+            throw new IllegalStateException("The object had been finalized without a fence, even though we don't expect it.");
+        }
+
+        if (!PREMATURE_FINALIZATION)
+            return;
+
+        // Positive test
+        finalized = false;
+        for (int c = 0; !finalized && c < MAIN_ITERS; c++) {
+            finalized |= fenced();
+        }
+
+        if (finalized) {
+            throw new IllegalStateException("The object had been prematurely finalized.");
+        }
+    }
+
+    public static boolean nonFenced() {
+        AtomicBoolean finalized = new AtomicBoolean();
+        MyFinalizeable o = new MyFinalizeable(finalized);
+
+        for (int i = 0; i < LOOP_ITERS; i++) {
+            if (finalized.get()) break;
+            if (i > WARMUP_LOOP_ITERS) {
+                System.gc();
+                System.runFinalization();
+            }
+        }
+
+        return finalized.get();
+    }
+
+    public static boolean fenced() {
+        AtomicBoolean finalized = new AtomicBoolean();
+        MyFinalizeable o = new MyFinalizeable(finalized);
+
+        for (int i = 0; i < LOOP_ITERS; i++) {
+            if (finalized.get()) break;
+            if (i > WARMUP_LOOP_ITERS) {
+                System.gc();
+                System.runFinalization();
+            }
+        }
+
+        Reference.reachabilityFence(o);
+
+        return finalized.get();
+    }
+
+    private static class MyFinalizeable {
+        private final AtomicBoolean finalized;
+
+        public MyFinalizeable(AtomicBoolean b) {
+            this.finalized = b;
+        }
+
+        @Override
+        protected void finalize() throws Throwable {
+            super.finalize();
+            finalized.set(true);
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -22,8 +22,8 @@
  */
 
 /* @test
+ * @bug 4286936 8146213
  * @summary Unit test for server-socket-channel adaptors
- * @key intermittent
  */
 
 import java.io.*;
@@ -77,6 +77,9 @@
     static void test(int clientDally, int timeout, boolean shouldTimeout)
         throws Exception
     {
+        boolean needClient = !shouldTimeout;
+        client = null;
+        clientException = null;
         clientStarted = false;
         out.println();
 
@@ -90,9 +93,11 @@
             sso.bind(null);
             out.println("bound:   " + ssc);
             out.println("         " + sso);
-            startClient(sso.getLocalPort(), clientDally);
-            while (!clientStarted) {
-                Thread.sleep(20);
+            if (needClient) {
+                startClient(sso.getLocalPort(), clientDally);
+                while (!clientStarted) {
+                    Thread.sleep(20);
+                }
             }
             Socket so = null;
             try {
@@ -115,10 +120,12 @@
                 out.println("server:  read " + b);
             }
         }
-        client.interrupt();
-        client.join();
-        if (clientException != null)
-            throw clientException;
+        if (needClient) {
+            client.interrupt();
+            client.join();
+            if (clientException != null)
+                throw clientException;
+        }
     }
 
     public static void main(String[] args) throws Exception {
--- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,7 +32,6 @@
 import java.nio.*;
 import java.nio.channels.*;
 import java.util.*;
-import sun.misc.*;
 
 
 public class VectorIO {
--- a/jdk/test/java/nio/channels/SocketChannel/Write.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/nio/channels/SocketChannel/Write.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,7 +32,6 @@
 import java.nio.*;
 import java.nio.channels.*;
 import java.util.*;
-import sun.misc.*;
 
 
 public class Write {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,9 +30,6 @@
 import java.nio.channels.*;
 import java.lang.reflect.*;
 
-// dependency on Sun implementation
-import sun.nio.ch.*;
-
 public class Util {
 
     private static Object get(String className, String fieldName, Object o) throws Exception {
--- a/jdk/test/java/security/KeyStore/EntryMethods.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/security/KeyStore/EntryMethods.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,8 +32,6 @@
 import java.util.*;
 import java.io.*;
 
-import sun.security.provider.*;
-
 public class EntryMethods
     extends Provider
     implements KeyStore.Entry
--- a/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Tue Jan 26 09:11:58 2016 +0100
@@ -51,7 +51,7 @@
  *    getting reliable numbers. Otherwise GC activity may corrupt results.
  *    As of jdk80b48 using "-Xms500m -Xmx500m -XX:NewSize=400m" covers
  *    all cases.
- *  - Optionally using "-XX:+printGC" option provides information that
+ *  - Optionally using "-Xlog:gc" option provides information that
  *    helps checking any GC activity while benches are run.
  *
  * Vm Options:
@@ -60,7 +60,7 @@
  *     non fast-path case:  -Xms500m -Xmx500m -XX:NewSize=400m
  *    or use worst case (non fast-path above) with both types of algorithm.
  *
- *  - use -XX:+PrintGC to verify memory consumption of the benchmarks.
+ *  - use -Xlog:gc to verify memory consumption of the benchmarks.
  *    (See "Checking Memory Consumption" below).
  *
  * Description:
@@ -166,7 +166,7 @@
  *  but  is   not enough,  since  any   unexpected  incremental  GC  may  lower
  *  artificially the estimation of the memory consumption.
  *
- *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -XX:+PrintGC to evaluate
+ *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -Xlog:gc to evaluate
  *  correctly  the  values of  these options. When  running "-verbose", varying
  *  numbers reported for memory consumption may  indicate bad choices for these
  *  options.
@@ -217,7 +217,7 @@
             "   getting reliable numbers. Otherwise GC activity may corrupt results.\n" +
             "   As of jdk80b48 using \"-Xms500m -Xmx500m -XX:NewSize=400m\" covers \n" +
             "   all cases.\n" +
-            " - Optionally using \"-XX:+printGC\" option provides information that \n" +
+            " - Optionally using \"-Xlog:gc\" option provides information that \n" +
             "   helps checking any GC activity while benches are run.\n\n" +
             "Look at the heading comments and description in source code for " +
             "detailed information.\n");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ArrayList/ArrayManagement.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2016 Google, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8146568
+ * @summary brittle white box test of internal array management
+ * @run testng ArrayManagement
+ */
+
+import java.lang.reflect.Field;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.SplittableRandom;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class ArrayManagement {
+    static final int DEFAULT_CAPACITY = 10;
+    static final Field ELEMENT_DATA;
+    static final Field MODCOUNT;
+    static final SplittableRandom rnd = new SplittableRandom();
+
+    static {
+        try {
+            ELEMENT_DATA = ArrayList.class.getDeclaredField("elementData");
+            ELEMENT_DATA.setAccessible(true);
+            MODCOUNT = AbstractList.class.getDeclaredField("modCount");
+            MODCOUNT.setAccessible(true);
+        } catch (ReflectiveOperationException huh) {
+            throw new AssertionError(huh);
+        }
+    }
+
+    static Object[] elementData(ArrayList<?> list) {
+        try {
+            return (Object[]) ELEMENT_DATA.get(list);
+        } catch (ReflectiveOperationException huh) {
+            throw new AssertionError(huh);
+        }
+    }
+
+    static int modCount(ArrayList<?> list) {
+        try {
+            return MODCOUNT.getInt(list);
+        } catch (ReflectiveOperationException huh) {
+            throw new AssertionError(huh);
+        }
+    }
+
+    static int capacity(ArrayList<?> list) {
+        return elementData(list).length;
+    }
+
+    static int newCapacity(int oldCapacity) {
+        return oldCapacity + (oldCapacity >> 1);
+    }
+
+    static void ensureCapacity(ArrayList<Object> list, int capacity) {
+        int oldCapacity = capacity(list);
+        int oldModCount = modCount(list);
+        list.ensureCapacity(capacity);
+        assertEquals(modCount(list),
+                     (capacity(list) == oldCapacity)
+                     ? oldModCount
+                     : oldModCount + 1);
+    }
+
+    static List<Object> singletonList() {
+        return Collections.singletonList(Boolean.TRUE);
+    }
+
+    /** Opportunistically randomly test various add operations. */
+    static void addOneElement(ArrayList<Object> list) {
+        int size = list.size();
+        int modCount = modCount(list);
+        switch (rnd.nextInt(4)) {
+        case 0: assertTrue(list.add(Boolean.TRUE)); break;
+        case 1: list.add(size, Boolean.TRUE); break;
+        case 2: assertTrue(list.addAll(singletonList())); break;
+        case 3: assertTrue(list.addAll(size, singletonList())); break;
+        default: throw new AssertionError();
+        }
+        assertEquals(modCount(list), modCount + 1);
+        assertEquals(list.size(), size + 1);
+    }
+
+    @Test public void defaultCapacity() {
+        ArrayList<Object> list = new ArrayList<>();
+        assertEquals(capacity(new ArrayList<Object>()), 0);
+        for (int i = 0; i < DEFAULT_CAPACITY; i++) {
+            addOneElement(list);
+            assertEquals(capacity(list), DEFAULT_CAPACITY);
+        }
+        addOneElement(list);
+        assertEquals(capacity(list), newCapacity(DEFAULT_CAPACITY));
+    }
+
+    @Test public void defaultCapacityEnsureCapacity() {
+        ArrayList<Object> list = new ArrayList<>();
+        for (int i = 0; i <= DEFAULT_CAPACITY; i++) {
+            ensureCapacity(list, i);     // no-op!
+            assertEquals(capacity(list), 0);
+        }
+        for (int i = 0; i < DEFAULT_CAPACITY; i++) {
+            addOneElement(list);
+            assertEquals(capacity(list), DEFAULT_CAPACITY);
+        }
+        addOneElement(list);
+        assertEquals(capacity(list), newCapacity(DEFAULT_CAPACITY));
+        {
+            int capacity = capacity(list);
+            ensureCapacity(list, capacity + 1);
+            assertEquals(capacity(list), newCapacity(capacity));
+        }
+        {
+            int capacity = capacity(list);
+            ensureCapacity(list, 3 * capacity);
+            assertEquals(capacity(list), 3 * capacity);
+        }
+    }
+
+    @Test public void ensureCapacityBeyondDefaultCapacity() {
+        ArrayList<Object> list = new ArrayList<>();
+        list.ensureCapacity(DEFAULT_CAPACITY + 1);
+        assertEquals(capacity(list), DEFAULT_CAPACITY + 1);
+        for (int i = 0; i < DEFAULT_CAPACITY + 1; i++) {
+            addOneElement(list);
+            assertEquals(capacity(list), DEFAULT_CAPACITY + 1);
+        }
+        addOneElement(list);
+        assertEquals(capacity(list), newCapacity(DEFAULT_CAPACITY + 1));
+    }
+
+    @Test public void explicitZeroCapacity() {
+        ArrayList<Object> list = new ArrayList<>(0);
+        assertEquals(capacity(list), 0);
+        addOneElement(list);
+        assertEquals(capacity(list), 1);
+        addOneElement(list);
+        assertEquals(capacity(list), 2);
+        addOneElement(list);
+        assertEquals(capacity(list), 3);
+        addOneElement(list);
+        assertEquals(capacity(list), 4);
+        addOneElement(list);
+        assertEquals(capacity(list), 6);
+        addOneElement(list);
+        assertEquals(capacity(list), 6);
+        addOneElement(list);
+        assertEquals(capacity(list), 9);
+        list.clear();
+        assertEquals(capacity(list), 9);
+    }
+
+    @Test public void explicitLargeCapacity() {
+        int n = DEFAULT_CAPACITY * 3;
+        ArrayList<Object> list = new ArrayList<>(n);
+        assertEquals(capacity(list), n);
+        ensureCapacity(list, 0);
+        ensureCapacity(list, n);
+        for (int i = 0; i < n; i++) addOneElement(list);
+        assertEquals(capacity(list), n);
+
+        addOneElement(list);
+        assertEquals(capacity(list), newCapacity(n));
+    }
+
+    @Test public void emptyArraysAreShared() {
+        assertSame(elementData(new ArrayList<Object>()),
+                   elementData(new ArrayList<Object>()));
+        assertSame(elementData(new ArrayList<Object>(0)),
+                   elementData(new ArrayList<Object>(0)));
+    }
+
+    @Test public void emptyArraysDifferBetweenDefaultAndExplicit() {
+        assertNotSame(elementData(new ArrayList<Object>()),
+                      elementData(new ArrayList<Object>(0)));
+    }
+
+    @Test public void negativeCapacity() {
+        for (int capacity : new int[] { -1, Integer.MIN_VALUE }) {
+            try {
+                new ArrayList<Object>(capacity);
+                fail("should throw");
+            } catch (IllegalArgumentException success) {}
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ArrayList/Bug8146568.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Google, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8146568
+ * @summary repro for: NegativeArraySizeException in ArrayList.grow(int)
+ * @run main/othervm -Xmx17g Bug8146568
+ * @ignore This test has huge memory requirements
+ */
+
+public class Bug8146568 {
+    public static void main(String[] args) {
+        int size = Integer.MAX_VALUE - 2;
+        java.util.ArrayList<Object> huge = new java.util.ArrayList<>(size);
+        for (int i = 0; i < size; i++)
+            huge.add(null);
+        try {
+            huge.addAll(huge);
+            throw new Error("expected OutOfMemoryError not thrown");
+        } catch (OutOfMemoryError success) {}
+    }
+}
--- a/jdk/test/java/util/EnumMap/EnumMapBash.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/util/EnumMap/EnumMapBash.java	Tue Jan 26 09:11:58 2016 +0100
@@ -48,8 +48,6 @@
         bash(Silly500.class);
     }
 
-    private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
-
     static <T extends Enum<T>> void bash(Class<T> enumClass) {
         Enum[] universe = enumClass.getEnumConstants();
 
--- a/jdk/test/java/util/EnumSet/BogusEnumSet.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/util/EnumSet/BogusEnumSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -32,6 +32,11 @@
 
 public class BogusEnumSet {
     public static void main(String[] args) throws Throwable {
+        // This test depends on the current serialVersionUID of EnumSet,
+        // which may change if the EnumSet class is modified.
+        // The current value is 4168005130090799668L = 0x39D7BA9531116234L
+        // If the value changes, it will have to be patched into the
+        // serialized byte stream below at the location noted.
         byte[] serializedForm  = {
             (byte)0xac, (byte)0xed, 0x0, 0x5, 0x73, 0x72, 0x0, 0x18,
             0x6a,  0x61,  0x76,  0x61, 0x2e,  0x75,  0x74,  0x69,
@@ -40,9 +45,10 @@
             0x7e, (byte)0xb0, (byte)0xd0, 0x7e, 0x2, 0x0, 0x1, 0x4a, 0x0, 0x8,
             0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x78, 0x72, 0x0,
             0x11, 0x6a,  0x61,  0x76,  0x61, 0x2e,  0x75,  0x74,  0x69,
-            0x6c,  0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x74, 0xe,
-            0x3, 0x21, 0x6a, (byte)0xcd, (byte)0x8c, 0x29, (byte)0xdd, 0x2,
-            0x0, 0x2, 0x4c, 0x0, 0xb, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+            0x6c,  0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x74,
+            // EnumSet's serialVersionUID is the following eight bytes (big-endian)
+            0x39, (byte)0xd7, (byte)0xba, (byte)0x95, 0x31, 0x11, 0x62, 0x34,
+            0x2, 0x0, 0x2, 0x4c, 0x0, 0xb, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
             0x54, 0x79, 0x70, 0x65, 0x74, 0x0, 0x11, 0x4c, 0x6a, 0x61, 0x76,
             0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x43, 0x6c, 0x61, 0x73,
             0x73, 0x3b, 0x5b, 0x0, 0x8, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72,
--- a/jdk/test/java/util/Locale/Bug8008577.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/util/Locale/Bug8008577.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,7 @@
  * @bug 8008577 8138613
  * @summary Check whether CLDR locale provider adapter is enabled by default
  * @compile -XDignore.symbol.file Bug8008577.java
+ * @modules java.base/sun.util.locale.provider
  * @run main Bug8008577
  */
 
--- a/jdk/test/java/util/PluggableLocale/BreakIteratorProviderTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/java/util/PluggableLocale/BreakIteratorProviderTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,9 +26,7 @@
 
 import java.text.*;
 import java.util.*;
-import sun.text.resources.*;
 import sun.util.locale.provider.*;
-import sun.util.resources.*;
 
 public class BreakIteratorProviderTest extends ProviderTest {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/loading/MletParserLocaleTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Checking MletParser for Locale insensitive strings
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean MletParserLocaleTest
+ * @run build MletParserLocaleTest
+ * @run main/othervm/timeout=5 MletParserLocaleTest mlet4.html
+ */
+
+import java.io.File;
+import java.util.Locale;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.loading.MLet;
+
+public class MletParserLocaleTest {
+
+    public static void main(String[] args) throws Exception {
+
+        boolean error = false;
+
+        // Instantiate the MBean server
+        //
+        System.out.println("Create the MBean server");
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+
+        // Get Default Locale
+        Locale loc = Locale.getDefault();
+
+        // Instantiate an MLet
+        //
+        System.out.println("Create the MLet");
+        MLet mlet = new MLet();
+
+        // Register the MLet MBean with the MBeanServer
+        //
+        System.out.println("Register the MLet MBean");
+        ObjectName mletObjectName = new ObjectName("Test:type=MLet");
+        mbs.registerMBean(mlet, mletObjectName);
+
+        // Call getMBeansFromURL
+        //
+        System.out.println("Call mlet.getMBeansFromURL(<url>)");
+        String testSrc = System.getProperty("test.src");
+        System.out.println("test.src = " + testSrc);
+        String urlCodebase;
+        if (testSrc.startsWith("/")) {
+            urlCodebase =
+                "file:" + testSrc.replace(File.separatorChar, '/') + "/";
+        } else {
+            urlCodebase =
+                "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
+        }
+        String mletFile = urlCodebase + args[0];
+        System.out.println("MLet File = " + mletFile);
+        try {
+            // Change default Locale to Turkish
+            Locale.setDefault(new Locale("tr", "TR"));
+            mlet.getMBeansFromURL(mletFile);
+            System.out.println("Test Passes");
+        } catch (Exception e) {
+            error = true;
+            e.printStackTrace(System.out);
+        }finally {
+            Locale.setDefault(loc);
+        }
+
+        // Unregister the MLet MBean
+        //
+        System.out.println("Unregister the MLet MBean");
+        mbs.unregisterMBean(mletObjectName);
+
+        // Release MBean server
+        //
+        System.out.println("Release the MBean server");
+        MBeanServerFactory.releaseMBeanServer(mbs);
+
+        // End Test
+        //
+        System.out.println("Bye! Bye!");
+        if (error) System.exit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/loading/mlet4.html	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,2 @@
+<MLET CODE=HelloWorld ARCHIVE="helloworld.jar">
+</MLET>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportXMLLocaleTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Test for locale insensitive strings in DescriptorSupport class
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean DescriptorSupportXMLLocaleTest
+ * @run build DescriptorSupportXMLLocaleTest
+ * @run main DescriptorSupportXMLLocaleTest
+ */
+import java.util.Locale;
+import javax.management.modelmbean.DescriptorSupport;
+
+public class DescriptorSupportXMLLocaleTest {
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+        String xmlDesc = "<DESCRIPTOR>"
+                + "<FIELD name=\"field1\" value=\"dummy\">"
+                + "</FIELD>"
+                + "</DESCRIPTOR>";
+        Locale loc = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr", "TR"));
+            new DescriptorSupport(xmlDesc);
+        } catch (Exception e) {
+            e.printStackTrace(System.out);
+            failed = true;
+        }finally{
+            Locale.setDefault(loc);
+        }
+
+        if (!failed) {
+            System.out.println("OK: all tests passed");
+        } else {
+            System.out.println("TEST FAILED");
+            throw new IllegalArgumentException("Test Failed");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/JMXServiceURLLocaleTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Test for locale insensitive strings in JMXServiceURL class
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean JMXServiceURLLocaleTest
+ * @run build JMXServiceURLLocaleTest
+ * @run main JMXServiceURLLocaleTest
+*/
+
+import java.util.Locale;
+import javax.management.remote.JMXServiceURL;
+
+public class JMXServiceURLLocaleTest {
+    public static void main(String[] args) throws Exception {
+
+        boolean error = false;
+        Locale loc = Locale.getDefault();
+
+        try {
+            echo("Setting Turkish locale");
+            // Set locale other than Locale.ENGLISH
+            Locale.setDefault(new Locale("tr", "TR"));
+            new JMXServiceURL("service:jmx:RMI://");
+        } catch (Exception e) {
+            e.printStackTrace(System.out);
+            error = true;
+        } finally {
+            Locale.setDefault(loc);
+            echo("\n>>> Bye! Bye!");
+        }
+
+        if (error) {
+            echo("\nTest failed! ");
+            throw new IllegalArgumentException("Test failed");
+        } else {
+            echo("\nTest passed!\n");
+        }
+    }
+
+    private static void echo(String msg) {
+        System.out.println(msg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/Name.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, Red Hat Inc.
+ * 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.
+ */
+
+public class Name implements NameMBean {
+
+    private String firstName;
+    private String lastName;
+
+    @Override
+    public String getFirstName() {
+        return firstName;
+    }
+
+    @Override
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    @Override
+    public String getLastName() {
+        return lastName;
+    }
+
+    @Override
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/NameMBean.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Red Hat Inc.
+ * 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.
+ */
+
+public interface NameMBean {
+
+    String getFirstName();
+    void setFirstName(String firstName);
+
+    String getLastName();
+    void setLastName(String lastName);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnectorLogAttributesTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2016, Red Hat Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.net.ServerSocket;
+import java.rmi.registry.LocateRegistry;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * @test
+ * @bug 8147857
+ * @summary Tests whether RMIConnector logs attribute names correctly.
+ * @author Severin Gehwolf
+ */
+public class RMIConnectorLogAttributesTest {
+
+    private static final String ILLEGAL = ", FirstName[LastName]";
+    private static final Logger logger = Logger.getLogger("javax.management.remote.rmi");
+    private static final String ANY_NAME = "foo";
+    private static final TestLogHandler handler;
+    static {
+        handler = new TestLogHandler(ILLEGAL);
+        handler.setLevel(Level.FINEST);
+        logger.setLevel(Level.ALL);
+        logger.addHandler(handler);
+    }
+
+    private JMXConnectorServer startServer(int rmiPort) throws Exception {
+        System.out.println("DEBUG: Create RMI registry on port " + rmiPort);
+        LocateRegistry.createRegistry(rmiPort);
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+        HashMap<String,Object> env = new HashMap<String,Object>();
+
+        JMXServiceURL url =
+                new JMXServiceURL("service:jmx:rmi:///jndi/rmi://127.0.0.1:" + rmiPort + "/jmxrmi");
+        JMXConnectorServer cs =
+                JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
+
+        cs.start();
+        System.out.println("DEBUG: Started the RMI connector server");
+        return cs;
+    }
+
+    private int findPort() {
+        for (int i = 13333; i < 13333 + 100; i++) {
+            try {
+                ServerSocket socket = new ServerSocket(i);
+                socket.close();
+                return i;
+            } catch (IOException e) {
+                continue;
+            }
+        }
+        return -1;
+    }
+
+    private void runTest() {
+        int rmiPort = findPort();
+        if (rmiPort == -1) {
+            throw new RuntimeException("Test failed. No available port");
+        }
+        JMXConnectorServer server = null;
+        try {
+            server = startServer(rmiPort);
+            JMXConnector connector = connectToServer(server);
+            doTest(connector);
+        } catch (Exception e) {
+            throw new RuntimeException("Test failed unexpectedly", e);
+        } finally {
+            if (server != null) {
+                try {
+                    server.stop();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+        }
+    }
+
+    private JMXConnector connectToServer(JMXConnectorServer server) throws IOException, MalformedObjectNameException, NullPointerException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, ReflectionException, MBeanException {
+        JMXServiceURL url = server.getAddress();
+        Map<String, Object> env = new HashMap<String, Object>();
+        JMXConnector connector = JMXConnectorFactory.connect(url, env);
+
+        System.out.println("DEBUG: Client connected to RMI at: " + url);
+
+        return connector;
+    }
+
+    private void doTest(JMXConnector connector) throws IOException,
+    MalformedObjectNameException, ReflectionException,
+    InstanceAlreadyExistsException, MBeanRegistrationException,
+    MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
+        MBeanServerConnection  mbsc = connector.getMBeanServerConnection();
+
+
+        ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
+        System.out.println("DEBUG: Calling createMBean");
+        mbsc.createMBean(Name.class.getName(), objName);
+
+        System.out.println("DEBUG: Calling setAttributes");
+        AttributeList attList = new AttributeList();
+        attList.add(new Attribute("FirstName", ANY_NAME));
+        attList.add(new Attribute("LastName", ANY_NAME));
+        mbsc.setAttributes(objName, attList);
+    }
+
+    public static void main(String[] args) throws Exception {
+        RMIConnectorLogAttributesTest test = new RMIConnectorLogAttributesTest();
+        test.runTest();
+        if (handler.testFailed()) {
+            throw new RuntimeException("Test failed. Logged incorrect: '" + ILLEGAL + "'");
+        }
+        System.out.println("Test passed!");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/TestLogHandler.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Red Hat Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+
+public class TestLogHandler extends Handler {
+
+    private final String illegal;
+    private boolean testFailed;
+
+    public TestLogHandler(String illegal) {
+        this.illegal = illegal;
+        this.testFailed = false;
+    }
+
+    @Override
+    public void publish(LogRecord record) {
+        String msg = record.getMessage();
+        String method = record.getSourceMethodName();
+        String className = record.getSourceClassName();
+        if (msg.contains(illegal)) {
+            testFailed = true;
+        }
+        if (msg.contains("attribute names=")) {
+            System.err.println("LOG: " + className + "." + method + ": " + msg);
+        }
+    }
+
+    @Override
+    public void flush() {
+        // nothing
+    }
+
+    @Override
+    public void close() throws SecurityException {
+        // nothing
+    }
+
+    public boolean testFailed() {
+        return testFailed;
+    }
+
+}
--- a/jdk/test/javax/net/ssl/DTLS/CipherSuite.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/CipherSuite.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA
  * @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  * @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256
--- a/jdk/test/javax/net/ssl/DTLS/ClientAuth.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/ClientAuth.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm ClientAuth
  */
 
--- a/jdk/test/javax/net/ssl/DTLS/InvalidCookie.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/InvalidCookie.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm InvalidCookie
  */
 
--- a/jdk/test/javax/net/ssl/DTLS/InvalidRecords.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/InvalidRecords.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm InvalidRecords
  */
 
--- a/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm -Djdk.tls.client.enableStatusRequestExtension=false
  *      NoMacInitialClientHello
  */
--- a/jdk/test/javax/net/ssl/DTLS/Reordered.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/Reordered.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm Reordered
  */
 
--- a/jdk/test/javax/net/ssl/DTLS/Retransmission.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/Retransmission.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm Retransmission
  */
 
--- a/jdk/test/javax/net/ssl/DTLS/WeakCipherSuite.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/DTLS/WeakCipherSuite.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,8 @@
  * @test
  * @bug 8043758
  * @summary Datagram Transport Layer Security (DTLS)
- * @compile DTLSOverDatagram.java
+ * @modules java.base/sun.security.util
+ * @build DTLSOverDatagram
  * @run main/othervm WeakCipherSuite TLS_DH_anon_WITH_AES_128_GCM_SHA256
  * @run main/othervm WeakCipherSuite SSL_DH_anon_WITH_DES_CBC_SHA
  * @run main/othervm WeakCipherSuite SSL_RSA_WITH_DES_CBC_SHA
--- a/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -159,8 +159,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         String keyFilename =
             System.getProperty("test.src", "./") + "/" + pathToStores +
--- a/jdk/test/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -35,6 +35,7 @@
 import java.net.*;
 import javax.net.ssl.*;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.security.KeyStore;
 
 public class SSLCtxAccessToSessCtx  {
@@ -63,7 +64,7 @@
     /*
      * Is the server ready to serve?
      */
-    volatile static boolean serverReady = false;
+    AtomicInteger serverReady = new AtomicInteger(1);   // only one port now
 
     /*
      * Turn on SSL debugging?
@@ -89,12 +90,13 @@
 
         SSLServerSocket sslServerSocket =
             (SSLServerSocket) sslssf.createServerSocket(serverPort);
-        serverPorts[createdPorts++] = sslServerSocket.getLocalPort();
+        int slot = createdPorts.getAndIncrement();
+        serverPorts[slot] = sslServerSocket.getLocalPort();
 
         /*
          * Signal Client, we're ready for his connect.
          */
-        serverReady = true;
+        serverReady.getAndDecrement();
         int read = 0;
         SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
         InputStream sslIS = sslSocket.getInputStream();
@@ -121,7 +123,7 @@
         /*
          * Wait for server to get started.
          */
-        while (!serverReady) {
+        while (serverReady.get() > 0) {
             Thread.sleep(50);
         }
         /*
@@ -151,8 +153,8 @@
      * The remainder is just support stuff
      */
 
-    volatile int serverPorts[] = new int[]{0};
-    volatile int createdPorts = 0;
+    int serverPorts[] = new int[]{0};           // only one port at present
+    AtomicInteger createdPorts = new AtomicInteger(0);
     static SSLServerSocketFactory sslssf;
     static SSLSocketFactory sslsf;
     static SSLContext sslctx;
@@ -255,14 +257,20 @@
                          */
                         System.err.println("Server died...");
                         e.printStackTrace();
-                        serverReady = true;
+                        serverReady.set(0);
                         serverException = e;
                     }
                 }
             };
             serverThread.start();
         } else {
-            doServerSide(port);
+            try {
+                doServerSide(port);
+            } catch (Exception e) {
+                serverException = e;
+            } finally {
+                serverReady.set(0);
+            }
         }
     }
 
@@ -284,7 +292,11 @@
             };
             clientThread.start();
         } else {
-            doClientSide();
+            try {
+                doClientSide();
+            } catch (Exception e) {
+                clientException = e;
+            }
         }
     }
 }
--- a/jdk/test/javax/net/ssl/SSLSession/SessionTimeOutTests.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/SSLSession/SessionTimeOutTests.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -112,7 +112,8 @@
 
         SSLServerSocket sslServerSocket =
             (SSLServerSocket) sslssf.createServerSocket(serverPort);
-        serverPorts[createdPorts++] = sslServerSocket.getLocalPort();
+        int slot = createdPorts.getAndIncrement();
+        serverPorts[slot] = sslServerSocket.getLocalPort();
 
         /*
          * Signal Client, we're ready for his connect.
@@ -288,8 +289,8 @@
      * The remainder is just support stuff
      */
 
-    volatile int serverPorts[] = new int[PORTS];
-    volatile int createdPorts = 0;
+    int serverPorts[] = new int[PORTS];
+    AtomicInteger createdPorts = new AtomicInteger(0);
     static SSLServerSocketFactory sslssf;
     static SSLSocketFactory sslsf;
     static SSLContext sslctx;
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketSNISensitive.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketSNISensitive.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -433,8 +433,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, 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
@@ -111,8 +111,6 @@
         out.println(" Testing - https://" + LOCAL_IP + ":" + testPort);
         out.println(" Testing - Protocol : " + testProtocols);
         out.println(" Testing - Cipher : " + testCipher);
-        Provider p = new sun.security.ec.SunEC();
-        Security.insertProviderAt(p, 1);
         try {
             CipherTestUtils.main(new JSSEFactory(LOCAL_IP,
                     testPort, testProtocols,
@@ -132,8 +130,6 @@
         out.println(" Testing Protocol: " + testProtocol);
         out.println(" Testing Cipher: " + testCipher);
         out.println(" Testing Port: " + testPort);
-        Provider p = new sun.security.ec.SunEC();
-        Security.insertProviderAt(p, 1);
         try {
             CipherTestUtils.main(new JSSEFactory(null, testPort,
                     testProtocol, testCipher, "Server JSSE"),
--- a/jdk/test/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -230,8 +230,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         String keyFilename =
             System.getProperty("test.src", ".") + "/" + pathToStores +
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKey512.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKey512.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -282,6 +282,8 @@
         // reset the security property to make sure that the algorithms
         // and keys used in this test are not disabled.
         Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -303,6 +303,8 @@
         // reset the security property to make sure that the algorithms
         // and keys used in this test are not disabled.
         Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug) {
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/javax/xml/jaxp/PrecisionDecimalDV/XPrecisionDecimalToString.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/javax/xml/jaxp/PrecisionDecimalDV/XPrecisionDecimalToString.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,6 +31,7 @@
  *   in com.sun.org.apache.xerces.internal.impl.dv.xs.PrecisionDecimalDV$XPrecisionDecimal.
  *   Since that method is private the test unfortunately needs to use reflection
  *   to invoke the method.
+ * @modules java.xml/com.sun.org.apache.xerces.internal.impl.dv.xs
  * @run main XPrecisionDecimalToString
  * @author Daniel Fuchs
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/publish/WSTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016, 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 8146086
+ * @summary Publishing two webservices on same port fails with "java.net.BindException: Address already in use"
+ * @run main/othervm WSTest
+ */
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+import java.net.ServerSocket;
+
+public class WSTest {
+
+    @WebService(targetNamespace = "test")
+    public static class Method1 {
+        @WebMethod
+        public String getMethod1Value() {
+            return "from Method1";
+        }
+    }
+
+    @WebService(targetNamespace = "test")
+    public static class Method2 {
+        @WebMethod
+        public String getMethod2Value() {
+            return "from Method2";
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        // find a free port
+        ServerSocket ss = new ServerSocket(0);
+        int port = ss.getLocalPort();
+        ss.close();
+
+        Endpoint endPoint1 = null;
+        Endpoint endPoint2 = null;
+        try {
+            endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1",
+                    new Method1());
+            endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2",
+                    new Method2());
+
+            System.out.println("Sleep 3 secs...");
+
+            Thread.sleep(3000);
+        } finally {
+            stop(endPoint2);
+            stop(endPoint1);
+        }
+    }
+
+    private static void stop(Endpoint endPoint) {
+        if (endPoint == null) return;
+
+        try {
+            endPoint.stop();
+        } catch (Throwable ignored) {
+        }
+    }
+
+}
--- a/jdk/test/jdk/internal/jline/KeyConversionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/jdk/internal/jline/KeyConversionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
  * @test
  * @bug 8080679
  * @summary Verify the conversion from key events to escape sequences works properly.
+ * @modules jdk.internal.le/jdk.internal.jline
  * @requires os.family == "windows"
  */
 
--- a/jdk/test/jdk/internal/jline/console/StripAnsiTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/jdk/internal/jline/console/StripAnsiTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8080679
+ * @modules jdk.internal.le/jdk.internal.jline.console
  * @summary Verify ConsoleReader.stripAnsi strips escape sequences from its input correctly.
  */
 
--- a/jdk/test/lib/testlibrary/ExtendedRobot.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/lib/testlibrary/ExtendedRobot.java	Tue Jan 26 09:11:58 2016 +0100
@@ -48,7 +48,7 @@
  * </pre>
  *
  * @author      Dmitriy Ermashov
- * @since       1.9
+ * @since       9
  */
 
 public class ExtendedRobot extends Robot {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Tue Jan 26 09:11:58 2016 +0100
@@ -38,8 +38,7 @@
  * <pre>
  * {@code
  * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- *                                       .addVMArg("-XX:+PrintGC");
- *                                       .addVMArg("-XX:+PrintGCDetails")
+ *                                       .addVMArg("-Xlog:gc*=debug")
  *                                       .addToolArg("-heap")
  *                                       .addToolArg(pid);
  * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
--- a/jdk/test/sun/awt/shell/ShellFolderMemoryLeak.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/awt/shell/ShellFolderMemoryLeak.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
             after calling Win32ShellFolder:listFiles
             multiple times on some directory with
             large number of files/folders
- * @modules java.desktop/sun.awt
+ * @modules java.desktop/sun.awt.shell
  * @requires (os.family == "windows")
  * @run main/timeout=1000 ShellFolderMemoryLeak
  */
@@ -223,4 +223,4 @@
                     .log(Level.SEVERE, "Unable to delete files", ex);
         }
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java	Mon Jan 25 14:09:28 2016 -1000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, 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 8080535
- * @summary Static storages should be initialized with optimal capacity
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OptimalCapacity
- * @run main OptimalMapSize
- */
-
-import jdk.testlibrary.OptimalCapacity;
-
-public class OptimalMapSize {
-    public static void main(String[] args) throws Throwable {
-        OptimalCapacity.ofIdentityHashMap(
-                Class.forName("sun.invoke.anon.ConstantPoolPatch"),
-                "CONSTANT_VALUE_CLASS_TAG", 6);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXAgentInterfaceBinding.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2015, Red Hat Inc
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnectorServer;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+
+/**
+ * Tests client connections to the JDK's built-in JMX agent server on the given
+ * ports/interface combinations.
+ *
+ * @see JMXInterfaceBindingTest
+ *
+ * @author Severin Gehwolf <sgehwolf@redhat.com>
+ *
+ * Usage:
+ *
+ * SSL:
+ *        java -Dcom.sun.management.jmxremote.ssl.need.client.auth=true \
+ *             -Dcom.sun.management.jmxremote.host=127.0.0.1 \
+ *             -Dcom.sun.management.jmxremote.port=9111 \
+ *             -Dcom.sun.management.jmxremote.rmi.port=9112 \
+ *             -Dcom.sun.management.jmxremote.authenticate=false \
+ *             -Dcom.sun.management.jmxremote.ssl=true \
+ *             -Dcom.sun.management.jmxremote.registry.ssl=true
+ *             -Djavax.net.ssl.keyStore=... \
+ *             -Djavax.net.ssl.keyStorePassword=... \
+ *             JMXAgentInterfaceBinding 127.0.0.1 9111 9112 true
+ *
+ * Non-SSL:
+ *        java -Dcom.sun.management.jmxremote.host=127.0.0.1 \
+ *             -Dcom.sun.management.jmxremote.port=9111 \
+ *             -Dcom.sun.management.jmxremote.rmi.port=9112 \
+ *             -Dcom.sun.management.jmxremote.authenticate=false \
+ *             -Dcom.sun.management.jmxremote.ssl=false \
+ *             JMXAgentInterfaceBinding 127.0.0.1 9111 9112 false
+ *
+ */
+public class JMXAgentInterfaceBinding {
+
+    private final MainThread mainThread;
+
+    public JMXAgentInterfaceBinding(InetAddress bindAddress,
+                                   int jmxPort,
+                                   int rmiPort,
+                                   boolean useSSL) {
+        this.mainThread = new MainThread(bindAddress, jmxPort, rmiPort, useSSL);
+    }
+
+    public void startEndpoint() {
+        mainThread.start();
+        try {
+            mainThread.join();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Test failed", e);
+        }
+        if (mainThread.isFailed()) {
+            mainThread.rethrowException();
+        }
+    }
+
+    public static void main(String[] args) {
+        if (args.length != 4) {
+            throw new RuntimeException(
+                    "Test failed. usage: java JMXInterfaceBindingTest <BIND_ADDRESS> <JMX_PORT> <RMI_PORT> {true|false}");
+        }
+        int jmxPort = parsePortFromString(args[1]);
+        int rmiPort = parsePortFromString(args[2]);
+        boolean useSSL = Boolean.parseBoolean(args[3]);
+        String strBindAddr = args[0];
+        System.out.println(
+                "DEBUG: Running test for triplet (hostname,jmxPort,rmiPort) = ("
+                        + strBindAddr + "," + jmxPort + "," + rmiPort + "), useSSL = " + useSSL);
+        InetAddress bindAddress;
+        try {
+            bindAddress = InetAddress.getByName(args[0]);
+        } catch (UnknownHostException e) {
+            throw new RuntimeException("Test failed. Unknown ip: " + args[0]);
+        }
+        JMXAgentInterfaceBinding test = new JMXAgentInterfaceBinding(bindAddress,
+                jmxPort, rmiPort, useSSL);
+        test.startEndpoint(); // Expect for main test to terminate process
+    }
+
+    private static int parsePortFromString(String port) {
+        try {
+            return Integer.parseInt(port);
+        } catch (NumberFormatException e) {
+            throw new RuntimeException(
+                    "Invalid port specified. Not an integer! Value was: "
+                            + port);
+        }
+    }
+
+    private static class JMXConnectorThread extends Thread {
+
+        private final InetAddress addr;
+        private final int jmxPort;
+        private final int rmiPort;
+        private final boolean useSSL;
+        private final CountDownLatch latch;
+        private boolean failed;
+        private boolean jmxConnectWorked;
+        private boolean rmiConnectWorked;
+
+        private JMXConnectorThread(InetAddress addr,
+                                   int jmxPort,
+                                   int rmiPort,
+                                   boolean useSSL,
+                                   CountDownLatch latch) {
+            this.addr = addr;
+            this.jmxPort = jmxPort;
+            this.rmiPort = rmiPort;
+            this.latch = latch;
+            this.useSSL = useSSL;
+        }
+
+        @Override
+        public void run() {
+            try {
+                connect();
+            } catch (IOException e) {
+                failed = true;
+            }
+        }
+
+        private void connect() throws IOException {
+            System.out.println(
+                    "JMXConnectorThread: Attempting JMX connection on: "
+                            + addr.getHostAddress() + " on port " + jmxPort);
+            JMXServiceURL url;
+            try {
+                url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
+                        + addr.getHostAddress() + ":" + jmxPort + "/jmxrmi");
+            } catch (MalformedURLException e) {
+                throw new RuntimeException("Test failed.", e);
+            }
+            Map<String, Object> env = new HashMap<>();
+            if (useSSL) {
+                SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
+                env.put("com.sun.jndi.rmi.factory.socket", csf);
+                env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
+            }
+            // connect and immediately close
+            JMXConnector c = JMXConnectorFactory.connect(url, env);
+            c.close();
+            System.out.println("JMXConnectorThread: connection to JMX worked");
+            jmxConnectWorked = true;
+            checkRmiSocket();
+            latch.countDown(); // signal we are done.
+        }
+
+        private void checkRmiSocket() throws IOException {
+            Socket rmiConnection;
+            if (useSSL) {
+                rmiConnection = SSLSocketFactory.getDefault().createSocket();
+            } else {
+                rmiConnection = new Socket();
+            }
+            SocketAddress target = new InetSocketAddress(addr, rmiPort);
+            rmiConnection.connect(target);
+            if (useSSL) {
+                ((SSLSocket)rmiConnection).startHandshake();
+            }
+            System.out.println(
+                    "JMXConnectorThread: connection to rmi socket worked host/port = "
+                            + addr.getHostAddress() + "/" + rmiPort);
+            rmiConnectWorked = true;
+            // Closing the channel without sending any data will cause an
+            // java.io.EOFException on the server endpoint. We don't care about this
+            // though, since we only want to test if we can connect.
+            rmiConnection.close();
+        }
+
+        public boolean isFailed() {
+            return failed;
+        }
+
+        public boolean jmxConnectionWorked() {
+            return jmxConnectWorked;
+        }
+
+        public boolean rmiConnectionWorked() {
+            return rmiConnectWorked;
+        }
+    }
+
+    private static class MainThread extends Thread {
+
+        private static final int WAIT_FOR_JMX_AGENT_TIMEOUT_MS = 500;
+        private final InetAddress bindAddress;
+        private final int jmxPort;
+        private final int rmiPort;
+        private final boolean useSSL;
+        private boolean terminated = false;
+        private boolean jmxAgentStarted = false;
+        private Exception excptn;
+
+        private MainThread(InetAddress bindAddress, int jmxPort, int rmiPort, boolean useSSL) {
+            this.bindAddress = bindAddress;
+            this.jmxPort = jmxPort;
+            this.rmiPort = rmiPort;
+            this.useSSL = useSSL;
+        }
+
+        @Override
+        public void run() {
+            try {
+                waitUntilReadyForConnections();
+                // Do nothing, but wait for termination.
+                try {
+                    while (!terminated) {
+                        Thread.sleep(100);
+                    }
+                } catch (InterruptedException e) { // ignore
+                }
+                System.out.println("MainThread: Thread stopped.");
+            } catch (Exception e) {
+                this.excptn = e;
+            }
+        }
+
+        private void waitUntilReadyForConnections() {
+            CountDownLatch latch = new CountDownLatch(1);
+            JMXConnectorThread connectionTester = new JMXConnectorThread(
+                    bindAddress, jmxPort, rmiPort, useSSL, latch);
+            connectionTester.start();
+            boolean expired = false;
+            try {
+                expired = !latch.await(WAIT_FOR_JMX_AGENT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+                System.out.println(
+                        "MainThread: Finished waiting for JMX agent to become available: expired == "
+                                + expired);
+                jmxAgentStarted = !expired;
+            } catch (InterruptedException e) {
+                throw new RuntimeException("Test failed", e);
+            }
+            if (!jmxAgentStarted) {
+                throw new RuntimeException(
+                        "Test failed. JMX server agents not becoming available.");
+            }
+            if (connectionTester.isFailed()
+                    || !connectionTester.jmxConnectionWorked()
+                    || !connectionTester.rmiConnectionWorked()) {
+                throw new RuntimeException(
+                        "Test failed. JMX agent does not seem ready. See log output for details.");
+            }
+            // The main test expects this exact message being printed
+            System.out.println("MainThread: Ready for connections");
+        }
+
+        private boolean isFailed() {
+            return excptn != null;
+        }
+
+        private void rethrowException() throws RuntimeException {
+            throw new RuntimeException(excptn);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2015, Red Hat Inc
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.testlibrary.ProcessThread;
+import jdk.testlibrary.ProcessTools;
+
+/**
+ * NOTE:
+ *    This test requires at least a setup similar to the following in
+ *    /etc/hosts file (or the windows equivalent). I.e. it expects it to
+ *    be multi-homed and not both being the loop-back interface.
+ *    For example:
+ *    ----->8-------- /etc/hosts ----------->8---
+ *    127.0.0.1   localhost
+ *    192.168.0.1 localhost
+ *    ----->8-------- /etc/hosts ----------->8---
+ *
+ * @test
+ * @bug     6425769
+ * @summary Test JMX agent host address binding. Same ports but different
+ *          interfaces to bind to (using plain sockets and SSL sockets).
+ *
+ * @modules java.management/sun.management
+ *          java.management/sun.management.jmxremote
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* JMXAgentInterfaceBinding
+ * @run main/timeout=5 JMXInterfaceBindingTest
+ */
+public class JMXInterfaceBindingTest {
+
+    public static final int COMMUNICATION_ERROR_EXIT_VAL = 1;
+    public static final int STOP_PROCESS_EXIT_VAL = 143;
+    public static final int JMX_PORT = 9111;
+    public static final int RMI_PORT = 9112;
+    public static final String READY_MSG = "MainThread: Ready for connections";
+    public static final String TEST_CLASS = JMXAgentInterfaceBinding.class.getSimpleName();
+    public static final String KEYSTORE_LOC = System.getProperty("test.src", ".") +
+                                              File.separator +
+                                              "ssl" +
+                                              File.separator +
+                                              "keystore";
+    public static final String TRUSTSTORE_LOC = System.getProperty("test.src", ".") +
+                                                File.separator +
+                                                "ssl" +
+                                                File.separator +
+                                                "truststore";
+    public static final String TEST_CLASSPATH = System.getProperty("test.classes", ".");
+
+    public void run(InetAddress[] addrs) {
+        System.out.println("DEBUG: Running tests with plain sockets.");
+        runTests(addrs, false);
+        System.out.println("DEBUG: Running tests with SSL sockets.");
+        runTests(addrs, true);
+    }
+
+    private void runTests(InetAddress[] addrs, boolean useSSL) {
+        ProcessThread[] jvms = new ProcessThread[addrs.length];
+        for (int i = 0; i < addrs.length; i++) {
+            System.out.println();
+            String msg = String.format("DEBUG: Launching java tester for triplet (HOSTNAME,JMX_PORT,RMI_PORT) == (%s,%d,%d)",
+                    addrs[i].getHostAddress(),
+                    JMX_PORT,
+                    RMI_PORT);
+            System.out.println(msg);
+            jvms[i] = runJMXBindingTest(addrs[i], useSSL);
+            jvms[i].start();
+            System.out.println("DEBUG: Started " + (i + 1) + " Process(es).");
+        }
+        int failedProcesses = 0;
+        for (ProcessThread pt: jvms) {
+            try {
+                pt.stopProcess();
+                pt.join();
+            } catch (InterruptedException e) {
+                System.err.println("Failed to stop process: " + pt.getName());
+                throw new RuntimeException("Test failed", e);
+            }
+            int exitValue = pt.getOutput().getExitValue();
+            // If there is a communication error (the case we care about)
+            // we get a exit code of 1
+            if (exitValue == COMMUNICATION_ERROR_EXIT_VAL) {
+                // Failure case since the java processes should still be
+                // running.
+                System.err.println("Test FAILURE on " + pt.getName());
+                failedProcesses++;
+            } else if (exitValue == STOP_PROCESS_EXIT_VAL) {
+                System.out.println("DEBUG: OK. Spawned java process terminated with expected exit code of " + STOP_PROCESS_EXIT_VAL);
+            } else {
+                System.err.println("Test FAILURE on " + pt.getName() + " reason: Unexpected exit code => " + exitValue);
+                failedProcesses++;
+            }
+        }
+        if (failedProcesses > 0) {
+            throw new RuntimeException("Test FAILED. " + failedProcesses + " out of " + addrs.length + " process(es) failed to start the JMX agent.");
+        }
+    }
+
+    private ProcessThread runJMXBindingTest(InetAddress a, boolean useSSL) {
+        List<String> args = new ArrayList<>();
+        args.add("-classpath");
+        args.add(TEST_CLASSPATH);
+        args.add("-Dcom.sun.management.jmxremote.host=" + a.getHostAddress());
+        args.add("-Dcom.sun.management.jmxremote.port=" + JMX_PORT);
+        args.add("-Dcom.sun.management.jmxremote.rmi.port=" + RMI_PORT);
+        args.add("-Dcom.sun.management.jmxremote.authenticate=false");
+        args.add("-Dcom.sun.management.jmxremote.ssl=" + Boolean.toString(useSSL));
+        if (useSSL) {
+            args.add("-Dcom.sun.management.jmxremote.registry.ssl=true");
+            args.add("-Djavax.net.ssl.keyStore=" + KEYSTORE_LOC);
+            args.add("-Djavax.net.ssl.trustStore=" + TRUSTSTORE_LOC);
+            args.add("-Djavax.net.ssl.keyStorePassword=password");
+            args.add("-Djavax.net.ssl.trustStorePassword=trustword");
+        }
+        args.add(TEST_CLASS);
+        args.add(a.getHostAddress());
+        args.add(Integer.toString(JMX_PORT));
+        args.add(Integer.toString(RMI_PORT));
+        args.add(Boolean.toString(useSSL));
+        try {
+            ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[] {}));
+            System.out.println(ProcessTools.getCommandLine(builder));
+            ProcessThread jvm = new ProcessThread("JMX-Tester-" + a.getHostAddress(), JMXInterfaceBindingTest::isJMXAgentResponseAvailable, builder);
+            return jvm;
+        } catch (Exception e) {
+            throw new RuntimeException("Test failed", e);
+        }
+
+    }
+
+    private static boolean isJMXAgentResponseAvailable(String line) {
+        if (line.equals(READY_MSG)) {
+            System.out.println("DEBUG: Found expected READY_MSG.");
+            return true;
+        } else if (line.startsWith("Error:")) {
+            // Allow for a JVM process that exits with
+            // "Error: JMX connector server communication error: ..."
+            // to continue as well since we handle that case elsewhere.
+            // This has the effect that the test does not timeout and
+            // fails with an exception in the test.
+            System.err.println("PROBLEM: JMX agent of target JVM did not start as it should.");
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static void main(String[] args) {
+        InetAddress[] addrs = getAddressesForLocalHost();
+        if (addrs.length < 2) {
+            System.out.println("Ignoring manual test since no more than one IPs are configured for 'localhost'");
+            return;
+        }
+        JMXInterfaceBindingTest test = new JMXInterfaceBindingTest();
+        test.run(addrs);
+        System.out.println("All tests PASSED.");
+    }
+
+    private static InetAddress[] getAddressesForLocalHost() {
+        InetAddress[] addrs;
+        try {
+            addrs = InetAddress.getAllByName("localhost");
+        } catch (UnknownHostException e) {
+            throw new RuntimeException("Test failed", e);
+        }
+        return addrs;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/DigestAuth.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.InetSocketAddress;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8138990
+ * @summary Tests for HTTP Digest auth
+ *          The impl maintains a cache for auth info,
+ *          the testcases run in a separate JVM to avoid cache hits
+ * @run main/othervm DigestAuth good
+ * @run main/othervm DigestAuth only_nonce
+ * @run main/othervm DigestAuth sha1
+ * @run main/othervm DigestAuth no_header
+ * @run main/othervm DigestAuth no_nonce
+ * @run main/othervm DigestAuth no_qop
+ * @run main/othervm DigestAuth invalid_alg
+ * @run main/othervm DigestAuth validate_server
+ * @run main/othervm DigestAuth validate_server_no_qop
+ */
+public class DigestAuth {
+
+    static final String LOCALHOST = "localhost";
+    static final String EXPECT_FAILURE = null;
+    static final String EXPECT_DIGEST = "Digest";
+    static final String REALM = "testrealm@host.com";
+    static final String NEXT_NONCE = "40f2e879449675f288476d772627370a";
+
+    static final String GOOD_WWW_AUTH_HEADER = "Digest "
+            + "realm=\"testrealm@host.com\", "
+            + "qop=\"auth,auth-int\", "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+            + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+    static final String GOOD_WWW_AUTH_HEADER_NO_QOP = "Digest "
+            + "realm=\"testrealm@host.com\", "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+            + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+    static final String WWW_AUTH_HEADER_NO_NONCE = "Digest "
+            + "realm=\"testrealm@host.com\", "
+            + "qop=\"auth,auth-int\", "
+            + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+    static final String WWW_AUTH_HEADER_NO_QOP = "Digest "
+            + "realm=\"testrealm@host.com\", "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+            + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+    static final String WWW_AUTH_HEADER_ONLY_NONCE = "Digest "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\"";
+
+    static final String WWW_AUTH_HEADER_SHA1 = "Digest "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+            + "algorithm=\"SHA1\"";
+
+    static final String WWW_AUTH_HEADER_INVALID_ALGORITHM = "Digest "
+            + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+            + "algorithm=\"SHA123\"";
+
+    static final String AUTH_INFO_HEADER_NO_QOP_FIRST =
+              "nextnonce=\"" + NEXT_NONCE + "\", "
+            + "rspauth=\"ee85bc4315d8b18757809f1a8b9382d8\"";
+
+    static final String AUTH_INFO_HEADER_NO_QOP_SECOND =
+              "rspauth=\"12f2fa12841b3775b6054576722446b2\"";
+
+    static final String AUTH_INFO_HEADER_WRONG_DIGEST =
+              "nextnonce=\"" + NEXT_NONCE + "\", "
+            + "rspauth=\"7327570c586207eca2afae94fc20903d\", "
+            + "cnonce=\"0a4f113b\", "
+            + "nc=00000001, "
+            + "qop=auth";
+
+    public static void main(String[] args) throws Exception {
+        if (args.length == 0) {
+            throw new RuntimeException("No testcase specified");
+        }
+        String testcase = args[0];
+
+        // start a local HTTP server
+        try (LocalHttpServer server = LocalHttpServer.startServer()) {
+
+            // set authenticator
+            AuthenticatorImpl auth = new AuthenticatorImpl();
+            Authenticator.setDefault(auth);
+
+            String url = String.format("http://%s:%d/test/",
+                    LOCALHOST, server.getPort());
+
+            boolean success = true;
+            switch (testcase) {
+                case "good":
+                    // server returns a good WWW-Authenticate header
+                    server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER);
+                    success = testAuth(url, auth, EXPECT_DIGEST);
+                    if (auth.lastRequestedPrompt == null ||
+                            !auth.lastRequestedPrompt.equals(REALM)) {
+                        System.out.println("Unexpected realm: "
+                                + auth.lastRequestedPrompt);
+                        success = false;
+                    }
+                    break;
+                case "validate_server":
+                    // enable processing Authentication-Info headers
+                    System.setProperty("http.auth.digest.validateServer",
+                            "true");
+
+                    /* Server returns good WWW-Authenticate
+                     * and Authentication-Info headers with wrong digest
+                     */
+                    server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER);
+                    server.setAuthInfoHeader(AUTH_INFO_HEADER_WRONG_DIGEST);
+                    success = testAuth(url, auth, EXPECT_FAILURE);
+                    if (auth.lastRequestedPrompt == null ||
+                            !auth.lastRequestedPrompt.equals(REALM)) {
+                        System.out.println("Unexpected realm: "
+                                + auth.lastRequestedPrompt);
+                        success = false;
+                    }
+                    break;
+                case "validate_server_no_qop":
+                    // enable processing Authentication-Info headers
+                    System.setProperty("http.auth.digest.validateServer",
+                            "true");
+
+                    /* Server returns good both WWW-Authenticate
+                     * and Authentication-Info headers without any qop field,
+                     * so that client-nonce should not be taked into account,
+                     * and connection should succeed.
+                     */
+                    server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER_NO_QOP);
+                    server.setAuthInfoHeader(AUTH_INFO_HEADER_NO_QOP_FIRST);
+                    success = testAuth(url, auth, EXPECT_DIGEST);
+                    if (auth.lastRequestedPrompt == null ||
+                            !auth.lastRequestedPrompt.equals(REALM)) {
+                        System.out.println("Unexpected realm: "
+                                + auth.lastRequestedPrompt);
+                        success = false;
+                    }
+
+                    // connect again and check if nextnonce was used
+                    server.setAuthInfoHeader(AUTH_INFO_HEADER_NO_QOP_SECOND);
+                    success &= testAuth(url, auth, EXPECT_DIGEST);
+                    if (!NEXT_NONCE.equals(server.lastRequestedNonce)) {
+                        System.out.println("Unexpected next nonce: "
+                                + server.lastRequestedNonce);
+                        success = false;
+                    }
+                    break;
+                case "only_nonce":
+                    /* Server returns a good WWW-Authenticate header
+                     * which contains only nonce (no realm set).
+                     *
+                     * Realm from  WWW-Authenticate header is passed to
+                     * authenticator which can use it as a prompt
+                     * when it asks a user for credentials.
+                     *
+                     * It's fine if an HTTP client doesn't fail if no realm set,
+                     * and delegates making a decision to authenticator/user.
+                     */
+                    server.setWWWAuthHeader(WWW_AUTH_HEADER_ONLY_NONCE);
+                    success = testAuth(url, auth, EXPECT_DIGEST);
+                    if (auth.lastRequestedPrompt != null &&
+                            !auth.lastRequestedPrompt.trim().isEmpty()) {
+                        System.out.println("Unexpected realm: "
+                                + auth.lastRequestedPrompt);
+                        success = false;
+                    }
+                    break;
+                case "sha1":
+                    // server returns a good WWW-Authenticate header with SHA-1
+                    server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA1);
+                    success = testAuth(url, auth, EXPECT_DIGEST);
+                    break;
+                case "no_header":
+                    // server returns no WWW-Authenticate header
+                    success = testAuth(url, auth, EXPECT_FAILURE);
+                    if (auth.lastRequestedScheme != null) {
+                        System.out.println("Unexpected scheme: "
+                                + auth.lastRequestedScheme);
+                        success = false;
+                    }
+                    break;
+                case "no_nonce":
+                    // server returns a wrong WWW-Authenticate header (no nonce)
+                    server.setWWWAuthHeader(WWW_AUTH_HEADER_NO_NONCE);
+                    success = testAuth(url, auth, EXPECT_FAILURE);
+                    break;
+                case "invalid_alg":
+                    // server returns a wrong WWW-Authenticate header
+                    // (invalid hash algorithm)
+                    server.setWWWAuthHeader(WWW_AUTH_HEADER_INVALID_ALGORITHM);
+                    success = testAuth(url, auth, EXPECT_FAILURE);
+                    break;
+                case "no_qop":
+                    // server returns a good WWW-Authenticate header
+                    // without QOPs
+                    server.setWWWAuthHeader(WWW_AUTH_HEADER_NO_QOP);
+                    success = testAuth(url, auth, EXPECT_DIGEST);
+                    break;
+                default:
+                    throw new RuntimeException("Unexpected testcase: "
+                            + testcase);
+            }
+
+            if (!success) {
+                throw new RuntimeException("Test failed");
+            }
+        }
+
+        System.out.println("Test passed");
+    }
+
+    static boolean testAuth(String url, AuthenticatorImpl auth,
+            String expectedScheme) {
+
+        try {
+            System.out.printf("Connect to %s, expected auth scheme is '%s'%n",
+                    url, expectedScheme);
+            load(url);
+
+            if (expectedScheme == null) {
+                System.out.println("Unexpected successful connection");
+                return false;
+            }
+
+            System.out.printf("Actual auth scheme is '%s'%n",
+                    auth.lastRequestedScheme);
+            if (!expectedScheme.equalsIgnoreCase(auth.lastRequestedScheme)) {
+                System.out.println("Unexpected auth scheme");
+                return false;
+            }
+        } catch (IOException e) {
+            if (expectedScheme != null) {
+                System.out.println("Unexpected exception: " + e);
+                e.printStackTrace(System.out);
+                return false;
+            }
+            System.out.println("Expected exception: " + e);
+        }
+
+        return true;
+    }
+
+    static void load(String url) throws IOException {
+        URLConnection conn = new URL(url).openConnection();
+        conn.setUseCaches(false);
+        try (BufferedReader reader = new BufferedReader(
+                new InputStreamReader(conn.getInputStream()))) {
+
+            String line = reader.readLine();
+            if (line == null) {
+                throw new IOException("Couldn't read response");
+            }
+            do {
+                System.out.println(line);
+            } while ((line = reader.readLine()) != null);
+        }
+    }
+
+    private static class AuthenticatorImpl extends Authenticator {
+
+        private String lastRequestedScheme;
+        private String lastRequestedPrompt;
+
+        @Override
+        public PasswordAuthentication getPasswordAuthentication() {
+            lastRequestedScheme = getRequestingScheme();
+            lastRequestedPrompt = getRequestingPrompt();
+            System.out.println("AuthenticatorImpl: requested "
+                    + lastRequestedScheme);
+
+            return new PasswordAuthentication("Mufasa",
+                    "Circle Of Life".toCharArray());
+        }
+    }
+
+    // local HTTP server which pretends to support HTTP Digest auth
+    static class LocalHttpServer implements HttpHandler, AutoCloseable {
+
+        private final HttpServer server;
+        private volatile String wwwAuthHeader = null;
+        private volatile String authInfoHeader = null;
+        private volatile String lastRequestedNonce;
+
+        private LocalHttpServer(HttpServer server) {
+            this.server = server;
+        }
+
+        void setWWWAuthHeader(String wwwAuthHeader) {
+            this.wwwAuthHeader = wwwAuthHeader;
+        }
+
+        void setAuthInfoHeader(String authInfoHeader) {
+            this.authInfoHeader = authInfoHeader;
+        }
+
+        static LocalHttpServer startServer() throws IOException {
+            HttpServer httpServer = HttpServer.create(
+                    new InetSocketAddress(0), 0);
+            LocalHttpServer localHttpServer = new LocalHttpServer(httpServer);
+            localHttpServer.start();
+
+            return localHttpServer;
+        }
+
+        void start() {
+            server.createContext("/test", this);
+            server.start();
+            System.out.println("HttpServer: started on port " + getPort());
+        }
+
+        void stop() {
+            server.stop(0);
+            System.out.println("HttpServer: stopped");
+        }
+
+        int getPort() {
+            return server.getAddress().getPort();
+        }
+
+        @Override
+        public void handle(HttpExchange t) throws IOException {
+            System.out.println("HttpServer: handle connection");
+
+            // read a request
+            try (InputStream is = t.getRequestBody()) {
+                while (is.read() > 0);
+            }
+
+            try {
+                List<String> headers = t.getRequestHeaders()
+                        .get("Authorization");
+                String header = "";
+                if (headers != null && !headers.isEmpty()) {
+                    header = headers.get(0).trim().toLowerCase();
+                }
+                if (header.startsWith("digest")) {
+                    if (authInfoHeader != null) {
+                        t.getResponseHeaders().add("Authentication-Info",
+                                authInfoHeader);
+                    }
+                    lastRequestedNonce = findParameter(header, "nonce");
+                    byte[] output = "hello".getBytes();
+                    t.sendResponseHeaders(200, output.length);
+                    t.getResponseBody().write(output);
+                    System.out.println("HttpServer: return 200");
+                } else {
+                    if (wwwAuthHeader != null) {
+                        t.getResponseHeaders().add(
+                                "WWW-Authenticate", wwwAuthHeader);
+                    }
+                    byte[] output = "forbidden".getBytes();
+                    t.sendResponseHeaders(401, output.length);
+                    t.getResponseBody().write(output);
+                    System.out.println("HttpServer: return 401");
+                }
+            } catch (IOException e) {
+                System.out.println("HttpServer: exception: " + e);
+                System.out.println("HttpServer: return 500");
+                t.sendResponseHeaders(500, 0);
+            } finally {
+                t.close();
+            }
+        }
+
+        private static String findParameter(String header, String name) {
+            name = name.toLowerCase();
+            if (header != null) {
+                String[] params = header.split("\\s");
+                for (String param : params) {
+                    param = param.trim().toLowerCase();
+                    if (param.startsWith(name)) {
+                        String[] parts = param.split("=");
+                        if (parts.length > 1) {
+                            return parts[1]
+                                    .replaceAll("\"", "").replaceAll(",", "");
+                        }
+                    }
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public void close() {
+            stop();
+        }
+    }
+}
--- a/jdk/test/sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,6 +39,7 @@
 /*
  * @test
  * @bug 8137174
+ * @modules java.base/sun.net.www.protocol.http.ntlm
  * @summary Checks if NTLM auth works fine if security manager set
  * @run main/othervm/java.security.policy=NTLMAuthWithSM.policy NTLMAuthWithSM
  */
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -746,8 +746,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Tue Jan 26 09:11:58 2016 +0100
@@ -48,7 +48,7 @@
  * @bug 8010117
  * @summary Verify if CallerSensitive methods are annotated with
  *          sun.reflect.CallerSensitive annotation
- * @modules jdk.compiler/com.sun.tools.classfile jdk.jdeps/com.sun.tools.jdeps
+ * @modules jdk.jdeps/com.sun.tools.classfile jdk.jdeps/com.sun.tools.jdeps
  * @build CallerSensitiveFinder
  * @run main/othervm/timeout=900 CallerSensitiveFinder
  */
--- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,7 +29,6 @@
  * @modules java.base/sun.reflect
  *          jdk.jdeps/com.sun.tools.classfile
  *          jdk.jdeps/com.sun.tools.jdeps
- * @modules java.base/sun.reflect
  * @compile -XDignore.symbol.file MissingCallerSensitive.java
  * @build CallerSensitiveFinder
  * @run main MissingCallerSensitive
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Tue Jan 26 09:11:58 2016 +0100
@@ -540,6 +540,7 @@
             "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
             "/usr/lib64/"});
         osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
+        osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
         osMap.put("Windows-x86-32", new String[]{
             PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
         osMap.put("Windows-amd64-64", new String[]{
--- a/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,8 @@
     public static void main(String[] args) throws Exception {
         String nssCfg = "--name=NSS\nnssSecmodDirectory=.\n ";
 //          "attributes(*,CKO_PRIVATE_KEY,CKK_DSA) = { CKA_NETSCAPE_DB = 0h00 }";
-        Provider p = new sun.security.pkcs11.SunPKCS11(nssCfg);
+        Provider p = Security.getProvider("SunPKCS11");
+        p.configure(nssCfg);
 
         KeyStore ks = KeyStore.getInstance("PKCS11", p);
         ks.load(null, "test12".toCharArray());
--- a/jdk/test/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8047769
+ * @modules java.base/sun.security.provider
  * @summary SecureRandom should be more frugal with file descriptors
  */
 
--- a/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8046321
  * @summary Unit tests for OCSPNonceExtension objects
+ * @modules java.base/sun.security.provider.certpath
+ *          java.base/sun.security.util
+ *          java.base/sun.security.x509
  */
 
 import java.security.cert.Extension;
--- a/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,8 @@
  * @test
  * @bug 8046321
  * @summary OCSP Stapling for TLS (ResponderId tests)
+ * @modules java.base/sun.security.provider.certpath
+ *          java.base/sun.security.x509
  */
 
 import java.io.*;
--- a/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,7 @@
  * @bug 8080535
  * @summary Expected size of Character.UnicodeBlock.map is not optimal
  * @library /lib/testlibrary
+ * @modules java.base/sun.security.ssl
  * @build jdk.testlibrary.OptimalCapacity
  * @run main OptimalListSize
  */
--- a/jdk/test/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -287,8 +287,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -339,8 +339,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/SSLSocketImpl/CheckMethods.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/SSLSocketImpl/CheckMethods.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,7 +29,6 @@
 import java.net.*;
 import java.util.*;
 import java.lang.reflect.*;
-import com.sun.net.ssl.internal.ssl.*;
 
 public class CheckMethods {
     static boolean debug = false;
--- a/jdk/test/sun/security/ssl/X509KeyManager/PreferredKey.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/X509KeyManager/PreferredKey.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -57,8 +57,10 @@
 
     public static void main(String[] args) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         KeyStore ks;
         KeyManagerFactory kmf;
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/BasicConstraints.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/BasicConstraints.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -458,8 +458,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/PKIXExtendedTM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/PKIXExtendedTM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -794,8 +794,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -306,8 +306,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -796,8 +796,10 @@
 
     public static void main(String args[]) throws Exception {
         // MD5 is used in this test case, don't disable MD5 algorithm.
-        Security.setProperty(
-                "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.certpath.disabledAlgorithms",
+                "MD2, RSA keySize < 1024");
+        Security.setProperty("jdk.tls.disabledAlgorithms",
+                "SSLv3, RC4, DH keySize < 768");
 
         if (debug)
             System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/x509/AVA/EmailAddressEncoding.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/security/x509/AVA/EmailAddressEncoding.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,6 @@
 import javax.security.auth.x500.*;
 import sun.security.util.*;
 import sun.security.pkcs.*;
-import sun.security.x509.*;
 
 public class EmailAddressEncoding {
 
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -38,6 +38,7 @@
  *      7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695
  *      8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916
  * @summary Verify locale data
+ * @modules java.base/sun.util.resources
  * @run main LocaleDataTest
  * @run main LocaleDataTest -cldr
  *
--- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -60,30 +60,30 @@
     }
 
     private static void testFlagPlus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagMinus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("-PrintGC");
-        verifyIsDisabled("PrintGC");
+        output.shouldContain("-HeapDumpOnOutOfMemoryError");
+        verifyIsDisabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagEqual() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testInvalidFlag() throws Exception {
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Tue Jan 26 09:11:58 2016 +0100
@@ -98,7 +98,7 @@
      * -XX:+UsePerfData is required for running the tests on embedded platforms.
      */
     public static final String[] VM_ARGS = {
-        "-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails",
+        "-XX:+UsePerfData", "-Xmx512m", "-Xlog:gc",
         "-Dmultiline.prop=value1\nvalue2\r\nvalue3"
     };
     /**
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,6 +30,7 @@
  *          is not initialized.
  *
  * @modules java.base/sun.util.logging
+ *          java.logging/sun.util.logging.internal
  * @compile -XDignore.symbol.file PlatformLoggerTest.java
  * @run main/othervm PlatformLoggerTest
  */
--- a/jdk/test/tools/launcher/Settings.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/tools/launcher/Settings.java	Tue Jan 26 09:11:58 2016 +0100
@@ -74,7 +74,7 @@
 
     static void runTestOptionDefault() throws IOException {
         String stackSize = "256"; // in kb
-        if (getArch().equals("ppc64")) {
+        if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
             stackSize = "800";
         }
         TestResult tr = null;
--- a/jdk/test/tools/launcher/TooSmallStackSize.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6762191
+ * @ignore 8146751
  * @summary Setting stack size to 16K causes segmentation fault
  * @compile TooSmallStackSize.java
  * @run main TooSmallStackSize
--- a/langtools/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -344,3 +344,4 @@
 cb73b474703e2de266542b505cffd658bcc052da jdk-9+99
 51136404ee5e6cd5868b60d66ebd55a02170b508 jdk-9+100
 3b3bea483542bc08278af529fb25f2e5930da945 jdk-9+101
+6149fc30cd710eb3484dc9863d8837ecaedb96b6 jdk-9+102
--- a/langtools/make/build.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/make/build.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -77,7 +77,7 @@
     -tag "implNote:a:Implementation Note:"
 
 # Version info -- override as needed
-jdk.version = 1.9.0
+jdk.version = 9
 build.number = b00
 milestone = internal
 
@@ -88,4 +88,4 @@
 # timestamps
 # FIXME -- need to include openjdk as needed
 release = ${jdk.version}-${milestone}
-full.version = ${release}-${build.number}
+full.version = ${release}+${build.number}
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Tue Jan 26 09:11:58 2016 +0100
@@ -55,7 +55,7 @@
      * 1.6: no changes
      * 1.7: diamond syntax, try-with-resources, etc.
      * 1.8: lambda expressions and default methods
-     * 1.9: To be determined
+     * 9: To be determined
      */
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2011, 2016, 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 com.sun.source.util;
+
+import java.util.List;
+
+import javax.lang.model.element.Name;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+
+import com.sun.source.doctree.AttributeTree;
+import com.sun.source.doctree.AttributeTree.ValueKind;
+import com.sun.source.doctree.AuthorTree;
+import com.sun.source.doctree.CommentTree;
+import com.sun.source.doctree.DeprecatedTree;
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocRootTree;
+import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.EndElementTree;
+import com.sun.source.doctree.EntityTree;
+import com.sun.source.doctree.ErroneousTree;
+import com.sun.source.doctree.IdentifierTree;
+import com.sun.source.doctree.IndexTree;
+import com.sun.source.doctree.InheritDocTree;
+import com.sun.source.doctree.LinkTree;
+import com.sun.source.doctree.LiteralTree;
+import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ReferenceTree;
+import com.sun.source.doctree.ReturnTree;
+import com.sun.source.doctree.SeeTree;
+import com.sun.source.doctree.SerialDataTree;
+import com.sun.source.doctree.SerialFieldTree;
+import com.sun.source.doctree.SerialTree;
+import com.sun.source.doctree.SinceTree;
+import com.sun.source.doctree.StartElementTree;
+import com.sun.source.doctree.TextTree;
+import com.sun.source.doctree.ThrowsTree;
+import com.sun.source.doctree.UnknownBlockTagTree;
+import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.doctree.ValueTree;
+import com.sun.source.doctree.VersionTree;
+
+/**
+ *  Factory for creating {@code DocTree} nodes.
+ *
+ *  @implNote The methods in an implementation of this interface may only accept {@code DocTree}
+ *  nodes that have been created by the same implementation.
+ *
+ *  @since 9
+ */
+public interface DocTreeFactory {
+    /**
+     * Create a new {@code AttributeTree} object, to represent an HTML attribute in an HTML tag.
+     * @param name  the name of the attribute
+     * @param vkind the kind of attribute value
+     * @param value the value, if any, of the attribute
+     * @return an {@code AttributeTree} object
+     */
+    AttributeTree newAttributeTree(Name name, ValueKind vkind, List<? extends DocTree> value);
+
+    /**
+     * Create a new {@code AuthorTree} object, to represent an {@code {@author } } tag.
+     * @param name the name of the author
+     * @return an {@code AuthorTree} object
+     */
+    AuthorTree newAuthorTree(List<? extends DocTree> name);
+
+    /**
+     * Create a new {@code CodeTree} object, to represent a {@code {@code } } tag.
+     * @param text the content of the tag
+     * @return a {@code CodeTree} object
+     */
+    LiteralTree newCodeTree(TextTree text);
+
+    /**
+     * Create a new {@code CommentTree}, to represent an HTML comment.
+     * @param text the content of the comment
+     * @return a {@code CommentTree} object
+     */
+    CommentTree newCommentTree(String text);
+
+    /**
+     * Create a new {@code DeprecatedTree} object, to represent an {@code {@deprecated } } tag.
+     * @param text the content of the tag
+     * @return a {@code DeprecatedTree} object
+     */
+    DeprecatedTree newDeprecatedTree(List<? extends DocTree> text);
+
+    /**
+     * Create a new {@code DocCommentTree} object, to represent a complete doc comment.
+     * @param firstSentence the first sentence of the doc comment
+     * @param body the body of the doc comment following the first sentence
+     * @param tags the block tags in the doc comment
+     * @return a {@code DocCommentTree} object
+     */
+    DocCommentTree newDocCommentTree(List<? extends DocTree> firstSentence, List<? extends DocTree> body, List<? extends DocTree> tags);
+
+    /**
+     * Create a new {@code DocRootTree} object, to represent an {@code {@docroot} } tag.
+     * @return a {@code DocRootTree} object
+     */
+    DocRootTree newDocRootTree();
+
+    /**
+     * Create a new {@code EndElement} object, to represent the end of an HTML element.
+     * @param name the name of the HTML element
+     * @return an {@code EndElementTree} object
+     */
+    EndElementTree newEndElementTree(Name name);
+
+    /**
+     * Create a new {@code EntityTree} object, to represent an HTML entity.
+     * @param name the name of the entity, representing the characters between '&lt;' and ';'
+     * in the representation of the entity in an HTML document
+     * @return an {@code EntityTree} object
+     */
+    EntityTree newEntityTree(Name name);
+
+    /**
+     * Create a new {@code ErroneousTree} object, to represent some unparseable input.
+     * @param text the unparseable text
+     * @param diag a diagnostic associated with the unparseable text, or null
+     * @return an {@code ErroneousTree} object
+     */
+    ErroneousTree newErroneousTree(String text, Diagnostic<JavaFileObject> diag);
+
+    /**
+     * Create a new {@code ExceptionTree} object, to represent an {@code @exception } tag.
+     * @param name the name of the exception
+     * @param description a description of why the exception might be thrown
+     * @return an {@code ExceptionTree} object
+     */
+    ThrowsTree newExceptionTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code IdentifierTree} object, to represent an identifier, such as in a
+     * {@code @param } tag.
+     * @param name the name of the identifier
+     * @return an {@code IdentifierTree} object
+     */
+    IdentifierTree newIdentifierTree(Name name);
+
+    /**
+     * Create a new {@code IndexTree} object, to represent an {@code {@index } } tag.
+     * @param term the search term
+     * @param description an optional description of the search term
+     * @return an {@code IndexTree} object
+     */
+    IndexTree newIndexTree(DocTree term, List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code InheritDocTree} object, to represent an {@code {@inheritDoc} } tag.
+     * @return an {@code InheritDocTree} object
+     */
+    InheritDocTree newInheritDocTree();
+
+    /**
+     * Create a new {@code LinkTree} object, to represent a {@code {@link } } tag.
+     * @param ref the API element being referenced
+     * @param label an optional label for the link
+     * @return a {@code LinkTree} object
+     */
+    LinkTree newLinkTree(ReferenceTree ref, List<? extends DocTree> label);
+
+    /**
+     * Create a new {@code LinkPlainTree} object, to represent a {@code {@linkplain } } tag.
+     * @param ref the API element being referenced
+     * @param label an optional label for the link
+     * @return a {@code LinkPlainTree} object
+     */
+    LinkTree newLinkPlainTree(ReferenceTree ref, List<? extends DocTree> label);
+
+    /**
+     * Create a new {@code LiteralTree} object, to represent a {@code {@literal } } tag.
+     * @param text the content of the tag
+     * @return a {@code LiteralTree} object
+     */
+    LiteralTree newLiteralTree(TextTree text);
+
+    /**
+     * Create a new {@code ParamTree} object, to represent a {@code @param } tag.
+     * @param isTypeParameter true if this is a type parameter, and false otherwise
+     * @param name the parameter being described
+     * @param description the description of the parameter
+     * @return a {@code ParamTree} object
+     */
+    ParamTree newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code ReferenceTree} object, to represent a reference to an API element.
+     *
+     * @param signature the doc comment signature of the reference
+     * @return a {@code ReferenceTree} object
+     */
+    ReferenceTree newReferenceTree(String signature);
+
+    /**
+     * Create a new {@code ReturnTree} object, to represent a {@code @return } tag.
+     * @param description the description of the return value of a method
+     * @return a {@code ReturnTree} object
+     */
+    ReturnTree newReturnTree(List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code SeeTree} object, to represent a {@code @see } tag.
+     * @param reference the reference
+     * @return a {@code SeeTree} object
+     */
+    SeeTree newSeeTree(List<? extends DocTree> reference);
+
+    /**
+     * Create a new {@code SerialTree} object, to represent a {@code @serial } tag.
+     * @param description the description for the tag
+     * @return a {@code SerialTree} object
+     */
+    SerialTree newSerialTree(List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code SerialDataTree} object, to represent a {@code @serialData } tag.
+     * @param description the description for the tag
+     * @return a {@code SerialDataTree} object
+     */
+    SerialDataTree newSerialDataTree(List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code SerialFieldTree} object, to represent a {@code @serialField } tag.
+     * @param name the name of the field
+     * @param type the type of the field
+     * @param description the description of the field
+     * @return a {@code SerialFieldTree} object
+     */
+    SerialFieldTree newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code SinceTree} object, to represent a {@code @since } tag.
+     * @param text the content of the tag
+     * @return a {@code SinceTree} object
+     */
+    SinceTree newSinceTree(List<? extends DocTree> text);
+
+    /**
+     * Create a new {@code StartElementTree} object, to represent the start of an HTML element.
+     * @param name the name of the HTML element
+     * @param attrs the attributes
+     * @param selfClosing true if the start element is marked as self-closing; otherwise false
+     * @return a {@code StartElementTree} object
+     */
+    StartElementTree newStartElementTree(Name name, List<? extends DocTree> attrs, boolean selfClosing);
+
+    /**
+     * Create a new {@code TextTree} object, to represent some plain text.
+     * @param text the text
+     * @return a {@code TextTree} object
+     */
+    TextTree newTextTree(String text);
+
+    /**
+     * Create a new {@code ThrowsTree} object, to represent a {@code @throws } tag.
+     * @param name the name of the exception
+     * @param description a description of why the exception might be thrown
+     * @return a {@code ThrowsTree} object
+     */
+    ThrowsTree newThrowsTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
+     * Create a new {@code UnknownBlockTagTree} object, to represent an unrecognized block tag.
+     * @param name the name of the block tag
+     * @param content the content
+     * @return an {@code UnknownBlockTagTree} object
+     */
+    UnknownBlockTagTree newUnknownBlockTagTree(Name name, List<? extends DocTree> content);
+
+    /**
+     * Create a new {@code UnknownInlineTagTree} object, to represent an unrecognized inline tag.
+     * @param name the name of the inline tag
+     * @param content the content
+     * @return an {@code UnknownInlineTagTree} object
+     */
+    UnknownInlineTagTree newUnknownInlineTagTree(Name name, List<? extends DocTree> content);
+
+    /**
+     * Create a new {@code ValueTree} object, to represent a {@code {@value } } tag.
+     * @param ref a reference to the value
+     * @return a {@code ValueTree} object
+     */
+    ValueTree newValueTree(ReferenceTree ref);
+
+    /**
+     * Create a new {@code VersionTree} object, to represent a {@code {@version } } tag.
+     * @param text the content of the tag
+     * @return a {@code VersionTree} object
+     */
+    VersionTree newVersionTree(List<? extends DocTree> text);
+
+    /**
+     * Set the position to be recorded in subsequent tree nodes created by this factory.
+     * The position should be a character offset relative to the beginning of the source file
+     * or {@link javax.tools.Diagnostic#NOPOS NOPOS}.
+     * @param pos the position
+     * @return this object, to facilitate method chaining
+     */
+    DocTreeFactory at(int pos);
+
+    /**
+     * Get the first sentence contained in a list of content.
+     * The determination of the first sentence is implementation specific, and may
+     * involve the use of a locale-specific {@link java.text.BreakIterator BreakIterator}
+     * and other heuristics.
+     * The resulting list may share a common set of initial items with the input list.
+     * @param list the list
+     * @return a list containing the first sentence of the list.
+     */
+    List<DocTree> getFirstSentence(List<? extends DocTree> list);
+
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreePath.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTreePath.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, 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
@@ -70,6 +70,7 @@
         }
 
         class PathFinder extends DocTreePathScanner<DocTreePath,DocTree> {
+            @Override
             public DocTreePath scan(DocTree tree, DocTree target) {
                 if (tree == target) {
                     throw new Result(new DocTreePath(getCurrentPath(), target));
@@ -151,18 +152,22 @@
         return parent;
     }
 
+    @Override
     public Iterator<DocTree> iterator() {
         return new Iterator<DocTree>() {
+            @Override
             public boolean hasNext() {
                 return next != null;
             }
 
+            @Override
             public DocTree next() {
                 DocTree t = next.leaf;
                 next = next.parent;
                 return t;
             }
 
+            @Override
             public void remove() {
                 throw new UnsupportedOperationException();
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -126,6 +126,20 @@
     public abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException;
 
     /**
+     * Returns a doc tree path containing the doc comment tree of the given file.
+     * The file must be an HTML file, in which case the doc comment tree represents the
+     * contents of the &lt;body&gt; tag, and any enclosing tags are ignored.
+     * Returns {@code null} if no doc comment was found.
+     * Future releases may support additional file types.
+     *
+     * @param fileObject the content container
+     * @return a doc tree path containing the doc comment read from the given file.
+     *
+     * @since 9
+     */
+    public abstract DocTreePath getDocTreePath(FileObject fileObject);
+
+    /**
      * Returns the language model element referred to by the leaf node of the given
      * {@link DocTreePath}, or {@code null} if unknown.
      * @param path the path for the tree node
@@ -175,4 +189,12 @@
      * @since 9
      */
     public abstract void setBreakIterator(BreakIterator breakiterator);
+
+    /**
+     * Returns a utility object for creating {@code DocTree} objects.
+     * @return  a utility object for creating {@code DocTree} objects
+     *
+     * @since 9
+     */
+    public abstract DocTreeFactory getDocTreeFactory();
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -49,7 +49,6 @@
 import javax.tools.Diagnostic;
 import javax.tools.FileObject;
 import javax.tools.ForwardingFileObject;
-import javax.tools.ForwardingJavaFileObject;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
@@ -160,7 +159,7 @@
     private JavacTaskImpl javacTaskImpl;
     private Names names;
     private Types types;
-    private DocTreeMaker doctreeMaker;
+    private DocTreeMaker docTreeMaker;
     private BreakIterator breakIterator;
     private JavaFileManager fileManager;
     private ParserFactory parser;
@@ -206,7 +205,7 @@
         memberEnter = MemberEnter.instance(context);
         names = Names.instance(context);
         types = Types.instance(context);
-        doctreeMaker = DocTreeMaker.instance(context);
+        docTreeMaker = DocTreeMaker.instance(context);
         parser = ParserFactory.instance(context);
         fileManager = context.get(JavaFileManager.class);
         JavacTask t = context.get(JavacTask.class);
@@ -294,6 +293,11 @@
             };
     }
 
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DocTreeMaker getDocTreeFactory() {
+        return docTreeMaker;
+    }
+
     private DocTree getLastChild(DocTree tree) {
         final DocTree[] last = new DocTree[] {null};
 
@@ -398,7 +402,7 @@
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public java.util.List<DocTree> getFirstSentence(java.util.List<? extends DocTree> list) {
-        return doctreeMaker.getFirstSentence(list);
+        return docTreeMaker.getFirstSentence(list);
     }
 
     private Symbol attributeDocReference(TreePath path, DCReference ref) {
@@ -411,9 +415,9 @@
             final Name memberName;
             if (ref.qualifierExpression == null) {
                 tsym = env.enclClass.sym;
-                memberName = ref.memberName;
+                memberName = (Name) ref.memberName;
             } else {
-                // See if the qualifierExpression is a type or package name.
+                // newSeeTree if the qualifierExpression is a type or package name.
                 // javac does not provide the exact method required, so
                 // we first check if qualifierExpression identifies a type,
                 // and if not, then we check to see if it identifies a package.
@@ -437,7 +441,7 @@
                     }
                 } else {
                     tsym = t.tsym;
-                    memberName = ref.memberName;
+                    memberName = (Name) ref.memberName;
                 }
             }
 
@@ -449,7 +453,7 @@
                 paramTypes = null;
             else {
                 ListBuffer<Type> lb = new ListBuffer<>();
-                for (List<JCTree> l = ref.paramTypes; l.nonEmpty(); l = l.tail) {
+                for (List<JCTree> l = (List<JCTree>) ref.paramTypes; l.nonEmpty(); l = l.tail) {
                     JCTree tree = l.head;
                     Type t = attr.attribType(tree, env);
                     lb.add(t);
@@ -913,7 +917,7 @@
         }
     }
 
-    private JavaFileObject asJavaFileObject(FileObject fileObject) {
+    static JavaFileObject asJavaFileObject(FileObject fileObject) {
         JavaFileObject jfo = null;
 
         if (fileObject instanceof JavaFileObject) {
@@ -927,11 +931,11 @@
         return jfo;
     }
 
-    private void checkHtmlKind(FileObject fileObject) {
+    private static void checkHtmlKind(FileObject fileObject) {
         checkHtmlKind(fileObject, BaseFileManager.getKind(fileObject.getName()));
     }
 
-    private void checkHtmlKind(FileObject fileObject, JavaFileObject.Kind kind) {
+    private static void checkHtmlKind(FileObject fileObject, JavaFileObject.Kind kind) {
         if (kind != JavaFileObject.Kind.HTML) {
             throw new IllegalArgumentException("HTML file expected:" + fileObject.getName());
         }
@@ -1012,6 +1016,12 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DocTreePath getDocTreePath(FileObject fileObject) {
+        JavaFileObject jfo = asJavaFileObject(fileObject);
+        return new DocTreePath(makeTreePath(jfo), getDocCommentTree(jfo));
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public void setBreakIterator(BreakIterator breakiterator) {
         this.breakIterator = breakiterator;
     }
@@ -1126,11 +1136,10 @@
         }
     }
 
-    public TreePath makeTreePath(final FileObject fileObject, final int offset) {
-        JavaFileObject jfo = asJavaFileObject(fileObject);
+    private TreePath makeTreePath(final JavaFileObject jfo) {
         JCCompilationUnit jcCompilationUnit = new JCCompilationUnit(List.nil()) {
             public int getPos() {
-                return offset;
+                return Position.FIRSTPOS;
             }
 
             public JavaFileObject getSourcefile() {
@@ -1140,7 +1149,7 @@
             @Override @DefinedBy(Api.COMPILER_TREE)
             public Position.LineMap getLineMap() {
                 try {
-                    CharSequence content = fileObject.getCharContent(true);
+                    CharSequence content = jfo.getCharContent(true);
                     String s = content.toString();
                     return Position.makeLineMap(s.toCharArray(), s.length(), true);
                 } catch (IOException ignore) {}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Tue Jan 26 09:11:58 2016 +0100
@@ -368,6 +368,10 @@
                 accept(stripMetadata, null) :
                 this;
     }
+
+    public Type stripMetadata() {
+        return accept(stripMetadata, null);
+    }
     //where
         private final static TypeMapping<Void> stripMetadata = new TypeMapping<Void>() {
             @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1017,7 +1017,7 @@
                 case METHOD_INVOCATION: {
                     JCMethodInvocation invocation = (JCMethodInvocation)frame;
                     if (!invocation.typeargs.contains(tree)) {
-                        throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
+                        return TypeAnnotationPosition.unknown;
                     }
                     MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
                     final int type_index = invocation.typeargs.indexOf(tree);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Jan 26 09:11:58 2016 +0100
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.TypeMetadata.Annotations;
 import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError;
+import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext;
 import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
 import com.sun.tools.javac.comp.Infer.FreeTypeListener;
@@ -885,40 +886,46 @@
     }
 
     public void visitClassDef(JCClassDecl tree) {
-        // Local and anonymous classes have not been entered yet, so we need to
-        // do it now.
-        if (env.info.scope.owner.kind.matches(KindSelector.VAL_MTH)) {
-            enter.classEnter(tree, env);
-        } else {
-            // If this class declaration is part of a class level annotation,
-            // as in @MyAnno(new Object() {}) class MyClass {}, enter it in
-            // order to simplify later steps and allow for sensible error
-            // messages.
-            if (env.tree.hasTag(NEWCLASS) && TreeInfo.isInAnnotation(env, tree))
+        Optional<ArgumentAttr.LocalCacheContext> localCacheContext =
+                Optional.ofNullable(env.info.isSpeculative ?
+                        argumentAttr.withLocalCacheContext() : null);
+        try {
+            // Local and anonymous classes have not been entered yet, so we need to
+            // do it now.
+            if (env.info.scope.owner.kind.matches(KindSelector.VAL_MTH)) {
                 enter.classEnter(tree, env);
-        }
-
-        ClassSymbol c = tree.sym;
-        if (c == null) {
-            // exit in case something drastic went wrong during enter.
-            result = null;
-        } else {
-            // make sure class has been completed:
-            c.complete();
-
-            // If this class appears as an anonymous class
-            // in a superclass constructor call where
-            // no explicit outer instance is given,
-            // disable implicit outer instance from being passed.
-            // (This would be an illegal access to "this before super").
-            if (env.info.isSelfCall &&
-                env.tree.hasTag(NEWCLASS) &&
-                ((JCNewClass) env.tree).encl == null)
-            {
-                c.flags_field |= NOOUTERTHIS;
+            } else {
+                // If this class declaration is part of a class level annotation,
+                // as in @MyAnno(new Object() {}) class MyClass {}, enter it in
+                // order to simplify later steps and allow for sensible error
+                // messages.
+                if (env.tree.hasTag(NEWCLASS) && TreeInfo.isInAnnotation(env, tree))
+                    enter.classEnter(tree, env);
             }
-            attribClass(tree.pos(), c);
-            result = tree.type = c.type;
+
+            ClassSymbol c = tree.sym;
+            if (c == null) {
+                // exit in case something drastic went wrong during enter.
+                result = null;
+            } else {
+                // make sure class has been completed:
+                c.complete();
+
+                // If this class appears as an anonymous class
+                // in a superclass constructor call where
+                // no explicit outer instance is given,
+                // disable implicit outer instance from being passed.
+                // (This would be an illegal access to "this before super").
+                if (env.info.isSelfCall &&
+                        env.tree.hasTag(NEWCLASS) &&
+                        ((JCNewClass)env.tree).encl == null) {
+                    c.flags_field |= NOOUTERTHIS;
+                }
+                attribClass(tree.pos(), c);
+                result = tree.type = c.type;
+            }
+        } finally {
+            localCacheContext.ifPresent(LocalCacheContext::leave);
         }
     }
 
@@ -3873,8 +3880,6 @@
                    v.name != names._class;
         }
 
-    Warner noteWarner = new Warner();
-
     /**
      * Check that method arguments conform to its instantiation.
      **/
@@ -3928,7 +3933,7 @@
         // For methods, we need to compute the instance type by
         // Resolve.instantiate from the symbol's type as well as
         // any type arguments and value arguments.
-        noteWarner.clear();
+        Warner noteWarner = new Warner();
         try {
             Type owntype = rs.checkMethod(
                     env,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -2207,6 +2207,9 @@
             if ((id.sym.flags() & FINAL) != 0 && id.sym.owner.kind == MTH)
                 return builder.build(rval);
         }
+        Name name = TreeInfo.name(rval);
+        if (name == names._super)
+            return builder.build(rval);
         VarSymbol var =
             new VarSymbol(FINAL|SYNTHETIC,
                           names.fromString(
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, 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
@@ -121,7 +121,7 @@
                 ? body.head.pos
                 : !tags.isEmpty() ? tags.head.pos : Position.NOPOS;
 
-        DCDocComment dc = m.at(pos).DocComment(comment, body, tags);
+        DCDocComment dc = m.at(pos).newDocCommentTree(comment, body, tags);
         return dc;
     }
 
@@ -171,7 +171,7 @@
                 case '>':
                     newline = false;
                     addPendingText(trees, bp - 1);
-                    trees.add(m.at(bp).Erroneous(newString(bp, bp+1), diagSource, "dc.bad.gt"));
+                    trees.add(m.at(bp).newErroneousTree(newString(bp, bp + 1), diagSource, "dc.bad.gt"));
                     nextChar();
                     if (textStart == -1) {
                         textStart = bp;
@@ -231,7 +231,7 @@
                 TagParser tp = tagParsers.get(name);
                 if (tp == null) {
                     List<DCTree> content = blockContent();
-                    return m.at(p).UnknownBlockTag(name, content);
+                    return m.at(p).newUnknownBlockTagTree(name, content);
                 } else {
                     switch (tp.getKind()) {
                         case BLOCK:
@@ -284,7 +284,7 @@
                     DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_ALL);
                     if (text != null) {
                         nextChar();
-                        return m.at(p).UnknownInlineTag(name, List.of(text)).setEndPos(bp);
+                        return m.at(p).newUnknownInlineTagTree(name, List.of(text)).setEndPos(bp);
                     }
                 } else {
                     if (!tp.retainWhiteSpace) {
@@ -354,7 +354,7 @@
 
                 case '}':
                     if (--depth == 0) {
-                        return m.at(pos).Text(newString(pos, bp));
+                        return m.at(pos).newTextTree(newString(pos, bp));
                     }
                     newline = false;
                     lastNonWhite = bp;
@@ -384,6 +384,7 @@
      */
     // TODO: boolean allowMember should be enum FORBID, ALLOW, REQUIRE
     // TODO: improve quality of parse to forbid bad constructions.
+    // TODO: update to use ReferenceParser
     @SuppressWarnings("fallthrough")
     protected DCReference reference(boolean allowMember) throws ParseException {
         int pos = bp;
@@ -481,7 +482,7 @@
             fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
         }
 
-        return m.at(pos).Reference(sig, qualExpr, member, paramTypes).setEndPos(bp);
+        return m.at(pos).newReferenceTree(sig, qualExpr, member, paramTypes).setEndPos(bp);
     }
 
     JCTree parseType(String s) throws ParseException {
@@ -537,7 +538,7 @@
 
         if (isJavaIdentifierStart(ch)) {
             Name name = readJavaIdentifier();
-            return m.at(pos).Identifier(name);
+            return m.at(pos).newIdentifierTree(name);
         }
 
         throw new ParseException("dc.identifier.expected");
@@ -565,7 +566,7 @@
                 case '"':
                     nextChar();
                     // trim trailing white-space?
-                    return m.at(pos).Text(newString(pos, bp));
+                    return m.at(pos).newTextTree(newString(pos, bp));
 
                 case '@':
                     if (newline)
@@ -593,7 +594,7 @@
                     // fallthrough
 
                 case '\r': case '\f': case ' ': case '\t':
-                    return m.at(pos).Text(newString(pos, bp));
+                    return m.at(pos).newTextTree(newString(pos, bp));
 
                 case '@':
                     if (newline)
@@ -605,7 +606,7 @@
 
                 case '}':
                     if (depth == 0 || --depth == 0)
-                        return m.at(pos).Text(newString(pos, bp));
+                        return m.at(pos).newTextTree(newString(pos, bp));
                     break;
             }
             newline = false;
@@ -729,7 +730,7 @@
             if (ch != ';')
                 return erroneous("dc.missing.semicolon", p);
             nextChar();
-            return m.at(p).Entity(name);
+            return m.at(p).newEntityTree(name);
         }
     }
 
@@ -751,7 +752,7 @@
                 }
                 if (ch == '>') {
                     nextChar();
-                    DCTree dctree = m.at(p).StartElement(name, attrs, selfClosing).setEndPos(bp);
+                    DCTree dctree = m.at(p).newStartElementTree(name, attrs, selfClosing).setEndPos(bp);
                     return dctree;
                 }
             }
@@ -762,7 +763,7 @@
                 skipWhitespace();
                 if (ch == '>') {
                     nextChar();
-                    return m.at(p).EndElement(name);
+                    return m.at(p).newEndElementTree(name);
                 }
             }
         } else if (ch == '!') {
@@ -777,11 +778,13 @@
                             dash++;
                             nextChar();
                         }
-                        // strictly speaking, a comment should not contain "--"
+                        // Strictly speaking, a comment should not contain "--"
                         // so dash > 2 is an error, dash == 2 implies ch == '>'
+                        // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
+                        // for more details.
                         if (dash >= 2 && ch == '>') {
                             nextChar();
-                            return m.at(p).Comment(newString(p, bp));
+                            return m.at(p).newCommentTree(newString(p, bp));
                         }
 
                         nextChar();
@@ -844,7 +847,7 @@
                 skipWhitespace();
                 value = v.toList();
             }
-            DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
+            DCAttribute attr = m.at(namePos).newAttributeTree(name, vkind, value);
             attrs.add(attr);
         }
 
@@ -869,7 +872,7 @@
     protected void addPendingText(ListBuffer<DCTree> list, int textEnd) {
         if (textStart != -1) {
             if (textStart <= textEnd) {
-                list.add(m.at(textStart).Text(newString(textStart, textEnd + 1)));
+                list.add(m.at(textStart).newTextTree(newString(textStart, textEnd + 1)));
             }
             textStart = -1;
         }
@@ -891,7 +894,7 @@
             i--;
         }
         textStart = -1;
-        return m.at(pos).Erroneous(newString(pos, i + 1), diagSource, code);
+        return m.at(pos).newErroneousTree(newString(pos, i + 1), diagSource, code);
     }
 
     protected boolean isIdentifierStart(char ch) {
@@ -1017,7 +1020,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.AUTHOR) {
                 public DCTree parse(int pos) {
                     List<DCTree> name = blockContent();
-                    return m.at(pos).Author(name);
+                    return m.at(pos).newAuthorTree(name);
                 }
             },
 
@@ -1026,7 +1029,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
                     nextChar();
-                    return m.at(pos).Code((DCText) text);
+                    return m.at(pos).newCodeTree((DCText) text);
                 }
             },
 
@@ -1034,7 +1037,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.DEPRECATED) {
                 public DCTree parse(int pos) {
                     List<DCTree> reason = blockContent();
-                    return m.at(pos).Deprecated(reason);
+                    return m.at(pos).newDeprecatedTree(reason);
                 }
             },
 
@@ -1043,7 +1046,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     if (ch == '}') {
                         nextChar();
-                        return m.at(pos).DocRoot();
+                        return m.at(pos).newDocRootTree();
                     }
                     inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
                     nextChar();
@@ -1057,7 +1060,7 @@
                     skipWhitespace();
                     DCReference ref = reference(false);
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Exception(ref, description);
+                    return m.at(pos).newExceptionTree(ref, description);
                 }
             },
 
@@ -1079,7 +1082,7 @@
                     } else {
                         nextChar();
                     }
-                    return m.at(pos).Index(term, description);
+                    return m.at(pos).newIndexTree(term, description);
                 }
             },
 
@@ -1088,7 +1091,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     if (ch == '}') {
                         nextChar();
-                        return m.at(pos).InheritDoc();
+                        return m.at(pos).newInheritDocTree();
                     }
                     inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
                     nextChar();
@@ -1101,7 +1104,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     DCReference ref = reference(true);
                     List<DCTree> label = inlineContent();
-                    return m.at(pos).Link(ref, label);
+                    return m.at(pos).newLinkTree(ref, label);
                 }
             },
 
@@ -1110,7 +1113,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     DCReference ref = reference(true);
                     List<DCTree> label = inlineContent();
-                    return m.at(pos).LinkPlain(ref, label);
+                    return m.at(pos).newLinkPlainTree(ref, label);
                 }
             },
 
@@ -1119,7 +1122,7 @@
                 public DCTree parse(int pos) throws ParseException {
                     DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
                     nextChar();
-                    return m.at(pos).Literal((DCText) text);
+                    return m.at(pos).newLiteralTree((DCText) text);
                 }
             },
 
@@ -1144,7 +1147,7 @@
 
                     skipWhitespace();
                     List<DCTree> desc = blockContent();
-                    return m.at(pos).Param(typaram, id, desc);
+                    return m.at(pos).newParamTree(typaram, id, desc);
                 }
             },
 
@@ -1152,7 +1155,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.RETURN) {
                 public DCTree parse(int pos) {
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Return(description);
+                    return m.at(pos).newReturnTree(description);
                 }
             },
 
@@ -1167,7 +1170,7 @@
                                 skipWhitespace();
                                 if (ch == '@'
                                         || ch == EOI && bp == buf.length - 1) {
-                                    return m.at(pos).See(List.<DCTree>of(string));
+                                    return m.at(pos).newSeeTree(List.<DCTree>of(string));
                                 }
                             }
                             break;
@@ -1175,7 +1178,7 @@
                         case '<':
                             List<DCTree> html = blockContent();
                             if (html != null)
-                                return m.at(pos).See(html);
+                                return m.at(pos).newSeeTree(html);
                             break;
 
                         case '@':
@@ -1192,7 +1195,7 @@
                             if (isJavaIdentifierStart(ch) || ch == '#') {
                                 DCReference ref = reference(true);
                                 List<DCTree> description = blockContent();
-                                return m.at(pos).See(description.prepend(ref));
+                                return m.at(pos).newSeeTree(description.prepend(ref));
                             }
                     }
                     throw new ParseException("dc.unexpected.content");
@@ -1203,7 +1206,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL_DATA) {
                 public DCTree parse(int pos) {
                     List<DCTree> description = blockContent();
-                    return m.at(pos).SerialData(description);
+                    return m.at(pos).newSerialDataTree(description);
                 }
             },
 
@@ -1219,7 +1222,7 @@
                         skipWhitespace();
                         description = blockContent();
                     }
-                    return m.at(pos).SerialField(name, type, description);
+                    return m.at(pos).newSerialFieldTree(name, type, description);
                 }
             },
 
@@ -1227,7 +1230,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL) {
                 public DCTree parse(int pos) {
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Serial(description);
+                    return m.at(pos).newSerialTree(description);
                 }
             },
 
@@ -1235,7 +1238,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.SINCE) {
                 public DCTree parse(int pos) {
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Since(description);
+                    return m.at(pos).newSinceTree(description);
                 }
             },
 
@@ -1245,7 +1248,7 @@
                     skipWhitespace();
                     DCReference ref = reference(false);
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Throws(ref, description);
+                    return m.at(pos).newThrowsTree(ref, description);
                 }
             },
 
@@ -1256,7 +1259,7 @@
                     skipWhitespace();
                     if (ch == '}') {
                         nextChar();
-                        return m.at(pos).Value(ref);
+                        return m.at(pos).newValueTree(ref);
                     }
                     nextChar();
                     throw new ParseException("dc.unexpected.content");
@@ -1267,7 +1270,7 @@
             new TagParser(Kind.BLOCK, DCTree.Kind.VERSION) {
                 public DCTree parse(int pos) {
                     List<DCTree> description = blockContent();
-                    return m.at(pos).Version(description);
+                    return m.at(pos).newVersionTree(description);
                 }
             },
         };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ReferenceParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012, 2016, 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 com.sun.tools.javac.parser;
+
+import com.sun.tools.javac.parser.Tokens.TokenKind;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Name;
+
+/**
+ *  A utility class to parse a string in a doc comment containing a
+ *  reference to an API element, such as a type, field or method.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class ReferenceParser {
+    /**
+     * An object to contain the result of parsing a reference to an API element.
+     * Any, but not all, of the member fields may be null.
+     */
+    static public class Reference {
+        /** The type, if any, in the signature. */
+        public final JCTree qualExpr;
+        /** The member name, if any, in the signature. */
+        public final Name member;
+        /** The parameter types, if any, in the signature. */
+        public final List<JCTree> paramTypes;
+
+        Reference(JCTree qualExpr, Name member, List<JCTree> paramTypes) {
+            this.qualExpr = qualExpr;
+            this.member = member;
+            this.paramTypes = paramTypes;
+        }
+    }
+
+    /**
+     * An exception that indicates an error occurred while parsing a signature.
+     */
+    static public class ParseException extends Exception {
+        private static final long serialVersionUID = 0;
+        ParseException(String message) {
+            super(message);
+        }
+    }
+
+    private final ParserFactory fac;
+
+    /**
+     * Create a parser object to parse reference signatures.
+     * @param fac a factory for parsing Java source code.
+     */
+    public ReferenceParser(ParserFactory fac) {
+        this.fac = fac;
+    }
+
+    /**
+     * Parse a reference to an API element as may be found in doc comment.
+     * @param sig the signature to be parsed
+     * @return a {@code Reference} object containing the result of parsing the signature
+     * @throws ParseException if there is an error while parsing the signature
+     */
+    public Reference parse(String sig) throws ParseException {
+
+        // Break sig apart into qualifiedExpr member paramTypes.
+        JCTree qualExpr;
+        Name member;
+        List<JCTree> paramTypes;
+
+        Log.DeferredDiagnosticHandler deferredDiagnosticHandler
+                = new Log.DeferredDiagnosticHandler(fac.log);
+
+        try {
+            int hash = sig.indexOf("#");
+            int lparen = sig.indexOf("(", hash + 1);
+            if (hash == -1) {
+                if (lparen == -1) {
+                    qualExpr = parseType(sig);
+                    member = null;
+                } else {
+                    qualExpr = null;
+                    member = parseMember(sig.substring(0, lparen));
+                }
+            } else {
+                qualExpr = (hash == 0) ? null : parseType(sig.substring(0, hash));
+                if (lparen == -1)
+                    member = parseMember(sig.substring(hash + 1));
+                else
+                    member = parseMember(sig.substring(hash + 1, lparen));
+            }
+
+            if (lparen < 0) {
+                paramTypes = null;
+            } else {
+                int rparen = sig.indexOf(")", lparen);
+                if (rparen != sig.length() - 1)
+                    throw new ParseException("dc.ref.bad.parens");
+                paramTypes = parseParams(sig.substring(lparen + 1, rparen));
+            }
+
+            if (!deferredDiagnosticHandler.getDiagnostics().isEmpty())
+                throw new ParseException("dc.ref.syntax.error");
+
+        } finally {
+            fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
+        }
+
+        return new Reference(qualExpr, member, paramTypes);
+    }
+
+    private JCTree parseType(String s) throws ParseException {
+        JavacParser p = fac.newParser(s, false, false, false);
+        JCTree tree = p.parseType();
+        if (p.token().kind != TokenKind.EOF)
+            throw new ParseException("dc.ref.unexpected.input");
+        return tree;
+    }
+
+    private Name parseMember(String s) throws ParseException {
+        JavacParser p = fac.newParser(s, false, false, false);
+        Name name = p.ident();
+        if (p.token().kind != TokenKind.EOF)
+            throw new ParseException("dc.ref.unexpected.input");
+        return name;
+    }
+
+    private List<JCTree> parseParams(String s) throws ParseException {
+        if (s.trim().isEmpty())
+            return List.nil();
+
+        JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false);
+        ListBuffer<JCTree> paramTypes = new ListBuffer<>();
+        paramTypes.add(p.parseType());
+
+        if (p.token().kind == TokenKind.IDENTIFIER)
+            p.nextToken();
+
+        while (p.token().kind == TokenKind.COMMA) {
+            p.nextToken();
+            paramTypes.add(p.parseType());
+
+            if (p.token().kind == TokenKind.IDENTIFIER)
+                p.nextToken();
+        }
+
+        if (p.token().kind != TokenKind.EOF)
+            throw new ParseException("dc.ref.unexpected.input");
+
+        return paramTypes.toList();
+    }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -35,13 +35,13 @@
 import com.sun.tools.javac.util.DiagnosticSource;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Position;
 
 import java.io.IOException;
 import java.io.StringWriter;
+import java.util.List;
 
+import javax.lang.model.element.Name;
 import javax.tools.JavaFileObject;
 
 /**
@@ -122,32 +122,32 @@
             this.tags = tags;
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.DOC_COMMENT;
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
             return v.visitDocComment(this, d);
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getFirstSentence() {
             return firstSentence;
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getFullBody() {
             return fullBody;
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBody() {
             return body;
         }
 
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public List<? extends DocTree> getBlockTags() {
             return tags;
         }
@@ -155,14 +155,14 @@
     }
 
     public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return getKind().tagName;
         }
     }
 
     public static abstract class DCInlineTag extends DCEndPosTree<DCInlineTag> implements InlineTagTree {
-        @DefinedBy(Api.COMPILER_TREE)
+        @Override @DefinedBy(Api.COMPILER_TREE)
         public String getTagName() {
             return getKind().tagName;
         }
@@ -343,6 +343,11 @@
             this.diag = diags.error(null, diagSource, this, code, args);
         }
 
+        DCErroneous(String body, JCDiagnostic diag) {
+            this.body = body;
+            this.diag = diag;
+        }
+
         @Override @DefinedBy(Api.COMPILER_TREE)
         public Kind getKind() {
             return Kind.ERRONEOUS;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -29,16 +29,26 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.EnumSet;
+import java.util.List;
 import java.util.ListIterator;
 
+import javax.lang.model.element.Name;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+
 import com.sun.source.doctree.AttributeTree.ValueKind;
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.DocTree.Kind;
 import com.sun.source.doctree.EndElementTree;
+import com.sun.source.doctree.IdentifierTree;
+import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.TextTree;
+import com.sun.source.util.DocTreeFactory;
 import com.sun.tools.doclint.HtmlTag;
 import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.parser.ParserFactory;
+import com.sun.tools.javac.parser.ReferenceParser;
 import com.sun.tools.javac.parser.Tokens.Comment;
 import com.sun.tools.javac.tree.DCTree.DCAttribute;
 import com.sun.tools.javac.tree.DCTree.DCAuthor;
@@ -70,12 +80,12 @@
 import com.sun.tools.javac.tree.DCTree.DCValue;
 import com.sun.tools.javac.tree.DCTree.DCVersion;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.DiagnosticSource;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
-import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Pair;
 import com.sun.tools.javac.util.Position;
 
@@ -88,7 +98,7 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class DocTreeMaker {
+public class DocTreeMaker implements DocTreeFactory {
 
     /** The context key for the tree factory. */
     protected static final Context.Key<DocTreeMaker> treeMakerKey = new Context.Key<>();
@@ -114,6 +124,9 @@
 
     private final JavacTrees trees;
 
+    /** Utility class to parse reference signatures. */
+    private final ReferenceParser referenceParser;
+
     /** Create a tree maker with NOPOS as initial position.
      */
     protected DocTreeMaker(Context context) {
@@ -121,11 +134,13 @@
         diags = JCDiagnostic.Factory.instance(context);
         this.pos = Position.NOPOS;
         trees = JavacTrees.instance(context);
+        referenceParser = new ReferenceParser(ParserFactory.instance(context));
         sentenceBreakTags = EnumSet.of(H1, H2, H3, H4, H5, H6, PRE, P);
     }
 
     /** Reassign current position.
      */
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DocTreeMaker at(int pos) {
         this.pos = pos;
         return this;
@@ -138,39 +153,44 @@
         return this;
     }
 
-    public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
-        DCAttribute tree = new DCAttribute(name, vkind, value);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCAttribute newAttributeTree(javax.lang.model.element.Name name, ValueKind vkind, java.util.List<? extends DocTree> value) {
+        DCAttribute tree = new DCAttribute(name, vkind, cast(value));
         tree.pos = pos;
         return tree;
     }
 
-    public DCAuthor Author(List<DCTree> name) {
-        DCAuthor tree = new DCAuthor(name);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCAuthor newAuthorTree(java.util.List<? extends DocTree> name) {
+        DCAuthor tree = new DCAuthor(cast(name));
         tree.pos = pos;
         return tree;
     }
 
-    public DCLiteral Code(DCText text) {
-        DCLiteral tree = new DCLiteral(Kind.CODE, text);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCLiteral newCodeTree(TextTree text) {
+        DCLiteral tree = new DCLiteral(Kind.CODE, (DCText) text);
         tree.pos = pos;
         return tree;
     }
 
-    public DCComment Comment(String text) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCComment newCommentTree(String text) {
         DCComment tree = new DCComment(text);
         tree.pos = pos;
         return tree;
     }
 
-    public DCDeprecated Deprecated(List<DCTree> text) {
-        DCDeprecated tree = new DCDeprecated(text);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCDeprecated newDeprecatedTree(List<? extends DocTree> text) {
+        DCDeprecated tree = new DCDeprecated(cast(text));
         tree.pos = pos;
         return tree;
     }
 
-    public DCDocComment DocComment(Comment comment, List<DCTree> fullBody, List<DCTree> tags) {
+    public DCDocComment newDocCommentTree(Comment comment, List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
         Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
-        DCDocComment tree = new DCDocComment(comment, fullBody, pair.fst, pair.snd, tags);
+        DCDocComment tree = new DCDocComment(comment, cast(fullBody), pair.fst, pair.snd, cast(tags));
         tree.pos = pos;
         return tree;
     }
@@ -180,172 +200,219 @@
      * first sentence and a body, this is useful, in cases
      * where the trees are being synthesized by a tool.
      */
-    public DCDocComment DocComment(List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCDocComment newDocCommentTree(List<? extends DocTree> firstSentence, List<? extends DocTree> body, List<? extends DocTree> tags) {
         ListBuffer<DCTree> lb = new ListBuffer<>();
-        lb.addAll(firstSentence);
-        lb.addAll(body);
+        lb.addAll(cast(firstSentence));
+        lb.addAll(cast(body));
         List<DCTree> fullBody = lb.toList();
-        DCDocComment tree = new DCDocComment(null, fullBody, firstSentence, body, tags);
+        DCDocComment tree = new DCDocComment(null, fullBody, cast(firstSentence), cast(body), cast(tags));
         return tree;
     }
 
-    public DCDocRoot DocRoot() {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCDocRoot newDocRootTree() {
         DCDocRoot tree = new DCDocRoot();
         tree.pos = pos;
         return tree;
     }
 
-    public DCEndElement EndElement(Name name) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCEndElement newEndElementTree(Name name) {
         DCEndElement tree = new DCEndElement(name);
         tree.pos = pos;
         return tree;
     }
 
-    public DCEntity Entity(Name name) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCEntity newEntityTree(Name name) {
         DCEntity tree = new DCEntity(name);
         tree.pos = pos;
         return tree;
     }
 
-    public DCErroneous Erroneous(String text, DiagnosticSource diagSource, String code, Object... args) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCErroneous newErroneousTree(String text, Diagnostic<JavaFileObject> diag) {
+        DCErroneous tree = new DCErroneous(text, (JCDiagnostic) diag);
+        tree.pos = pos;
+        return tree;
+    }
+
+    public DCErroneous newErroneousTree(String text, DiagnosticSource diagSource, String code, Object... args) {
         DCErroneous tree = new DCErroneous(text, diags, diagSource, code, args);
         tree.pos = pos;
         return tree;
     }
 
-    public DCThrows Exception(DCReference name, List<DCTree> description) {
-        DCThrows tree = new DCThrows(Kind.EXCEPTION, name, description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCThrows newExceptionTree(ReferenceTree name, List<? extends DocTree> description) {
+        // TODO: verify the reference is just to a type (not a field or method)
+        DCThrows tree = new DCThrows(Kind.EXCEPTION, (DCReference) name, cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCIdentifier Identifier(Name name) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCIdentifier newIdentifierTree(Name name) {
         DCIdentifier tree = new DCIdentifier(name);
         tree.pos = pos;
         return tree;
     }
 
-    public DCIndex Index(DCTree term, List<DCTree> description) {
-        DCIndex tree = new DCIndex(term, description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCIndex newIndexTree(DocTree term, List<? extends DocTree> description) {
+        DCIndex tree = new DCIndex((DCTree) term, cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCInheritDoc InheritDoc() {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCInheritDoc newInheritDocTree() {
         DCInheritDoc tree = new DCInheritDoc();
         tree.pos = pos;
         return tree;
     }
 
-    public DCLink Link(DCReference ref, List<DCTree> label) {
-        DCLink tree = new DCLink(Kind.LINK, ref, label);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCLink newLinkTree(ReferenceTree ref, List<? extends DocTree> label) {
+        DCLink tree = new DCLink(Kind.LINK, (DCReference) ref, cast(label));
         tree.pos = pos;
         return tree;
     }
 
-    public DCLink LinkPlain(DCReference ref, List<DCTree> label) {
-        DCLink tree = new DCLink(Kind.LINK_PLAIN, ref, label);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCLink newLinkPlainTree(ReferenceTree ref, List<? extends DocTree> label) {
+        DCLink tree = new DCLink(Kind.LINK_PLAIN, (DCReference) ref, cast(label));
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCLiteral newLiteralTree(TextTree text) {
+        DCLiteral tree = new DCLiteral(Kind.LITERAL, (DCText) text);
         tree.pos = pos;
         return tree;
     }
 
-    public DCLiteral Literal(DCText text) {
-        DCLiteral tree = new DCLiteral(Kind.LITERAL, text);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCParam newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description) {
+        DCParam tree = new DCParam(isTypeParameter, (DCIdentifier) name, cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCParam Param(boolean isTypeParameter, DCIdentifier name, List<DCTree> description) {
-        DCParam tree = new DCParam(isTypeParameter, name, description);
-        tree.pos = pos;
-        return tree;
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCReference newReferenceTree(String signature) {
+        try {
+            ReferenceParser.Reference ref = referenceParser.parse(signature);
+            DCReference tree = new DCReference(signature, ref.qualExpr, ref.member, ref.paramTypes);
+            tree.pos = pos;
+            return tree;
+        } catch (ReferenceParser.ParseException e) {
+            throw new IllegalArgumentException("invalid signature", e);
+        }
     }
 
-    public DCReference Reference(String signature,
-            JCTree qualExpr, Name member, List<JCTree> paramTypes) {
+    public DCReference newReferenceTree(String signature, JCTree qualExpr, Name member, List<JCTree> paramTypes) {
         DCReference tree = new DCReference(signature, qualExpr, member, paramTypes);
         tree.pos = pos;
         return tree;
     }
 
-    public DCReturn Return(List<DCTree> description) {
-        DCReturn tree = new DCReturn(description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCReturn newReturnTree(List<? extends DocTree> description) {
+        DCReturn tree = new DCReturn(cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCSee See(List<DCTree> reference) {
-        DCSee tree = new DCSee(reference);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSee newSeeTree(List<? extends DocTree> reference) {
+        DCSee tree = new DCSee(cast(reference));
         tree.pos = pos;
         return tree;
     }
 
-    public DCSerial Serial(List<DCTree> description) {
-        DCSerial tree = new DCSerial(description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSerial newSerialTree(List<? extends DocTree> description) {
+        DCSerial tree = new DCSerial(cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCSerialData SerialData(List<DCTree> description) {
-        DCSerialData tree = new DCSerialData(description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSerialData newSerialDataTree(List<? extends DocTree> description) {
+        DCSerialData tree = new DCSerialData(cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCSerialField SerialField(DCIdentifier name, DCReference type, List<DCTree> description) {
-        DCSerialField tree = new DCSerialField(name, type, description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSerialField newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) {
+        DCSerialField tree = new DCSerialField((DCIdentifier) name, (DCReference) type, cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCSince Since(List<DCTree> text) {
-        DCSince tree = new DCSince(text);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSince newSinceTree(List<? extends DocTree> text) {
+        DCSince tree = new DCSince(cast(text));
         tree.pos = pos;
         return tree;
     }
 
-    public DCStartElement StartElement(Name name, List<DCTree> attrs, boolean selfClosing) {
-        DCStartElement tree = new DCStartElement(name, attrs, selfClosing);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCStartElement newStartElementTree(Name name, List<? extends DocTree> attrs, boolean selfClosing) {
+        DCStartElement tree = new DCStartElement(name, cast(attrs), selfClosing);
         tree.pos = pos;
         return tree;
     }
 
-    public DCText Text(String text) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCText newTextTree(String text) {
         DCText tree = new DCText(text);
         tree.pos = pos;
         return tree;
     }
 
-    public DCThrows Throws(DCReference name, List<DCTree> description) {
-        DCThrows tree = new DCThrows(Kind.THROWS, name, description);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCThrows newThrowsTree(ReferenceTree name, List<? extends DocTree> description) {
+        // TODO: verify the reference is just to a type (not a field or method)
+        DCThrows tree = new DCThrows(Kind.THROWS, (DCReference) name, cast(description));
         tree.pos = pos;
         return tree;
     }
 
-    public DCUnknownBlockTag UnknownBlockTag(Name name, List<DCTree> content) {
-        DCUnknownBlockTag tree = new DCUnknownBlockTag(name, content);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCUnknownBlockTag newUnknownBlockTagTree(Name name, List<? extends DocTree> content) {
+        DCUnknownBlockTag tree = new DCUnknownBlockTag(name, cast(content));
         tree.pos = pos;
         return tree;
     }
 
-    public DCUnknownInlineTag UnknownInlineTag(Name name, List<DCTree> content) {
-        DCUnknownInlineTag tree = new DCUnknownInlineTag(name, content);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCUnknownInlineTag newUnknownInlineTagTree(Name name, List<? extends DocTree> content) {
+        DCUnknownInlineTag tree = new DCUnknownInlineTag(name, cast(content));
         tree.pos = pos;
         return tree;
     }
 
-    public DCValue Value(DCReference ref) {
-        DCValue tree = new DCValue(ref);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCValue newValueTree(ReferenceTree ref) {
+        // TODO: verify the reference is to a constant value
+        DCValue tree = new DCValue((DCReference) ref);
         tree.pos = pos;
         return tree;
     }
 
-    public DCVersion Version(List<DCTree> text) {
-        DCVersion tree = new DCVersion(text);
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCVersion newVersionTree(List<? extends DocTree> text) {
+        DCVersion tree = new DCVersion(cast(text));
         tree.pos = pos;
         return tree;
     }
 
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public java.util.List<DocTree> getFirstSentence(java.util.List<? extends DocTree> list) {
         Pair<List<DCTree>, List<DCTree>> pair = splitBody(list);
         return new ArrayList<>(pair.fst);
@@ -389,12 +456,12 @@
                         int sbreak = getSentenceBreak(s, peekedNext);
                         if (sbreak > 0) {
                             s = removeTrailingWhitespace(s.substring(0, sbreak));
-                            DCText text = this.at(spos).Text(s);
+                            DCText text = this.at(spos).newTextTree(s);
                             fs.add(text);
                             foundFirstSentence = true;
                             int nwPos = skipWhiteSpace(tt.getBody(), sbreak);
                             if (nwPos > 0) {
-                                DCText text2 = this.at(spos + nwPos).Text(tt.getBody().substring(nwPos));
+                                DCText text2 = this.at(spos + nwPos).newTextTree(tt.getBody().substring(nwPos));
                                 body.add(text2);
                             }
                             continue;
@@ -405,7 +472,7 @@
                             if (sbrk) {
                                 DocTree next = itr.next();
                                 s = removeTrailingWhitespace(s);
-                                DCText text = this.at(spos).Text(s);
+                                DCText text = this.at(spos).newTextTree(s);
                                 fs.add(text);
                                 body.add((DCTree) next);
                                 foundFirstSentence = true;
@@ -436,7 +503,7 @@
     /*
      * Computes the first sentence break, a simple dot-space algorithm.
      */
-    int defaultSentenceBreak(String s) {
+    private int defaultSentenceBreak(String s) {
         // scan for period followed by whitespace
         int period = -1;
         for (int i = 0; i < s.length(); i++) {
@@ -483,7 +550,7 @@
      * Therefore, we have to probe further to determine whether
      * there really is a sentence break or not at the end of this run of text.
      */
-    int getSentenceBreak(String s, DocTree dt) {
+    private int getSentenceBreak(String s, DocTree dt) {
         BreakIterator breakIterator = trees.getBreakIterator();
         if (breakIterator == null) {
             return defaultSentenceBreak(s);
@@ -533,11 +600,11 @@
         return -1; // indeterminate at this time
     }
 
-    boolean isSentenceBreak(javax.lang.model.element.Name tagName) {
+    private boolean isSentenceBreak(javax.lang.model.element.Name tagName) {
         return sentenceBreakTags.contains(get(tagName));
     }
 
-    boolean isSentenceBreak(DocTree dt, boolean isFirstDocTree) {
+    private boolean isSentenceBreak(DocTree dt, boolean isFirstDocTree) {
         switch (dt.getKind()) {
             case START_ELEMENT:
                     StartElementTree set = (StartElementTree)dt;
@@ -553,7 +620,7 @@
     /*
      * Returns the position of the the first non-white space
      */
-    int skipWhiteSpace(String s, int start) {
+    private int skipWhiteSpace(String s, int start) {
         for (int i = start; i < s.length(); i++) {
             char c = s.charAt(i);
             if (!Character.isWhitespace(c)) {
@@ -563,7 +630,7 @@
         return -1;
     }
 
-    String removeTrailingWhitespace(String s) {
+    private String removeTrailingWhitespace(String s) {
         for (int i = s.length() - 1 ; i >= 0 ; i--) {
             char ch = s.charAt(i);
             if (!Character.isWhitespace(ch)) {
@@ -572,4 +639,9 @@
         }
         return s;
     }
+
+    @SuppressWarnings("unchecked")
+    private List<DCTree> cast(List<? extends DocTree> list) {
+        return (List<DCTree>) list;
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Jan 26 09:11:58 2016 +0100
@@ -235,16 +235,16 @@
     }
 
     private boolean unique(TypeVar typevar) {
-        typevar = (TypeVar)typevar.stripMetadataIfNeeded();
+        typevar = (TypeVar) typevar.stripMetadata();
 
         int found = 0;
         for (Type t : whereClauses.get(WhereClauseKind.TYPEVAR).keySet()) {
-            if (t.toString().equals(typevar.toString())) {
+            if (t.stripMetadata().toString().equals(typevar.toString())) {
                 found++;
             }
         }
         if (found < 1)
-            throw new AssertionError("Missing type variable in where clause " + typevar);
+            throw new AssertionError("Missing type variable in where clause: " + typevar);
         return found == 1;
     }
     //where
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, 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
@@ -87,7 +87,7 @@
     }
 
     public static boolean extractBooleanOption(String opName, String s, boolean deflt) {
-       String str = extractStringOption(opName, s);
+        String str = extractStringOption(opName, s);
         return "true".equals(str) ? true
              : "false".equals(str) ? false
              : deflt;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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,10 +67,10 @@
         Log.debug("==========================================================");
 
         // Prepare sjavac object
-        boolean background = Util.extractBooleanOption("background", options.getServerConf(), true);
+        boolean useServer = options.getServerConf() != null;
         Sjavac sjavac;
         // Create an sjavac implementation to be used for compilation
-        if (background) {
+        if (useServer) {
             try {
                 sjavac = new SjavacClient(options);
             } catch (PortFileInaccessibleException e) {
@@ -83,7 +83,8 @@
 
         int rc = sjavac.compile(args, out, err);
 
-        if (!background)
+        // If sjavac is running in the foreground we should shut it down at this point
+        if (!useServer)
             sjavac.shutdown();
 
         return rc;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -310,8 +310,6 @@
             err = "Please specify output directory.";
         } else if (options.isJavaFilesAmongJavacArgs()) {
             err = "Sjavac does not handle explicit compilation of single .java files.";
-        } else if (options.getServerConf() == null) {
-            err = "No server configuration provided.";
         } else if (!options.getImplicitPolicy().equals("none")) {
             err = "The only allowed setting for sjavac is -implicit:none";
         } else if (options.getSources().isEmpty() && options.getStateDir() != null) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Tue Jan 26 09:11:58 2016 +0100
@@ -225,10 +225,10 @@
      * Wait for the port file to contain values that look valid.
      */
     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++) {
+        long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
+        while (true) {
             Log.debug("Looking for valid port file values...");
             lock();
             getValues();
@@ -237,12 +237,13 @@
                 Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
                 return;
             }
-            if (attempt >= MAX_ATTEMPTS) {
-                throw new IOException("No port file values materialized. Giving up after " +
-                                      (System.currentTimeMillis() - startTime) + " ms");
+            if (System.currentTimeMillis() > timeout) {
+                break;
             }
             Thread.sleep(MS_BETWEEN_ATTEMPTS);
         }
+        throw new IOException("No port file values materialized. Giving up after " +
+                                      (System.currentTimeMillis() - startTime) + " ms");
     }
 
     /**
@@ -282,4 +283,15 @@
     public String getFilename() {
         return filename;
     }
+
+    private long getServerStartupTimeoutSeconds() {
+        String str = System.getProperty("serverStartupTimeout");
+        if (str != null) {
+            try {
+                return Integer.parseInt(str);
+            } catch (NumberFormatException e) {
+            }
+        }
+        return 60;
+    }
 }
--- a/langtools/test/Makefile	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/Makefile	Tue Jan 26 09:11:58 2016 +0100
@@ -412,7 +412,15 @@
 	fi
 
 # Check to make sure these directories exist
-check-jck: $(JCK_HOME) $(PRODUCT_HOME)
+check-jck:
+	if [ ! -d '$(JCK_HOME)' ]; then \
+	    echo "JCK_HOME $(JCK_HOME) missing" ; \
+	    $(EXIT) 1 ; \
+	fi
+	if [ ! -d '$(PRODUCT_HOME)' ]; then \
+	    echo "PRODUCT_HOME $(PRODUCT_HOME) missing" ; \
+	    $(EXIT) 1 ; \
+	fi
 
 all-summary: FRC
 	@if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
--- a/langtools/test/jdk/jshell/ClassPathTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/ClassPathTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,8 @@
 /*
  * @test
  * @summary Tests for EvalState#addToClasspath
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ToolBox Compiler
  * @run testng ClassPathTest
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8144095
  * @summary Test Command Completion
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build ReplToolTesting TestingInputStream Compiler ToolBox
  * @run testng CommandCompletionTest
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,8 @@
  * @test
  * @bug 8141092
  * @summary Test Completion
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ToolBox Compiler
  * @run testng CompletionSuggestionTest
--- a/langtools/test/jdk/jshell/ErrorTranslationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/ErrorTranslationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,9 @@
 /*
  * @test
  * @summary Tests for shell error translation
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ExpectedDiagnostic ToolBox Compiler
  * @run testng ErrorTranslationTest
--- a/langtools/test/jdk/jshell/HistoryTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/HistoryTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,8 @@
 /*
  * @test
  * @summary Test Completion
+ * @modules jdk.jshell/jdk.internal.jshell.tool
+ *          jdk.internal.le/jdk.internal.jline.console.history
  * @build HistoryTest
  * @run testng HistoryTest
  */
--- a/langtools/test/jdk/jshell/ImportTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/ImportTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,8 @@
 /*
  * @test
  * @summary Test imports
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ToolBox ExpectedDiagnostic
  * @run testng ImportTest
--- a/langtools/test/jdk/jshell/KullaCompletenessStressTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/KullaCompletenessStressTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,7 @@
 /*
  * @test
  * @summary Test SourceCodeAnalysis
+ * @modules jdk.compiler/com.sun.tools.javac.api
  * @build KullaTesting TestingInputStream KullaCompletenessStressTest CompletenessStressTest
  * @run testng KullaCompletenessStressTest
  */
--- a/langtools/test/jdk/jshell/StartOptionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/StartOptionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,9 @@
 /*
  * @test
  * @summary Testing start-up options.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build Compiler ToolBox
  * @run testng StartOptionTest
--- a/langtools/test/jdk/jshell/StopExecutionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/StopExecutionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,7 @@
 /*
  * @test
  * @summary Test JShell#stop
+ * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream
  * @run testng StopExecutionTest
  */
--- a/langtools/test/jdk/jshell/T8146368/JShellToolTest8146368.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/T8146368/JShellToolTest8146368.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
  * @test
  * @bug 8146368
  * @summary Test Smashing Error when user language is Japanese
+ * @modules jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib /jdk/jshell
  * @build ReplToolTesting
  * @run testng/othervm -Duser.language=ja JShellToolTest8146368
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
  * @test
  * @bug 8081845
  * @summary Tests for /reload in JShell tool
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ToolBox Compiler
  * @run testng ToolReloadTest
--- a/langtools/test/lib/combo/TEST.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/lib/combo/TEST.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -1,4 +1,6 @@
 # This file identifies root(s) of the test-ng hierarchy.
 
+TestNG.dirs = .
 
-TestNG.dirs = .
+modules = \
+        jdk.compiler/com.sun.tools.javac.util
--- a/langtools/test/tools/all/RunCodingRules.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/all/RunCodingRules.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,6 +29,7 @@
  *          java.logging
  *          java.xml
  *          jdk.compiler/com.sun.tools.javac.resources
+ *          jdk.compiler/com.sun.tools.javac.util
  */
 
 
--- a/langtools/test/tools/javac/6410653/T6410653.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/6410653/T6410653.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,7 @@
  * @summary REGRESSION: javac crashes if -d or -s argument is a file
  * @author  Peter von der Ah\u00e9
  * @modules java.compiler
- *          jdk.compiler
+ *          jdk.compiler/com.sun.tools.javac.util
  */
 
 import java.lang.reflect.Field;
--- a/langtools/test/tools/javac/6567415/T6567415.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/6567415/T6567415.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,7 +26,7 @@
  * @bug 6567415
  * @summary Test to ensure javac does not go into an infinite loop, while
  *               reading a classfile of a specific length.
- * @modules jdk.compiler
+ * @modules jdk.compiler/com.sun.tools.javac.jvm
  * @compile -XDignore.symbol.file T6567415.java
  * @run main T6567415
  * @author ksrini
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/RichFormatterWithAnnotationsTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, 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 8144580
+ * @summary java.lang.AssertionError: Missing type variable in where clause: T
+ * @compile -Xlint:unchecked RichFormatterWithAnnotationsTest.java
+ */
+
+import java.lang.annotation.*;
+import java.util.*;
+
+public class RichFormatterWithAnnotationsTest {
+
+    @Target({ElementType.TYPE_USE})
+    @interface NonNull { }
+
+    public static <T> void test() {
+        final Collection<@NonNull T> c = new LinkedList<>();
+        final List<@NonNull String> l = new LinkedList<@NonNull String>((Collection<@NonNull String>) c) {
+            // empty
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8145987
+ * @summary Assertion failure when compiling stream with type annotation
+ * @compile/fail/ref=AnnotatedMethodSelectorTest.out -XDrawDiagnostics AnnotatedMethodSelectorTest.java
+ */
+
+
+class AnnotatedMethodSelectorTest {
+    @interface A {}
+    static public void main(String... args) {
+        java.util.@A() Arrays.stream(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest.out	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,2 @@
+AnnotatedMethodSelectorTest.java:12:19: compiler.err.annotation.type.not.applicable.to.type: AnnotatedMethodSelectorTest.A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest2.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8145987
+ * @summary Assertion failure when compiling stream with type annotation
+ * @compile/fail/ref=AnnotatedMethodSelectorTest2.out -XDrawDiagnostics AnnotatedMethodSelectorTest2.java
+ */
+
+class AnnotatedMethodSelectorTest2<T> {
+    @interface A {}
+    class Inner {}
+    static public void main(String... args) {
+        new AnnotatedMethodSelectorTest2<@A String>() {
+            java.util.@A List l;
+        }.hashCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest2.out	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,3 @@
+AnnotatedMethodSelectorTest2.java:12:42: compiler.err.annotation.type.not.applicable.to.type: AnnotatedMethodSelectorTest2.A
+AnnotatedMethodSelectorTest2.java:13:23: compiler.err.annotation.type.not.applicable.to.type: AnnotatedMethodSelectorTest2.A
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest3.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8145987
+ * @summary Assertion failure when compiling stream with type annotation
+ * @compile/fail/ref=AnnotatedMethodSelectorTest3.out -XDrawDiagnostics AnnotatedMethodSelectorTest3.java
+ */
+
+
+class AnnotatedMethodSelectorTest3 {
+    @interface A {}
+    static <T> AnnotatedMethodSelectorTest3 id() {
+        return null;
+    }
+    static public void main(String... args) {
+        AnnotatedMethodSelectorTest3.<@A String> id().id().id().id().id();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedMethodSelectorTest3.out	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,2 @@
+AnnotatedMethodSelectorTest3.java:15:39: compiler.err.annotation.type.not.applicable.to.type: AnnotatedMethodSelectorTest3.A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/boxing/IncrementBoxedAndAccess.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016, 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 8143388
+ * @summary Verify that boxed postfix operator works properly when referring to super class' field.
+ * @library /tools/lib
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class IncrementBoxedAndAccess {
+    public static void main(String... args) throws IOException {
+        new IncrementBoxedAndAccess().run();
+    }
+
+    void run() throws IOException {
+        ToolBox tb = new ToolBox();
+
+        Path expected = Paths.get("expected");
+        Files.createDirectories(expected);
+        tb.cleanDirectory(expected);
+        tb.new JavacTask()
+          .sources("package p1;" +
+                   "public class B {" +
+                   "    protected Integer i;" +
+                   "}",
+                   "package p2;" +
+                   "public class S extends p1.B {" +
+                   "    public void i() { i++; }" +
+                   "    private class I {" +
+                   "        void i() { i++; }" +
+                   "        private class II {" +
+                   "            void i() { i++; }" +
+                   "        }" +
+                   "    }" +
+                   "}")
+          .outdir(expected)
+          .run();
+
+        Path actual = Paths.get("actual");
+        Files.createDirectories(actual);
+        tb.cleanDirectory(actual);
+        tb.new JavacTask()
+          .sources("package p1;" +
+                   "public class B {" +
+                   "    protected Integer i;" +
+                   "}",
+                   "package p2;" +
+                   "public class S extends p1.B {" +
+                   "    public void i() { super.i++; }" +
+                   "    private class I {" +
+                   "        void i() { S.super.i++; }" +
+                   "        private class II {" +
+                   "            void i() { S.super.i++; }" +
+                   "        }" +
+                   "    }" +
+                   "}")
+          .outdir(actual)
+          .run();
+    }
+}
--- a/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042947
  * @summary Checking AnnotationDefault attribute.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build AnnotationDefaultTest TestBase TestResult InMemoryFileManager ToolBox AnnotationDefaultVerifier
  * @run main AnnotationDefaultTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042931
  * @summary Checking EnclosingMethod attribute of anonymous/local class.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build EnclosingMethodTest TestBase TestResult InMemoryFileManager ToolBox
  * @run main EnclosingMethodTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,12 +25,11 @@
  * @test
  * @summary Tests a line number table attribute for language constructions in different containers.
  * @bug 8040131
- *
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox TestBase InMemoryFileManager LineNumberTestBase Container TestCase
  * @run main LineNumberTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary local variable table attribute test.
  * @bug 8040097
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox LocalVariableTestBase TestBase InMemoryFileManager
  * @compile -g LocalVariableTableTest.java
  * @run main LocalVariableTableTest
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary local variable type table attribute test.
  * @bug 8040097
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox LocalVariableTestBase TestBase InMemoryFileManager
  * @compile -g LocalVariableTypeTableTest.java
  * @run main LocalVariableTypeTableTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for constructors.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build ConstructorTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ConstructorTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for enum.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build EnumTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver EnumTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for methods which throw exceptions.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build ExceptionTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ExceptionTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for fields.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build FieldTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver FieldTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for inner classes.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build InnerClassTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver InnerClassTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for method parameters.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build MethodParameterTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver MethodParameterTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8049238
  * @summary Checks Signature attribute for type bounds.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build MethodTypeBoundTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver MethodTypeBoundTest
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,10 +27,10 @@
  * @summary Checks Signature attribute for array return type of method.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules java.desktop
- *          jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build ReturnTypeTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ReturnTypeTest
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for anonymous class.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main AnonymousClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for inner class.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main InnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for local class.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main LocalClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for complex structure of nested classes and other types.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main MixTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for file compiled without debug information.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @compile -g:none NoSourceFileAttribute.java
  * @run main NoSourceFileAttribute
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for synthetic class.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main SyntheticClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary sourcefile attribute test for two type in one file.
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
  * @run main TopLevelClassesOneFileTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,7 +25,11 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for access method
-*           generated to access to private methods and fields.
+ *          generated to access to private methods and fields.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build AccessToPrivateInnerClassMembersTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,9 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for access method
  *          generated to access to private methods and fields.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build AccessToPrivateSiblingsTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for assert statement.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build AssertFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for bridge method generated for generic method.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build BridgeMethodForGenericMethodTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,10 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for bridge method
  *          generated for lambda expressions and method references.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build BridgeMethodsForLambdaTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for enum members.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build EnumTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,10 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for package-info.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for "this$0" field.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @library /tools/lib /tools/javac/lib ../lib
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @build ThisFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,9 @@
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
  *          Checks that the attribute is generated for bridge method.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,6 +26,9 @@
  * @bug 8044411
  * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute.
  *          Checks that the attribute is generated for bridge method.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411 8079060 8138612
  * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,9 @@
  * @test
  * @bug 8044411
  * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute.
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib /tools/javac/lib ../lib
  * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
  * @build TestCase ClassType TestAnnotationInfo
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042261
  * @summary Checking that deprecated attribute does not apply to classes of deprecated package.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build  ToolBox TestBase TestResult InMemoryFileManager
  * @run main DeprecatedPackageTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,10 +27,10 @@
  * @summary Checking what attribute is generated by annotation Deprecated
  *          or javadoc deprecated for field, method, class(inner/local), interface.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build ToolBox TestBase TestResult InMemoryFileManager
  * @run main DeprecatedTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner annotations in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerAnnotationsInInnerAnnotationTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner annotations in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerAnnotationsInInnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner annotations in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerAnnotationsInInnerEnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner annotations in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerAnnotationsInInnerInterfaceTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Test that inner classes have in its inner classes attribute enclosing classes and its immediate members.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesHierarchyTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251 8062373
  * @summary Testing InnerClasses_attribute of inner classes in anonymous class.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesInAnonymousClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner classes in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesInInnerAnnotationTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8034854 8042251
  * @summary Testing InnerClasses_attribute of inner classes in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesInInnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8034854 8042251
  * @summary Testing InnerClasses_attribute of inner classes in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesInInnerEnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner classes in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
  * @run main InnerClassesInInnerInterfaceTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Test that outer_class_info_index of local and anonymous class is zero.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerClassesIndexTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8034854 8042251
  * @summary Testing inner classes attributes.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerClassesTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner enums in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerEnumInInnerAnnotationTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner enums in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerEnumInInnerEnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner enums in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerEnumInInnerInterfaceTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner enums in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerEnumsInInnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner interfaces in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerInterfacesInInnerAnnotationTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @summary Testing InnerClasses_attribute of inner interfaces in inner class.
  * @author aeremeev
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerInterfacesInInnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner interfaces in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerInterfacesInInnerEnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Testing InnerClasses_attribute of inner interfaces in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
  * @run main InnerInterfacesInInnerInterfaceTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 8042251
  * @summary Test that there are no inner classes attributes in case of there are no inner classes.
  * @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- *          jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.classfile
  * @build TestBase InMemoryFileManager ToolBox
  * @run main NoInnerClassesTest
  */
--- a/langtools/test/tools/javac/failover/CheckAttributedTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/failover/CheckAttributedTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,10 @@
  *  temporarily workaround combo tests are causing time out in several platforms
  * @library ../lib
  * @modules java.desktop
+ *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.comp
+ *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
  * @build combo.ComboTestHelper
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8147493/T8147493a.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, 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 8147493
+ * @summary regression when type-checking unchecked method calls
+ * @compile T8147493a.java
+ */
+
+abstract class T8147493a {
+    interface One {}
+    interface Two<I extends One> { I get(); }
+    interface Three<T> {}
+    interface Four<T> {}
+
+    <E extends Two<?>, L extends Three<E>> Four<L> f(Class raw, E destination) {
+        return g(raw, destination.get());
+    }
+
+    abstract <I extends One, E extends Two<I>, L extends Three<E>> Four<L> g(
+            Class<L> labelClass, I destinationId);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8147493/T8147493b.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2016, 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 8147493
+ * @summary regression when type-checking unchecked method calls
+ * @compile T8147493b.java
+ */
+
+abstract class T8147493b {
+
+    abstract <A> A f(A t);
+    abstract <B> Class<B> g(Class<B> x, String y);
+    abstract <C> void h(C t);
+
+    void m(Class raw) {
+      h(g(raw, f(null)));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/8147546/T8147546a.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, 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 8147546
+  * @summary regression when type-checking generic calls inside nested declarations occurring in method context
+  * @compile T8147546a.java
+  */
+abstract class T8147546a {
+
+    interface I<O> { void t(O clazz); }
+    abstract <A> I<A> a(Class<A> clazz);
+    abstract <B> B b(Class<B> t);
+    abstract <C> C c(C a);
+
+    Object f(Iterable<Object> xs) {
+        return c(c(new Object() {
+            <T> void g(Class<T> clazz) {
+                a(clazz).t(b(clazz));
+            }
+        }));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/8147546/T8147546b.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, 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 8147546
+  * @summary regression when type-checking generic calls inside nested declarations occurring in method context
+  * @compile T8147546b.java
+  */
+abstract class T8147546b {
+
+    interface I<O> { void t(O clazz); }
+
+    abstract <B> B b(Class<B> t);
+    abstract <C> C c(C a);
+
+    abstract Object d(Runnable r);
+
+    Object f(Iterable<Object> xs) {
+        return c(d(
+                () -> {
+                    class Foo {
+                        <T> void g(Class<T> clazz, I<T> i) {
+                            i.t(b(clazz));
+                        }
+                    }
+                }));
+    }
+}
--- a/langtools/test/tools/javac/lexer/JavaLexerTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/lexer/JavaLexerTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -24,6 +24,8 @@
 /**
  * @test
  * @bug 8056897
+ * @modules jdk.compiler/com.sun.tools.javac.parser
+ *          jdk.compiler/com.sun.tools.javac.util
  * @summary Proper lexing of integer literals.
  */
 
@@ -78,4 +80,4 @@
             throw new AssertionError("Unexpected token text: " + actualText);
         }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,7 @@
  * @test
  * @bug 8072480
  * @summary Verify option clash between -release and -source is reported correctly.
+ * @modules jdk.compiler/com.sun.tools.javac.util
  */
 
 import java.io.ByteArrayOutputStream;
--- a/langtools/test/tools/javadoc/CompletionError.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javadoc/CompletionError.java	Tue Jan 26 09:11:58 2016 +0100
@@ -27,7 +27,7 @@
  * @summary Check that CompletionFailures for missing classes are not incorrectly passed to
  *          the javadoc API clients.
  * @library /tools/lib
- * @modules jdk.javadoc
+ * @modules jdk.javadoc com.sun.tools.javac.api
  * @run main CompletionError
  */
 
--- a/langtools/test/tools/javadoc/sampleapi/SampleApiTest.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javadoc/sampleapi/SampleApiTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -25,6 +25,11 @@
  * @test
  * @bug 8130880
  * @library lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.parser
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
  * @run main sampleapi.SampleApiDefaultRunner -o:out/src
  * @run main SampleApiTest
  */
--- a/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javadoc/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -163,7 +163,7 @@
             "1.6, 12/11/06",
             "1.7, 07/28/11",
             "1.8, 04/19/14",
-            "1.9, 06/03/16" };
+            "9,   06/03/16" };
 
         static int index = 0;
 
--- a/langtools/test/tools/javap/classfile/6888367/T6888367.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/javap/classfile/6888367/T6888367.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,6 +37,7 @@
  * @test
  * @bug 6888367
  * @summary classfile library parses signature attributes incorrectly
+ * @modules jdk.jdeps/com.sun.tools.classfile
  */
 
 /*
--- a/langtools/test/tools/sjavac/ClasspathDependencies.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/ClasspathDependencies.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -47,8 +47,6 @@
 
 public class ClasspathDependencies extends SjavacBase {
 
-    static final String server = "--server:portfile=testserver,background=false";
-
     public static void main(String... args) throws Exception {
 
         Path root = Paths.get(ClasspathDependencies.class.getSimpleName() + "Test");
@@ -64,7 +62,7 @@
         headline("Create a test dependency, Dep.class, and put it in the classpath dir");
         String depCode = "package dep; public class Dep { public void m1() {} }";
         toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
-        int rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep);
+        int rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
         check(rc == 0, "Compilation failed unexpectedly");
 
         ////////////////////////////////////////////////////////////////////////
@@ -73,7 +71,7 @@
                           "package pkg;" +
                           "import dep.Dep;" +
                           "public class C { Dep dep; public void m() { new Dep().m1(); } }");
-        rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
+        rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
         check(rc == 0, "Compilation failed unexpectedly");
         FileTime modTime1 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
 
@@ -82,12 +80,12 @@
         Thread.sleep(2000);
         depCode = depCode.replaceAll("}$", "private void m2() {} }");
         toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
-        rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep);
+        rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
         check(rc == 0, "Compilation failed unexpectedly");
 
         ////////////////////////////////////////////////////////////////////////
         headline("Make sure that this does not trigger recompilation of C.java");
-        rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
+        rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
         check(rc == 0, "Compilation failed unexpectedly");
         FileTime modTime2 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
         check(modTime1.equals(modTime2), "Recompilation erroneously triggered");
@@ -97,12 +95,12 @@
         Thread.sleep(2000);
         depCode = depCode.replace("m1()", "m1(String... arg)");
         toolbox.writeFile(srcDep.resolve("dep/Dep.java"), depCode);
-        rc = compile(server, "-d", classesDep, "--state-dir=" + classesDep, srcDep);
+        rc = compile("-d", classesDep, "--state-dir=" + classesDep, srcDep);
         check(rc == 0, "Compilation failed unexpectedly");
 
         ////////////////////////////////////////////////////////////////////////
         headline("Make sure that recompilation of C.java is triggered");
-        rc = compile(server, "-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
+        rc = compile("-d", classes, "--state-dir=" + classes, src, "-cp", classesDep);
         check(rc == 0, "Compilation failed unexpectedly");
         FileTime modTime3 = Files.getLastModifiedTime(classes.resolve("pkg/C.class"));
         check(modTime2.compareTo(modTime3) < 0, "Recompilation not triggered");
--- a/langtools/test/tools/sjavac/CompileCircularSources.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/CompileCircularSources.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -64,7 +64,6 @@
                 "-h", HEADERS.toString(),
                 "--state-dir=" + BIN,
                 "-j", "3",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state,
--- a/langtools/test/tools/sjavac/CompileExcludingDependency.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/CompileExcludingDependency.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -60,8 +60,7 @@
                 "-x", "alfa/omega/*",
                 "-sourcepath", GENSRC.toString(),
                 "-d", BIN.toString(),
-                "--state-dir=" + BIN,
-                SERVER_ARG);
+                "--state-dir=" + BIN);
 
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/CompileWithAtFile.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/CompileWithAtFile.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -62,7 +62,7 @@
         Files.createDirectory(BIN);
         Map<String,Long> previous_bin_state = collectState(BIN);
 
-        compile("@" + GENSRC + "/list.txt", "--server:portfile=testserver,background=false");
+        compile("@" + GENSRC + "/list.txt");
 
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -70,8 +70,7 @@
                 "-d", BIN.toString(),
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
-                "-j", "1",
-                SERVER_ARG);
+                "-j", "1");
 
         System.out.println("The first compile went well!");
         Map<String,Long> new_bin_state = collectState(BIN);
@@ -87,8 +86,7 @@
                              "-d", BIN.toString(),
                              "--state-dir=" + BIN,
                              "-h", HEADERS.toString(),
-                             "-j", "1",
-                             SERVER_ARG);
+                             "-j", "1");
 
         System.out.println("----- Compile without exluded beta failed, as expected! Good!");
     }
--- a/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -68,8 +68,7 @@
                 "-d", BIN.toString(),
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
-                "-j", "1",
-                SERVER_ARG);
+                "-j", "1");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
                                      BIN + "/alfa/omega/A.class",
@@ -84,8 +83,7 @@
                              "-d", BIN.toString(),
                              "--state-dir=" + BIN,
                              "-h", HEADERS.toString(),
-                             "-j", "1",
-                             SERVER_ARG);
+                             "-j", "1");
 
         System.out.println("----- Compile without exluded beta failed, as expected! Good!");
     }
--- a/langtools/test/tools/sjavac/HiddenFiles.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/HiddenFiles.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -58,7 +58,6 @@
         // This compilation should fail (return RC_FATAL) since A.java refers to B.java and B.java
         // is excluded.
         int rc = compile("-x", "pkg/B.java", SRC.toString(),
-                         "--server:portfile=testportfile,background=false",
                          "-d", BIN.toString(),
                          "--state-dir=" + STATE_DIR);
 
--- a/langtools/test/tools/sjavac/IgnoreSymbolFile.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IgnoreSymbolFile.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -55,17 +55,14 @@
 
         new File("classes").mkdirs();
 
-        String server = "--server:portfile=testserver,background=false";
-        int rc1 = compile(server,
-                          "-d", "classes",
+        int rc1 = compile("-d", "classes",
                           "--state-dir=classes",
                           "-Werror",
                           "src");
         if (rc1 == 0)
             error("compilation succeeded unexpectedly");
 
-        int rc2 = compile(server,
-                          "-d", "classes",
+        int rc2 = compile("-d", "classes",
                           "--state-dir=classes",
                           "-Werror",
                           "-XDignore.symbol.file=true",
--- a/langtools/test/tools/sjavac/IncCompInheritance.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompInheritance.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -52,8 +52,7 @@
         toolbox.writeFile(src.resolve("pkgc/C.java"), c);
 
         // Initial compile (should succeed)
-        String server = "--server:portfile=testserver,background=false";
-        int rc1 = compile(server, "-d", classes, "--state-dir=" + classes, src);
+        int rc1 = compile("-d", classes, "--state-dir=" + classes, src);
         if (rc1 != 0)
             throw new AssertionError("Compilation failed unexpectedly");
 
@@ -65,7 +64,7 @@
         // Incremental compile (C should now be recompiled even though it
         // depends on A only through inheritance via B).
         // Since A.m is removed, this should fail.
-        int rc2 = compile(server, "-d", classes, "--state-dir=" + classes, src);
+        int rc2 = compile("-d", classes, "--state-dir=" + classes, src);
         if (rc2 == 0)
             throw new AssertionError("Compilation succeeded unexpectedly");
     }
--- a/langtools/test/tools/sjavac/IncCompileChangeNative.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileChangeNative.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -76,7 +76,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyNewerFiles(previous_bin_state, new_bin_state,
@@ -106,7 +105,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyNewerFiles(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/IncCompileDropClasses.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileDropClasses.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -71,7 +71,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -62,7 +62,6 @@
                 "-d", BIN.toString(),
                 "--state-dir=" + BIN,
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> previous_bin_state = collectState(BIN);
 
@@ -77,7 +76,6 @@
                 "-d", BIN.toString(),
                 "--state-dir=" + BIN,
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
 
--- a/langtools/test/tools/sjavac/IncCompileNoChanges.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileNoChanges.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -69,7 +69,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyEqual(new_bin_state, previous_bin_state);
--- a/langtools/test/tools/sjavac/IncCompileUpdateNative.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileUpdateNative.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -76,7 +76,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyNewerFiles(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/IncCompileWithChanges.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncCompileWithChanges.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -81,7 +81,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
         Map<String,Long> new_bin_state = collectState(BIN);
 
--- a/langtools/test/tools/sjavac/IncludeExcludePatterns.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/IncludeExcludePatterns.java	Tue Jan 26 09:11:58 2016 +0100
@@ -125,7 +125,6 @@
         toolbox.cleanDirectory(BIN);
         toolbox.cleanDirectory(STATE_DIR);
         String args = filterArgs + " " + SRC
-                + " --server:portfile=testportfile,background=false"
                 + " -d " + BIN
                 + " --state-dir=" + STATE_DIR;
         int rc = compile((Object[]) args.split(" "));
--- a/langtools/test/tools/sjavac/NoState.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/NoState.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -49,7 +49,6 @@
         tb.writeFile(GENSRC.resolve("pkg/A.java"), "package pkg; class A {}");
         Files.createDirectory(BIN);
         compile("-d", BIN.toString(),
-                "--server:portfile=testserver,background=false",
                 GENSRC + "/pkg/A.java");
 
         // Make sure file was compiled
--- a/langtools/test/tools/sjavac/PackagePathMismatch.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/PackagePathMismatch.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -47,8 +47,7 @@
                           "package a.b.c; class Test { }");
 
         // Compile should fail since package a.b.c does not match path a/x/c.
-        int rc1 = compile("--server:portfile=testserver,background=false",
-                          "-d", classes,
+        int rc1 = compile("-d", classes,
                           "--state-dir=" + classes,
                           src);
         if (rc1 == 0)
--- a/langtools/test/tools/sjavac/ParallelCompilations.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/ParallelCompilations.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -61,7 +61,6 @@
             "-d", BIN.toString(),
             "--state-dir=" + BIN,
             "-j", "10",
-            SERVER_ARG,
             "--log=debug");
   }
 }
--- a/langtools/test/tools/sjavac/PermittedArtifact.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/PermittedArtifact.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -63,8 +63,7 @@
                 "--permit-artifact=" + BIN + "/alfa/omega/AA.class",
                 "-src", GENSRC.toString(),
                 "-d", BIN.toString(),
-                "--state-dir=" + BIN,
-                SERVER_ARG);
+                "--state-dir=" + BIN);
 
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
--- a/langtools/test/tools/sjavac/SJavacTester.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/SJavacTester.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -30,10 +30,6 @@
 
 public class SJavacTester {
 
-    static final String SERVER_ARG = "--server:"
-            + "portfile=testportfile,"
-            + "background=false";
-
     final ToolBox tb = new ToolBox();
     final Path TEST_ROOT = Paths.get(getClass().getSimpleName());
 
@@ -90,7 +86,6 @@
                 "--state-dir=" + BIN,
                 "-h", HEADERS.toString(),
                 "-j", "1",
-                SERVER_ARG,
                 "--log=debug");
     }
 
--- a/langtools/test/tools/sjavac/StateDir.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/langtools/test/tools/sjavac/StateDir.java	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,8 +59,7 @@
 
         compile("--state-dir=" + BAR,
                 "-src", GENSRC.toString(),
-                "-d", BIN.toString(),
-                SJavacTester.SERVER_ARG);
+                "-d", BIN.toString());
 
         Map<String,Long> new_bin_state = collectState(BIN);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
--- a/make/BuildStatic.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/BuildStatic.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -41,7 +41,7 @@
     $(SUPPORT_OUTPUTDIR)/modules_libs/$(module)/$(module).symbols)
 
 $(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
-	$(ECHO) $(LOG_INFO) "Generating global exported.symbols file"
+	$(call LogInfo, Generating global exported.symbols file)
 	$(MKDIR) -p $(@D)
 	$(CAT) $^ > $@
 
--- a/make/CompileJavaModules.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/CompileJavaModules.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -367,10 +367,6 @@
 
 ################################################################################
 
-jdk.hotspot.agent_SRC += \
-    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent \
-    $(HOTSPOT_TOPDIR)/agent/src/share/classes \
-    #
 jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
 jdk.hotspot.agent_COPY := .png sa.js .properties
 
@@ -381,9 +377,9 @@
   # These can't be handled by COPY to SetupJavaCompilation since they chop off
   # one directory level.
   $(eval $(call SetupCopyFiles, COPY_SA_IMAGES, \
-      SRC := $(HOTSPOT_TOPDIR)/agent/src/share/classes/images, \
+      SRC := $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/images, \
       DEST := $(JDK_OUTPUTDIR)/modules/$(MODULE), \
-      FILES := $(wildcard $(HOTSPOT_TOPDIR)/agent/src/share/classes/images/*/*/*.gif), \
+      FILES := $(wildcard $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/images/*/*/*.gif), \
   ))
   jdk.hotspot.agent: $(COPY_SA_IMAGES)
 endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/GenerateModuleDeps.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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 included from Main.gmk only.
+
+include $(SRC_ROOT)/make/common/JavaCompilation.gmk
+include $(SRC_ROOT)/make/common/SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation, BUILD_GENMODULESLIST, \
+    SETUP := BOOT_JAVAC, \
+    SRC := $(JDK_TOPDIR)/make/src/classes, \
+    INCLUDES := build/tools/module, \
+    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
+    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
+    DISABLE_SJAVAC := true, \
+))
+
+TOOL_GENMODULESLIST = $(JAVA_SMALL) \
+    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
+    build.tools.module.GenModulesList
+
+MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is used from make/common/Modules.gmk
+MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
+
+$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml $(BUILD_GENMODULESLIST)
+	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
+
+$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
+	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
+
+TARGETS += $(MODULE_DEPS_MAKEFILE)
+
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , GenerateModuleDeps.gmk))
+
+# Trigger generation of this file and restart make if it changed.
+-include $(MODULE_DEPS_MAKEFILE)
--- a/make/HotspotWrapper.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/HotspotWrapper.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -35,14 +35,18 @@
 
 default: all
 
-# Get all files except .hg in the hotspot directory.
-HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
+# Get all files in src, make or agent subdirs in hotspot directory and
+# filter out .hg. This skips the test directory.
+HOTSPOT_FILES := $(shell $(FIND) -L \
+    $(HOTSPOT_TOPDIR)/src $(HOTSPOT_TOPDIR)/make \
+    -name ".hg" -prune -o -print)
 
 # The old build creates hotspot output dir before calling hotspot and
 # not doing it breaks builds on msys.
 $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
 	@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
+	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
+	    LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
 	$(TOUCH) $@
 
 hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
--- a/make/Images.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/Images.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -248,38 +248,38 @@
   endif
 
   $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
   ifeq ($(OPENJDK_TARGET_OS), solaris)
     $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
     $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
   endif
 
   ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
     $(JRE_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
 
     $(JDK_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
   endif
 
@@ -333,7 +333,7 @@
 # Processing license files from source area to image area
 # These are modified to have the platform specific EOL chars.
 define process-doc-file
-	$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	LC_ALL=C $(SED) 's/$$//g' $< > $@
@@ -378,7 +378,7 @@
 
 # Param 1 - The file containing the MODULES list
 define prepare-info-file
-  $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+  $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
   $(MKDIR) -p $(@D)
   $(RM) $@
 endef
@@ -426,38 +426,30 @@
 # src.zip
 
 $(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(install-file)
 
 JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
 
 ################################################################################
 # /demo dir
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+  $(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
+      DEST := $(JDK_IMAGE_DIR)/demo, \
+      FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+          $(call DoubleDollar, $(call DoubleDollar, \
+          $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+          -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+  ))
 
-# The db demo contains an empty dir that needs to be copied. The other
-# directories will always trigger the rule for recompile since
-# _the.list_of_packages files are touched.
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
-  $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demos/image/%
-	if [ ! -d "$@" ]; then \
-	  $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
-	  $(MKDIR) -p $(@D); \
-	  if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
-	fi
-
-  # Find all files including directories
-  JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
-      $(patsubst $(SUPPORT_OUTPUTDIR)/demos/image/%, $(JDK_IMAGE_DIR)/demo/%, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-          ! \( -name "_the*" -o -name "javac_state" \) )))
-
-  JDK_TARGETS += $(JDK_DEMO_TARGETS)
+  JDK_TARGETS += $(JDK_COPY_DEMOS)
 endif
 
 ################################################################################
 # /sample dir
 
-$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
     SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
     DEST := $(JDK_IMAGE_DIR)/sample, \
     FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
--- a/make/Init.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/Init.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -226,8 +226,8 @@
   $(eval $(call ParseCompareBuild))
 
   ifeq ($(LOG_NOFILE), true)
-    # Disable log wrapper if LOG=[level,]nofile was given
-    override BUILD_LOG_WRAPPER :=
+    # Disable build log if LOG=[level,]nofile was given
+    override BUILD_LOG_PIPE :=
   endif
 
   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
@@ -277,10 +277,10 @@
         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 	  $(call RotateLogFiles)
 	  $(call PrepareFailureLogs)
-	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
+	  $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
           ifneq ($(SEQUENTIAL_TARGETS), )
             # Don't touch build output dir since we might be cleaning. That
-            # means no log wrapper.
+            # means no log pipe.
 	    ( cd $(TOPDIR) && \
 	        $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 	        $(SEQUENTIAL_TARGETS) )
@@ -289,11 +289,12 @@
 	    $(call StartGlobalTimer)
 	    $(call PrepareSmartJavac)
 	    ( cd $(TOPDIR) && \
-	        $(BUILD_LOG_WRAPPER) $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+	        $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 	            -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
-	            $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \
-	        ( exitcode=$$? && $(BUILD_LOG_WRAPPER) \
-	        $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \
+	            $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
+	        ( exitcode=$$? && \
+	        $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
+	            $(BUILD_LOG_PIPE) && \
 	        cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 	            HAS_SPEC=true on-failure ; \
 	        exit $$exitcode ) )
@@ -301,7 +302,7 @@
 	    $(call StopGlobalTimer)
 	    $(call ReportBuildTimes)
           endif
-	  $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
+	  $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
         endif
 
     on-failure:
--- a/make/InitSupport.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/InitSupport.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -155,7 +155,7 @@
     else ifeq ($$(LOG_LEVEL), debug)
       MAKE_LOG_FLAGS :=
     else ifeq ($$(LOG_LEVEL), trace)
-      MAKE_LOG_FLAGS := -d
+      MAKE_LOG_FLAGS :=
     else
       $$(info Error: LOG must be one of: warn, info, debug or trace.)
       $$(error Cannot continue)
@@ -235,11 +235,15 @@
           $$(foreach var, $$(all_confs), $$(info * $$(var)))
           $$(error Cannot continue)
         else
-          ifeq ($$(words $$(matching_confs)), 1)
-            $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
-          else
-            $$(info Building these configurations (matching CONF=$$(CONF)):)
-            $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+          # Don't repeat this output on make restarts caused by including
+          # generated files.
+          ifeq ($$(MAKE_RESTARTS),)
+            ifeq ($$(words $$(matching_confs)), 1)
+              $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
+            else
+              $$(info Building these configurations (matching CONF=$$(CONF)):)
+              $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+            endif
           endif
         endif
 
@@ -284,7 +288,7 @@
 
     $$(main_targets_file):
 	@( cd $$(topdir) && \
-	    $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
+	$$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
 	    -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
 	    LOG_LEVEL=$$(LOG_LEVEL) \
 	    create-main-targets-include )
@@ -313,7 +317,7 @@
   BUILD_LOG := $(OUTPUT_ROOT)/build.log
   BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
 
-  BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
+  BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2)
 
   # Sanity check the spec file, so it matches this source code
   define CheckSpecSanity
@@ -455,7 +459,7 @@
   endef
 
   define RotateLogFiles
-	$(RM) $(BUILD_LOG).old 2> /dev/null
+	$(RM) $(BUILD_LOG).old 2> /dev/null && \
 	$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
 	$(if $(findstring trace, $(LOG_LEVEL)), \
 	  $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
@@ -464,7 +468,7 @@
   endef
 
   define PrepareFailureLogs
-	$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null
+	$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
 	$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
   endef
 
@@ -483,8 +487,8 @@
   endef
 
   define StartGlobalTimer
-	$(RM) -r $(BUILDTIMESDIR) 2> /dev/null
-	$(MKDIR) -p $(BUILDTIMESDIR)
+	$(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
+	$(MKDIR) -p $(BUILDTIMESDIR) && \
 	$(call RecordStartTime,TOTAL)
   endef
 
@@ -495,13 +499,14 @@
   # Find all build_time_* files and print their contents in a list sorted
   # on the name of the sub repository.
   define ReportBuildTimes
-	$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
+	$(PRINTF) $(LOG_INFO) -- \
 	    "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
 	    "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
 	    "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
 	    "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
 	    $(XARGS) $(CAT) | $(SORT) -k 2`" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
+	    $(BUILD_LOG_PIPE)
   endef
 
 endif # HAS_SPEC
--- a/make/MacBundles.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/MacBundles.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -57,23 +57,23 @@
 
   # Copy empty directories (jre/lib/applet).
   $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
 
   $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/Main.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -42,6 +42,8 @@
 
 # Load the vital tools for all the makefiles.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
+# Explicitly generate module deps makefile data
+include $(SRC_ROOT)/make/GenerateModuleDeps.gmk
 include $(SRC_ROOT)/make/common/Modules.gmk
 
 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
@@ -78,7 +80,7 @@
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
 
 buildtools-jdk:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
+	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
 
 ALL_TARGETS += buildtools-langtools interim-langtools \
     interim-rmic interim-cldrconverter buildtools-jdk
@@ -218,7 +220,7 @@
 # used to track the exact sources used to build that image.
 source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
 $(SUPPORT_OUTPUTDIR)/source_tips: FRC
-	@$(MKDIR) -p $(@D)
+	$(call MakeDir, $(@D))
 	@$(RM) $@
 	@$(call GetSourceTips)
 
@@ -427,6 +429,10 @@
   # in javadoc.
   java.desktop-gensrc-jdk: java.base-gensrc
 
+  # The annotation processing for jdk.vm.ci needs java.base classes from the
+  # current JDK.
+  jdk.vm.ci-gensrc-hotspot: java.base-java 
+
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
 
@@ -656,7 +662,7 @@
 	  @$(ECHO) $(sort $(ALL_MODULES))
 
 create-main-targets-include:
-	  @$(ECHO) $(LOG_INFO) Generating main target list
+	  $(call LogInfo, Generating main target list)
 	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
 	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 
--- a/make/MainSupport.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/MainSupport.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -141,7 +141,6 @@
   else
     $2-$$($1_TARGET_SUFFIX):
   endif
-	$(ECHO) $(LOG_INFO) "Building $$@"
         ifeq ($$($1_USE_WRAPPER), true)
 	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
 	      -f ModuleWrapper.gmk \
--- a/make/StripBinaries.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/StripBinaries.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -40,8 +40,8 @@
 
 ifneq ($(STRIP), )
   define StripRecipe
-	$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(MKDIR) -p $(@D)
+	$(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
+	$(call MakeDir, $(@D))
 	$(CP) $< $@.tmp
 	$(CHMOD) u+w $@.tmp
 	$(STRIP) $(STRIPFLAGS) $@.tmp
--- a/make/common/IdlCompilation.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/IdlCompilation.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -56,10 +56,9 @@
     $4_OLDIMPLBASE_MSG:=with -oldImplBase
   endif
   $5 : $4
-	$(MKDIR) -p $3/$$($4_TMPDIR)
+	$$(call LogInfo, Compiling IDL $(patsubst $2/%,%,$4))
+	$$(call MakeDir, $$(@D))
 	$(RM) -rf $3/$$($4_TMPDIR)
-	$(MKDIR) -p $(dir $5)
-	$(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
 	$8 -td $3/$$($4_TMPDIR) \
 	    -i $2/org/omg/CORBA \
 	    -i $2/org/omg/PortableInterceptor \
--- a/make/common/JavaCompilation.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/JavaCompilation.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -246,13 +246,6 @@
 
   $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
 
-  # Create the corresponding smart javac wrapper command line.
-  $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
-      $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
-      $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \
-      $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
-      -src $$(call PathList, $$($1_SRC))
-
   # All files below META-INF are always copied.
   $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
   # Find all files to be copied from source to bin.
@@ -315,11 +308,32 @@
   ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
     # Using sjavac to compile.
 
+    # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
+    # match the absolute path, only the part inside each src dir. Instead -i and
+    # -x flags apply only to the next -src arg on the command line.
+    $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
+    $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
+    $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
+        $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
+        $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
+        $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
+        $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
+        $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
+        -src $$(s))
+
+    ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
+      $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
+      $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
+    else
+      $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
+    endif
+
+
     ifneq (,$$($1_HEADERS))
       $1_HEADERS_ARG := -h $$($1_HEADERS)
     endif
 
-    $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS) $$($1_FLAGS) \
+    $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
         $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
         $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
     $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps)
@@ -327,6 +341,9 @@
     $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
 	$(MKDIR) -p $$(@D) $$(dir $$($1_SJAVAC_PORTFILE))
 	$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+        ifneq ($$($1_SJAVAC_ARGS_FILE), )
+	  $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
+        endif
 	$(ECHO) Compiling $1
 	$(call LogFailures, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch.log, $$($1_SAFE_NAME), \
 	    $$($1_JVM) $$($1_SJAVAC) \
--- a/make/common/MakeBase.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/MakeBase.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -86,8 +86,7 @@
 
 # Record starting time for build of a sub repository.
 define RecordStartTime
-	$(MKDIR) -p $(BUILDTIMESDIR)
-	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)
+	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
 	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
 endef
 
@@ -233,6 +232,7 @@
   endef
 endif # HAS_FILE_FUNCTION
 
+################################################################################
 # The source tips can come from the Mercurial repository, or in the files
 # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
 # directory as the original $(HGDIR) directory.
@@ -264,12 +264,14 @@
 	$(PRINTF) "\n" >> $@
 endef
 
-# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+# Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
 define CreateHgTip
 	$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
 	$(ECHO) $1/$(HGTIP_FILENAME)
 endef
 
+################################################################################
+
 define SetupLogging
   ifeq ($$(LOG_LEVEL), trace)
     # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
@@ -368,9 +370,9 @@
 
 ################################################################################
 # Make directory without forking mkdir if not needed
+# 1: List of directories to create
 MakeDir = \
-    $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
-      $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
+    $(strip $(if $(wildcard $1), , $(shell $(MKDIR) -p $1)))
 
 ################################################################################
 # Assign a variable only if it is empty
@@ -418,7 +420,8 @@
   # Running mkdir and cp in the same shell speeds up copy intensive tasks in Cygwin
   # significantly.
   define install-file
-	$(MKDIR) -p '$(@D)' && $(CP) -fP '$<' '$@'
+	$(call MakeDir, $(@D))
+	$(CP) -fP '$<' '$@'
   endef
 endif
 
@@ -518,9 +521,9 @@
   # Param 1 - Dirs to find in
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
   define CacheFind
-    $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
+      $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
     $(shell $(FIND) $1 \( -type f -o -type l \) $2), \
-    $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
+        $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
   endef
 
 else
@@ -541,7 +544,7 @@
   # 3 : Variable to add targets to
   # 4 : Macro to call for copy operation
   $2: $1
-	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+	$$(call LogInfo, Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
 	$$($$(strip $4))
 
   $3 += $2
@@ -686,8 +689,10 @@
 # Param 2 - A compact but representative name to describe this command
 # Param 3 - Command to run
 LogFailures = \
-  ( ($(BASH) $(SRC_ROOT)/common/bin/logger.sh $1 $3 && $(RM) $1) || \
-  (exitcode=$(DOLLAR)$(DOLLAR)? && $(MV) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && exit $(DOLLAR)$(DOLLAR)exitcode) )
+  ( $3 > >($(TEE) $1) 2> >($(TEE) $1 >&2) || \
+      (exitcode=$(DOLLAR)$(DOLLAR)? && \
+      $(CP) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && \
+      exit $(DOLLAR)$(DOLLAR)exitcode) )
 
 ################################################################################
 # Find lib dir for module
--- a/make/common/Modules.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/Modules.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -26,9 +26,6 @@
 ifndef _MODULES_GMK
 _MODULES_GMK := 1
 
-include JavaCompilation.gmk
-include SetupJavaCompilers.gmk
-
 ################################################################################
 # Some platforms don't have the serviceability agent
 ifeq ($(INCLUDE_SA), false)
@@ -49,51 +46,26 @@
     #
 
 # Find all modules with java sources by looking in the source dirs
-# jdk.hotspot.agent currently doesn't comply with source dir policy.
 define FindJavaModules
   $(filter-out $(MODULES_FILTER), $(sort $(notdir \
       $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
       $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
           $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)) \
-          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))) \
-      jdk.hotspot.agent)
+          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
 endef
 
 # Find all modules with source for the target platform.
-# jdk.hotspot.agent currently doesn't comply with source dir policy.
 define FindAllModules
   $(sort $(filter-out $(MODULES_FILTER) closed demo sample, \
       $(notdir $(patsubst %/,%, $(dir \
       $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
       $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
-      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS)))))) \
-      jdk.hotspot.agent))
+      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS))))))))
 endef
 
 ################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
-    SETUP := BOOT_JAVAC, \
-    SRC := $(JDK_TOPDIR)/make/src/classes, \
-    INCLUDES := build/tools/module, \
-    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
-    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
-    DISABLE_SJAVAC := true))
-
-TOOL_GENMODULESLIST = $(JAVA_SMALL) \
-    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
-    build.tools.module.GenModulesList
-
-MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is generated in make/GenerateModuleDeps.gmk
 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
-
-$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
-    $(BUILD_GENMODULESLIST)
-	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
-
-$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
-	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
-
 -include $(MODULE_DEPS_MAKEFILE)
 
 # Param 1: Module to find deps for
--- a/make/common/NativeCompilation.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/NativeCompilation.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -261,18 +261,17 @@
           # The Visual Studio compiler lacks a feature for generating make dependencies, but by
           # setting -showIncludes, all included files are printed. These are filtered out and
           # parsed into make dependences.
-          # Keep as much as possible on one execution line for best performance on Windows
-	  $(RM) $$($1_$2_DEP).exitvalue ; \
-	  ($(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
+          # Keep as much as possible on one execution line for best performance on Windows.
+          # No need to save exit code from compilation since pipefail is always active on
+          # Windows.
+	  $(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
 	      $$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
-	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) || echo $$$$? > $$($1_$2_DEP).exitvalue ) \
-	      | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \
+	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) \
+	      | $(GREP) -v -e "^Note: including file:" \
 	          -e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \
-	      ( test -s $$($1_$2_DEP).exitvalue \
-	          && exit `$(CAT) $$($1_$2_DEP).exitvalue` || true ) ; \
-	  ($(ECHO) $$@: \\ ; \
-	      $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) \
-	      | $(SORT) -u > $$($1_$2_DEP) ; \
+	  $(ECHO) $$@: \\ > $$($1_$2_DEP) ; \
+	  $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_OBJ).log \
+	      | $(SORT) -u >> $$($1_$2_DEP) ; \
 	  $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
         endif
   endif
@@ -306,7 +305,6 @@
 #   RC_FLAGS flags for RC.
 #   MAPFILE mapfile
 #   REORDER reorder file
-#   DEBUG_SYMBOLS add debug symbols (if configured on)
 #   CC the compiler to use, default is $(CC)
 #   LD the linker to use, default is $(LD)
 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
@@ -539,25 +537,9 @@
     $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
   endif
 
-  ifeq ($(DEBUG_BINARIES), true)
-    $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
-    $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
-  endif
-  ifeq ($$($1_DEBUG_SYMBOLS), true)
-    ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
-      ifdef OPENJDK
-        # Always add debug symbols
-        $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
-        $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
-      else
-        # Programs don't get the debug symbols added in the old build. It's not clear if
-        # this is intentional.
-        ifeq ($$($1_PROGRAM),)
-          $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
-          $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
-        endif
-      endif
-    endif
+  ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
+    $1_EXTRA_CFLAGS += $(CFLAGS_DEBUG_SYMBOLS)
+    $1_EXTRA_CXXFLAGS += $(CXXFLAGS_DEBUG_SYMBOLS)
   endif
 
   ifneq (,$$($1_REORDER))
@@ -658,14 +640,14 @@
           $$($1_RES).vardeps)
 
       $$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))"
+		$$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET))))
 		$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
 		    $$($1_VERSIONINFO_RESOURCE)
                 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
 		$$($1_CC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
-		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0
-		($(ECHO) $$($1_RES): \\ \
-		&& $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP)
+		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || true ; \
+		$(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \
+		$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw >> $$($1_RES_DEP) ; \
 		$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS)
     endif
   endif
@@ -696,67 +678,67 @@
 
   # Need to make sure TARGET is first on list
   $1 := $$($1_TARGET)
-  ifeq ($$($1_STATIC_LIBRARY),)
-    ifeq ($$($1_DEBUG_SYMBOLS), true)
-      ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
-        ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
-          # The dependency on TARGET is needed on windows for debuginfo files
-          # to be rebuilt properly.
-          $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
+  
+  ifeq ($(COPY_DEBUG_SYMBOLS), true)
+    # Only copy debug symbols for dynamic libraries and programs.
+    ifeq ($$($1_STATIC_LIBRARY), )
+      ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
+        # The dependency on TARGET is needed on windows for debuginfo files
+        # to be rebuilt properly.
+        $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
 		$(CP) $$< $$@
-        endif
+      endif
 
-        # Generate debuginfo files.
-        ifeq ($(OPENJDK_TARGET_OS), windows)
-          $1_EXTRA_LDFLAGS += "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
-              "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
-              $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
-          # No separate command is needed for debuginfo on windows, instead
-          # touch target to make sure it has a later time stamp than the debug
-          # symbol files to avoid unnecessary relinking on rebuild.
-          $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
+      # Generate debuginfo files.
+      ifeq ($(OPENJDK_TARGET_OS), windows)
+        $1_EXTRA_LDFLAGS += "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
+            "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
+        $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
+            $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+        # No separate command is needed for debuginfo on windows, instead
+        # touch target to make sure it has a later time stamp than the debug
+        # symbol files to avoid unnecessary relinking on rebuild.
+        $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
 
-        else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
-          # Setup the command line creating debuginfo files, to be run after linking.
-          # It cannot be run separately since it updates the original target file
-          $1_CREATE_DEBUGINFO_CMDS := \
-              $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
-              $(CD) $$($1_OUTPUT_DIR) && \
-                  $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
+      else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
+        $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+        # Setup the command line creating debuginfo files, to be run after linking.
+        # It cannot be run separately since it updates the original target file
+        $1_CREATE_DEBUGINFO_CMDS := \
+            $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+            $(CD) $$($1_OUTPUT_DIR) && \
+                $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
 
-        else ifeq ($(OPENJDK_TARGET_OS), macosx)
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
-          # On Macosx, the debuginfo generation doesn't touch the linked binary, but
-          # to avoid always relinking, touch it anyway to force a later timestamp than
-          # the dSYM files.
-          $1_CREATE_DEBUGINFO_CMDS := \
-              $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
-              $(TOUCH) $$($1_TARGET)
-        endif # OPENJDK_TARGET_OS
+      else ifeq ($(OPENJDK_TARGET_OS), macosx)
+        $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
+        # On Macosx, the debuginfo generation doesn't touch the linked binary, but
+        # to avoid always relinking, touch it anyway to force a later timestamp than
+        # the dSYM files.
+        $1_CREATE_DEBUGINFO_CMDS := \
+            $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
+            $(TOUCH) $$($1_TARGET)
+      endif # OPENJDK_TARGET_OS
 
-        # This dependency dance ensures that debug info files get rebuilt
-        # properly if deleted.
-        $$($1_TARGET): $$($1_DEBUGINFO_FILES)
-        $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
+      # This dependency dance ensures that debug info files get rebuilt
+      # properly if deleted.
+      $$($1_TARGET): $$($1_DEBUGINFO_FILES)
+      $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
 
-        ifeq ($(ZIP_DEBUGINFO_FILES), true)
-          $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
+      ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+        $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
+        $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
 
-          # The dependency on TARGET is needed for debuginfo files
-          # to be rebuilt properly.
-          $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
+        # The dependency on TARGET is needed for debuginfo files
+        # to be rebuilt properly.
+        $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
 		$(CD) $$($1_OBJECT_DIR) \
-		&& $(ZIP) -q $$@ $$(notdir $$($1_DEBUGINFO_FILES))
+		&& $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
 
-        else
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
-        endif
-      endif # $(ENABLE_DEBUG_SYMBOLS)
-    endif # $1_DEBUG_SYMBOLS
-  endif # !STATIC_LIBRARY
+      else
+        $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
+      endif
+    endif # !STATIC_LIBRARY
+  endif # COPY_DEBUG_SYMBOLS
 
   ifeq ($$($1_STRIP_SYMBOLS), true)
     ifneq ($$($1_STRIP), )
@@ -801,7 +783,7 @@
                 endif
                 # Keep as much as possible on one execution line for best performance
                 # on Windows
-		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" ; \
+		$$(call LogInfo, Linking $$($1_BASENAME))
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		    $(LD_OUT_OPTION)$$@ \
@@ -820,7 +802,7 @@
 
     # Generating a static library, ie object file archive.
     $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE)
-	$(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)"
+	$$(call LogInfo, Archiving $$($1_STATIC_LIBRARY))
 	$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 	    $$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
 	        $$($1_RES))
@@ -842,7 +824,7 @@
 
     $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
         $$($1_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" ; \
+		$$(call LogInfo, Linking executable $$($1_BASENAME))
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		        $(EXE_OUT_OPTION)$$($1_TARGET) \
--- a/make/common/RMICompilation.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/RMICompilation.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -68,15 +68,15 @@
   $$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
 
   $$($1_DEP_FILE): $$($1_CLASS_FILES)
-	$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
-	$(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \
+	$$(call LogInfo, Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES))
+	$$(call MakeDir, $$($1_STUB_CLASSES_DIR))
 	$(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
 	    -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
 	if [ "x$$($1_ARGS2)" != "x" ]; then \
 	  $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \
 	  $(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
 	      -d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
-	fi;
+	fi; \
 	$(TOUCH) $$@
 
 
--- a/make/common/TestFilesCompilation.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/TestFilesCompilation.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -87,7 +87,7 @@
         CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \
         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
         OPTIMIZATION := LOW, \
-        DEBUG_SYMBOLS := true)) \
+    )) \
     $$(eval $1 += $$(BUILD_TEST_$$(name)) )  \
   )
 
--- a/make/common/TextFileProcessing.gmk	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/common/TextFileProcessing.gmk	Tue Jan 26 09:11:58 2016 +0100
@@ -35,12 +35,12 @@
 # param 4 = the target file name (possibly with a partial path)
 define SetupSingleTextFileForProcessing
   $(strip $3)/$(strip $4): $2 $$($1_VARDEPS_FILE)
-	$(ECHO) $(LOG_INFO) "Processing $(strip $4)"
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp'
-	$$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp'
-	$$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp'
-	$(RM) '$$@.includes.tmp'
+	$$(call LogInfo, Processing $(strip $4))
+	$$(call MakeDir, $$(@D))
+	$(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp' ; \
+	$$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp' ; \
+	$$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp' ; \
+	$(RM) '$$@.includes.tmp' ; \
 	$(MV) '$$@.replacements.tmp' '$$@'
 
   $1 += $(strip $3)/$(strip $4)
--- a/make/jprt.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/make/jprt.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -34,13 +34,8 @@
 # The current release name
 jprt.tools.default.release=jdk9
 
-# Check if this is the equivalent of a hotspot push job
-# Interpret -testset hotspot to mean exactly that
-my.is.hotspot.job.hotspot=true
-my.is.hotspot.job=${my.is.hotspot.job.${jprt.test.set}}
-
-# Disable syncing the source after builds and tests are done
-jprt.sync.push=${my.is.hotspot.job ? false : true}
+# Allow concurrent changes to be merged in prior to pushing
+jprt.sync.push=true
 
 # Directories to be excluded from the source bundles
 jprt.bundle.exclude.src.dirs=build dist webrev
@@ -48,6 +43,9 @@
 # Use configure when building
 jprt.build.use.configure=true
 
+# Disable the need for preinstalled Xcode
+jprt.macosx.jdk9.target.attribute.compilerXcode511.appliesTo.builds=none
+
 # Set up the run flavors (jvm variants)
 jprt.run.flavors=c1,c2,default,${my.additional.run.flavors}
 
@@ -104,7 +102,7 @@
     --with-output-sync=recurse						\
     --with-boot-jdk=$ALT_BOOTDIR					\
     --with-jobs=$ALT_PARALLEL_COMPILE_JOBS				\
-    --with-version-opt=$JPRT_JOB_ID				 	\
+    --with-version-opt=$JPRT_JOB_ID					\
     MAKE=$JPRT_MAKE                                                     \
     ${my.additional.build.configure.args.${jprt.test.set}}		\
     ${my.custom.build.configure.args}
@@ -162,21 +160,21 @@
 my.build.targets.default=						\
     solaris_sparcv9_5.11-{product|fastdebug},				\
     solaris_x64_5.11-{product|fastdebug},				\
-    linux_i586_2.6-{product|fastdebug},					\
-    linux_x64_2.6-{product|fastdebug},					\
+    linux_i586_3.8-{product|fastdebug},					\
+    linux_x64_3.8-{product|fastdebug},					\
     macosx_x64_10.9-{product|fastdebug},				\
-    windows_i586_6.2-{product|fastdebug},				\
-    windows_x64_6.2-{product|fastdebug}
+    windows_i586_6.3-{product|fastdebug},				\
+    windows_x64_6.3-{product|fastdebug}
 
 # Test target list (no fastdebug & limited c2 testing)
 my.test.target.set=							\
     solaris_sparcv9_5.11-product-c2-TESTNAME,				\
     solaris_x64_5.11-product-c2-TESTNAME,				\
-    linux_i586_2.6-product-{c1|c2}-TESTNAME,				\
-    linux_x64_2.6-product-c2-TESTNAME,					\
+    linux_i586_3.8-product-{c1|c2}-TESTNAME,				\
+    linux_x64_3.8-product-c2-TESTNAME,					\
     macosx_x64_10.9-product-c2-TESTNAME,				\
-    windows_i586_6.2-product-c1-TESTNAME,				\
-    windows_x64_6.2-product-c2-TESTNAME
+    windows_i586_6.3-product-c1-TESTNAME,				\
+    windows_x64_6.3-product-c2-TESTNAME
 
 # Default vm test targets (testset=default)
 my.test.targets.default=						\
@@ -260,8 +258,8 @@
 my.test.target.set.jck=							\
     solaris_sparcv9_5.11-product-c2-JCK7TESTRULE,			\
     solaris_x64_5.11-product-c2-JCK7TESTRULE,				\
-    linux_i586_2.6-product-c1-JCK7TESTRULE,				\
-    linux_x64_2.6-product-c2-JCK7TESTRULE
+    linux_i586_3.8-product-c1-JCK7TESTRULE,				\
+    linux_x64_3.8-product-c2-JCK7TESTRULE
 
 # JCK testset targets
 my.make.rule.test.targets.jck=						\
@@ -284,13 +282,13 @@
 my.build.targets.hotspot=						\
     solaris_sparcv9_5.11-{product|fastdebug},			\
     solaris_x64_5.11-{product|fastdebug},				\
-    linux_i586_2.6-{product|fastdebug},					\
-    linux_x64_2.6-{product|fastdebug},			\
+    linux_i586_3.8-{product|fastdebug},					\
+    linux_x64_3.8-{product|fastdebug},			\
     macosx_x64_10.9-{product|fastdebug},				\
-    windows_i586_6.2-{product|fastdebug},				\
-    windows_x64_6.2-{product|fastdebug},			\
+    windows_i586_6.3-{product|fastdebug},				\
+    windows_x64_6.3-{product|fastdebug},			\
     solaris_x64_5.11-{debugOpen},					\
-    linux_x64_2.6-{productOpen},					\
+    linux_x64_3.8-{productOpen},					\
     ${my.additional.build.targets.hotspot}
 
 # Tests to run on the various platforms for hotspot push jobs
@@ -317,27 +315,27 @@
     solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1
 
 my.test.targets.hotspot.linux.i586=					\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-jvm98,			\
-    linux_i586_2.6-{product|fastdebug}-c2-jvm98_nontiered,		\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-scimark,			\
-    linux_i586_2.6-product-c1-runThese8_Xcomp_lang,			\
-    linux_i586_2.6-product-c1-runThese8_Xcomp_vm,			\
-    linux_i586_2.6-fastdebug-c1-runThese8_Xshare,			\
-    linux_i586_2.6-fastdebug-c2-runThese8_Xcomp_lang,			\
-    linux_i586_2.6-fastdebug-c2-runThese8_Xcomp_vm,			\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
-    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_G1
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-jvm98,			\
+    linux_i586_3.8-{product|fastdebug}-c2-jvm98_nontiered,		\
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-scimark,			\
+    linux_i586_3.8-product-c1-runThese8_Xcomp_lang,			\
+    linux_i586_3.8-product-c1-runThese8_Xcomp_vm,			\
+    linux_i586_3.8-fastdebug-c1-runThese8_Xshare,			\
+    linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_lang,			\
+    linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm,			\
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
+    linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_G1
 
 my.test.targets.hotspot.linux.x64=					\
-    linux_x64_2.6-{product|fastdebug}-c2-jvm98,				\
-    linux_x64_2.6-{product|fastdebug}-c2-jvm98_nontiered,		\
-    linux_x64_2.6-{product|fastdebug}-c2-scimark,			\
-    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_SerialGC,		\
-    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
-    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_CMS,			\
-    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_G1
+    linux_x64_3.8-{product|fastdebug}-c2-jvm98,				\
+    linux_x64_3.8-{product|fastdebug}-c2-jvm98_nontiered,		\
+    linux_x64_3.8-{product|fastdebug}-c2-scimark,			\
+    linux_x64_3.8-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    linux_x64_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
+    linux_x64_3.8-{product|fastdebug}-c2-GCBasher_CMS,			\
+    linux_x64_3.8-{product|fastdebug}-c2-GCBasher_G1
 
 my.test.targets.hotspot.macosx.x64=					\
     macosx_x64_10.9-{product|fastdebug}-c2-jvm98,			\
@@ -349,34 +347,34 @@
     macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_G1
 
 my.test.targets.hotspot.windows.i586=					\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-jvm98,			\
-    windows_i586_6.2-{product|fastdebug}-c2-jvm98_nontiered,		\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-scimark,		\
-    windows_i586_6.2-product-{c1|c2}-runThese8,				\
-    windows_i586_6.2-product-{c1|c2}-runThese8_Xcomp_lang,		\
-    windows_i586_6.2-product-{c1|c2}-runThese8_Xcomp_vm,		\
-    windows_i586_6.2-fastdebug-c1-runThese8_Xshare,			\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
-    windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_G1
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-jvm98,			\
+    windows_i586_6.3-{product|fastdebug}-c2-jvm98_nontiered,		\
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-scimark,		\
+    windows_i586_6.3-product-{c1|c2}-runThese8,				\
+    windows_i586_6.3-product-{c1|c2}-runThese8_Xcomp_lang,		\
+    windows_i586_6.3-product-{c1|c2}-runThese8_Xcomp_vm,		\
+    windows_i586_6.3-fastdebug-c1-runThese8_Xshare,			\
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
+    windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_G1
 
 my.test.targets.hotspot.windows.x64=					\
-    windows_x64_6.2-{product|fastdebug}-c2-jvm98,			\
-    windows_x64_6.2-{product|fastdebug}-c2-jvm98_nontiered,		\
-    windows_x64_6.2-{product|fastdebug}-c2-scimark,			\
-    windows_x64_6.2-product-c2-runThese8,				\
-    windows_x64_6.2-product-c2-runThese8_Xcomp_lang,			\
-    windows_x64_6.2-product-c2-runThese8_Xcomp_vm,			\
-    windows_x64_6.2-{product|fastdebug}-c2-GCBasher_SerialGC,		\
-    windows_x64_6.2-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
-    windows_x64_6.2-{product|fastdebug}-c2-GCBasher_CMS,		\
-    windows_x64_6.2-{product|fastdebug}-c2-GCBasher_G1
+    windows_x64_6.3-{product|fastdebug}-c2-jvm98,			\
+    windows_x64_6.3-{product|fastdebug}-c2-jvm98_nontiered,		\
+    windows_x64_6.3-{product|fastdebug}-c2-scimark,			\
+    windows_x64_6.3-product-c2-runThese8,				\
+    windows_x64_6.3-product-c2-runThese8_Xcomp_lang,			\
+    windows_x64_6.3-product-c2-runThese8_Xcomp_vm,			\
+    windows_x64_6.3-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    windows_x64_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
+    windows_x64_6.3-{product|fastdebug}-c2-GCBasher_CMS,		\
+    windows_x64_6.3-{product|fastdebug}-c2-GCBasher_G1
 
 # Some basic "smoke" tests for OpenJDK builds
 my.test.targets.hotspot.open=						\
     solaris_x64_5.11-{productOpen|fastdebugOpen}-c2-jvm98,		\
-    linux_x64_2.6-{productOpen|fastdebugOpen}-c2-jvm98
+    linux_x64_3.8-{productOpen|fastdebugOpen}-c2-jvm98
 
 # The complete list of test targets for jprt
 my.test.targets.hotspot=						\
@@ -399,24 +397,24 @@
 # Make file based test targets
 
 my.make.rule.test.targets.hotspot.basicvmtests=                         \
-  linux_i586_2.6-*-default-hotspot_basicvmtest,                         \
-  linux_x64_2.6-*-default-hotspot_basicvmtest,                          \
+  linux_i586_3.8-*-default-hotspot_basicvmtest,                         \
+  linux_x64_3.8-*-default-hotspot_basicvmtest,                          \
   macosx_x64_10.9-*-default-hotspot_basicvmtest,                        \
   solaris_sparcv9_5.11-*-default-hotspot_basicvmtest,                   \
   solaris_x64_5.11-*-default-hotspot_basicvmtest,                       \
-  windows_i586_6.2-*-default-hotspot_basicvmtest,                       \
-  windows_x64_6.2-*-default-hotspot_basicvmtest
-  
+  windows_i586_6.3-*-default-hotspot_basicvmtest,                       \
+  windows_x64_6.3-*-default-hotspot_basicvmtest
+
 my.make.rule.test.targets.hotspot.reg.group=				\
   solaris_sparcv9_5.11-fastdebug-c2-GROUP,				\
   solaris_x64_5.11-fastdebug-c2-GROUP,					\
-  linux_i586_2.6-fastdebug-c2-GROUP,					\
-  linux_x64_2.6-fastdebug-c2-GROUP,					\
+  linux_i586_3.8-fastdebug-c2-GROUP,					\
+  linux_x64_3.8-fastdebug-c2-GROUP,					\
   macosx_x64_10.9-fastdebug-c2-GROUP,					\
-  windows_i586_6.2-fastdebug-c2-GROUP,					\
-  windows_x64_6.2-fastdebug-c2-GROUP,					\
-  linux_i586_2.6-fastdebug-c1-GROUP,					\
-  windows_i586_6.2-fastdebug-c1-GROUP
+  windows_i586_6.3-fastdebug-c2-GROUP,					\
+  windows_x64_6.3-fastdebug-c2-GROUP,					\
+  linux_i586_3.8-fastdebug-c1-GROUP,					\
+  windows_i586_6.3-fastdebug-c1-GROUP
 
 # Hotspot jtreg tests
 my.make.rule.test.targets.hotspot.reg=						\
--- a/modules.xml	Mon Jan 25 14:09:28 2016 -1000
+++ b/modules.xml	Tue Jan 26 09:11:58 2016 +0100
@@ -237,6 +237,7 @@
       <to>jdk.charsets</to>
       <to>jdk.management.resource</to>
       <to>jdk.scripting.nashorn</to>
+      <to>jdk.vm.ci</to>
     </export>
     <export>
       <name>jdk.internal.perf</name>
@@ -398,6 +399,7 @@
       <to>java.xml.crypto</to>
       <to>jdk.crypto.ec</to>
       <to>jdk.crypto.pkcs11</to>
+      <to>jdk.crypto.ucrypto</to>
       <to>jdk.naming.dns</to>
     </export>
     <export>
--- a/nashorn/.hgtags	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/.hgtags	Tue Jan 26 09:11:58 2016 +0100
@@ -335,3 +335,4 @@
 74ddd1339c57cf2c2a13e34e1760006c2e54d1fc jdk-9+99
 da397aea8adad7e6f743b60bfe0c415fc8508df5 jdk-9+100
 1916a2c680d8c33b59943dbb6dc2dd2000ec821a jdk-9+101
+e5620875888583d35e9492b62fe27e054df26049 jdk-9+102
--- a/nashorn/make/project.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/make/project.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -311,7 +311,7 @@
   -XX:+HeapDumpOnOutOfMemoryError
 
 # turn on assertions for tests
-run.test.jvmargs.main=${run.test.jvmargs.common} -esa -ea -da:java.lang.invoke.LambdaFormEditor
+run.test.jvmargs.main=${run.test.jvmargs.common} -esa -ea
 
 # Extra jvmargs that might be useful for debugging
 # and performance improvements/monitoring
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -83,6 +83,6 @@
 
 /**
  * Contains the linker for ordinary Java objects.
- * @since 1.9
+ * @since 9
  */
 package jdk.dynalink.beans;
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -111,6 +111,6 @@
  * implement the {@link jdk.dynalink.linker.GuardingTypeConverterFactory}
  * interface to provide the logic for these conversions.
  * </p>
- * @since 1.9
+ * @since 9
  */
 package jdk.dynalink.linker;
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -87,6 +87,6 @@
  * by providing basic implementations of some classes as well as various
  * utilities.
  * </p>
- * @since 1.9
+ * @since 9
  */
 package jdk.dynalink.linker.support;
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/support/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -85,6 +85,6 @@
  * <p>Contains classes that make using Dynalink more convenient by providing
  * basic implementations of some classes as well as various utilities.
  * </p>
- * @since 1.9
+ * @since 9
  */
 package jdk.dynalink.support;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayAccessTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>expression</em> [ <em>index</em> ]
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ArrayAccessTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ArrayLiteralTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,7 +30,7 @@
 /**
  * Represents ECMAScript array literal expression.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ArrayLiteralTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/AssignmentTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>variable</em> = <em>expression</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface AssignmentTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BinaryTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   <em>leftOperand</em> <em>operator</em> <em>rightOperand</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface BinaryTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BlockTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  *   { <em>statements</em> }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface BlockTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/BreakTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  *   break <em>label</em> ;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface BreakTree extends GotoTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CaseTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  *       <em>statements</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface CaseTree extends Tree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CatchTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *       <em>block</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface CatchTree extends Tree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompilationUnitTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,7 +31,7 @@
  * Represents the abstract syntax tree for compilation units (source
  * files)
  *
- * @since 1.9
+ * @since 9
  */
 public interface CompilationUnitTree extends Tree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/CompoundAssignmentTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   <em>variable</em> <em>operator</em> <em>expression</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface CompoundAssignmentTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalExpressionTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>condition</em> ? <em>trueExpression</em> : <em>falseExpression</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ConditionalExpressionTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ConditionalLoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * A mixin for conditional "loop" statements.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ConditionalLoopTree extends LoopTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ContinueTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   continue <em>label</em> ;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ContinueTree extends GotoTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DebuggerTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *     <em>debugger;</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface DebuggerTree extends StatementTree {
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Diagnostic.java	Tue Jan 26 09:11:58 2016 +0100
@@ -40,7 +40,7 @@
  * <p>Line terminator is as defined in ECMAScript specification which is one
  * of { &#92;u000A, &#92;u000B, &#92;u2028, &#92;u2029 }.
  *
- * @since 1.9
+ * @since 9
  */
 public interface Diagnostic {
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DiagnosticListener.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * Interface for receiving diagnostics from Nashorn parser.
  *
- * @since 1.9
+ * @since 9
  */
 @FunctionalInterface
 public interface DiagnosticListener {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  *   while ( <em>expression</em> );
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface DoWhileLoopTree extends ConditionalLoopTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/EmptyStatementTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,6 +33,6 @@
  *    ;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface EmptyStatementTree extends StatementTree {}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ErroneousTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * A tree node to stand in for a malformed expression.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ErroneousTree extends ExpressionTree {
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionStatementTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>expression</em> ;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ExpressionStatementTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExpressionTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,6 +29,6 @@
  * A tree node used as the base class for the different types of
  * expressions.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ExpressionTree extends Tree {}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *       <em>statement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ForInLoopTree extends LoopTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForLoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *       <em>statement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ForLoopTree extends ConditionalLoopTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionCallTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  *   this . <em>identifier</em> ( <em>arguments</em> )
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface FunctionCallTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  *      <em>body</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface FunctionDeclarationTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  *      <em>body</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface FunctionExpressionTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/GotoTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,7 +31,7 @@
  * type serves as a super interface for {@link BreakTree} and
  * {@link ContinueTree}.
  *
- * @since 1.9
+ * @since 9
  */
 public interface GotoTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IdentifierTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>name</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface IdentifierTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IfTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  *       <em>elseStatement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface IfTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/InstanceOfTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>expression</em> instanceof <em>type</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface InstanceOfTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LabeledStatementTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>label</em> : <em>statement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface LabeledStatementTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LineMap.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,7 +29,7 @@
  * Provides methods to convert between character positions and line numbers
  * for a compilation unit.
  *
- * @since 1.9
+ * @since 9
  */
 public interface LineMap {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LiteralTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   <em>value</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface LiteralTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/LoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * A mixin for "loop" statements.
  *
- * @since 1.9
+ * @since 9
  */
 public interface LoopTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/MemberSelectTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>expression</em> . <em>identifier</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface MemberSelectTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/NewTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -35,7 +35,7 @@
  *   new <em>identifier</em> ( <em>arguments</em> )
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface NewTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ObjectLiteralTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -30,7 +30,7 @@
 /**
  * Represents ECMAScript object literal expression.
  *
- * @since 1.9
+ * @since 9
  */
 public interface ObjectLiteralTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParenthesizedTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   ( <em>expression</em> )
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ParenthesizedTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,7 +36,7 @@
 /**
  * Represents nashorn ECMAScript parser instance.
  *
- * @since 1.9
+ * @since 9
  */
 public interface Parser {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/PropertyTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * To represent property setting in an object literal tree.
  *
- * @since 1.9
+ * @since 9
  */
 public interface PropertyTree extends Tree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -28,7 +28,7 @@
 /**
  * Represents regular expression literal in the source code.
  *
- * @since 1.9
+ * @since 9
  */
 public interface RegExpLiteralTree extends Tree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ReturnTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *   return <em>expression</em>;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ReturnTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/StatementTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -29,7 +29,7 @@
  * A tree node used as the base class for the different kinds of
  * statements.
  *
- * @since 1.9
+ * @since 9
  */
 public interface StatementTree extends Tree {
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -37,7 +37,7 @@
  *   }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface SwitchTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ThrowTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   throw <em>expression</em>;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ThrowTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,7 +31,7 @@
  * <p><b>WARNING:</b> This interface and its sub-interfaces are
  * subject to change as the ECMAScript  programming language evolves.
  *
- * @since 1.9
+ * @since 9
  */
 public interface Tree {
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java	Tue Jan 26 09:11:58 2016 +0100
@@ -51,7 +51,7 @@
  *            methods.  Use {@code Void} for visitors that do not need an
  *            additional parameter.
  *
- * @since 1.9
+ * @since 9
  */
 public interface TreeVisitor<R,P> {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TryTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -39,7 +39,7 @@
  *       <em>finallyBlock</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface TryTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnaryTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -36,7 +36,7 @@
  *   <em>expression</em> <em>operator</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface UnaryTree extends ExpressionTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  * {@linkplain TreeVisitor tree visitor} to indicate that the
  * visitor was created for a prior version of the language.
  *
- * @since 1.9
+ * @since 9
  */
 public class UnknownTreeException extends RuntimeException {
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/VariableTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,7 +33,7 @@
  *   <em>var</em> <em>name</em> <em>initializer</em> ;
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface VariableTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *     <em>statement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface WhileLoopTree extends ConditionalLoopTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WithTree.java	Tue Jan 26 09:11:58 2016 +0100
@@ -34,7 +34,7 @@
  *     <em>statement</em>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface WithTree extends StatementTree {
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/package-info.java	Tue Jan 26 09:11:58 2016 +0100
@@ -68,7 +68,7 @@
  * </code>
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 package jdk.nashorn.api.tree;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java	Tue Jan 26 09:11:58 2016 +0100
@@ -335,7 +335,7 @@
                 break;
             case SHR:
                 final long result = JSType.toUint32(lhs.getInt32() >>> rhs.getInt32());
-                return LiteralNode.newInstance(token, finish, JSType.isRepresentableAsInt(result) ? (int) result : (double) result);
+                return LiteralNode.newInstance(token, finish, JSType.toNarrowestNumber(result));
             case SAR:
                 return LiteralNode.newInstance(token, finish, lhs.getInt32() >> rhs.getInt32());
             case SHL:
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Tue Jan 26 09:11:58 2016 +0100
@@ -70,7 +70,6 @@
 import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
 import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData;
 import jdk.nashorn.internal.runtime.arrays.IntElements;
-import jdk.nashorn.internal.runtime.arrays.IntOrLongElements;
 import jdk.nashorn.internal.runtime.arrays.IteratorAction;
 import jdk.nashorn.internal.runtime.arrays.NumericElements;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
@@ -285,7 +284,7 @@
         final long newLen = NativeArray.validLength(newLenDesc.getValue());
 
         // Step 3e - note that we need to convert to int or double as long is not considered a JS number type anymore
-        newLenDesc.setValue(JSType.isRepresentableAsInt(newLen) ? Integer.valueOf((int) newLen) : Double.valueOf((double) newLen));
+        newLenDesc.setValue(JSType.toNarrowestNumber(newLen));
 
         // Step 3f
         // increasing array length - just need to set new length value (and attributes if any) and return
@@ -1043,7 +1042,7 @@
             if (bulkable(sobj) && sobj.getArray().length() + args.length <= JSType.MAX_UINT) {
                 final ArrayData newData = sobj.getArray().push(true, args);
                 sobj.setArray(newData);
-                return newData.length();
+                return JSType.toNarrowestNumber(newData.length());
             }
 
             long len = JSType.toUint32(sobj.getLength());
@@ -1052,7 +1051,7 @@
             }
             sobj.set("length", len, CALLSITE_STRICT);
 
-            return len;
+            return JSType.toNarrowestNumber(len);
         } catch (final ClassCastException | NullPointerException e) {
             throw typeError(Context.getGlobal(), e, "not.an.object", ScriptRuntime.safeToString(self));
         }
@@ -1471,7 +1470,7 @@
         final long newLength = len + items.length;
         sobj.set("length", newLength, CALLSITE_STRICT);
 
-        return newLength;
+        return JSType.toNarrowestNumber(newLength);
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Tue Jan 26 09:11:58 2016 +0100
@@ -791,6 +791,15 @@
         return Double.NaN;
     }
 
+    /**
+     * Convert a long to the narrowest JavaScript Number type. This returns either a
+     * {@link Integer} or {@link Double} depending on the magnitude of {@code l}.
+     * @param l a long value
+     * @return the value converted to Integer or Double
+     */
+    public static Number toNarrowestNumber(final long l) {
+        return isRepresentableAsInt(l) ? Integer.valueOf((int) l) : Double.valueOf((double) l);
+    }
 
     /**
      * JavaScript compliant conversion of Boolean to number
@@ -1727,21 +1736,6 @@
     }
 
     /**
-     * Returns the boxed version of a primitive class
-     * @param clazz the class
-     * @return the boxed type of clazz, or unchanged if not primitive
-     */
-    public static Class<?> getBoxedClass(final Class<?> clazz) {
-        if (clazz == int.class) {
-            return Integer.class;
-        } else if (clazz == double.class) {
-            return Double.class;
-        }
-        assert !clazz.isPrimitive();
-        return clazz;
-    }
-
-    /**
      * Create a method handle constant of the correct primitive type
      * for a constant object
      * @param o object
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java	Tue Jan 26 09:11:58 2016 +0100
@@ -54,7 +54,13 @@
      */
     PropertyListeners(final PropertyListeners listener) {
         if (listener != null && listener.listeners != null) {
-            this.listeners = new WeakHashMap<>(listener.listeners);
+            this.listeners = new WeakHashMap<>();
+            // We need to copy the nested weak sets in order to avoid concurrent modification issues, see JDK-8146274
+            synchronized (listener) {
+                for (final Map.Entry<Object, WeakPropertyMapSet> entry : listener.listeners.entrySet()) {
+                    this.listeners.put(entry.getKey(), new WeakPropertyMapSet(entry.getValue()));
+                }
+            }
         }
     }
 
@@ -228,7 +234,15 @@
 
     private static class WeakPropertyMapSet {
 
-        private final WeakHashMap<PropertyMap, Boolean> map = new WeakHashMap<>();
+        private final WeakHashMap<PropertyMap, Boolean> map;
+
+        WeakPropertyMapSet() {
+            this.map = new WeakHashMap<>();
+        }
+
+        WeakPropertyMapSet(final WeakPropertyMapSet set) {
+            this.map = new WeakHashMap<>(set.map);
+        }
 
         void add(final PropertyMap propertyMap) {
             map.put(propertyMap, Boolean.TRUE);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/AdaptationResult.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/AdaptationResult.java	Tue Jan 26 09:11:58 2016 +0100
@@ -55,11 +55,17 @@
     static final AdaptationResult SUCCESSFUL_RESULT = new AdaptationResult(Outcome.SUCCESS, "");
 
     private final Outcome outcome;
+    private final RuntimeException cause;
     private final String[] messageArgs;
 
+    AdaptationResult(final Outcome outcome, final RuntimeException cause, final String... messageArgs) {
+        this.outcome = outcome;
+        this.cause = cause;
+        this.messageArgs = messageArgs;
+    }
+
     AdaptationResult(final Outcome outcome, final String... messageArgs) {
-        this.outcome = outcome;
-        this.messageArgs = messageArgs;
+        this(outcome, null, messageArgs);
     }
 
     Outcome getOutcome() {
@@ -67,6 +73,6 @@
     }
 
     ECMAException typeError() {
-        return ECMAErrors.typeError("extend." + outcome, messageArgs);
+        return ECMAErrors.typeError(cause, "extend." + outcome, messageArgs);
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Tue Jan 26 09:11:58 2016 +0100
@@ -193,7 +193,7 @@
      * Create a call site and link it for Nashorn. This version of the method conforms to the invokedynamic bootstrap
      * method expected signature and is referenced from Nashorn generated bytecode as the bootstrap method for all
      * invokedynamic instructions.
-     * @param lookup MethodHandle lookup. Ignored as Nashorn only uses public lookup.
+     * @param lookup MethodHandle lookup.
      * @param opDesc Dynalink dynamic operation descriptor.
      * @param type   Method type.
      * @param flags  flags for call type, trace/profile etc.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Jan 26 09:11:58 2016 +0100
@@ -31,19 +31,21 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_VARARGS;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
 import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
 import static jdk.internal.org.objectweb.asm.Opcodes.ASTORE;
-import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
-import static jdk.internal.org.objectweb.asm.Opcodes.IFNONNULL;
-import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
-import static jdk.internal.org.objectweb.asm.Opcodes.ISTORE;
-import static jdk.internal.org.objectweb.asm.Opcodes.POP;
+import static jdk.internal.org.objectweb.asm.Opcodes.D2F;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.I2B;
+import static jdk.internal.org.objectweb.asm.Opcodes.I2S;
 import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.nashorn.internal.codegen.CompilerConstants.interfaceCallNoLookup;
+import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.linker.AdaptationResult.Outcome.ERROR_NO_ACCESSIBLE_CONSTRUCTOR;
 
+import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Constructor;
@@ -56,9 +58,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Handle;
@@ -67,8 +67,7 @@
 import jdk.internal.org.objectweb.asm.Type;
 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
 import jdk.nashorn.api.scripting.ScriptUtils;
-import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.linker.AdaptationResult.Outcome;
@@ -86,8 +85,7 @@
  * dispatched by name. A single JavaScript function will act as the implementation for all overloaded methods of the
  * same name. When methods on an adapter instance are invoked, the functions are invoked having the ScriptObject passed
  * in the instance constructor as their "this". Subsequent changes to the ScriptObject (reassignment or removal of its
- * functions) are not reflected in the adapter instance; the method implementations are bound to functions at
- * constructor invocation time.
+ * functions) will be reflected in the adapter instance as it is live dispatching to its members on every method invocation.
  * {@code java.lang.Object} methods {@code equals}, {@code hashCode}, and {@code toString} can also be overridden. The
  * only restriction is that since every JavaScript object already has a {@code toString} function through the
  * {@code Object.prototype}, the {@code toString} in the adapter is only overridden if the passed ScriptObject has a
@@ -104,7 +102,7 @@
  * strict or not.
  * </li>
  * <li>
- * If the adapter being generated can have class-level overrides, constructors taking same arguments as the superclass
+ * If the adapter being generated has class-level overrides, constructors taking same arguments as the superclass
  * constructors are created. These constructors simply delegate to the superclass constructor. They are simply used to
  * create instances of the adapter class, with no instance-level overrides, as they don't have them. If the original
  * class' constructor was variable arity, the adapter constructor will also be variable arity. Protected constructors
@@ -115,7 +113,7 @@
  * For adapter methods that return values, all the JavaScript-to-Java conversions supported by Nashorn will be in effect
  * to coerce the JavaScript function return value to the expected Java return type.
  * </p><p>
- * Since we are adding a trailing argument to the generated constructors in the adapter class, they will never be
+ * Since we are adding a trailing argument to the generated constructors in the adapter class with instance-level overrides, they will never be
  * declared as variable arity, even if the original constructor in the superclass was declared as variable arity. The
  * reason we are passing the additional argument at the end of the argument list instead at the front is that the
  * source-level script expression <code>new X(a, b) { ... }</code> (which is a proprietary syntax extension Nashorn uses
@@ -137,51 +135,67 @@
  * implemented securely.
  */
 final class JavaAdapterBytecodeGenerator {
-    private static final Type SCRIPTUTILS_TYPE = Type.getType(ScriptUtils.class);
-    private static final Type OBJECT_TYPE = Type.getType(Object.class);
-    private static final Type CLASS_TYPE  = Type.getType(Class.class);
-
-    static final String OBJECT_TYPE_NAME  = OBJECT_TYPE.getInternalName();
-    static final String SCRIPTUTILS_TYPE_NAME  = SCRIPTUTILS_TYPE.getInternalName();
-
-    static final String INIT = "<init>";
+    // Field names in adapters
+    private static final String GLOBAL_FIELD_NAME = "global";
+    private static final String DELEGATE_FIELD_NAME = "delegate";
+    private static final String IS_FUNCTION_FIELD_NAME = "isFunction";
+    private static final String CALL_THIS_FIELD_NAME = "callThis";
 
-    static final String GLOBAL_FIELD_NAME = "global";
+    // Initializer names
+    private static final String INIT = "<init>";
+    private static final String CLASS_INIT = "<clinit>";
 
-    // "global" is declared as Object instead of Global - avoid static references to internal Nashorn classes when possible.
-    static final String GLOBAL_TYPE_DESCRIPTOR = OBJECT_TYPE.getDescriptor();
-
-    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE);
-    static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
-
+    // Types often used in generated bytecode
+    private static final Type OBJECT_TYPE = Type.getType(Object.class);
     private static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class);
     private static final Type SCRIPT_FUNCTION_TYPE = Type.getType(ScriptFunction.class);
-    private static final Type STRING_TYPE = Type.getType(String.class);
-    private static final Type METHOD_TYPE_TYPE = Type.getType(MethodType.class);
-    private static final Type METHOD_HANDLE_TYPE = Type.getType(MethodHandle.class);
-    private static final String GET_HANDLE_OBJECT_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE);
-    private static final String GET_HANDLE_FUNCTION_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE);
-    private static final String GET_CLASS_INITIALIZER_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE);
-    private static final Type RUNTIME_EXCEPTION_TYPE = Type.getType(RuntimeException.class);
-    private static final Type THROWABLE_TYPE = Type.getType(Throwable.class);
-    private static final Type UNSUPPORTED_OPERATION_TYPE = Type.getType(UnsupportedOperationException.class);
+
+    // JavaAdapterServices methods used in generated bytecode
+    private static final Call CHECK_FUNCTION = lookupServiceMethod("checkFunction", ScriptFunction.class, Object.class, String.class);
+    private static final Call EXPORT_RETURN_VALUE = lookupServiceMethod("exportReturnValue", Object.class, Object.class);
+    private static final Call GET_CALL_THIS = lookupServiceMethod("getCallThis", Object.class, ScriptFunction.class, Object.class);
+    private static final Call GET_CLASS_OVERRIDES = lookupServiceMethod("getClassOverrides", ScriptObject.class);
+    private static final Call GET_NON_NULL_GLOBAL = lookupServiceMethod("getNonNullGlobal", ScriptObject.class);
+    private static final Call HAS_OWN_TO_STRING = lookupServiceMethod("hasOwnToString", boolean.class, ScriptObject.class);
+    private static final Call INVOKE_NO_PERMISSIONS = lookupServiceMethod("invokeNoPermissions", void.class, MethodHandle.class, Object.class);
+    private static final Call NOT_AN_OBJECT = lookupServiceMethod("notAnObject", void.class, Object.class);
+    private static final Call SET_GLOBAL = lookupServiceMethod("setGlobal", Runnable.class, ScriptObject.class);
+    private static final Call TO_CHAR_PRIMITIVE = lookupServiceMethod("toCharPrimitive", char.class, Object.class);
+    private static final Call UNSUPPORTED = lookupServiceMethod("unsupported", UnsupportedOperationException.class);
+    private static final Call WRAP_THROWABLE = lookupServiceMethod("wrapThrowable", RuntimeException.class, Throwable.class);
+
+    // Other methods invoked by the generated bytecode
+    private static final Call UNWRAP = staticCallNoLookup(ScriptUtils.class, "unwrap", Object.class, Object.class);
+    private static final Call CHAR_VALUE_OF = staticCallNoLookup(Character.class, "valueOf", Character.class, char.class);
+    private static final Call DOUBLE_VALUE_OF = staticCallNoLookup(Double.class, "valueOf", Double.class, double.class);
+    private static final Call LONG_VALUE_OF = staticCallNoLookup(Long.class, "valueOf", Long.class, long.class);
+    private static final Call RUN = interfaceCallNoLookup(Runnable.class, "run", void.class);
 
-    private static final String SERVICES_CLASS_TYPE_NAME = Type.getInternalName(JavaAdapterServices.class);
-    private static final String RUNTIME_EXCEPTION_TYPE_NAME = RUNTIME_EXCEPTION_TYPE.getInternalName();
-    private static final String ERROR_TYPE_NAME = Type.getInternalName(Error.class);
-    private static final String THROWABLE_TYPE_NAME = THROWABLE_TYPE.getInternalName();
-    private static final String UNSUPPORTED_OPERATION_TYPE_NAME = UNSUPPORTED_OPERATION_TYPE.getInternalName();
+    // ASM handle to the bootstrap method
+    private static final Handle BOOTSTRAP_HANDLE = new Handle(H_INVOKESTATIC,
+            Type.getInternalName(JavaAdapterServices.class), "bootstrap",
+            MethodType.methodType(CallSite.class, Lookup.class, String.class,
+                    MethodType.class, int.class).toMethodDescriptorString());
+
+    // ASM handle to the bootstrap method for array populator
+    private static final Handle CREATE_ARRAY_BOOTSTRAP_HANDLE = new Handle(H_INVOKESTATIC,
+            Type.getInternalName(JavaAdapterServices.class), "createArrayBootstrap",
+            MethodType.methodType(CallSite.class, Lookup.class, String.class,
+                    MethodType.class).toMethodDescriptorString());
 
-    private static final String METHOD_HANDLE_TYPE_DESCRIPTOR = METHOD_HANDLE_TYPE.getDescriptor();
-    private static final String GET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE);
-    private static final String GET_CLASS_METHOD_DESCRIPTOR = Type.getMethodDescriptor(CLASS_TYPE);
-    private static final String EXPORT_RETURN_VALUE_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE, OBJECT_TYPE);
-    private static final String UNWRAP_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE, OBJECT_TYPE);
-    private static final String GET_CONVERTER_METHOD_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE, CLASS_TYPE);
-    private static final String TO_CHAR_PRIMITIVE_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.CHAR_TYPE, OBJECT_TYPE);
-    private static final String TO_STRING_METHOD_DESCRIPTOR = Type.getMethodDescriptor(STRING_TYPE, OBJECT_TYPE);
+    // Field type names used in the generated bytecode
+    private static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
+    private static final String OBJECT_TYPE_DESCRIPTOR = OBJECT_TYPE.getDescriptor();
+    private static final String BOOLEAN_TYPE_DESCRIPTOR = Type.BOOLEAN_TYPE.getDescriptor();
+
+    // Throwable names used in the generated bytecode
+    private static final String RUNTIME_EXCEPTION_TYPE_NAME = Type.getInternalName(RuntimeException.class);
+    private static final String ERROR_TYPE_NAME = Type.getInternalName(Error.class);
+    private static final String THROWABLE_TYPE_NAME = Type.getInternalName(Throwable.class);
+
+    // Some more frequently used method descriptors
+    private static final String GET_METHOD_PROPERTY_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE, SCRIPT_OBJECT_TYPE);
+    private static final String VOID_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
 
     // Package used when the adapter can't be defined in the adaptee's package (either because it's sealed, or because
     // it's a java.* package.
@@ -191,11 +205,13 @@
     private static final String JAVA_PACKAGE_PREFIX = "java/";
     private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 255;
 
-    private static final String CLASS_INIT = "<clinit>";
-
     // Method name prefix for invoking super-methods
     static final String SUPER_PREFIX = "super$";
 
+    // Method name and type for the no-privilege finalizer delegate
+    private static final String FINALIZER_DELEGATE_NAME = "$$nashornFinalizerDelegate";
+    private static final String FINALIZER_DELEGATE_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE);
+
     /**
      * Collection of methods we never override: Object.clone(), Object.finalize().
      */
@@ -215,30 +231,13 @@
     private final String superClassName;
     // Binary name of the generated class.
     private final String generatedClassName;
-    private final Set<String> usedFieldNames = new HashSet<>();
     private final Set<String> abstractMethodNames = new HashSet<>();
     private final String samName;
     private final Set<MethodInfo> finalMethods = new HashSet<>(EXCLUDED);
     private final Set<MethodInfo> methodInfos = new HashSet<>();
-    private boolean autoConvertibleFromFunction = false;
+    private final boolean autoConvertibleFromFunction;
     private boolean hasExplicitFinalizer = false;
 
-    /**
-     * Names of static fields holding type converter method handles for return value conversion. We are emitting code
-     * for invoking these explicitly after the delegate handle is invoked, instead of doing an asType or
-     * filterReturnValue on the delegate handle, as that would create a new converter handle wrapping the function's
-     * handle for every instance of the adapter, causing the handle.invokeExact() call sites to become megamorphic.
-     */
-    private final Map<Class<?>, String> converterFields = new LinkedHashMap<>();
-
-    /**
-     * Subset of possible return types for all methods; namely, all possible return types of the SAM methods (we
-     * identify SAM types by having all of their abstract methods share a single name, so there can be multiple
-     * overloads with multiple return types. We use this set when emitting the constructor taking a ScriptFunction (the
-     * SAM initializer) to avoid populating converter fields that will never be used by SAM methods.
-     */
-    private final Set<Class<?>> samReturnTypes = new HashSet<>();
-
     private final ClassWriter cw;
 
     /**
@@ -271,17 +270,22 @@
         generatedClassName = getGeneratedClassName(superClass, interfaces);
 
         cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
-        generateGlobalFields();
+        generateField(GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+        generateField(DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
 
         gatherMethods(superClass);
         gatherMethods(interfaces);
-        samName = abstractMethodNames.size() == 1 ? abstractMethodNames.iterator().next() : null;
-        generateHandleFields();
-        generateConverterFields();
+        if (abstractMethodNames.size() == 1) {
+            samName = abstractMethodNames.iterator().next();
+            generateField(CALL_THIS_FIELD_NAME, OBJECT_TYPE_DESCRIPTOR);
+            generateField(IS_FUNCTION_FIELD_NAME, BOOLEAN_TYPE_DESCRIPTOR);
+        } else {
+            samName = null;
+        }
         if(classOverride) {
             generateClassInit();
         }
-        generateConstructors();
+        autoConvertibleFromFunction = generateConstructors();
         generateMethods();
         generateSuperMethods();
         if (hasExplicitFinalizer) {
@@ -291,9 +295,8 @@
         cw.visitEnd();
     }
 
-    private void generateGlobalFields() {
-        cw.visitField(ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0), GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR, null, null).visitEnd();
-        usedFieldNames.add(GLOBAL_FIELD_NAME);
+    private void generateField(final String name, final String fieldDesc) {
+        cw.visitField(ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0), name, fieldDesc, null, null).visitEnd();
     }
 
     JavaAdapterClassLoader createAdapterClassLoader() {
@@ -343,154 +346,84 @@
         return interfaceNames;
     }
 
-    private void generateHandleFields() {
-        final int flags = ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0);
-        for (final MethodInfo mi: methodInfos) {
-            cw.visitField(flags, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR, null, null).visitEnd();
+    private void generateClassInit() {
+        final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_STATIC, CLASS_INIT,
+                VOID_METHOD_DESCRIPTOR, null, null));
+
+        // Assign "global = Context.getGlobal()"
+        GET_NON_NULL_GLOBAL.invoke(mv);
+        mv.putstatic(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+
+        GET_CLASS_OVERRIDES.invoke(mv);
+        if(samName != null) {
+            // If the class is a SAM, allow having ScriptFunction passed as class overrides
+            mv.dup();
+            mv.instanceOf(SCRIPT_FUNCTION_TYPE);
+            mv.dup();
+            mv.putstatic(generatedClassName, IS_FUNCTION_FIELD_NAME, BOOLEAN_TYPE_DESCRIPTOR);
+            final Label notFunction = new Label();
+            mv.ifeq(notFunction);
+            mv.dup();
+            mv.checkcast(SCRIPT_FUNCTION_TYPE);
+            emitInitCallThis(mv);
+            mv.visitLabel(notFunction);
         }
+        mv.putstatic(generatedClassName, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+
+        endInitMethod(mv);
     }
 
-    private void generateConverterFields() {
-        final int flags = ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0);
-        for (final MethodInfo mi: methodInfos) {
-            final Class<?> returnType = mi.type.returnType();
-            // Handle primitive types, Object, and String specially
-            if(!returnType.isPrimitive() && returnType != Object.class && returnType != String.class) {
-                if(!converterFields.containsKey(returnType)) {
-                    final String name = nextName("convert");
-                    converterFields.put(returnType, name);
-                    if(mi.getName().equals(samName)) {
-                        samReturnTypes.add(returnType);
-                    }
-                    cw.visitField(flags, name, METHOD_HANDLE_TYPE_DESCRIPTOR, null, null).visitEnd();
-                }
-            }
+    /**
+     * Emit bytecode for initializing the "callThis" field.
+     */
+    private void emitInitCallThis(final InstructionAdapter mv) {
+        loadField(mv, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+        GET_CALL_THIS.invoke(mv);
+        if(classOverride) {
+            mv.putstatic(generatedClassName, CALL_THIS_FIELD_NAME, OBJECT_TYPE_DESCRIPTOR);
+        } else {
+            // It is presumed ALOAD 0 was already executed
+            mv.putfield(generatedClassName, CALL_THIS_FIELD_NAME, OBJECT_TYPE_DESCRIPTOR);
         }
     }
 
-    private void generateClassInit() {
-        final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_STATIC, CLASS_INIT,
-                Type.getMethodDescriptor(Type.VOID_TYPE), null, null));
-
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR, false);
-        final Label initGlobal;
-        if(samName != null) {
-            // If the class is a SAM, allow having a ScriptFunction passed as class overrides
-            final Label notAFunction = new Label();
-            mv.dup();
-            mv.instanceOf(SCRIPT_FUNCTION_TYPE);
-            mv.ifeq(notAFunction);
-            mv.checkcast(SCRIPT_FUNCTION_TYPE);
-
-            // Assign MethodHandle fields through invoking getHandle() for a ScriptFunction, only assigning the SAM
-            // method(s).
-            for (final MethodInfo mi : methodInfos) {
-                if(mi.getName().equals(samName)) {
-                    mv.dup();
-                    loadMethodTypeAndGetHandle(mv, mi, GET_HANDLE_FUNCTION_DESCRIPTOR);
-                } else {
-                    mv.visitInsn(ACONST_NULL);
-                }
-                mv.putstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
-            }
-            initGlobal = new Label();
-            mv.goTo(initGlobal);
-            mv.visitLabel(notAFunction);
-        } else {
-            initGlobal = null;
-        }
-        // Assign MethodHandle fields through invoking getHandle() for a ScriptObject
-        for (final MethodInfo mi : methodInfos) {
-            mv.dup();
-            mv.aconst(mi.getName());
-            loadMethodTypeAndGetHandle(mv, mi, GET_HANDLE_OBJECT_DESCRIPTOR);
-            mv.putstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
-        }
-
-        if(initGlobal != null) {
-            mv.visitLabel(initGlobal);
-        }
-        // Assign "global = Context.getGlobal()"
-        invokeGetGlobalWithNullCheck(mv);
-        mv.putstatic(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
-
-        generateConverterInit(mv, false);
-        endInitMethod(mv);
-    }
-
-    private void generateConverterInit(final InstructionAdapter mv, final boolean samOnly) {
-        assert !samOnly || !classOverride;
-        for(final Map.Entry<Class<?>, String> converterField: converterFields.entrySet()) {
-            final Class<?> returnType = converterField.getKey();
-            if(!classOverride) {
-                mv.visitVarInsn(ALOAD, 0);
-            }
-
-            if(samOnly && !samReturnTypes.contains(returnType)) {
-                mv.visitInsn(ACONST_NULL);
-            } else {
-                mv.aconst(Type.getType(converterField.getKey()));
-                mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getObjectConverter", GET_CONVERTER_METHOD_DESCRIPTOR, false);
-            }
-
-            if(classOverride) {
-                mv.putstatic(generatedClassName, converterField.getValue(), METHOD_HANDLE_TYPE_DESCRIPTOR);
-            } else {
-                mv.putfield(generatedClassName, converterField.getValue(), METHOD_HANDLE_TYPE_DESCRIPTOR);
-            }
-        }
-    }
-
-    private static void loadMethodTypeAndGetHandle(final InstructionAdapter mv, final MethodInfo mi, final String getHandleDescriptor) {
-        // NOTE: we're using generic() here because we'll be linking to the "generic" invoker version of
-        // the functions anyway, so we cut down on megamorphism in the invokeExact() calls in adapter
-        // bodies. Once we start linking to type-specializing invokers, this should be changed.
-        mv.aconst(Type.getMethodType(mi.type.generic().toMethodDescriptorString()));
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor, false);
-    }
-
-    private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) {
-        invokeGetGlobal(mv);
-        mv.dup();
-        mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context
-        mv.pop();
-    }
-
-    private void generateConstructors() throws AdaptationException {
+    private boolean generateConstructors() throws AdaptationException {
         boolean gotCtor = false;
+        boolean canBeAutoConverted = false;
         for (final Constructor<?> ctor: superClass.getDeclaredConstructors()) {
             final int modifier = ctor.getModifiers();
             if((modifier & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0 && !isCallerSensitive(ctor)) {
-                generateConstructors(ctor);
+                canBeAutoConverted = generateConstructors(ctor) | canBeAutoConverted;
                 gotCtor = true;
             }
         }
         if(!gotCtor) {
             throw new AdaptationException(ERROR_NO_ACCESSIBLE_CONSTRUCTOR, superClass.getCanonicalName());
         }
+        return canBeAutoConverted;
     }
 
-    private void generateConstructors(final Constructor<?> ctor) {
+    private boolean generateConstructors(final Constructor<?> ctor) {
         if(classOverride) {
             // Generate a constructor that just delegates to ctor. This is used with class-level overrides, when we want
             // to create instances without further per-instance overrides.
             generateDelegatingConstructor(ctor);
-        } else {
-            // Generate a constructor that delegates to ctor, but takes an additional ScriptObject parameter at the
-            // beginning of its parameter list.
-            generateOverridingConstructor(ctor, false);
+            return false;
+        }
+
+        // Generate a constructor that delegates to ctor, but takes an additional ScriptObject parameter at the
+        // beginning of its parameter list.
+        generateOverridingConstructor(ctor, false);
 
-            if (samName != null) {
-                if (!autoConvertibleFromFunction && ctor.getParameterTypes().length == 0) {
-                    // If the original type only has a single abstract method name, as well as a default ctor, then it can
-                    // be automatically converted from JS function.
-                    autoConvertibleFromFunction = true;
-                }
-                // If all our abstract methods have a single name, generate an additional constructor, one that takes a
-                // ScriptFunction as its first parameter and assigns it as the implementation for all abstract methods.
-                generateOverridingConstructor(ctor, true);
-            }
+        if (samName == null) {
+            return false;
         }
+        // If all our abstract methods have a single name, generate an additional constructor, one that takes a
+        // ScriptFunction as its first parameter and assigns it as the implementation for all abstract methods.
+        generateOverridingConstructor(ctor, true);
+        // If the original type only has a single abstract method name, as well as a default ctor, then it can
+        // be automatically converted from JS function.
+        return ctor.getParameterTypes().length == 0;
     }
 
     private void generateDelegatingConstructor(final Constructor<?> ctor) {
@@ -503,14 +436,7 @@
                 Type.getMethodDescriptor(originalCtorType.getReturnType(), argTypes), null, null));
 
         mv.visitCode();
-        // Invoke super constructor with the same arguments.
-        mv.visitVarInsn(ALOAD, 0);
-        int offset = 1; // First arg is at position 1, after this.
-        for (final Type argType: argTypes) {
-            mv.load(offset, argType);
-            offset += argType.getSize();
-        }
-        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false);
+        emitSuperConstructorCall(mv, originalCtorType.getDescriptor());
 
         endInitMethod(mv);
     }
@@ -548,80 +474,54 @@
         System.arraycopy(originalArgTypes, 0, newArgTypes, 0, argLen);
 
         // All constructors must be public, even if in the superclass they were protected.
-        // Existing super constructor <init>(this, args...) triggers generating <init>(this, args..., scriptObj).
+        // Existing super constructor <init>(this, args...) triggers generating <init>(this, args..., delegate).
         // Any variable arity constructors become fixed-arity with explicit array arguments.
         final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC, INIT,
                 Type.getMethodDescriptor(originalCtorType.getReturnType(), newArgTypes), null, null));
 
         mv.visitCode();
-        // First, invoke super constructor with original arguments. If the form of the constructor we're generating is
-        // <init>(this, args..., scriptFn), then we're invoking super.<init>(this, args...).
-        mv.visitVarInsn(ALOAD, 0);
-        final Class<?>[] argTypes = ctor.getParameterTypes();
-        int offset = 1; // First arg is at position 1, after this.
-        for (int i = 0; i < argLen; ++i) {
-            final Type argType = Type.getType(argTypes[i]);
-            mv.load(offset, argType);
-            offset += argType.getSize();
-        }
-        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false);
-
-        // Get a descriptor to the appropriate "JavaAdapterFactory.getHandle" method.
-        final String getHandleDescriptor = fromFunction ? GET_HANDLE_FUNCTION_DESCRIPTOR : GET_HANDLE_OBJECT_DESCRIPTOR;
-
-        // Assign MethodHandle fields through invoking getHandle()
-        for (final MethodInfo mi : methodInfos) {
-            mv.visitVarInsn(ALOAD, 0);
-            if (fromFunction && !mi.getName().equals(samName)) {
-                // Constructors initializing from a ScriptFunction only initialize methods with the SAM name.
-                // NOTE: if there's a concrete overloaded method sharing the SAM name, it'll be overridden too. This
-                // is a deliberate design choice. All other method handles are initialized to null.
-                mv.visitInsn(ACONST_NULL);
-            } else {
-                mv.visitVarInsn(ALOAD, offset);
-                if(!fromFunction) {
-                    mv.aconst(mi.getName());
-                }
-                loadMethodTypeAndGetHandle(mv, mi, getHandleDescriptor);
-            }
-            mv.putfield(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
-        }
+        // First, invoke super constructor with original arguments.
+        final int extraArgOffset = emitSuperConstructorCall(mv, originalCtorType.getDescriptor());
 
         // Assign "this.global = Context.getGlobal()"
         mv.visitVarInsn(ALOAD, 0);
-        invokeGetGlobalWithNullCheck(mv);
-        mv.putfield(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
+        GET_NON_NULL_GLOBAL.invoke(mv);
+        mv.putfield(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+
+        // Assign "this.delegate = delegate"
+        mv.visitVarInsn(ALOAD, 0);
+        mv.visitVarInsn(ALOAD, extraArgOffset);
+        mv.putfield(generatedClassName, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
 
-        // Initialize converters
-        generateConverterInit(mv, fromFunction);
+        if (fromFunction) {
+            // Assign "isFunction = true"
+            mv.visitVarInsn(ALOAD, 0);
+            mv.iconst(1);
+            mv.putfield(generatedClassName, IS_FUNCTION_FIELD_NAME, BOOLEAN_TYPE_DESCRIPTOR);
+
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitVarInsn(ALOAD, extraArgOffset);
+            emitInitCallThis(mv);
+        }
+
         endInitMethod(mv);
 
         if (! fromFunction) {
             newArgTypes[argLen] = OBJECT_TYPE;
             final InstructionAdapter mv2 = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC, INIT,
                     Type.getMethodDescriptor(originalCtorType.getReturnType(), newArgTypes), null, null));
-            generateOverridingConstructorWithObjectParam(mv2, ctor, originalCtorType.getDescriptor());
+            generateOverridingConstructorWithObjectParam(mv2, originalCtorType.getDescriptor());
         }
     }
 
     // Object additional param accepting constructor - generated to handle null and undefined value
     // for script adapters. This is effectively to throw TypeError on such script adapters. See
     // JavaAdapterServices.getHandle as well.
-    private void generateOverridingConstructorWithObjectParam(final InstructionAdapter mv, final Constructor<?> ctor, final String ctorDescriptor) {
+    private void generateOverridingConstructorWithObjectParam(final InstructionAdapter mv, final String ctorDescriptor) {
         mv.visitCode();
-        mv.visitVarInsn(ALOAD, 0);
-        final Class<?>[] argTypes = ctor.getParameterTypes();
-        int offset = 1; // First arg is at position 1, after this.
-        for (int i = 0; i < argTypes.length; ++i) {
-            final Type argType = Type.getType(argTypes[i]);
-            mv.load(offset, argType);
-            offset += argType.getSize();
-        }
-        mv.invokespecial(superClassName, INIT, ctorDescriptor, false);
-        mv.visitVarInsn(ALOAD, offset);
-        mv.visitInsn(ACONST_NULL);
-        mv.visitInsn(ACONST_NULL);
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR, false);
+        final int extraArgOffset = emitSuperConstructorCall(mv, ctorDescriptor);
+        mv.visitVarInsn(ALOAD, extraArgOffset);
+        NOT_AN_OBJECT.invoke(mv);
         endInitMethod(mv);
     }
 
@@ -635,14 +535,6 @@
         mv.visitEnd();
     }
 
-    private static void invokeGetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false);
-    }
-
-    private static void invokeSetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false);
-    }
-
     /**
      * Encapsulation of the information used to generate methods in the adapter classes. Basically, a wrapper around the
      * reflective Method object, a cached MethodType, and the name of the field in the adapter class that will hold the
@@ -652,7 +544,6 @@
     private static class MethodInfo {
         private final Method method;
         private final MethodType type;
-        private String methodHandleFieldName;
 
         private MethodInfo(final Class<?> clazz, final String name, final Class<?>... argTypes) throws NoSuchMethodException {
             this(clazz.getDeclaredMethod(name, argTypes));
@@ -681,21 +572,6 @@
         public int hashCode() {
             return getName().hashCode() ^ type.hashCode();
         }
-
-        void setIsCanonical(final JavaAdapterBytecodeGenerator self) {
-            methodHandleFieldName = self.nextName(getName());
-        }
-    }
-
-    private String nextName(final String name) {
-        int i = 0;
-        String nextName = name;
-        while (!usedFieldNames.add(nextName)) {
-            final String ordinal = String.valueOf(i++);
-            final int maxNameLen = 255 - ordinal.length();
-            nextName = (name.length() <= maxNameLen ? name : name.substring(0, maxNameLen)).concat(ordinal);
-        }
-        return nextName;
     }
 
     private void generateMethods() {
@@ -705,18 +581,25 @@
     }
 
     /**
-     * Generates a method in the adapter class that adapts a method from the original class. The generated methods will
-     * inspect the method handle field assigned to them. If it is null (the JS object doesn't provide an implementation
-     * for the method) then it will either invoke its version in the supertype, or if it is abstract, throw an
-     * {@link UnsupportedOperationException}. Otherwise, if the method handle field's value is not null, the handle is
-     * invoked using invokeExact (signature polymorphic invocation as per JLS 15.12.3). Before the invocation, the
-     * current Nashorn {@link Context} is checked, and if it is different than the global used to create the adapter
-     * instance, the creating global is set to be the current global. In this case, the previously current global is
-     * restored after the invocation. If invokeExact results in a Throwable that is not one of the method's declared
-     * exceptions, and is not an unchecked throwable, then it is wrapped into a {@link RuntimeException} and the runtime
-     * exception is thrown. The method handle retrieved from the field is guaranteed to exactly match the signature of
-     * the method; this is guaranteed by the way constructors of the adapter class obtain them using
-     * {@link #getHandle(Object, String, MethodType, boolean)}.
+     * Generates a method in the adapter class that adapts a method from the
+     * original class. The generated method will either invoke the delegate
+     * using a CALL dynamic operation call site (if it is a SAM method and the
+     * delegate is a ScriptFunction), or invoke GET_METHOD_PROPERTY dynamic
+     * operation with the method name as the argument and then invoke the
+     * returned ScriptFunction using the CALL dynamic operation. If
+     * GET_METHOD_PROPERTY returns null or undefined (that is, the JS object
+     * doesn't provide an implementation for the method) then the method will
+     * either do a super invocation to base class, or if the method is abstract,
+     * throw an {@link UnsupportedOperationException}. Finally, if
+     * GET_METHOD_PROPERTY returns something other than a ScriptFunction, null,
+     * or undefined, a TypeError is thrown. The current Global is checked before
+     * the dynamic operations, and if it is different  than the Global used to
+     * create the adapter, the creating Global is set to be the current Global.
+     * In this case, the previously current Global is restored after the
+     * invocation. If CALL results in a Throwable that is not one of the
+     * method's declared exceptions, and is not an unchecked throwable, then it
+     * is wrapped into a {@link RuntimeException} and the runtime exception is
+     * thrown.
      * @param mi the method info describing the method to be generated.
      */
     private void generateMethod(final MethodInfo mi) {
@@ -734,109 +617,158 @@
                 methodDesc, null, exceptionNames));
         mv.visitCode();
 
-        final Label handleDefined = new Label();
-
         final Class<?> returnType = type.returnType();
         final Type asmReturnType = Type.getType(returnType);
 
-        // See if we have overriding method handle defined
-        if(classOverride) {
-            mv.getstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
-        } else {
-            mv.visitVarInsn(ALOAD, 0);
-            mv.getfield(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
-        }
-        // stack: [handle]
-        mv.visitInsn(DUP);
-        mv.visitJumpInsn(IFNONNULL, handleDefined);
-
-        // No handle is available, fall back to default behavior
-        if(Modifier.isAbstract(method.getModifiers())) {
-            // If the super method is abstract, throw an exception
-            mv.anew(UNSUPPORTED_OPERATION_TYPE);
-            mv.dup();
-            mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR, false);
-            mv.athrow();
-        } else {
-            mv.visitInsn(POP);
-            // If the super method is not abstract, delegate to it.
-            emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc);
-        }
-
-        mv.visitLabel(handleDefined);
-        // Load the creatingGlobal object
-        if(classOverride) {
-            // If class handle is defined, load the static defining global
-            mv.getstatic(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
-        } else {
-            mv.visitVarInsn(ALOAD, 0);
-            mv.getfield(generatedClassName, GLOBAL_FIELD_NAME, GLOBAL_TYPE_DESCRIPTOR);
-        }
-        // stack: [creatingGlobal, handle]
-        final Label setupGlobal = new Label();
-        mv.visitLabel(setupGlobal);
-
         // Determine the first index for a local variable
         int nextLocalVar = 1; // "this" is at 0
         for(final Type t: asmArgTypes) {
             nextLocalVar += t.getSize();
         }
-        // Set our local variable indices
-        final int currentGlobalVar  = nextLocalVar++;
-        final int globalsDifferVar  = nextLocalVar++;
+        // Set our local variable index
+        final int globalRestoringRunnableVar = nextLocalVar++;
+
+        // Load the creatingGlobal object
+        loadField(mv, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+
+        // stack: [creatingGlobal]
+        SET_GLOBAL.invoke(mv);
+        // stack: [runnable]
+        mv.visitVarInsn(ASTORE, globalRestoringRunnableVar);
+        // stack: []
+
+        final Label tryBlockStart = new Label();
+        mv.visitLabel(tryBlockStart);
 
-        mv.dup();
-        // stack: [creatingGlobal, creatingGlobal, handle]
+        final Label callCallee = new Label();
+        final Label defaultBehavior = new Label();
+        // If this is a SAM type...
+        if (samName != null) {
+            // ...every method will be checking whether we're initialized with a
+            // function.
+            loadField(mv, IS_FUNCTION_FIELD_NAME, BOOLEAN_TYPE_DESCRIPTOR);
+            // stack: [isFunction]
+            if (name.equals(samName)) {
+                final Label notFunction = new Label();
+                mv.ifeq(notFunction);
+                // stack: []
+                // If it's a SAM method, it'll load delegate as the "callee" and
+                // "callThis" as "this" for the call if delegate is a function.
+                loadField(mv, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+                // NOTE: if we added "mv.checkcast(SCRIPT_FUNCTION_TYPE);" here
+                // we could emit the invokedynamic CALL instruction with signature
+                // (ScriptFunction, Object, ...) instead of (Object, Object, ...).
+                // We could combine this with an optimization in
+                // ScriptFunction.findCallMethod where it could link a call with a
+                // thinner guard when the call site statically guarantees that the
+                // callee argument is a ScriptFunction. Additionally, we could use
+                // a "ScriptFunction function" field in generated classes instead
+                // of a "boolean isFunction" field to avoid the checkcast.
+                loadField(mv, CALL_THIS_FIELD_NAME, OBJECT_TYPE_DESCRIPTOR);
+                // stack: [callThis, delegate]
+                mv.goTo(callCallee);
+                mv.visitLabel(notFunction);
+            } else {
+                // If it's not a SAM method, and the delegate is a function,
+                // it'll fall back to default behavior
+                mv.ifne(defaultBehavior);
+                // stack: []
+            }
+        }
 
-        // Emit code for switching to the creating global
-        // Global currentGlobal = Context.getGlobal();
-        invokeGetGlobal(mv);
-        mv.dup();
+        // At this point, this is either not a SAM method or the delegate is
+        // not a ScriptFunction. We need to emit a GET_METHOD_PROPERTY Nashorn
+        // invokedynamic.
 
-        mv.visitVarInsn(ASTORE, currentGlobalVar);
-        // stack: [currentGlobal, creatingGlobal, creatingGlobal, handle]
-        // if(definingGlobal == currentGlobal) {
-        final Label globalsDiffer = new Label();
-        mv.ifacmpne(globalsDiffer);
-        // stack: [creatingGlobal, handle]
-        //     globalsDiffer = false
-        mv.pop();
-        // stack: [handle]
-        mv.iconst(0); // false
-        // stack: [false, handle]
-        final Label invokeHandle = new Label();
-        mv.goTo(invokeHandle);
-        mv.visitLabel(globalsDiffer);
-        // } else {
-        //     Context.setGlobal(definingGlobal);
-        // stack: [creatingGlobal, handle]
-        invokeSetGlobal(mv);
-        // stack: [handle]
-        //     globalsDiffer = true
-        mv.iconst(1);
-        // stack: [true, handle]
+        if(name.equals("toString")) {
+            // Since every JS Object has a toString, we only override
+            // "String toString()" it if it's explicitly specified on the object.
+            loadField(mv, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+            // stack: [delegate]
+            HAS_OWN_TO_STRING.invoke(mv);
+            // stack: [hasOwnToString]
+            mv.ifeq(defaultBehavior);
+        }
+
+        loadField(mv, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+        mv.dup();
+        // stack: [delegate, delegate]
+        final String encodedName = NameCodec.encode(name);
+        mv.visitInvokeDynamicInsn(encodedName,
+                GET_METHOD_PROPERTY_METHOD_DESCRIPTOR, BOOTSTRAP_HANDLE,
+                NashornCallSiteDescriptor.GET_METHOD_PROPERTY);
+        // stack: [callee, delegate]
+        mv.visitLdcInsn(name);
+        // stack: [name, callee, delegate]
+        CHECK_FUNCTION.invoke(mv);
+        // stack: [fnCalleeOrNull, delegate]
+        final Label hasFunction = new Label();
+        mv.dup();
+        // stack: [fnCalleeOrNull, fnCalleeOrNull, delegate]
+        mv.ifnonnull(hasFunction);
+        // stack: [null, delegate]
+        // If it's null or undefined, clear stack and fall back to default
+        // behavior.
+        mv.pop2();
+        // stack: []
 
-        mv.visitLabel(invokeHandle);
-        mv.visitVarInsn(ISTORE, globalsDifferVar);
-        // stack: [handle]
+        // We can also arrive here from check for "delegate instanceof ScriptFunction"
+        // in a non-SAM method as well as from a check for "hasOwnToString(delegate)"
+        // for a toString delegate.
+        mv.visitLabel(defaultBehavior);
+        final Runnable emitFinally = ()->emitFinally(mv, globalRestoringRunnableVar);
+        final Label normalFinally = new Label();
+        if(Modifier.isAbstract(method.getModifiers())) {
+            // If the super method is abstract, throw UnsupportedOperationException
+            UNSUPPORTED.invoke(mv);
+            // NOTE: no need to invoke emitFinally.run() as we're inside the
+            // tryBlockStart/tryBlockEnd range, so throwing this exception will
+            // transfer control to the rethrow handler and the finally block in it
+            // will execute.
+            mv.athrow();
+        } else {
+            // If the super method is not abstract, delegate to it.
+            emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc);
+            mv.goTo(normalFinally);
+        }
 
-        // Load all parameters back on stack for dynamic invocation. NOTE: since we're using a generic
-        // Object(Object, Object, ...) type signature for the method, we must box all arguments here.
+        mv.visitLabel(hasFunction);
+        // stack: [callee, delegate]
+        mv.swap();
+        // stack [delegate, callee]
+        mv.visitLabel(callCallee);
+
+
+        // Load all parameters back on stack for dynamic invocation.
+
         int varOffset = 1;
+        // If the param list length is more than 253 slots, we can't invoke it
+        // directly as with (callee, this) it'll exceed 255.
+        final boolean isVarArgCall = getParamListLengthInSlots(asmArgTypes) > 253;
         for (final Type t : asmArgTypes) {
             mv.load(varOffset, t);
-            boxStackTop(mv, t);
+            convertParam(mv, t, isVarArgCall);
             varOffset += t.getSize();
         }
+        // stack: [args..., callee, delegate]
+
+        // If the resulting parameter list length is too long...
+        if (isVarArgCall) {
+            // ... we pack the parameters (except callee and this) into an array
+            // and use Nashorn vararg invocation.
+            mv.visitInvokeDynamicInsn(NameCodec.EMPTY_NAME,
+                    getArrayCreatorMethodType(type).toMethodDescriptorString(),
+                    CREATE_ARRAY_BOOTSTRAP_HANDLE);
+        }
 
         // Invoke the target method handle
-        final Label tryBlockStart = new Label();
-        mv.visitLabel(tryBlockStart);
-        emitInvokeExact(mv, type.generic());
-        convertReturnValue(mv, returnType, asmReturnType);
-        final Label tryBlockEnd = new Label();
-        mv.visitLabel(tryBlockEnd);
-        emitFinally(mv, currentGlobalVar, globalsDifferVar);
+        mv.visitInvokeDynamicInsn(encodedName,
+                getCallMethodType(isVarArgCall, type).toMethodDescriptorString(),
+                BOOTSTRAP_HANDLE, NashornCallSiteDescriptor.CALL);
+        // stack: [returnValue]
+        convertReturnValue(mv, returnType);
+        mv.visitLabel(normalFinally);
+        emitFinally.run();
         mv.areturn(asmReturnType);
 
         // If Throwable is not declared, we need an adapter from Throwable to RuntimeException
@@ -846,10 +778,7 @@
             // Add "throw new RuntimeException(Throwable)" handler for Throwable
             throwableHandler = new Label();
             mv.visitLabel(throwableHandler);
-            mv.anew(RUNTIME_EXCEPTION_TYPE);
-            mv.dupX1();
-            mv.swap();
-            mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE), false);
+            WRAP_THROWABLE.invoke(mv);
             // Fall through to rethrow handler
         } else {
             throwableHandler = null;
@@ -857,149 +786,166 @@
         final Label rethrowHandler = new Label();
         mv.visitLabel(rethrowHandler);
         // Rethrow handler for RuntimeException, Error, and all declared exception types
-        emitFinally(mv, currentGlobalVar, globalsDifferVar);
+        emitFinally.run();
         mv.athrow();
-        final Label methodEnd = new Label();
-        mv.visitLabel(methodEnd);
-
-        mv.visitLocalVariable("currentGlobal", GLOBAL_TYPE_DESCRIPTOR, null, setupGlobal, methodEnd, currentGlobalVar);
-        mv.visitLocalVariable("globalsDiffer", Type.BOOLEAN_TYPE.getDescriptor(), null, setupGlobal, methodEnd, globalsDifferVar);
 
         if(throwableDeclared) {
-            mv.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrowHandler, THROWABLE_TYPE_NAME);
+            mv.visitTryCatchBlock(tryBlockStart, normalFinally, rethrowHandler, THROWABLE_TYPE_NAME);
             assert throwableHandler == null;
         } else {
-            mv.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrowHandler, RUNTIME_EXCEPTION_TYPE_NAME);
-            mv.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrowHandler, ERROR_TYPE_NAME);
+            mv.visitTryCatchBlock(tryBlockStart, normalFinally, rethrowHandler, RUNTIME_EXCEPTION_TYPE_NAME);
+            mv.visitTryCatchBlock(tryBlockStart, normalFinally, rethrowHandler, ERROR_TYPE_NAME);
             for(final String excName: exceptionNames) {
-                mv.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrowHandler, excName);
+                mv.visitTryCatchBlock(tryBlockStart, normalFinally, rethrowHandler, excName);
             }
-            mv.visitTryCatchBlock(tryBlockStart, tryBlockEnd, throwableHandler, THROWABLE_TYPE_NAME);
+            mv.visitTryCatchBlock(tryBlockStart, normalFinally, throwableHandler, THROWABLE_TYPE_NAME);
         }
         endMethod(mv);
     }
 
-    private void convertReturnValue(final InstructionAdapter mv, final Class<?> returnType, final Type asmReturnType) {
-        switch(asmReturnType.getSort()) {
-        case Type.VOID:
-            mv.pop();
-            break;
-        case Type.BOOLEAN:
-            JSType.TO_BOOLEAN.invoke(mv);
-            break;
-        case Type.BYTE:
-            JSType.TO_INT32.invoke(mv);
-            mv.visitInsn(Opcodes.I2B);
-            break;
-        case Type.SHORT:
-            JSType.TO_INT32.invoke(mv);
-            mv.visitInsn(Opcodes.I2S);
-            break;
-        case Type.CHAR:
-            // JSType doesn't have a TO_CHAR, so we have services supply us one.
-            mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "toCharPrimitive", TO_CHAR_PRIMITIVE_METHOD_DESCRIPTOR, false);
-            break;
-        case Type.INT:
-            JSType.TO_INT32.invoke(mv);
-            break;
-        case Type.LONG:
-            JSType.TO_LONG.invoke(mv);
-            break;
-        case Type.FLOAT:
-            JSType.TO_NUMBER.invoke(mv);
-            mv.visitInsn(Opcodes.D2F);
-            break;
-        case Type.DOUBLE:
-            JSType.TO_NUMBER.invoke(mv);
-            break;
-        default:
-            if(asmReturnType.equals(OBJECT_TYPE)) {
-                // Must hide ConsString (and potentially other internal Nashorn types) from callers
-                mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "exportReturnValue", EXPORT_RETURN_VALUE_METHOD_DESCRIPTOR, false);
-            } else if(asmReturnType.equals(STRING_TYPE)){
-                // Well-known conversion to String. Not using the JSType one as we want to preserve null as null instead
-                // of the string "n,u,l,l".
-                mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "toString", TO_STRING_METHOD_DESCRIPTOR, false);
-            } else {
-                // Invoke converter method handle for everything else. Note that we could have just added an asType or
-                // filterReturnValue to the invoked handle instead, but then every instance would have the function
-                // method handle wrapped in a separate converter method handle, making handle.invokeExact() megamorphic.
-                if(classOverride) {
-                    mv.getstatic(generatedClassName, converterFields.get(returnType), METHOD_HANDLE_TYPE_DESCRIPTOR);
-                } else {
-                    mv.visitVarInsn(ALOAD, 0);
-                    mv.getfield(generatedClassName, converterFields.get(returnType), METHOD_HANDLE_TYPE_DESCRIPTOR);
-                }
-                mv.swap();
-                emitInvokeExact(mv, MethodType.methodType(returnType, Object.class));
+    private static MethodType getCallMethodType(final boolean isVarArgCall, final MethodType type) {
+        final Class<?>[] callParamTypes;
+        if (isVarArgCall) {
+            // Variable arity calls are always (Object callee, Object this, Object[] params)
+            callParamTypes = new Class<?>[] { Object.class, Object.class, Object[].class };
+        } else {
+            // Adjust invocation type signature for conversions we instituted in
+            // convertParam; also, byte and short get passed as ints.
+            final Class<?>[] origParamTypes = type.parameterArray();
+            callParamTypes = new Class<?>[origParamTypes.length + 2];
+            callParamTypes[0] = Object.class; // callee; could be ScriptFunction.class ostensibly
+            callParamTypes[1] = Object.class; // this
+            for(int i = 0; i < origParamTypes.length; ++i) {
+                callParamTypes[i + 2] = getNashornParamType(origParamTypes[i], false);
             }
         }
+        return MethodType.methodType(getNashornReturnType(type.returnType()), callParamTypes);
+    }
+
+    private static MethodType getArrayCreatorMethodType(final MethodType type) {
+        final Class<?>[] callParamTypes = type.parameterArray();
+        for(int i = 0; i < callParamTypes.length; ++i) {
+            callParamTypes[i] = getNashornParamType(callParamTypes[i], true);
+        }
+        return MethodType.methodType(Object[].class, callParamTypes);
+    }
+
+    private static Class<?> getNashornParamType(final Class<?> clazz, final boolean varArg) {
+        if (clazz == byte.class || clazz == short.class) {
+            return int.class;
+        } else if (clazz == float.class) {
+            // If using variable arity, we'll pass a Double instead of double
+            // so that floats don't extend the length of the parameter list.
+            // We return Object.class instead of Double.class though as the
+            // array collector will anyway operate on Object.
+            return varArg ? Object.class : double.class;
+        } else if (!clazz.isPrimitive() || clazz == long.class || clazz == char.class) {
+            return Object.class;
+        }
+        return clazz;
+    }
+
+    private static Class<?> getNashornReturnType(final Class<?> clazz) {
+        if (clazz == byte.class || clazz == short.class) {
+            return int.class;
+        } else if (clazz == float.class) {
+            return double.class;
+        } else if (clazz == void.class || clazz == char.class) {
+            return Object.class;
+        }
+        return clazz;
+    }
+
+
+    private void loadField(final InstructionAdapter mv, final String name, final String desc) {
+        if(classOverride) {
+            mv.getstatic(generatedClassName, name, desc);
+        } else {
+            mv.visitVarInsn(ALOAD, 0);
+            mv.getfield(generatedClassName, name, desc);
+        }
     }
 
-    private static void emitInvokeExact(final InstructionAdapter mv, final MethodType type) {
-        mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false);
+    private static void convertReturnValue(final InstructionAdapter mv, final Class<?> origReturnType) {
+        if (origReturnType == void.class) {
+            mv.pop();
+        } else if (origReturnType == Object.class) {
+            // Must hide ConsString (and potentially other internal Nashorn types) from callers
+            EXPORT_RETURN_VALUE.invoke(mv);
+        } else if (origReturnType == byte.class) {
+            mv.visitInsn(I2B);
+        } else if (origReturnType == short.class) {
+            mv.visitInsn(I2S);
+        } else if (origReturnType == float.class) {
+            mv.visitInsn(D2F);
+        } else if (origReturnType == char.class) {
+            TO_CHAR_PRIMITIVE.invoke(mv);
+        }
     }
 
-    private static void boxStackTop(final InstructionAdapter mv, final Type t) {
+    /**
+     * Emits instruction for converting a parameter on the top of the stack to
+     * a type that is understood by Nashorn.
+     * @param mv the current method visitor
+     * @param t the type on the top of the stack
+     * @param varArg if the invocation will be variable arity
+     */
+    private static void convertParam(final InstructionAdapter mv, final Type t, final boolean varArg) {
+        // We perform conversions of some primitives to accommodate types that
+        // Nashorn can handle.
         switch(t.getSort()) {
-        case Type.BOOLEAN:
-            invokeValueOf(mv, "Boolean", 'Z');
-            break;
-        case Type.BYTE:
-        case Type.SHORT:
-        case Type.INT:
-            // bytes and shorts get boxed as integers
-            invokeValueOf(mv, "Integer", 'I');
-            break;
         case Type.CHAR:
-            invokeValueOf(mv, "Character", 'C');
+            // Chars are boxed, as we don't know if the JS code wants to treat
+            // them as an effective "unsigned short" or as a single-char string.
+            CHAR_VALUE_OF.invoke(mv);
             break;
         case Type.FLOAT:
-            // floats get boxed as doubles
+            // Floats are widened to double.
             mv.visitInsn(Opcodes.F2D);
-            invokeValueOf(mv, "Double", 'D');
+            if (varArg) {
+                // We'll be boxing everything anyway for the vararg invocation,
+                // so we might as well do it proactively here and thus not cause
+                // a widening in the number of slots, as that could even make
+                // the array creation invocation go over 255 param slots.
+                DOUBLE_VALUE_OF.invoke(mv);
+            }
             break;
         case Type.LONG:
-            invokeValueOf(mv, "Long", 'J');
-            break;
-        case Type.DOUBLE:
-            invokeValueOf(mv, "Double", 'D');
-            break;
-        case Type.ARRAY:
-        case Type.METHOD:
-            // Already boxed
+            // Longs are boxed as Nashorn can't represent them precisely as a
+            // primitive number.
+            LONG_VALUE_OF.invoke(mv);
             break;
         case Type.OBJECT:
             if(t.equals(OBJECT_TYPE)) {
-                mv.invokestatic(SCRIPTUTILS_TYPE_NAME, "unwrap", UNWRAP_METHOD_DESCRIPTOR, false);
+                // Object can carry a ScriptObjectMirror and needs to be unwrapped
+                // before passing into a Nashorn function.
+                UNWRAP.invoke(mv);
             }
             break;
-        default:
-            // Not expecting anything else (e.g. VOID)
-            assert false;
-            break;
         }
     }
 
-    private static void invokeValueOf(final InstructionAdapter mv, final String boxedType, final char unboxedType) {
-        mv.invokestatic("java/lang/" + boxedType, "valueOf", "(" + unboxedType + ")Ljava/lang/" + boxedType + ";", false);
+    private static int getParamListLengthInSlots(final Type[] paramTypes) {
+        int len = paramTypes.length;
+        for(final Type t: paramTypes) {
+            final int sort = t.getSort();
+            if (sort == Type.FLOAT || sort == Type.DOUBLE) {
+                // Floats are widened to double, so they'll take up two slots.
+                // Longs on the other hand are always boxed, so their width
+                // becomes 1 and thus they don't contribute an extra slot here.
+                ++len;
+            }
+        }
+        return len;
     }
-
     /**
      * Emit code to restore the previous Nashorn Context when needed.
      * @param mv the instruction adapter
-     * @param currentGlobalVar index of the local variable holding the reference to the current global at method
-     * entry.
-     * @param globalsDifferVar index of the boolean local variable that is true if the global needs to be restored.
+     * @param globalRestoringRunnableVar index of the local variable holding the reference to the global restoring Runnable
      */
-    private static void emitFinally(final InstructionAdapter mv, final int currentGlobalVar, final int globalsDifferVar) {
-        // Emit code to restore the previous Nashorn global if needed
-        mv.visitVarInsn(ILOAD, globalsDifferVar);
-        final Label skip = new Label();
-        mv.ifeq(skip);
-        mv.visitVarInsn(ALOAD, currentGlobalVar);
-        invokeSetGlobal(mv);
-        mv.visitLabel(skip);
+    private static void emitFinally(final InstructionAdapter mv, final int globalRestoringRunnableVar) {
+        mv.visitVarInsn(ALOAD, globalRestoringRunnableVar);
+        RUN.invoke(mv);
     }
 
     private static boolean isThrowableDeclared(final Class<?>[] exceptions) {
@@ -1030,7 +976,7 @@
         mv.visitCode();
 
         emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc);
-
+        mv.areturn(Type.getType(mi.type.returnType()));
         endMethod(mv);
     }
 
@@ -1052,7 +998,15 @@
         throw new AssertionError("can't find the class/interface that extends " + cl);
     }
 
-    private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
+    private int emitSuperConstructorCall(final InstructionAdapter mv, final String methodDesc) {
+        return emitSuperCall(mv, null, INIT, methodDesc, true);
+    }
+
+    private int emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
+        return emitSuperCall(mv, owner, name, methodDesc, false);
+    }
+
+    private int emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc, final boolean constructor) {
         mv.visitVarInsn(ALOAD, 0);
         int nextParam = 1;
         final Type methodType = Type.getMethodType(methodDesc);
@@ -1062,48 +1016,46 @@
         }
 
         // default method - non-abstract, interface method
-        if (Modifier.isInterface(owner.getModifiers())) {
+        if (!constructor && Modifier.isInterface(owner.getModifiers())) {
             // we should call default method on the immediate "super" type - not on (possibly)
             // the indirectly inherited interface class!
             mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
         } else {
             mv.invokespecial(superClassName, name, methodDesc, false);
         }
-        mv.areturn(methodType.getReturnType());
+        return nextParam;
     }
 
     private void generateFinalizerMethods() {
-        final String finalizerDelegateName = nextName("access$");
-        generateFinalizerDelegate(finalizerDelegateName);
-        generateFinalizerOverride(finalizerDelegateName);
+        generateFinalizerDelegate();
+        generateFinalizerOverride();
     }
 
-    private void generateFinalizerDelegate(final String finalizerDelegateName) {
+    private void generateFinalizerDelegate() {
         // Generate a delegate that will be invoked from the no-permission trampoline. Note it can be private, as we'll
         // refer to it with a MethodHandle constant pool entry in the overridden finalize() method (see
         // generateFinalizerOverride()).
         final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PRIVATE | ACC_STATIC,
-                finalizerDelegateName, Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE), null, null));
+                FINALIZER_DELEGATE_NAME, FINALIZER_DELEGATE_METHOD_DESCRIPTOR, null, null));
 
         // Simply invoke super.finalize()
         mv.visitVarInsn(ALOAD, 0);
         mv.checkcast(Type.getType(generatedClassName));
-        mv.invokespecial(superClassName, "finalize", Type.getMethodDescriptor(Type.VOID_TYPE), false);
+        mv.invokespecial(superClassName, "finalize", VOID_METHOD_DESCRIPTOR, false);
 
         mv.visitInsn(RETURN);
         endMethod(mv);
     }
 
-    private void generateFinalizerOverride(final String finalizerDelegateName) {
+    private void generateFinalizerOverride() {
         final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC, "finalize",
-                VOID_NOARG_METHOD_DESCRIPTOR, null, null));
+                VOID_METHOD_DESCRIPTOR, null, null));
         // Overridden finalizer will take a MethodHandle to the finalizer delegating method, ...
-        mv.aconst(new Handle(Opcodes.H_INVOKESTATIC, generatedClassName, finalizerDelegateName,
-                Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE)));
+        mv.aconst(new Handle(Opcodes.H_INVOKESTATIC, generatedClassName, FINALIZER_DELEGATE_NAME,
+                FINALIZER_DELEGATE_METHOD_DESCRIPTOR));
         mv.visitVarInsn(ALOAD, 0);
         // ...and invoke it through JavaAdapterServices.invokeNoPermissions
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "invokeNoPermissions",
-                Type.getMethodDescriptor(METHOD_HANDLE_TYPE, OBJECT_TYPE), false);
+        INVOKE_NO_PERMISSIONS.invoke(mv);
         mv.visitInsn(RETURN);
         endMethod(mv);
     }
@@ -1157,11 +1109,8 @@
                     final MethodInfo mi = new MethodInfo(typeMethod);
                     if (Modifier.isFinal(m) || isCallerSensitive(typeMethod)) {
                         finalMethods.add(mi);
-                    } else if (!finalMethods.contains(mi) && methodInfos.add(mi)) {
-                        if (Modifier.isAbstract(m)) {
-                            abstractMethodNames.add(mi.getName());
-                        }
-                        mi.setIsCanonical(this);
+                    } else if (!finalMethods.contains(mi) && methodInfos.add(mi) && Modifier.isAbstract(m)) {
+                        abstractMethodNames.add(mi.getName());
                     }
                 }
             }
@@ -1222,7 +1171,7 @@
                 return type2;
             }
             if (c1.isInterface() || c2.isInterface()) {
-                return OBJECT_TYPE_NAME;
+                return OBJECT_TYPE.getInternalName();
             }
             return assignableSuperClass(c1, c2).getName().replace('.', '/');
         } catch(final ClassNotFoundException e) {
@@ -1238,4 +1187,8 @@
     private static boolean isCallerSensitive(final AccessibleObject e) {
         return e.isAnnotationPresent(CallerSensitive.class);
     }
+
+    private static final Call lookupServiceMethod(final String name, final Class<?> rtype, final Class<?>... ptypes) {
+        return staticCallNoLookup(JavaAdapterServices.class, name, rtype, ptypes);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -54,6 +54,7 @@
 import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.linker.AdaptationResult.Outcome;
 
 /**
  * A factory class that generates adapter classes. Adapter classes allow
@@ -211,7 +212,7 @@
      *         be generated from a ScriptFunction.
      */
     static boolean isAutoConvertibleFromFunction(final Class<?> clazz) {
-        return getAdapterInfo(new Class<?>[] { clazz }).autoConvertibleFromFunction;
+        return getAdapterInfo(new Class<?>[] { clazz }).isAutoConvertibleFromFunction();
     }
 
     private static AdapterInfo getAdapterInfo(final Class<?>[] types) {
@@ -273,7 +274,7 @@
                 } catch (final AdaptationException e) {
                     return new AdapterInfo(e.getAdaptationResult());
                 } catch (final RuntimeException e) {
-                    return new AdapterInfo(new AdaptationResult(AdaptationResult.Outcome.ERROR_OTHER, Arrays.toString(types), e.toString()));
+                    return new AdapterInfo(new AdaptationResult(Outcome.ERROR_OTHER, e, Arrays.toString(types), e.toString()));
                 }
             }
         }, CREATE_ADAPTER_INFO_ACC_CTXT);
@@ -319,6 +320,13 @@
                 getClassAdapterClass(classOverrides, protectionDomain);
         }
 
+        boolean isAutoConvertibleFromFunction() {
+            if(adaptationResult.getOutcome() == AdaptationResult.Outcome.ERROR_OTHER) {
+                throw adaptationResult.typeError();
+            }
+            return autoConvertibleFromFunction;
+        }
+
         private StaticClass getInstanceAdapterClass(final ProtectionDomain protectionDomain) {
             CodeSource codeSource = protectionDomain.getCodeSource();
             if(codeSource == null) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Tue Jan 26 09:11:58 2016 +0100
@@ -33,8 +33,11 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
+import java.lang.invoke.CallSite;
+import java.lang.invoke.ConstantCallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
 import java.security.AccessController;
 import java.security.CodeSigner;
@@ -43,15 +46,18 @@
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.security.SecureClassLoader;
+import java.util.Objects;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.org.objectweb.asm.Type;
 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ECMAException;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
-import jdk.nashorn.internal.runtime.Undefined;
 
 /**
  * Provides static utility services to generated Java adapter classes.
@@ -64,50 +70,47 @@
     }
 
     /**
-     * Given a JS script function, binds it to null JS "this", and adapts its parameter types, return types, and arity
-     * to the specified type and arity. This method is public mainly for implementation reasons, so the adapter classes
-     * can invoke it from their constructors that take a ScriptFunction in its first argument to obtain the method
-     * handles for their abstract method implementations.
-     * @param fn the script function
-     * @param type the method type it has to conform to
-     * @return the appropriately adapted method handle for invoking the script function.
+     * Given a script function used as a delegate for a SAM adapter, figure out
+     * the right object to use as its "this" when called.
+     * @param delegate the delegate function
+     * @param global the current global of the adapter
+     * @return either the passed global, or UNDEFINED if the function is strict.
      */
-    public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
-        // JS "this" will be global object or undefined depending on if 'fn' is strict or not
-        return bindAndAdaptHandle(fn, fn.isStrict()? ScriptRuntime.UNDEFINED : Context.getGlobal(), type);
+    public static Object getCallThis(final ScriptFunction delegate, final Object global) {
+        return delegate.isStrict() ? ScriptRuntime.UNDEFINED : global;
+    }
+
+    /**
+     * Throws a "not.an.object" type error. Used when the delegate passed to the
+     * adapter constructor is not a script object.
+     * @param obj the object that is not a script object.
+     */
+    public static void notAnObject(final Object obj) {
+        throw typeError("not.an.object", ScriptRuntime.safeToString(obj));
     }
 
     /**
-     * Given a JS script object, retrieves a function from it by name, binds it to the script object as its "this", and
-     * adapts its parameter types, return types, and arity to the specified type and arity. This method is public mainly
-     * for implementation reasons, so the adapter classes can invoke it from their constructors that take a Object
-     * in its first argument to obtain the method handles for their method implementations.
-     * @param obj the script obj
-     * @param name the name of the property that contains the function
-     * @param type the method type it has to conform to
-     * @return the appropriately adapted method handle for invoking the script function, or null if the value of the
-     * property is either null or undefined, or "toString" was requested as the name, but the object doesn't directly
-     * define it but just inherits it through prototype.
+     * Checks if the passed object, which is supposed to be a callee retrieved
+     * through applying the GET_METHOD_PROPERTY operation on the delegate, is
+     * a ScriptFunction, or null or undefined. These are the only allowed values
+     * for adapter method implementations, so in case it is neither, it throws
+     * a type error. Note that this restriction is somewhat artificial; as the
+     * CALL dynamic operation could invoke any Nashorn callable. We are
+     * restricting adapters to actual ScriptFunction objects for now though.
+     * @param callee the callee to check
+     * @param name the name of the function
+     * @return the callee cast to a ScriptFunction, or null if it was null or undefined.
+     * @throws ECMAException representing a JS TypeError with "not.a.function"
+     * message if the passed callee is neither a script function, nor null, nor
+     * undefined.
      */
-    public static MethodHandle getHandle(final Object obj, final String name, final MethodType type) {
-        if (! (obj instanceof ScriptObject)) {
-            throw typeError("not.an.object", ScriptRuntime.safeToString(obj));
-        }
-
-        final ScriptObject sobj = (ScriptObject)obj;
-        // Since every JS Object has a toString, we only override "String toString()" it if it's explicitly specified
-        if ("toString".equals(name) && !sobj.hasOwnProperty("toString")) {
+    public static ScriptFunction checkFunction(final Object callee, final String name) {
+        if (callee instanceof ScriptFunction) {
+            return (ScriptFunction)callee;
+        } else if (JSType.nullOrUndefined(callee)) {
             return null;
         }
-
-        final Object fnObj = sobj.get(name);
-        if (fnObj instanceof ScriptFunction) {
-            return bindAndAdaptHandle((ScriptFunction)fnObj, sobj, type);
-        } else if(fnObj == null || fnObj instanceof Undefined) {
-            return null;
-        } else {
-            throw typeError("not.a.function", name);
-        }
+        throw typeError("not.a.function.value", name, ScriptRuntime.safeToString(callee));
     }
 
     /**
@@ -116,8 +119,8 @@
      * static initializers.
      * @return the thread-local JS object used to define methods for the class being initialized.
      */
-    public static Object getClassOverrides() {
-        final Object overrides = classOverrides.get();
+    public static ScriptObject getClassOverrides() {
+        final ScriptObject overrides = classOverrides.get();
         assert overrides != null;
         return overrides;
     }
@@ -135,29 +138,59 @@
     }
 
     /**
-     * Set the current global scope
-     * @param global the global scope
+     * Set the current global scope to that of the adapter global
+     * @param adapterGlobal the adapter's global scope
+     * @return a Runnable that when invoked restores the previous global
      */
-    public static void setGlobal(final Object global) {
-        Context.setGlobal((ScriptObject)global);
+    public static Runnable setGlobal(final ScriptObject adapterGlobal) {
+        final Global currentGlobal = Context.getGlobal();
+        if (adapterGlobal != currentGlobal) {
+            Context.setGlobal(adapterGlobal);
+            return ()->Context.setGlobal(currentGlobal);
+        }
+        return ()->{};
+    }
+
+    /**
+     * Get the current non-null global scope
+     * @return the current global scope
+     * @throws NullPointerException if the current global scope is null.
+     */
+    public static ScriptObject getNonNullGlobal() {
+        return Objects.requireNonNull(Context.getGlobal(), "Current global is null");
     }
 
     /**
-     * Get the current global scope
-     * @return the current global scope
+     * Returns true if the object has its own toString function. Used
+     * when implementing toString for adapters. Since every JS Object has a
+     * toString function, we only override "String toString()" in adapters if
+     * it is explicitly specified and not inherited from a prototype.
+     * @param sobj the object
+     * @return true if the object has its own toString function.
      */
-    public static Object getGlobal() {
-        return Context.getGlobal();
+    public static boolean hasOwnToString(final ScriptObject sobj) {
+        // NOTE: we could just use ScriptObject.hasOwnProperty("toString"), but
+        // its logic is more complex and this is what it boils down to with a
+        // fixed "toString" argument.
+        return sobj.getMap().findProperty("toString") != null;
+    }
+
+    /**
+     * Delegate to {@link Bootstrap#bootstrap(Lookup, String, MethodType, int)}.
+     * @param lookup MethodHandle lookup.
+     * @param opDesc Dynalink dynamic operation descriptor.
+     * @param type   Method type.
+     * @param flags  flags for call type, trace/profile etc.
+     * @return CallSite with MethodHandle to appropriate method or null if not found.
+     */
+    public static CallSite bootstrap(final Lookup lookup, final String opDesc, final MethodType type, final int flags) {
+        return Bootstrap.bootstrap(lookup, opDesc, type, flags);
     }
 
     static void setClassOverrides(final ScriptObject overrides) {
         classOverrides.set(overrides);
     }
 
-    private static MethodHandle bindAndAdaptHandle(final ScriptFunction fn, final Object self, final MethodType type) {
-        return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(fn.getBoundInvokeHandle(self), type, false), type);
-    }
-
     private static MethodHandle createNoPermissionsInvoker() {
         final String className = "NoPermissionsInvoker";
 
@@ -203,16 +236,6 @@
     }
 
     /**
-     * Returns a method handle used to convert a return value from a delegate method (always Object) to the expected
-     * Java return type.
-     * @param returnType the return type
-     * @return the converter for the expected return type
-     */
-    public static MethodHandle getObjectConverter(final Class<?> returnType) {
-        return Bootstrap.getLinkerServices().getTypeConverter(Object.class, returnType);
-    }
-
-    /**
      * Invoked when returning Object from an adapted method to filter out internal Nashorn objects that must not be seen
      * by the callers. Currently only transforms {@code ConsString} into {@code String} and transforms {@code ScriptObject} into {@code ScriptObjectMirror}.
      * @param obj the return value
@@ -233,13 +256,39 @@
     }
 
     /**
-     * Invoked to convert a return value of a delegate function to String. It is similar to
-     * {@code JSType.toString(Object)}, except it doesn't handle StaticClass specially, and it returns null for null
-     * input instead of the string "null".
-     * @param obj the return value.
-     * @return the String value of the return value
+     * Returns a new {@link RuntimeException} wrapping the passed throwable.
+     * Makes generated bytecode smaller by doing an INVOKESTATIC to this method
+     * rather than the NEW/DUP_X1/SWAP/INVOKESPECIAL &lt;init&gt; sequence.
+     * @param t the original throwable to wrap
+     * @return a newly created runtime exception wrapping the passed throwable.
+     */
+    public static RuntimeException wrapThrowable(final Throwable t) {
+        return new RuntimeException(t);
+    }
+
+    /**
+     * Creates and returns a new {@link UnsupportedOperationException}. Makes
+     * generated bytecode smaller by doing INVOKESTATIC to this method rather
+     * than the NEW/DUP/INVOKESPECIAL &lt;init&gt; sequence.
+     * @return a newly created {@link UnsupportedOperationException}.
      */
-    public static String toString(final Object obj) {
-        return JavaArgumentConverters.toString(obj);
+    public static UnsupportedOperationException unsupported() {
+        return new UnsupportedOperationException();
+    }
+
+    /**
+     * A bootstrap method used to collect invocation arguments into an Object array.
+     * for variable arity invocation.
+     * @param lookup the adapter's lookup (not used).
+     * @param name the call site name (not used).
+     * @param type the method type
+     * @return a method that takes the input parameters and packs them into a
+     * newly allocated Object array.
+     */
+    public static CallSite createArrayBootstrap(final MethodHandles.Lookup lookup, final String name, final MethodType type) {
+        return new ConstantCallSite(
+                MethodHandles.identity(Object[].class)
+                .asCollector(Object[].class, type.parameterCount())
+                .asType(type));
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -24,7 +24,7 @@
 
 Object.isSealed=tells if an object is sealed or not
 
-Object.isFrozen=tells if an object is fronzen or not
+Object.isFrozen=tells if an object is frozen or not
 
 Object.isExtensible=tells if an object is extensible or not
 
@@ -32,7 +32,7 @@
 
 Object=creates a new script object or converts given value as a script object
 
-Object.prototype.toString=returns a string representing of this object
+Object.prototype.toString=returns a string representation of this object
 
 Object.prototype.hasOwnProperty=tells whether this object has the specified property or not
 
@@ -42,3 +42,60 @@
 
 Object.bindProperties=binds the source object's properties to the target object (nashorn extension)
 
+Array.isArray=tells whether the argument is an array
+
+Array.prototype.toString=returns a string representation of this array
+
+Array.prototype.assertNumeric=asserts that the array is numeric, throws a type error if this is not the case
+
+Array.prototype.toLocaleString=returns a locale-specific string representation of this array
+
+Array=creates a new array
+
+Array.prototype.concat=concatenates arrays
+
+Array.prototype.join=returns a string representation of the array, with a separator placed between elements
+
+Array.prototype.pop=returns the element from the end of the array, or undefined
+
+Array.prototype.push=appends an element to the end of the array
+
+Array.prototype.reverse=reverses the array
+
+Array.prototype.shift=removes the first element from the array and returns that element
+
+Array.prototype.slice=returns a shallow copy of a slice of the array
+
+Array.prototype.sort=sorts the array
+
+Array.prototype.splice=changes the content of the array by removing and/or adding elements
+
+Array.prototype.unshift=adds one or more elements to the beginning of the array
+
+Array.prototype.indexOf=retrieves the first index of an element in the array, or -1 if the element is not found
+
+Array.prototype.lastIndexOf=retrieves the last index of an element in the array, or -1 if the element is not found
+
+Array.prototype.every=applies a predicate to all elements of the array, returns true if the predicate evaluates to true for all
+
+Array.prototype.some=tests whether a predicate evaluates to true for some element in the array
+
+Array.prototype.forEach=applies a function to all elements in the array
+
+Array.prototype.map=applies a function to all elements in the array, returns the array of results
+
+Array.prototype.filter=returns an array with those elements from this array that match a filter function
+
+Array.prototype.reduce=applies a left-fold to the array and returns the result
+
+Array.prototype.reduceRight=applies a right-fold to the array and returns the result
+
+Function=creates a new function with the given parameters and function body
+
+Function.prototype.toString=returns a string representation of this function
+
+Function.prototype.apply=invokes the function with the given this-reference and arguments array
+
+Function.prototype.call=invokes the function with the given this-reference and arguments
+
+Function.prototype.bind=returns a new function with bound this-reference and arguments
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8147845.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, 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-8147845: Varargs Array functions still leaking longs
+ *
+ * @test
+ * @run
+ */
+
+Assert.assertTrue([].push() === 0);
+Assert.assertTrue([].unshift() === 0);
+Assert.assertTrue(typeof [].push() === 'number');
+Assert.assertTrue(typeof [].unshift() === 'number');
+
+Assert.assertTrue([].push(1, 2, 3) === 3);
+Assert.assertTrue([].unshift(1, 2, 3) === 3);
+Assert.assertTrue(typeof [].push(1, 2, 3) === 'number');
+Assert.assertTrue(typeof [].unshift(1, 2, 3) === 'number');
+
+Assert.assertTrue([].push(1) === 1);
+Assert.assertTrue([].unshift(1) === 1);
+Assert.assertTrue(typeof [].push(1) === 'number');
+Assert.assertTrue(typeof [].unshift(1) === 'number');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/Hello.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+/**
+ * This is a test program used in the test jjs-option-cp.js
+ */
+public class Hello {
+    public Hello() {
+    }
+
+    public String getString() {
+        return "hello";
+    }
+}
--- a/nashorn/test/script/nosecurity/JDK-8144221.js	Mon Jan 25 14:09:28 2016 -1000
+++ b/nashorn/test/script/nosecurity/JDK-8144221.js	Tue Jan 26 09:11:58 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * Test that shebang handling works properly.
  *
  * @test
- * @runif os.not.windows
  * @option -scripting
  * @run
  */
@@ -126,8 +125,9 @@
 }
 
 function run(viajjs, name, arg1, arg2) {
-    var prefix = viajjs ? "${jjs} -scripting " : ''
-    $EXEC("${prefix}./shebang.js ${arg1} ${arg2}")
+    var prefix = viajjs ? "${jjs} -scripting " : win ? 'sh -c "' : '',
+        suffix = viajjs ? '' : win ? '"' : ''
+    $EXEC("${prefix}./shebang.js ${arg1} ${arg2}${suffix}")
     print("* ${name} via ${viajjs ? 'jjs' : 'shebang'}")
     print($OUT.trim())
     print($ERR.trim())
@@ -143,8 +143,8 @@
     $EXEC('chmod +x shebang.js')
     run(false, 'noargs', '', '')
     run(true, 'noargs', '', '')
-    run(false, 'withargs', 'a.js', '"hello world"')
-    run(true, 'withargs', 'a.js', '"hello world"')
+    run(false, 'withargs', 'a.js', "'hello world'")
+    run(true, 'withargs', 'a.js', "'hello world'")
     $EXEC('rm shebang.js')
 })
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-common.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing.
+ * @subtest
+ * @summary test used by all other jjs-option* test cases
+ */
+var javaHome = $ENV.JAVA_HOME,
+    homeJjs = "${javaHome}/bin/jjs",
+    altJjs = $EXEC('which jjs').trim(),
+    homejavac = "${javaHome}/bin/javac",
+    altjavac = $EXEC('which javac').trim()
+
+var Files = Java.type('java.nio.file.Files'),
+    Paths = Java.type('java.nio.file.Paths'),
+    System = Java.type('java.lang.System')
+
+// Initialize default values for variables used in different functions
+var func_cond_p = <<EOD
+$EXIT == 0
+EOD
+
+var func_cond_n = <<EOD
+$EXIT != 0
+EOD
+
+var flag_cond_p = <<EOD
+out == e_outp
+EOD
+
+var flag_cond_n = <<EOD
+out == e_outn
+EOD
+
+var e_outp = "true"
+var e_outn = "false"
+
+// special cases in which arguments used for negative testing also
+var args_p = "-scripting"
+var args_n = "-scripting"
+
+// create file to check -flag passing
+var path_f = Paths.get("temp-flag.js")
+var testflag_file = path_f.toAbsolutePath()
+
+// create file to check -flag functionality
+var path_func = Paths.get("temp-func.js")
+var testfunc_file = path_func.toAbsolutePath()
+
+
+function exists(f) {
+    return Files.exists(Paths.get(f))
+}
+
+var jjs = exists(homeJjs) ? homeJjs : altJjs
+var javac = exists(homejavac) ? homejavac : altjavac
+
+if (!exists(jjs)) {
+    throw "no jjs executable found; tried ${homeJjs} and ${altJjs}"
+}
+
+// write code to testflag_file
+function write_testflag_file() {
+    Files.write(testflag_file, msg_flag.getBytes())
+}
+
+// write code to testfunc_file
+function write_testfunc_file() {
+    Files.write(testfunc_file, msg_func.getBytes())
+}
+
+function flag_test_pass() {
+    print("flag test PASSED")
+}
+
+function flag_test_fail(e_out, out) {
+    print("flag test FAILED expected out:${e_out} found:${out}")
+}
+
+// check functionality of flag,cover both positive and negative cases
+function testjjs_opt_func(args, positive) {
+    $EXEC("${jjs} ${args}")
+    var out = $OUT.trim(),
+        err = $ERR.trim()
+    if (positive) {
+        if (eval(func_cond_p))
+            print("functionality test PASSED")
+        else
+            print("functionality test FAILED. stdout: ${out} -- stderr: ${err}")
+    }
+    else {
+        if (eval(func_cond_n))
+            print("functionality test PASSED")
+        else
+            print("functionality test FAILED. stdout: ${out} -- stderr: ${err}")
+    }
+
+}
+
+// check if corresponding $OPTIONS._XXX is set for given flag
+function testjjs_opt(args, type, func) {
+    $EXEC("${jjs} ${args}")
+    var out = $OUT.trim(),
+        err = $ERR.trim()
+    if (type) {
+        if (eval(flag_cond_p)) {
+            flag_test_pass()
+            if (func)
+                testjjs_opt_func(arg_p, type)
+        }
+        else {
+            flag_test_fail(e_outp, out)
+        }
+    }
+    else {
+        if (eval(flag_cond_n)) {
+            flag_test_pass()
+            if (func)
+                testjjs_opt_func(arg_n, type)
+        }
+        else {
+            flag_test_fail(e_outn, out)
+        }
+    }
+}
+
+// Main entry point to test both flag and its functionality
+function testjjs_flag_and_func(flag, param) {
+    try {
+        var args = "${flag}" + "${param}"
+        write_testflag_file()
+        write_testfunc_file()
+        print("${flag} flag positive test:")
+        testjjs_opt("${args_p} ${args} ${testflag_file}", true, true) // positive test
+        print("${flag} flag negative test:")
+        testjjs_opt("${args_n} ${testflag_file}", false, true)        // negative test
+    } finally {
+        $EXEC("rm ${testflag_file}")
+        $EXEC("rm ${testfunc_file}")
+    }
+}
+
+// Main entry point to check only functionality of given -flag
+function testjjs_functionality(flag, param) {
+    try {
+        var args = "${flag}" + "${param}"
+        write_testfunc_file()
+        print("${flag} flag positive test:")
+        testjjs_opt_func("${args_p} ${args} ${testfunc_file}", true) // positive test
+        print("${flag} flag negative test:")
+        testjjs_opt_func("${args_n} ${testfunc_file}", false)        // negative test
+    } finally {
+        $EXEC("rm ${testfunc_file}")
+    }
+}
+
+// Main entry point to check only -flag settings for given flag
+function testjjs_flag(flag, param) {
+    try {
+        var args = "${flag}" + "${param}"
+        write_testflag_file()
+        print("${flag} flag positive test:")
+        testjjs_opt("${args_p} ${args} ${testflag_file}", true, false) // positive test
+        print("${flag} flag negative test:")
+        testjjs_opt("${args_n} ${testflag_file}", false, false)        // negative test
+    } finally {
+        $EXEC("rm ${testflag_file}")
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-cp.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test to check if -cp flag and its basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+var hello = __DIR__ + "Hello.class";
+var helloj = __DIR__ + "Hello.java";
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._classpath)"
+
+// code to check basic functionality
+var msg_func = <<EOD
+$EXEC("rm -f ${hello}")
+$EXEC("${javac} ${helloj}")
+var v = new Packages.Hello();
+if (v.string != 'hello') {
+    throw new Error("Unexpected property value");
+}
+EOD
+
+// flag test expected output variables
+var e_outp = "__DIR__"
+var e_outn = "null"
+
+// functionality test arguments
+var arg_p = "-scripting -cp ${__DIR__}  ${testfunc_file}"
+var arg_n = "-scripting ${testfunc_file}"
+
+// Testing starts here
+testjjs_flag_and_func("-cp", " __DIR__")
+$EXEC("rm -f ${hello}")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-cp.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+-cp flag positive test:
+flag test PASSED
+functionality test PASSED
+-cp flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-define.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test to check -D flag basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+var path_func = Paths.get("temp-property-func.js")
+var testfunc_file = path_func.toAbsolutePath()
+
+// code to check basic functionality
+var msg_func = <<EOD
+try {
+    var System = Java.type('java.lang.System');
+    print(System.getProperty('user.name'))
+    if (System.getProperty('user.name') != "nashorn9")
+        throw new Error("un expected system property user.name value")
+} finally {
+}
+EOD
+
+// Testing starts here
+testjjs_functionality("-D", "user.name=nashorn9")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-define.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,4 @@
+-D flag positive test:
+functionality test PASSED
+-D flag negative test:
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-doe.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -doe flag and its basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._dump_on_error)"
+
+// code to check basic functionality
+var msg_func = <<EOD
+print("Hello Nashorn)
+EOD
+
+// flag test expected output variables
+var e_outp = "true"
+var e_outn = "false"
+
+// functionality test arguments
+var arg_p = "-scripting -doe ${testfunc_file}"
+var arg_n = "-scripting ${testfunc_file}"
+
+// functionality condition checks used.
+var func_cond_p = <<'EOD'
+err.indexOf("internal") > -1
+EOD
+
+var func_cond_n = <<'EOD'
+err.indexOf("internal") <= -1
+EOD
+
+// one particular test starts here
+testjjs_flag_and_func("-doe", "")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-doe.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+-doe flag positive test:
+flag test PASSED
+functionality test PASSED
+-doe flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-fv.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test if -fv flag its basic funnctionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._fullversion)"
+
+// code to check basic functionality
+var msg_func = <<EOD
+var x = "Hello Nashorn"
+EOD
+
+// flag test expected output variables
+var e_outp = "true"
+var e_outn = "false"
+
+// functionality test arguments
+var arg_p = "-scripting -fv ${testfunc_file}"
+var arg_n = "-scripting ${testfunc_file}"
+
+var func_cond_p = <<'EOD'
+err.indexOf("full") > -1
+EOD
+
+var func_cond_n = <<'EOD'
+err.indexOf("full") <= -1
+EOD
+
+// one particular test starts here
+testjjs_flag_and_func("-fv", "")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-fv.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+-fv flag positive test:
+flag test PASSED
+functionality test PASSED
+-fv flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-fx.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * check -fx option.
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -fx flag and its basic functionality
+ * the JavaFX primary stage is available to Nashorn as a global property $STAGE with -fx
+ * used this to check with and without -fx 
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+var msg_flag = "print(typeof($STAGE)); exit();";
+
+// flag test expected output variables
+var e_outn = "undefined"
+
+// positive flag test condition expression string other than the default
+var flag_cond_p = <<'EOD'
+out != "undefined"
+EOD
+
+// Testing starts here
+testjjs_flag("-fx","")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-fx.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,4 @@
+-fx flag positive test:
+flag test PASSED
+-fx flag negative test:
+flag test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-lang.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -lang flag and its basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._es6)"
+
+// code to check basic functionality
+var msg_func = <<EOD
+const X = 4
+try {
+    X = 55
+    throw new Error("should have thrown TypeError")
+} catch (e) {
+    if (!(e instanceof TypeError)) {
+        throw new Error("TypeError expected, got " + e)
+    }
+}
+EOD
+
+// flag test expected output variables
+var e_outp = "true"
+var e_outn = "false"
+
+// functionality test arguments
+var arg_p = "-scripting --language=es6 ${testfunc_file}"
+var arg_n = "-scripting ${testfunc_file}"
+
+// Testing starts here
+testjjs_flag_and_func("--language", "=es6")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-lang.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+--language flag positive test:
+flag test PASSED
+functionality test PASSED
+--language flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-ot.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -ot flag
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+var args_n = "-scripting -ot=false"
+var msg_flag = "print($OPTIONS._optimistic_types);";
+
+// flag test expected output variables
+var e_outp = "true"
+var e_outn = "false"
+
+// Testing starts here
+testjjs_flag("-ot","")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-ot.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,4 @@
+-ot flag positive test:
+flag test PASSED
+-ot flag negative test:
+flag test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-scripting.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -scripting flag and its basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._scripting)"
+
+// code to check basic functionality
+var msg_func = <<'EOD'
+var x = "Nashorn"
+var hello = "Hello ${x}"
+if (hello != "Hello Nashorn") {
+    throw new Error("string interploation not working");
+}
+EOD
+
+// flag test expected output variables
+var e_outn = 'ReferenceErrorr: "$OPTIONS" is not defined'
+// negative flag test condition
+var flag_cond_n = 'err.indexOf("$OPTIONS") > -1'
+
+// functionality test arguments
+var arg_p = "-scripting ${testfunc_file}"
+var arg_n = "${testfunc_file}"
+
+var args_p = "",
+    args_n = ""
+
+// Testing starts here
+testjjs_flag_and_func("-scripting", "")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-scripting.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+-scripting flag positive test:
+flag test PASSED
+functionality test PASSED
+-scripting flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-strict.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test  -strict flag and its basic functionality
+ */
+
+load(__DIR__ + "jjs-common.js")
+
+// code to check -flag
+var msg_flag = "print($OPTIONS._strict)"
+
+// code to check basic functionality
+var msg_func = <<EOD
+try {
+    v = "nashorn"
+    throw new Error("should have thrown reference error")
+} catch (e) {
+    if (!(e instanceof ReferenceError)) {
+        throw new Error("ReferenceError expected, got " + e)
+    }
+}
+EOD
+
+// functionality test arguments
+var arg_p = "-scripting -strict ${testfunc_file}"
+var arg_n = "-scripting ${testfunc_file}"
+
+// Testing starts here
+testjjs_flag_and_func("-strict","")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-strict.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,6 @@
+-strict flag positive test:
+flag test PASSED
+functionality test PASSED
+-strict flag negative test:
+flag test PASSED
+functionality test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-version.js	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, 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-8144113: Nashorn: enable jjs testing. 
+ * check if jjs version is same as of java.
+ * @test
+ * @option -scripting
+ * @runif os.not.windows
+ * @run
+ * @summary Test -version flag and its functionality 
+ */
+
+
+load(__DIR__ + "jjs-common.js")
+
+var javaVersion = System.getProperty('java.version')
+
+// code to check -flag
+var msg_flag = 'var x = "Hello Nashorn"'
+
+// flag test expected output variables
+var e_outp = "nashorn ${javaVersion}"
+var e_outn = "Hello Nashorn"
+
+// not sure why version info is found in error stream not in out stream.??
+flag_cond_p = "err.indexOf(e_outp)> -1"
+flag_cond_n = "err.indexOf(e_outp)<= -1"
+
+testjjs_flag("-version","")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/jjs-option-version.js.EXPECTED	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,4 @@
+-version flag positive test:
+flag test PASSED
+-version flag negative test:
+flag test PASSED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/linker/test/JavaAdapterTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.internal.runtime.linker.test;
+
+import java.util.Collection;
+import java.util.Deque;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.function.Supplier;
+import javax.script.Bindings;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.internal.runtime.Context;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class JavaAdapterTest {
+    public interface TestConversions {
+        public byte getByte(byte b);
+        public short getShort(short b);
+        public char getChar(char c);
+        public int getInt(int i);
+        public float getFloat(float f);
+        public long getLong(long l);
+        public double getDouble(double d);
+    }
+
+    @Test
+    public static void testBlah() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.eval("new java.util.Comparator({})");
+    }
+
+    @Test
+    public static void testConversions() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("TestConversionsClass", TestConversions.class);
+        final TestConversions tc = (TestConversions)e.eval(
+                "function id(x) { return x };" +
+                "new TestConversionsClass.static({" +
+                "  getByte: id, getShort: id, getChar: id, getInt: id," +
+                "  getFloat: id, getLong: id, getDouble: id });");
+
+        Assert.assertEquals(Byte.MIN_VALUE, tc.getByte(Byte.MIN_VALUE));
+        Assert.assertEquals(Byte.MAX_VALUE, tc.getByte(Byte.MAX_VALUE));
+
+        Assert.assertEquals(Short.MIN_VALUE, tc.getShort(Short.MIN_VALUE));
+        Assert.assertEquals(Short.MAX_VALUE, tc.getShort(Short.MAX_VALUE));
+
+        Assert.assertEquals(Character.MIN_VALUE, tc.getChar(Character.MIN_VALUE));
+        Assert.assertEquals(Character.MAX_VALUE, tc.getChar(Character.MAX_VALUE));
+
+        Assert.assertEquals(Integer.MIN_VALUE, tc.getInt(Integer.MIN_VALUE));
+        Assert.assertEquals(Integer.MAX_VALUE, tc.getInt(Integer.MAX_VALUE));
+
+        Assert.assertEquals(Long.MIN_VALUE, tc.getLong(Long.MIN_VALUE));
+        Assert.assertEquals(Long.MAX_VALUE, tc.getLong(Long.MAX_VALUE));
+
+        Assert.assertEquals(Float.MIN_VALUE, tc.getFloat(Float.MIN_VALUE));
+        Assert.assertEquals(Float.MAX_VALUE, tc.getFloat(Float.MAX_VALUE));
+        Assert.assertEquals(Float.MIN_NORMAL, tc.getFloat(Float.MIN_NORMAL));
+        Assert.assertEquals(Float.POSITIVE_INFINITY, tc.getFloat(Float.POSITIVE_INFINITY));
+        Assert.assertEquals(Float.NEGATIVE_INFINITY, tc.getFloat(Float.NEGATIVE_INFINITY));
+        Assert.assertTrue(Float.isNaN(tc.getFloat(Float.NaN)));
+
+        Assert.assertEquals(Double.MIN_VALUE, tc.getDouble(Double.MIN_VALUE));
+        Assert.assertEquals(Double.MAX_VALUE, tc.getDouble(Double.MAX_VALUE));
+        Assert.assertEquals(Double.MIN_NORMAL, tc.getDouble(Double.MIN_NORMAL));
+        Assert.assertEquals(Double.POSITIVE_INFINITY, tc.getDouble(Double.POSITIVE_INFINITY));
+        Assert.assertEquals(Double.NEGATIVE_INFINITY, tc.getDouble(Double.NEGATIVE_INFINITY));
+        Assert.assertTrue(Double.isNaN(tc.getDouble(Double.NaN)));
+    }
+
+    private static ScriptEngine createEngine() {
+        // Use no optimistic typing so we run faster; short-running tests.
+        return new NashornScriptEngineFactory().getScriptEngine("-ot=false");
+    }
+
+    @Test
+    public static void testUnimplemented() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        final Runnable r = (Runnable) e.eval("new java.lang.Runnable({})");
+        Assert.assertNull(Context.getGlobal());
+        try {
+            r.run();
+            Assert.fail();
+        } catch(final UnsupportedOperationException x) {
+            // This is expected
+        }
+        // Check global has been restored
+        Assert.assertNull(Context.getGlobal());
+    }
+
+    public interface ThrowingRunnable {
+        public void run() throws Throwable;
+    }
+
+    @Test
+    public static void testUnimplementedWithThrowable() throws Throwable {
+        final ScriptEngine e = createEngine();
+        e.put("ThrowingRunnableClass", ThrowingRunnable.class);
+        final ThrowingRunnable r = (ThrowingRunnable) e.eval("new ThrowingRunnableClass.static({})");
+        Assert.assertNull(Context.getGlobal());
+        try {
+            r.run();
+            Assert.fail();
+        } catch(final UnsupportedOperationException x) {
+            // This is expected
+        }
+        // Check global has been restored
+        Assert.assertNull(Context.getGlobal());
+    }
+
+    public interface IntSupplierWithDefault {
+        public default int get() { return 42; }
+    }
+
+    @Test
+    public static void testUnimplementedWithDefault() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("IntSupplierWithDefault", IntSupplierWithDefault.class);
+        final IntSupplierWithDefault s1 = (IntSupplierWithDefault) e.eval("new IntSupplierWithDefault.static({})");
+        Assert.assertEquals(42, s1.get());
+        final IntSupplierWithDefault s2 = (IntSupplierWithDefault) e.eval("new IntSupplierWithDefault.static({ get: function() { return 43 }})");
+        Assert.assertEquals(43, s2.get());
+    }
+
+    public interface SupplierSupplier {
+        public Supplier<Object> getSupplier();
+    }
+
+    @Test
+    public static void testReturnAdapter() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("SupplierSupplier", SupplierSupplier.class);
+        final SupplierSupplier s = (SupplierSupplier) e.eval("new SupplierSupplier.static(function(){ return function() { return 'foo' } })");
+        Assert.assertEquals("foo", s.getSupplier().get());
+    }
+
+    public interface MaxParams {
+        public Object method(boolean p1, byte p2, short p3, char p4, int p5, float p6, long p7, double p8,
+                Object p9, Object p10, Object p11, Object p12, Object p13, Object p14, Object p15, Object p16,
+                Object p17, Object p18, Object p19, Object p20, Object p21, Object p22, Object p23, Object p24,
+                Object p25, Object p26, Object p27, Object p28, Object p29, Object p30, Object p31, Object p32,
+                Object p33, Object p34, Object p35, Object p36, Object p37, Object p38, Object p39, Object p40,
+                Object p41, Object p42, Object p43, Object p44, Object p45, Object p46, Object p47, Object p48,
+                Object p49, Object p50, Object p51, Object p52, Object p53, Object p54, Object p55, Object p56,
+                Object p57, Object p58, Object p59, Object p60, Object p61, Object p62, Object p63, Object p64,
+                Object p65, Object p66, Object p67, Object p68, Object p69, Object p70, Object p71, Object p72,
+                Object p73, Object p74, Object p75, Object p76, Object p77, Object p78, Object p79, Object p80,
+                Object p81, Object p82, Object p83, Object p84, Object p85, Object p86, Object p87, Object p88,
+                Object p89, Object p90, Object p91, Object p92, Object p93, Object p94, Object p95, Object p96,
+                Object p97, Object p98, Object p99, Object p100, Object p101, Object p102, Object p103, Object p104,
+                Object p105, Object p106, Object p107, Object p108, Object p109, Object p110, Object p111, Object p112,
+                Object p113, Object p114, Object p115, Object p116, Object p117, Object p118, Object p119, Object p120,
+                Object p121, Object p122, Object p123, Object p124, Object p125, Object p126, Object p127, Object p128,
+                Object p129, Object p130, Object p131, Object p132, Object p133, Object p134, Object p135, Object p136,
+                Object p137, Object p138, Object p139, Object p140, Object p141, Object p142, Object p143, Object p144,
+                Object p145, Object p146, Object p147, Object p148, Object p149, Object p150, Object p151, Object p152,
+                Object p153, Object p154, Object p155, Object p156, Object p157, Object p158, Object p159, Object p160,
+                Object p161, Object p162, Object p163, Object p164, Object p165, Object p166, Object p167, Object p168,
+                Object p169, Object p170, Object p171, Object p172, Object p173, Object p174, Object p175, Object p176,
+                Object p177, Object p178, Object p179, Object p180, Object p181, Object p182, Object p183, Object p184,
+                Object p185, Object p186, Object p187, Object p188, Object p189, Object p190, Object p191, Object p192,
+                Object p193, Object p194, Object p195, Object p196, Object p197, Object p198, Object p199, Object p200,
+                Object p201, Object p202, Object p203, Object p204, Object p205, Object p206, Object p207, Object p208,
+                Object p209, Object p210, Object p211, Object p212, Object p213, Object p214, Object p215, Object p216,
+                Object p217, Object p218, Object p219, Object p220, Object p221, Object p222, Object p223, Object p224,
+                Object p225, Object p226, Object p227, Object p228, Object p229, Object p230, Object p231, Object p232,
+                Object p233, Object p234, Object p235, Object p236, Object p237, Object p238, Object p239, Object p240,
+                Object p241, Object p242, Object p243, Object p244, Object p245, Object p246, Object p247, Object p248,
+                Object p249, Object p250, Object p251, Object p252);
+    }
+
+    @Test
+    public static void testMaxLengthAdapter() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("MaxParams", MaxParams.class);
+        final MaxParams s = (MaxParams) e.eval("new MaxParams.static(function(){ return arguments })");
+        final ScriptObjectMirror m = (ScriptObjectMirror)s.method(true, Byte.MIN_VALUE, Short.MIN_VALUE, 'a', Integer.MAX_VALUE, Float.MAX_VALUE, Long.MAX_VALUE, Double.MAX_VALUE,
+                "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
+                "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44",
+                "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62",
+                "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80",
+                "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98",
+                "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114",
+                "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128", "129", "130",
+                "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146",
+                "147", "148", "149", "150", "151", "152", "153", "154", "155", "156", "157", "158", "159", "160", "161", "162",
+                "163", "164", "165", "166", "167", "168", "169", "170", "171", "172", "173", "174", "175", "176", "177", "178",
+                "179", "180", "181", "182", "183", "184", "185", "186", "187", "188", "189", "190", "191", "192", "193", "194",
+                "195", "196", "197", "198", "199", "200", "201", "202", "203", "204", "205", "206", "207", "208", "209", "210",
+                "211", "212", "213", "214", "215", "216", "217", "218", "219", "220", "221", "222", "223", "224", "225", "226",
+                "227", "228", "229", "230", "231", "232", "233", "234", "235", "236", "237", "238", "239", "240", "241", "242",
+                "243", "244", "245", "246", "247", "248", "249", "250", "251");
+        Assert.assertEquals(true, m.getSlot(0));
+        Assert.assertEquals(Integer.valueOf(Byte.MIN_VALUE), m.getSlot(1)); // Byte becomes Integer
+        Assert.assertEquals(Integer.valueOf(Short.MIN_VALUE), m.getSlot(2)); // Short becomes Integer
+        Assert.assertEquals(Character.valueOf('a'), m.getSlot(3));
+        Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), m.getSlot(4));
+        Assert.assertEquals(Double.valueOf(Float.MAX_VALUE), m.getSlot(5)); // Float becomes Double
+        Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), m.getSlot(6)); // Long was untouched
+        Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), m.getSlot(7));
+        for (int i = 8; i < 252; ++i) {
+            Assert.assertEquals(String.valueOf(i), m.getSlot(i));
+        }
+    }
+
+    public interface TestScriptObjectMirror {
+        public JSObject getJSObject();
+        public ScriptObjectMirror getScriptObjectMirror();
+        public Map<Object, Object> getMap();
+        public Bindings getBindings();
+    }
+
+    @Test
+    public static void testReturnsScriptObjectMirror() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("TestScriptObjectMirrorClass", TestScriptObjectMirror.class);
+        final TestScriptObjectMirror tsom = (TestScriptObjectMirror)e.eval(
+                "new TestScriptObjectMirrorClass.static({\n" +
+                "  getJSObject: function() { return { 'kind': 'JSObject' } },\n" +
+                "  getScriptObjectMirror: function() { return { 'kind': 'ScriptObjectMirror' } },\n" +
+                "  getMap: function() { return { 'kind': 'Map' } },\n" +
+                "  getBindings: function() { return { 'kind': 'Bindings' } } })\n");
+        Assert.assertEquals(tsom.getJSObject().getMember("kind"), "JSObject");
+        Assert.assertEquals(tsom.getScriptObjectMirror().getMember("kind"), "ScriptObjectMirror");
+        Assert.assertEquals(tsom.getMap().get("kind"), "Map");
+        Assert.assertEquals(tsom.getBindings().get("kind"), "Bindings");
+    }
+
+    public interface TestListAdapter {
+        public List<Object> getList();
+        public Collection<Object> getCollection();
+        public Queue<Object> getQueue();
+        public Deque<Object> getDequeue();
+    }
+
+    @Test
+    public static void testReturnsListAdapter() throws ScriptException {
+        final ScriptEngine e = createEngine();
+        e.put("TestListAdapterClass", TestListAdapter.class);
+        final TestListAdapter tla = (TestListAdapter)e.eval(
+                "new TestListAdapterClass.static({\n" +
+                "  getList: function() { return [ 'List' ] },\n" +
+                "  getCollection: function() { return [ 'Collection' ] },\n" +
+                "  getQueue: function() { return [ 'Queue' ] },\n" +
+                "  getDequeue: function() { return [ 'Dequeue' ] } })\n");
+        Assert.assertEquals(tla.getList().get(0), "List");
+        Assert.assertEquals(tla.getCollection().iterator().next(), "Collection");
+        Assert.assertEquals(tla.getQueue().peek(), "Queue");
+        Assert.assertEquals(tla.getDequeue().peek(), "Dequeue");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/Makefile	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,114 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+#
+# This is a temporary standalone makefile
+#
+
+BUILD_DIR := $(shell pwd)/build
+CLASSES_DIR := ${BUILD_DIR}/classes
+IMAGE_DIR := ${BUILD_DIR}/image
+RUN_DIR := $(shell pwd)/run
+
+SRC_DIR := src/share/classes/
+SOURCES := ${SRC_DIR}/jdk/test/failurehandler/*.java                   \
+           ${SRC_DIR}/jdk/test/failurehandler/action/*.java            \
+           ${SRC_DIR}/jdk/test/failurehandler/jtreg/*.java             \
+           ${SRC_DIR}/jdk/test/failurehandler/value/*.java
+
+CONF_DIR = src/share/conf
+
+JAVA_RELEASE = 7
+
+TARGET_JAR = ${IMAGE_DIR}/lib/jtregFailureHandler.jar
+
+OS_NAME := $(shell uname -o 2>&1)
+
+ifeq ("${OS_NAME}", "Cygwin")
+BUILD_DIR := $(shell cygpath -m "${BUILD_DIR}")
+CLASSES_DIR := $(shell cygpath -m "${CLASSES_DIR}")
+IMAGE_DIR := $(shell cygpath -m "${IMAGE_DIR}") RUN_DIR := $(shell cygpath -m "${RUN_DIR}")
+SRC_DIR := $(shell cygpath -m "${SRC_DIR}")
+JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}")
+CC := "cl.exe"
+endif
+
+all: clean test
+
+native: require_env
+ifeq ("${OS_NAME}", "Cygwin")
+    "${CC}" src/windows/native/jdk/test/failurehandler/jtreg/*.c            \
+        -I"$(shell cygpath -w ${JAVA_HOME}/include)"                        \
+        -I"$(shell cygpath -w ${JAVA_HOME}/include/win32)"                  \
+        /link /MACHINE:X64 /DLL /OUT:timeoutHandler.dll
+endif
+
+check_defined = $(foreach 1,$1,$(__check_defined))
+__check_defined = $(if $(value $1),, $(error $1 is not set))
+
+classes: require_env
+    mkdir -p ${IMAGE_DIR}/bin ${IMAGE_DIR}/lib ${CLASSES_DIR}
+    "${JAVA_HOME}"/bin/javac -target ${JAVA_RELEASE} -source ${JAVA_RELEASE}  \
+        -sourcepath $(shell pwd)                                              \
+        -classpath ${JTREG_HOME}/lib/jtreg.jar:${JAVA_HOME}/lib/tools.jar     \
+        -d ${CLASSES_DIR}                                                     \
+        ${SOURCES}
+    "${JAVA_HOME}"/bin/jar cf ${TARGET_JAR} -C ${CLASSES_DIR} .
+    "${JAVA_HOME}"/bin/jar uf ${TARGET_JAR} -C ${CONF_DIR} .
+
+#
+# Use JTREG_TEST_OPTS for test VM options
+# Use JTREG_TESTS for jtreg tests parameter
+#
+test: require_env build
+    rm -rf ${RUN_DIR}
+    mkdir -p ${RUN_DIR}
+    "${JTREG_HOME}"/bin/jtreg                                               \
+        -jdk:"${JAVA_HOME}"                                                 \
+        ${JTREG_TEST_OPTS}                                                  \
+        -timeout:0.1 -va -retain:all                                        \
+        -noreport                                                           \
+        -agentvm                                                            \
+        -thd:"${TARGET_JAR}"                                                \
+        -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler   \
+        -od:"${TARGET_JAR}"                                                 \
+        -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver       \
+        -w:${RUN_DIR}/JTwork -r:${RUN_DIR}/JTreport                         \
+        $(if ${JTREG_TESTS}, ${JTREG_TESTS}, test)                          \
+        && false || true
+
+debug: JTREG_TEST_OPTS += "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'"
+debug: test
+
+require_env:
+    $(call check_defined, JAVA_HOME)
+    $(call check_defined, JTREG_HOME)
+
+clean:
+    rm -rf "${BUILD_DIR}" "${RUN_DIR}"
+
+build: classes native
+
+.PHONY: all build classes native test require_env clean
+.DEFAULT: all
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/README	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,107 @@
+Copyright (c) 2015, 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.
+
+
+
+DESCRIPTION
+
+The purpose of this library is gathering diagnostic information on test
+failures and timeouts. The library runs platform specific tools, which are
+configured in the way described below. The collected data will be available
+in HTML format next to JTR files.
+
+The library uses JTHarness Observer and jtreg TimeoutHandler extensions points.
+
+DEPENDENCES
+
+The library requires jtreg 4b13+ and JDK 7+.
+
+BUILDING
+
+To build a library, one should simply run make with 'JTREG_HOME' and
+'JAVA_HOME' environment variables set. 'JAVA_HOME' should contain path to JDK,
+'JTREG_HOME' -- path to jtreg.
+
+'image/lib/jtregFailureHandler.jar' is created on successful build.
+
+CONFIGURATION
+
+Properties files are used to configure the library. They define which actions
+to be performed in case of individual test failure or timeout. Each platform
+family uses its own property file (named '<platform>.properties'). For platform
+independent actions, 'common.properties' is used.
+
+Actions to be performed on each failure are listed in 'environment' property.
+Extra actions for timeouts are listed in 'onTimeout'.
+
+Each action is defined via the following parameters:
+ - 'javaOnly' -- run the action only for java applications, false by default
+ - 'app' -- an application to run, mandatory parameter
+ - 'args' -- application command line arguments, none by default
+ - 'params' -- a structure which defines how an application should be run,
+ described below
+
+Actions listed in 'onTimeout' are "patterned" actions. Besides the parameters
+listed above, they also have 'pattern' parameter -- a string which will be
+replaced by PID in 'args' parameter before action execution.
+
+'params' structure has the following parameters:
+ - repeat -- how many times an action will be run, 1 by default
+ - pause -- delay in ms between iterations, 500 by default
+ - timeout -- time limitation for iteration in ms, 20 000 by default
+ - stopOnError -- if true, an action will be interrupted after the first error,
+ false by default
+
+From '<platform>.properties', the library reads the following parameters
+ - 'config.execSuffix' -- a suffix for all binary application file names
+ - 'config.getChildren' -- a "patterned" action used to get the list of all
+ children
+
+For simplicity we use parameter values inheritance. This means that we are
+looking for the most specified parameter value. If we do not find it, we are
+trying to find less specific value by reducing prefix.
+For example, if properties contains 'p1=A', 'a.p1=B', 'a.b.p1=C', then
+parameter 'p1' will be:
+ - 'C' for 'a.b.c'
+ - 'B' for 'a.c'
+ - 'A' for 'b.c'
+
+RUNNING
+
+To enable the library in jtreg, the following options should be set:
+ - '-timeoutHandlerDir' points to the built jar ('jtregFailureHandler.jar')
+ - '-observerDir' points to the built jar
+ - '-timeoutHandler' equals to jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler
+ - '-observer' equals to jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver
+
+In case of environment issues during an action execution, such as missing
+application, hung application, lack of disk space, etc, the corresponding
+warning appears and the library proceeds to next action.
+
+EXAMPLES
+
+$ ${JTREG_HOME}/bin/jtreg -jdk:${JAVA_HOME}                                   \
+ -timeoutHandlerDir:./image/lib/jtregFailureHandler.jar                       \
+ -observerDir:./image/lib/jtregFailureHandler.jar                             \
+ -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler\
+ -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver         \
+ ${WS}/hotspot/test/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ElapsedTimePrinter.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import java.io.PrintWriter;
+import java.util.concurrent.TimeUnit;
+
+public class ElapsedTimePrinter implements AutoCloseable {
+    private final String name;
+    private final PrintWriter out;
+    private final Stopwatch stopwatch;
+
+    public ElapsedTimePrinter(Stopwatch stopwatch, String name,
+                              PrintWriter out) {
+        this.stopwatch = stopwatch;
+        this.name = name;
+        this.out = out;
+        stopwatch.start();
+    }
+
+    @Override
+    public void close()  {
+        stopwatch.stop();
+        out.printf("%s took %d s%n", name,
+                TimeUnit.NANOSECONDS.toSeconds(stopwatch.getElapsedTimeNs()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/EnvironmentInfoGatherer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+public interface EnvironmentInfoGatherer {
+    void gatherEnvironmentInfo(HtmlSection section);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/GathererFactory.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import jdk.test.failurehandler.action.ActionHelper;
+import jdk.test.failurehandler.value.InvalidValueException;
+
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.util.Properties;
+
+public final class GathererFactory {
+    private final Path workdir;
+    private final Path[] jdks;
+    private final PrintWriter log;
+    private final String osName;
+
+    public GathererFactory(String osName, Path workdir, PrintWriter log, Path... jdks) {
+        this.osName = osName;
+        this.workdir = workdir;
+        this.log = log;
+        this.jdks = jdks;
+    }
+
+    public EnvironmentInfoGatherer getEnvironmentInfoGatherer() {
+        return create();
+    }
+
+    public ProcessInfoGatherer getProcessInfoGatherer() {
+        return create();
+    }
+
+    private ToolKit create() {
+        Properties osProperty = Utils.getProperties(osName);
+        try {
+            ActionHelper helper = new ActionHelper(workdir, "config", osProperty, jdks);
+            return new ToolKit(helper, log, osName, "common");
+        } catch (InvalidValueException e) {
+            throw new IllegalStateException("can't create tool kit", e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import java.io.PrintWriter;
+import java.util.Objects;
+
+public class HtmlPage implements AutoCloseable {
+    private final PrintWriter writer;
+    private final HtmlSection rootSection;
+
+    public HtmlPage(PrintWriter writer) {
+        Objects.requireNonNull(writer, "writer cannot be null");
+        this.writer = writer;
+        rootSection = new HtmlSection(writer);
+    }
+
+    @Override
+    public void close() {
+        writer.close();
+    }
+
+    public HtmlSection getRootSection() {
+        return rootSection;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+public class HtmlSection {
+    protected final HtmlSection rootSection;
+    protected final String id;
+    protected final String name;
+
+    public PrintWriter getWriter() {
+        return textWriter;
+    }
+
+    protected final PrintWriter pw;
+    protected final PrintWriter textWriter;
+    protected boolean closed;
+
+    private HtmlSection child;
+
+
+    public HtmlSection(PrintWriter pw) {
+        this(pw, "", null, null);
+    }
+
+    private HtmlSection(PrintWriter pw, String id, String name, HtmlSection rootSection) {
+        this.pw = pw;
+        textWriter = new PrintWriter(new HtmlFilterWriter(pw));
+        this.id = id;
+        this.name = name;
+        child = null;
+        // main
+        if (rootSection == null) {
+            this.rootSection = this;
+            this.pw.println("<html>");
+            this.pw.println("<style>\n"
+                    + "div { display:none;}\n"
+                    + "</style>\n"
+                    + "\n"
+                    + "<script>\n"
+                    + "function show(e) {\n"
+                    + "  while (e != null) {\n"
+                    + "    if (e.tagName == 'DIV') {\n"
+                    + "      e.style.display = 'block';\n"
+                    + "    }\n"
+                    + "    e = e.parentNode;\n"
+                    + "  }\n"
+                    + "}\n"
+                    + "\n"
+                    + "function toggle(id) {\n"
+                    + "  e = document.getElementById(id);\n"
+                    + "  d = e.style.display;\n"
+                    + "  if (d == 'block') {\n"
+                    + "    e.style.display = 'none';\n"
+                    + "  } else {\n"
+                    + "    show(e);\n"
+                    + "  }\n"
+                    + "}\n"
+                    + "\n"
+                    + "function main() {\n"
+                    + "  index = location.href.indexOf(\"#\");"
+                    + "  if (index != -1) {\n"
+                    + "    show(document.getElementById(location.href.substring(index + 1)));\n"
+                    + "  }\n"
+                    + "}\n"
+                    + "\n"
+                    + "</script>\n"
+                    + "</head>");
+
+            this.pw.println("<body onload='main()'>");
+        } else {
+            this.rootSection = rootSection;
+            this.pw.print("<ul>");
+        }
+    }
+
+    public HtmlSection createChildren(String section) {
+        if (child != null) {
+            if (child.name.equals(section)) {
+                return child;
+            }
+            child.close();
+        }
+        child = new SubSection(this, section, rootSection);
+        return child;
+    }
+
+    protected final void removeChild(HtmlSection child) {
+        if (this.child == child) {
+            this.child = null;
+        }
+    }
+
+    public void close() {
+        closeChild();
+        if (closed) {
+            return;
+        }
+        closed = true;
+
+        if (rootSection == this) {
+            pw.println("</body>");
+            pw.println("</html>");
+            pw.close();
+        } else {
+            pw.println("</ul>");
+        }
+
+    }
+
+    protected final void closeChild() {
+        if (child != null) {
+            child.close();
+            child = null;
+        }
+    }
+
+    public void link(HtmlSection section, String child, String name) {
+        String path = section.id;
+        if (path.isEmpty()) {
+            path = child;
+        } else if (child != null) {
+            path = String.format("%s.%s", path, child);
+        }
+        pw.printf("<a href=\"#%1$s\" onclick=\"show(document.getElementById('%1$s')); return true;\">%2$s</a>%n",
+                path, name);
+    }
+
+    public HtmlSection createChildren(String[] sections) {
+        int i = 0;
+        int n = sections.length;
+        HtmlSection current = rootSection;
+        if (current != null) {
+            for (; i < n && current.child != null;
+                    ++i, current = current.child) {
+                if (!sections[i].equals(current.child.name)) {
+                    break;
+                }
+            }
+        }
+        for (; i < n; ++i) {
+            current = current.createChildren(sections[i]);
+        }
+        return current;
+    }
+
+    private static class SubSection extends HtmlSection {
+        private final HtmlSection parent;
+
+        public SubSection(HtmlSection parent, String name,
+                          HtmlSection rootSection) {
+            super(parent.pw,
+                    parent.id.isEmpty()
+                            ? name
+                            : String.format("%s.%s", parent.id, name),
+                    name, rootSection);
+            this.parent = parent;
+            pw.printf("<li><a name='%1$s'/><a href='#%1$s' onclick=\"toggle('%1$s'); return false;\">%2$s</a><div id='%1$s'><code><pre>",
+                    id, name);
+        }
+
+        @Override
+        public void close() {
+            closeChild();
+            if (closed) {
+                return;
+            }
+            pw.print("</pre></code></div></li><!-- " + id + "-->");
+            parent.removeChild(this);
+            super.close();
+        }
+    }
+
+    private static class HtmlFilterWriter extends FilterWriter {
+        public HtmlFilterWriter(PrintWriter pw) {
+            super(pw);
+        }
+
+        @Override
+        public void write(int c) throws IOException {
+            switch (c) {
+                case '<':
+                    super.write("&lt;", 0, 4);
+                    break;
+                case '>':
+                    super.write("&gt;", 0, 4);
+                    break;
+                case '"':
+                    super.write("&quot;", 0, 5);
+                    break;
+                case '&':
+                    super.write("&amp;", 0, 4);
+                    break;
+                default:
+                    super.write(c);
+            }
+        }
+
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            for (int i = off; i < len; ++i){
+                write(cbuf[i]);
+            }
+        }
+
+        @Override
+        public void write(String str, int off, int len) throws IOException {
+            for (int i = off; i < len; ++i){
+                write(str.charAt(i));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ProcessInfoGatherer.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+public interface ProcessInfoGatherer {
+    void gatherProcessInfo(HtmlSection section, long pid);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/Stopwatch.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+public final class Stopwatch {
+    protected boolean isResultAvailable;
+    protected boolean isRunning;
+
+    private long startTimeNs;
+    private long stopTimeNs;
+
+    public Stopwatch() {
+        isResultAvailable = false;
+    }
+
+    /**
+     * Starts measuring time.
+     */
+    public void start() {
+        startTimeNs = System.nanoTime();
+        isRunning = true;
+    }
+
+    /**
+     * Stops measuring time.
+     */
+    public void stop() {
+        if (!isRunning) {
+            throw new IllegalStateException(" hasn't been started");
+        }
+        stopTimeNs = System.nanoTime();
+        isRunning = false;
+        isResultAvailable = true;
+    }
+
+    /**
+     * @return time in nanoseconds measured between
+     * calls of {@link #start()} and {@link #stop()} methods.
+     *
+     * @throws IllegalStateException if called without preceding
+     * {@link #start()} {@link #stop()} method
+     */
+    public long getElapsedTimeNs() {
+        if (isRunning) {
+            throw new IllegalStateException("hasn't been stopped");
+        }
+        if (!isResultAvailable) {
+            throw new IllegalStateException("was not run");
+        }
+        return stopTimeNs - startTimeNs;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ToolKit.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import jdk.test.failurehandler.action.ActionSet;
+import jdk.test.failurehandler.action.ActionHelper;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+public class ToolKit implements EnvironmentInfoGatherer, ProcessInfoGatherer {
+    private final List<ActionSet> actions = new ArrayList<>();
+    private final ActionHelper helper;
+
+    public ToolKit(ActionHelper helper, PrintWriter log, String... names) {
+        this.helper = helper;
+        for (String name : names) {
+            actions.add(new ActionSet(helper, log, name));
+        }
+    }
+
+    @Override
+    public void gatherEnvironmentInfo(HtmlSection section) {
+        for (ActionSet set : actions) {
+            set.gatherEnvironmentInfo(section);
+        }
+    }
+
+    @Override
+    public void gatherProcessInfo(HtmlSection section, long pid) {
+        Queue<Long> pids = new LinkedList<>();
+        pids.add(pid);
+        for (Long p = pids.poll(); p != null; p = pids.poll()) {
+            HtmlSection pidSection = section.createChildren("" + p);
+            for (ActionSet set : actions) {
+                set.gatherProcessInfo(pidSection, p);
+            }
+            List<Long> children = helper.getChildren(pidSection, p);
+            if (!children.isEmpty()) {
+                HtmlSection s = pidSection.createChildren("children");
+                for (Long c : children) {
+                    s.link(section, c.toString(), c.toString());
+                }
+                pids.addAll(children);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/Utils.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Properties;
+
+public final class Utils {
+    private static final int BUFFER_LENGTH = 1024;
+
+    public static String prependPrefix(String prefix, String name) {
+        return  (prefix == null || prefix.isEmpty())
+                ? name
+                : (name == null || name.isEmpty())
+                  ? prefix
+                  : String.format("%s.%s", prefix, name);
+    }
+
+    public static void copyStream(InputStream in, OutputStream out)
+            throws IOException {
+        int n;
+        byte[] buffer = new byte[BUFFER_LENGTH];
+        while ((n = in.read(buffer)) != -1) {
+            out.write(buffer, 0, n);
+        }
+        out.flush();
+    }
+
+    public static void copyStream(Reader in, Writer out)
+            throws IOException {
+        int n;
+        char[] buffer = new char[BUFFER_LENGTH];
+        while ((n = in.read(buffer)) != -1) {
+            out.write(buffer, 0, n);
+        }
+        out.flush();
+    }
+
+    public static Properties getProperties(String name) {
+        Properties properties = new Properties();
+        String resourceName = String.format(
+                "/%s.%s", name.toLowerCase(), "properties");
+        InputStream stream = Utils.class.getResourceAsStream(resourceName);
+        if (stream == null) {
+            throw new IllegalStateException(String.format(
+                    "resource '%s' doesn't exist%n", resourceName));
+        }
+        try {
+            try {
+                properties.load(stream);
+            } finally {
+                stream.close();
+            }
+        } catch (IOException e) {
+            throw new IllegalStateException(String.format(
+                    "can't read resource '%s' : %s%n",
+                    resourceName, e.getMessage()), e);
+        }
+        return properties;
+    }
+
+    private Utils() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/Action.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import jdk.test.failurehandler.HtmlSection;
+
+public interface Action {
+    boolean isJavaOnly();
+    HtmlSection getSection(HtmlSection section);
+
+    ActionParameters getParameters();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.VirtualMachineDescriptor;
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.Stopwatch;
+import jdk.test.failurehandler.Utils;
+
+import java.io.BufferedReader;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.TimeUnit;
+
+public class ActionHelper {
+    private final Path workDir;
+    @Value(name = "execSuffix")
+    private String executableSuffix = "";
+    private Path[] paths;
+
+    private final PatternAction getChildren;
+
+    public ActionHelper(Path workDir, String prefix, Properties properties,
+                        Path... jdks) throws InvalidValueException {
+        this.workDir = workDir.toAbsolutePath();
+        getChildren = new PatternAction("children",
+                Utils.prependPrefix(prefix, "getChildren"), properties);
+        ValueHandler.apply(this, properties, prefix);
+        String[] pathStrings = System.getenv("PATH").split(File.pathSeparator);
+        paths = new Path[pathStrings.length];
+        for (int i = 0; i < paths.length; ++i) {
+            paths[i] = Paths.get(pathStrings[i]);
+        }
+        addJdks(jdks);
+    }
+
+    public List<Long> getChildren(HtmlSection section, long pid) {
+        String pidStr = "" + pid;
+        ProcessBuilder pb = getChildren.prepareProcess(section, this, pidStr);
+        PrintWriter log = getChildren.getSection(section).getWriter();
+        CharArrayWriter writer = new CharArrayWriter();
+        ExitCode code = run(log, writer, pb, getChildren.getParameters());
+        Reader output = new CharArrayReader(writer.toCharArray());
+
+        if (!ExitCode.OK.equals(code)) {
+            log.println("WARNING: get children pids action failed");
+            try {
+                Utils.copyStream(output, log);
+            } catch (IOException e) {
+                e.printStackTrace(log);
+            }
+            return Collections.emptyList();
+        }
+
+        List<Long> result = new ArrayList<>();
+        try {
+            try (BufferedReader reader = new BufferedReader(output)) {
+                String line;
+                while ((line = reader.readLine()) != null) {
+                    String value = line.trim();
+                    if (value.isEmpty()) {
+                        // ignore empty lines
+                        continue;
+                    }
+                    try {
+                        result.add(Long.valueOf(value));
+                    } catch (NumberFormatException e) {
+                        log.printf("WARNING: can't parse child pid %s : %s%n",
+                                line, e.getMessage());
+                        e.printStackTrace(log);
+                    }
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace(log);
+        }
+        return result;
+    }
+
+    public ProcessBuilder prepareProcess(PrintWriter log, String app,
+                                         String... args) {
+        File appBin = findApp(app);
+        if (appBin == null) {
+            log.printf("ERROR: can't find %s in %s.%n",
+                    app, Arrays.toString(paths));
+            return null;
+        }
+        List<String> command = new ArrayList<>(args.length + 1);
+        command.add(appBin.toString());
+        Collections.addAll(command, args);
+        return new ProcessBuilder()
+                .command(command)
+                .directory(workDir.toFile());
+    }
+
+    private File findApp(String app) {
+        String name = app + executableSuffix;
+        for (Path pathElem : paths) {
+            File result = pathElem.resolve(name).toFile();
+            if (result.exists()) {
+                return result;
+            }
+        }
+        return null;
+    }
+
+    private void addJdks(Path[] jdkPaths) {
+        if (jdkPaths != null && jdkPaths.length != 0) {
+            Path[] result = new Path[jdkPaths.length + paths.length];
+            for (int i = 0; i < jdkPaths.length; ++i) {
+                result[i] = jdkPaths[i].resolve("bin");
+            }
+            System.arraycopy(paths, 0, result, jdkPaths.length, paths.length);
+            paths = result;
+        }
+    }
+
+    private ExitCode run(PrintWriter log, Writer out, ProcessBuilder pb,
+                    ActionParameters params) {
+        char[] lineChars = new char[40];
+        Arrays.fill(lineChars, '-');
+        String line = new String(lineChars);
+        Stopwatch stopwatch = new Stopwatch();
+        stopwatch.start();
+
+        log.printf("%s%n[%tF %<tT] %s%n%1$s%n", line, new Date(), pb.command());
+        Process process;
+        KillerTask killer;
+
+        ExitCode result = ExitCode.NEVER_STARTED;
+
+        try {
+            process = pb.start();
+            killer = new KillerTask(process);
+            killer.schedule(params.timeout);
+            Utils.copyStream(new InputStreamReader(process.getInputStream()),
+                    out);
+            try {
+                result = new ExitCode(process.waitFor());
+                killer.cancel();
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                if (!killer.cancel()) {
+                    log.println(
+                            "WARNING: interrupted when waiting for the tool:");
+                    e.printStackTrace(log);
+                }
+            }
+            if (killer.hasTimedOut()) {
+                log.printf(
+                        "WARNING: tool timed out: killed process after %d ms%n",
+                        TimeUnit.MILLISECONDS.toMicros(params.timeout));
+                result = ExitCode.TIMED_OUT;
+            }
+        } catch (IOException e) {
+            e.printStackTrace(log);
+            result = ExitCode.LAUNCH_ERROR;
+        }
+
+        stopwatch.stop();
+        log.printf("%s%n[%tF %<tT] exit code : %d time : %d ms%n%1$s%n",
+                line, new Date(), result.value,
+                TimeUnit.MILLISECONDS.toSeconds(stopwatch.getElapsedTimeNs()));
+        return result;
+    }
+
+    public void runPatternAction(SimpleAction action, HtmlSection section) {
+        if (action != null) {
+            HtmlSection subSection = action.getSection(section);
+            PrintWriter log = subSection.getWriter();
+            ProcessBuilder pb = action.prepareProcess(log, this);
+            exec(subSection, pb, action.getParameters());
+        }
+    }
+
+    public void runPatternAction(PatternAction action, HtmlSection section,
+                                 String value) {
+        if (action != null) {
+            ProcessBuilder pb = action.prepareProcess(section, this, value);
+            HtmlSection subSection = action.getSection(section);
+            exec(subSection, pb, action.getParameters());
+        }
+    }
+
+    public boolean isJava(long pid, PrintWriter log) {
+        ProcessBuilder pb = prepareProcess(log, "jps", "-q");
+        if (pb == null) {
+            return false;
+        }
+        pb.redirectErrorStream(true);
+        boolean result = false;
+        String pidStr = "" + pid;
+        try {
+            Process process = pb.start();
+            try (BufferedReader reader = new BufferedReader(
+                    new InputStreamReader(process.getInputStream()))) {
+                String line;
+                while ((line = reader.readLine()) != null){
+                    if (pidStr.equals(line)) {
+                        result = true;
+                    }
+                }
+            }
+            process.waitFor();
+        } catch (IOException e) {
+            log.printf("WARNING: can't run jps : %s%n", e.getMessage());
+            e.printStackTrace(log);
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            e.printStackTrace(log);
+        }
+        return result;
+    }
+
+    private static class KillerTask extends TimerTask {
+        private static final Timer WATCHDOG = new Timer("WATCHDOG", true);
+        private final Process process;
+        private boolean timedOut;
+
+        public KillerTask(Process process) {
+            this.process = process;
+        }
+
+        public void run() {
+            try {
+                process.exitValue();
+            } catch (IllegalThreadStateException e) {
+                // !prepareProcess.isAlive()
+                process.destroy();
+                timedOut = true;
+            }
+        }
+
+        public boolean hasTimedOut() {
+            return timedOut;
+        }
+
+        public void schedule(long timeout) {
+            if (timeout > 0) {
+                WATCHDOG.schedule(this, timeout);
+            }
+        }
+    }
+
+    private void exec(HtmlSection section, ProcessBuilder process,
+                      ActionParameters params) {
+        if (process == null) {
+            return;
+        }
+        PrintWriter sectionWriter = section.getWriter();
+        if (params.repeat > 1) {
+            for (int i = 0, n = params.repeat; i < n; ++i) {
+                HtmlSection iteration = section.createChildren(
+                        String.format("iteration_%d", i));
+                PrintWriter writer = iteration.getWriter();
+                ExitCode exitCode = run(writer, writer, process, params);
+                if (params.stopOnError && !ExitCode.OK.equals(exitCode)) {
+                    sectionWriter.printf(
+                            "ERROR: non zero exit code[%d] -- break.",
+                            exitCode.value);
+                    break;
+                }
+                try {
+                    Thread.sleep(params.pause);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    e.printStackTrace(sectionWriter);
+                }
+            }
+        } else {
+            run(section.getWriter(), section.getWriter(), process, params);
+        }
+    }
+
+    /**
+     * Special values for prepareProcess exit code.
+     *
+     * <p>Can we clash with normal codes?
+     * On Solaris and Linux, only [0..255] are returned.
+     * On Windows, prepareProcess exit codes are stored in unsigned int.
+     * On MacOSX no limits (except it should fit C int type)
+     * are defined in the exit() man pages.
+     */
+    private static class ExitCode {
+        /** Process exits gracefully */
+        public static final ExitCode OK = new ExitCode(0);
+        /** Error launching prepareProcess */
+        public static final ExitCode LAUNCH_ERROR = new ExitCode(-1);
+        /** Application prepareProcess has been killed by watchdog due to timeout */
+        public static final ExitCode TIMED_OUT = new ExitCode(-2);
+        /** Application prepareProcess has never been started due to program logic */
+        public static final ExitCode NEVER_STARTED = new ExitCode(-3);
+
+        public final int value;
+
+        private ExitCode(int value) {
+            this.value = value;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+
+            ExitCode exitCode = (ExitCode) o;
+            return value == exitCode.value;
+        }
+
+        @Override
+        public int hashCode() {
+            return value;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionParameters.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import jdk.test.failurehandler.value.DefaultValue;
+import jdk.test.failurehandler.value.Value;
+
+public class ActionParameters {
+    @Value (name = "repeat")
+    @DefaultValue (value = "1")
+    public int repeat = 1;
+
+    @Value (name = "pause")
+    @DefaultValue (value = "500")
+    public long pause = 500;
+
+    @Value (name = "stopOnError")
+    @DefaultValue (value = "false")
+    public boolean stopOnError = false;
+
+    @Value (name = "timeout")
+    @DefaultValue (value = "" + 20_000L)
+    public long timeout = -1L;
+
+    public ActionParameters() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionSet.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import jdk.test.failurehandler.ProcessInfoGatherer;
+import jdk.test.failurehandler.EnvironmentInfoGatherer;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.Utils;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class ActionSet implements ProcessInfoGatherer, EnvironmentInfoGatherer {
+    private static final String ENVIRONMENT_PROPERTY = "environment";
+    private static final String ON_PID_PROPERTY = "onTimeout";
+
+    private final ActionHelper helper;
+
+    public String getName() {
+        return name;
+    }
+
+    private final String name;
+    private final List<SimpleAction> environmentActions;
+    private final List<PatternAction> processActions;
+
+
+    public ActionSet(ActionHelper helper, PrintWriter log, String name) {
+        this.helper = helper;
+        this.name = name;
+
+        Properties p = Utils.getProperties(name);
+        environmentActions = getSimpleActions(log, p, ENVIRONMENT_PROPERTY);
+        processActions = getPatternActions(log, p, ON_PID_PROPERTY);
+    }
+
+    private List<SimpleAction> getSimpleActions(PrintWriter log, Properties p,
+                                                String key) {
+        String[] tools = getTools(log, p, key);
+        List<SimpleAction> result = new ArrayList<>(tools.length);
+        for (String tool : tools) {
+            try {
+                SimpleAction action = new SimpleAction(
+                        Utils.prependPrefix(name, tool), tool, p);
+                result.add(action);
+            } catch (Exception e) {
+                log.printf("ERROR: %s cannot be created : %s %n",
+                        tool, e.getMessage());
+                e.printStackTrace(log);
+            }
+        }
+        return result;
+    }
+
+    private List<PatternAction> getPatternActions(PrintWriter log,
+                                                  Properties p, String key) {
+        String[] tools = getTools(log, p, key);
+        List<PatternAction> result = new ArrayList<>(tools.length);
+        for (String tool : tools) {
+            try {
+                PatternAction action = new PatternAction(
+                        Utils.prependPrefix(name, tool), tool, p);
+                result.add(action);
+            } catch (Exception e) {
+                log.printf("ERROR: %s cannot be created : %s %n",
+                        tool, e.getMessage());
+                e.printStackTrace(log);
+            }
+        }
+        return result;
+    }
+
+    private String[] getTools(PrintWriter writer, Properties p, String key) {
+        String value = p.getProperty(key);
+        if (value == null || value.isEmpty()) {
+            writer.printf("ERROR: '%s' property is empty%n", key);
+            return new String[]{};
+        }
+        return value.split(" ");
+    }
+
+
+    @Override
+    public void gatherProcessInfo(HtmlSection section, long pid) {
+        String pidStr = "" + pid;
+        for (PatternAction action : processActions) {
+            if (action.isJavaOnly()) {
+                if (helper.isJava(pid, section.getWriter())) {
+                    helper.runPatternAction(action, section, pidStr);
+                }
+            } else {
+                helper.runPatternAction(action, section, pidStr);
+            }
+        }
+    }
+
+    @Override
+    public void gatherEnvironmentInfo(HtmlSection section) {
+        for (SimpleAction action : environmentActions) {
+            helper.runPatternAction(action, section);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+
+import java.util.Properties;
+
+public class PatternAction implements Action {
+    @Value(name = "pattern")
+    private String pattern = null;
+
+    private final SimpleAction action;
+    private final String[] originalArgs;
+
+    public PatternAction(String id, Properties properties)
+            throws InvalidValueException {
+        this(id, id, properties);
+    }
+
+    public PatternAction(String name, String id, Properties properties)
+            throws InvalidValueException {
+        action = new SimpleAction(("pattern." + name), id, properties);
+        ValueHandler.apply(this, properties, id);
+        originalArgs = action.args.clone();
+    }
+
+    public ProcessBuilder prepareProcess(HtmlSection section,
+                                         ActionHelper helper, String value) {
+        action.sections[0] = value;
+        section = getSection(section);
+        String[] args = action.args;
+        System.arraycopy(originalArgs, 0, args, 0, originalArgs.length);
+
+        for (int i = 0, n = args.length; i < n; ++i) {
+            args[i] = args[i].replace(pattern, value) ;
+        }
+        return action.prepareProcess(section.getWriter(), helper);
+    }
+
+    @Override
+    public HtmlSection getSection(HtmlSection section) {
+        return action.getSection(section);
+    }
+
+    @Override
+    public ActionParameters getParameters() {
+        return action.getParameters();
+    }
+
+    @Override
+    public boolean isJavaOnly() {
+        return action.isJavaOnly();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/SimpleAction.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.action;
+
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.value.SubValues;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+import jdk.test.failurehandler.value.DefaultValue;
+
+import java.io.PrintWriter;
+import java.util.Properties;
+
+public class SimpleAction implements Action {
+    /* package-private */ final String[] sections;
+    @Value(name = "javaOnly")
+    @DefaultValue(value = "false")
+    private boolean javaOnly = false;
+
+    @Value (name = "app")
+    private String app = null;
+
+    @Value (name = "args")
+    @DefaultValue (value = "")
+    /* package-private */ String[] args = new String[]{};
+
+    @SubValues(prefix = "params")
+    private final ActionParameters params;
+
+    public SimpleAction(String id, Properties properties)
+            throws InvalidValueException {
+        this(id, id, properties);
+    }
+    public SimpleAction(String name, String id, Properties properties)
+            throws InvalidValueException {
+        sections = name.split("\\.");
+        this.params = new ActionParameters();
+        ValueHandler.apply(this, properties, id);
+    }
+
+    public ProcessBuilder prepareProcess(PrintWriter log, ActionHelper helper) {
+        ProcessBuilder process = helper.prepareProcess(log, app, args);
+        if (process != null) {
+            process.redirectErrorStream(true);
+        }
+
+        return process;
+    }
+
+    @Override
+    public boolean isJavaOnly() {
+        return javaOnly;
+    }
+
+    @Override
+    public HtmlSection getSection(HtmlSection section) {
+        return section.createChildren(sections);
+    }
+
+    @Override
+    public ActionParameters getParameters() {
+        return params;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.jtreg;
+
+import com.sun.javatest.Harness;
+import com.sun.javatest.Parameters;
+import com.sun.javatest.TestResult;
+import com.sun.javatest.regtest.RegressionParameters;
+import com.sun.javatest.regtest.OS;
+import jdk.test.failurehandler.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The jtreg test execution observer, which gathers info about
+ * system and dumps it to a file.
+ */
+public class GatherDiagnosticInfoObserver implements Harness.Observer {
+    public static final String LOG_FILENAME = "environment.log";
+    public static final String ENVIRONMENT_OUTPUT = "environment.html";
+
+    private String compileJdk;
+    private String testJdk;
+
+    /*
+     * The harness calls this method after each test.
+     */
+    @Override
+    public void finishedTest(TestResult tr) {
+        if (!tr.getStatus().isError() && !tr.getStatus().isFailed()) {
+            return;
+        }
+
+        String jtrFile = tr.getFile().toString();
+        final Path workDir = Paths.get(
+                jtrFile.substring(0, jtrFile.lastIndexOf('.')));
+        workDir.toFile().mkdir();
+
+        String name = getClass().getName();
+        PrintWriter log;
+        boolean needClose = false;
+        try {
+            log = new PrintWriter(new FileWriter(
+                    workDir.resolve(LOG_FILENAME).toFile(), true));
+            needClose = true;
+        } catch (IOException e) {
+            log = new PrintWriter(System.out);
+            log.printf("ERROR: %s cannot open log file %s", name,
+                    LOG_FILENAME);
+            e.printStackTrace(log);
+        }
+        try {
+            log.printf("%s ---%n", name);
+            GathererFactory gathererFactory = new GathererFactory(
+                    OS.current().family, workDir, log,
+                    Paths.get(testJdk), Paths.get(compileJdk));
+            gatherEnvInfo(workDir, name, log,
+                    gathererFactory.getEnvironmentInfoGatherer());
+        } catch (Throwable e) {
+            log.printf("ERROR: exception in observer %s:", name);
+            e.printStackTrace(log);
+        } finally {
+            log.printf("--- %s%n", name);
+            if (needClose) {
+                log.close();
+            } else {
+                log.flush();
+            }
+        }
+    }
+
+    private void gatherEnvInfo(Path workDir, String name, PrintWriter log,
+                               EnvironmentInfoGatherer gatherer) {
+        File output = workDir.resolve(ENVIRONMENT_OUTPUT).toFile();
+        try (HtmlPage html = new HtmlPage(new PrintWriter(
+                new FileWriter(output, true)))) {
+            try (ElapsedTimePrinter timePrinter
+                         = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
+                gatherer.gatherEnvironmentInfo(html.getRootSection());
+            }
+        } catch (Throwable e) {
+            log.printf("ERROR: exception in observer on getting environment "
+                    + "information %s:", name);
+            e.printStackTrace(log);
+        }
+    }
+
+    /*
+     * The harness calls this method one time per run, not per test.
+     */
+    @Override
+    public void startingTestRun(Parameters params) {
+        // TODO find a better way to get JDKs
+        RegressionParameters rp = (RegressionParameters) params;
+        Map<?,?> map = new HashMap<>();
+        rp.save(map);
+        compileJdk = (String) map.get("regtest.compilejdk");
+        testJdk = (String) map.get("regtest.testjdk");
+    }
+
+    @Override
+    public void startingTest(TestResult tr) {
+        // no-op
+    }
+
+    @Override
+    public void stoppingTestRun() {
+        // no-op
+    }
+
+    @Override
+    public void finishedTesting() {
+        // no-op
+    }
+
+    @Override
+    public void finishedTestRun(boolean allOK) {
+        // no-op
+    }
+
+    @Override
+    public void error(String msg) {
+        // no-op
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.jtreg;
+
+import com.sun.javatest.regtest.OS;
+import com.sun.javatest.regtest.TimeoutHandler;
+import jdk.test.failurehandler.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.nio.file.Path;
+
+/**
+ * A timeout handler for jtreg, which gathers information about the timed out
+ * process and its children.
+ */
+public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
+    static {
+        try {
+            System.loadLibrary("timeoutHandler");
+        } catch (UnsatisfiedLinkError ignore) {
+            // not all os need timeoutHandler native-library
+        }
+    }
+    private static final String LOG_FILENAME = "processes.log";
+    private static final String OUTPUT_FILENAME = "processes.html";
+
+    public GatherProcessInfoTimeoutHandler(PrintWriter jtregLog, File outputDir,
+                                           File testJdk) {
+        super(jtregLog, outputDir, testJdk);
+    }
+
+    /**
+     * Runs various actions for jtreg timeout handler.
+     *
+     * <p>Please see method code for the actions.
+     */
+    @Override
+    protected void runActions(Process process, long pid)
+            throws InterruptedException {
+        Path workDir = outputDir.toPath();
+
+        String name = getClass().getName();
+        PrintWriter actionsLog;
+        try {
+            // try to open a separate file for aciton log
+            actionsLog = new PrintWriter(new FileWriter(
+                    workDir.resolve(LOG_FILENAME).toFile(), true));
+        } catch (IOException e) {
+            // use jtreg log as a fallback
+            actionsLog = log;
+            actionsLog.printf("ERROR: %s cannot open log file %s : %s", name,
+                    LOG_FILENAME, e.getMessage());
+        }
+        try {
+            actionsLog.printf("%s ---%n", name);
+
+            File output = workDir.resolve(OUTPUT_FILENAME).toFile();
+            try {
+                PrintWriter pw = new PrintWriter(new FileWriter(output, true));
+                runGatherer(name, workDir, actionsLog, pw, pid);
+            } catch (IOException e) {
+                actionsLog.printf("IOException: cannot open output file[%s] : %s",
+                        output, e.getMessage());
+                e.printStackTrace(actionsLog);
+            }
+        } finally {
+            actionsLog.printf("--- %s%n", name);
+            // don't close jtreg log
+            if (actionsLog != log) {
+                actionsLog.close();
+            } else {
+                log.flush();
+            }
+        }
+    }
+
+    @Override
+    protected long getProcessId(Process process) {
+        long result = super.getProcessId(process);
+        if (result == 0L) {
+            /* jtreg didn't find pid, most probably we are on JDK < 9
+               there is no Process::getPid */
+            if ("windows".equals(OS.current().family)) {
+                try {
+                    Field field = process.getClass().getDeclaredField("handle");
+                    boolean old = field.isAccessible();
+                    try {
+                        field.setAccessible(true);
+                        long handle = field.getLong(process);
+                        result = getWin32Pid(handle);
+                    } finally {
+                        field.setAccessible(old);
+                    }
+                } catch (ReflectiveOperationException e) {
+                    e.printStackTrace(log);
+                }
+            }
+        }
+        return result;
+    }
+
+    private native long getWin32Pid(long handle);
+
+    private void runGatherer(String name, Path workDir, PrintWriter log,
+                             PrintWriter out, long pid) {
+        try (HtmlPage html = new HtmlPage(out)) {
+            ProcessInfoGatherer gatherer = new GathererFactory(
+                    OS.current().family,
+                    workDir, log, testJdk.toPath()).getProcessInfoGatherer();
+            try (ElapsedTimePrinter timePrinter
+                         = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
+                gatherer.gatherProcessInfo(html.getRootSection(), pid);
+            }
+        } catch (Throwable e) {
+            log.printf("ERROR: exception in timeout handler %s:", name);
+            e.printStackTrace(log);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ArrayParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.lang.reflect.Array;
+import java.util.Objects;
+
+public class ArrayParser implements ValueParser {
+    private final ValueParser parser;
+
+    public ArrayParser(ValueParser parser) {
+        Objects.requireNonNull(parser);
+        this.parser = parser;
+    }
+
+    @Override
+    public Object parse(Class<?> type, String value, String delimiter) {
+        Class<?> component = type.getComponentType();
+        if (component.isArray()) {
+            throw new IllegalArgumentException(
+                    "multidimensional array fields aren't supported");
+        }
+        String[] values = (value == null || value.isEmpty())
+                          ? new String[]{}
+                          : value.split(delimiter);
+        Object result = Array.newInstance(component, values.length);
+        for (int i = 0, n = values.length; i < n; ++i) {
+            Array.set(result, i, parser.parse(component, values[i], delimiter));
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/DefaultParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultParser implements ValueParser {
+    private static final Map<Class<?>, BasicParser> PARSERS = new HashMap<>();
+
+    static {
+        BasicParser.init();
+    }
+
+    @Override
+    public Object parse(Class<?> type, String value, String s) {
+        if (type.isArray()) {
+            return new ArrayParser(this).parse(type, value, s);
+        }
+        ValueParser parser = PARSERS.get(type);
+        if (parser == null) {
+            throw new IllegalArgumentException("can't find parser for "
+                    + type.getName());
+        }
+
+        return parser.parse(type, value, s);
+    }
+
+    private static enum BasicParser implements ValueParser {
+        BOOL(boolean.class, Boolean.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Boolean.valueOf(value);
+            }
+        },
+        BYTE(byte.class, Byte.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Byte.decode(value);
+            }
+        },
+        CHAR(char.class, Character.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                if (value.length() != 1) {
+                    throw new IllegalArgumentException(
+                            String.format("can't cast %s to char", value));
+                }
+                return value.charAt(0);
+            }
+        },
+        SHORT(short.class, Short.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Short.decode(value);
+            }
+        },
+        INT(int.class, Integer.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Integer.decode(value);
+            }
+        },
+        LONG(long.class, Long.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Long.decode(value);
+            }
+        },
+        FLOAT(float.class, Float.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Float.parseFloat(value);
+            }
+        },
+        DOUBLE(double.class, Double.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return Double.parseDouble(value);
+            }
+        },
+        STRING(String.class, Object.class) {
+            @Override
+            public Object parse(Class<?> type, String value, String s) {
+                return value;
+            }
+        };
+
+        private BasicParser(Class<?>... classes) {
+            for (Class<?> aClass : classes) {
+                DefaultParser.PARSERS.put(aClass, this);
+            }
+        }
+
+        private static void init() {
+            // no-op used to provoke <cinit>
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/DefaultValue.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface DefaultValue {
+    String value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/InvalidValueException.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+public class InvalidValueException extends Exception {
+    public InvalidValueException() { }
+
+    public InvalidValueException(String message) {
+        super(message);
+    }
+
+    public InvalidValueException(String s, Throwable e) {
+        super(s, e);
+    }
+
+    public InvalidValueException(Throwable cause) {
+        super(cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/PathValueParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.io.File;
+
+public class PathValueParser implements ValueParser {
+    @Override
+    public Object parse(Class<?> type, String value, String delimiter) {
+        if (type.isArray()) {
+            return new ArrayParser(this).parse(type, value, delimiter);
+        }
+        return new File(value).toPath();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/SubValues.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface SubValues {
+    String prefix();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/Value.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface Value {
+    String name();
+    Class<? extends ValueParser> parser() default DefaultParser.class;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import jdk.test.failurehandler.Utils;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Objects;
+import java.util.Properties;
+
+public final class ValueHandler {
+    public static <T> void apply(T object, Properties properties,
+                                 String prefix) throws InvalidValueException {
+        Objects.requireNonNull(object, "object cannot be null");
+        Objects.requireNonNull(properties, "properties cannot be null");
+        Class<?> aClass = object.getClass();
+        while (aClass != null) {
+            for (Field field : aClass.getDeclaredFields()) {
+                Value p = field.getAnnotation(Value.class);
+                if (p != null) {
+                    applyToField(p, object, field, properties, prefix);
+                } else {
+                    SubValues sub
+                            = field.getAnnotation(SubValues.class);
+                    if (sub != null) {
+                        getAccess(field);
+                        try {
+                            apply(field.get(object), properties,
+                                    Utils.prependPrefix(prefix, sub.prefix()));
+                        } catch (IllegalAccessException e) {
+                            throw new InvalidValueException(String.format(
+                                    "can't apply sub properties to %s.",
+                                    field.getName()));
+                        }
+                    }
+                }
+            }
+            aClass = aClass.getSuperclass();
+        }
+    }
+
+    private static void applyToField(Value property, Object object,
+                Field field, Properties properties, String prefix)
+            throws InvalidValueException {
+        getAccess(field);
+        if (Modifier.isFinal(field.getModifiers())) {
+            throw new InvalidValueException(
+                    String.format("field '%s' is final", field));
+        }
+        String name = Utils.prependPrefix(prefix, property.name());
+        String value = getProperty(properties, prefix, property.name());
+        if (value == null) {
+            DefaultValue defaultValue
+                    = field.getAnnotation(DefaultValue.class);
+            value = defaultValue == null ? null : defaultValue.value();
+        }
+        if (value == null) {
+            throw new InvalidValueException(String.format(
+                    "can't set '%s', because properties don't have '%s'.",
+                    field.getName(), name));
+        }
+        String delimiter = getProperty(properties,
+                Utils.prependPrefix(prefix, property.name()), "delimiter");
+        delimiter = delimiter == null ? " " : delimiter;
+        Class<? extends ValueParser> parserClass = property.parser();
+        try {
+            field.set(object, parserClass.newInstance().parse(
+                    field.getType(), value, delimiter));
+        } catch (ReflectiveOperationException | IllegalArgumentException e) {
+            throw new InvalidValueException(
+                    String.format("can't set field '%s' : %s",
+                            field.getName(), e.getMessage()), e);
+        }
+    }
+
+    private static String getProperty(Properties properties,
+                                      String prefix, String name) {
+        if (prefix == null || prefix.isEmpty()) {
+            return properties.getProperty(name);
+        }
+        int index = prefix.length();
+        do {
+            String value = properties.getProperty(
+                    Utils.prependPrefix(prefix.substring(0, index), name));
+            if (value != null) {
+                return value;
+            }
+            index = prefix.lastIndexOf('.', index - 1);
+        } while (index > 0);
+        return  properties.getProperty(name);
+    }
+
+    private static void getAccess(Field field) {
+        int modifiers = field.getModifiers();
+        if (!Modifier.isPublic(modifiers)) {
+            field.setAccessible(true);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueParser.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+public interface ValueParser {
+    Object parse(Class<?> type, String value, String delimiter);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/common.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+pattern=%p
+javaOnly=true
+args=%p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+  jinfo \
+  jcmd.compiler.codecache jcmd.compiler.codelist \
+        jcmd.compiler.queue \
+  jcmd.vm.classloader_stats jcmd.vm.stringtable \
+        jcmd.vm.symboltable jcmd.vm.uptime jcmd.vm.dynlibs \
+        jcmd.vm.system_properties \
+  jcmd.gc.class_stats jcmd.gc.class_histogram \
+  jstack \
+  jmap.heap jmap.histo jmap.clstats jmap.finalizerinfo
+
+jinfo.app=jinfo
+
+jcmd.app=jcmd
+
+jcmd.compiler.codecache.args=%p Compiler.codecache
+jcmd.compiler.codelist.args=%p Compiler.codelist
+jcmd.compiler.queue.args=%p Compiler.queue
+
+jcmd.vm.classloader_stats.args=%p VM.classloader_stats
+jcmd.vm.stringtable.args=%p VM.stringtable
+jcmd.vm.symboltable.args=%p VM.symboltable
+jcmd.vm.uptime.args=%p VM.uptime
+jcmd.vm.dynlibs.args=%p VM.dynlibs
+jcmd.vm.system_properties.args=%p VM.system_properties
+
+jcmd.gc.class_stats.args=%p GC.class_stats
+jcmd.gc.class_histogram.args=%p GC.class_histogram
+
+jstack.app=jstack
+jstack.params.repeat=6
+
+jmap.app=jmap
+jmap.heap.args=-heap %p
+jmap.histo.args=-histo %p
+jmap.clstats.args=-clstats %p
+jmap.finalizerinfo.args=-finalizerinfo %p
+
+################################################################################
+# environment info to gather
+################################################################################
+environment=jps
+jps.app=jps
+jps.args=-mlv
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/linux.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+config.getChildren.pattern=%p
+config.getChildren.app=ps
+config.getChildren.args=--no-headers -o pid --ppid %p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+  native.pmap.normal native.pmap.everything \
+  native.files native.locks \
+  native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+native.pmap.app=pmap
+native.pmap.normal.args=-p %p
+native.pmap.everything.args=-XXp %p
+
+native.files.app=lsof
+native.files.args=-p %p
+
+native.locks.app=lslocks
+native.locks.args=-u --pid %p
+
+native.stack.app=gdb
+native.stack.args=--pid=%p\0-batch\0-ex\0thread apply all backtrace
+native.stack.args.delimiter=\0
+native.stack.params.repeat=6
+
+native.core.app=gcore
+native.core.args=-o ./core.%p %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+  users.current users.logged users.last \
+  disk \
+  env \
+  system.dmesg system.sysctl \
+  process.top process.ps \
+  memory.free memory.vmstat.default memory.vmstat.statistics \
+        memory.vmstat.slabinfo memory.vmstat.disk \
+  files \
+  locks \
+  net.sockets net.statistics
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.sysctl.app=sysctl
+system.sysctl.args=-a
+
+process.top.app=top
+process.top.args=-b -n 1
+process.ps.app=ps
+process.ps.args=-Leo pid,pcpu,cputime,start,pmem,vsz,rssize,stackp,stat,sgi_p,wchan,user,args
+
+memory.free.app=free
+memory.free.args=-h
+memory.vmstat.app=vmstat
+memory.vmstat.default.args=3 3
+memory.vmstat.statistics.args=-s
+memory.vmstat.slabinfo.args=-m
+memory.vmstat.disk.args=-d
+
+files.app=lsof
+locks.app=lslocks
+locks.args=-u
+
+net.app=netstat
+net.sockets.args=-aeeopv
+net.statistics.args=-sv
+################################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/mac.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+config.getChildren.pattern=%p
+config.getChildren.app=pgrep
+config.getChildren.args=-P %p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+  native.vmmap native.heap native.leaks native.spindump \
+  native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+# Some of them require root privileges
+native.vmmap.app=vmmap
+native.heap.app=heap
+native.leaks.app=leaks
+native.spindump.app=spindump
+native.spindump.args=%p -stdout
+
+native.stack.app=lldb
+native.stack.delimiter=\0
+native.stack.params.repeat=6
+native.stack.args=-o\0attach %p\0-o\0thread backtrace all\0-o\0detach\0-o\0quit
+
+native.core.app=bash
+native.core.delimiter=\0
+native.core.args=-c\0gcore -o ./core.%p %p || \
+  lldb -o 'attach %p' -o 'process save-core core.%p' -o 'detach' -o 'quit'
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+  users.current users.logged users.last \
+  disk \
+  env \
+  system.dmesg system.sysctl \
+  process.ps process.top \
+  memory.vmstat \
+  netstat.av netstat.aL netstat.m netstat.s
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.sysctl.app=sysctl
+system.sysctl.args=-a
+
+process.ps.app=ps
+process.ps.args=-Meo pid,pcpu,cputime,start,pmem,vsz,rss,state,wchan,user,args
+process.top.app=top
+process.top.args=-l 1
+
+memory.vmstat.app=vm_stat
+memory.vmstat.args=-c 3 3
+
+
+netstat.app=netstat
+netstat.av.args=-av
+netstat.aL.args=-aL
+netstat.m.args=-m
+netstat.s.args=-s
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/solaris.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,111 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+# pattern will be replaced with the PID
+config.getChildren.pattern=%p
+config.getChildren.app=pgrep
+config.getChildren.args=-P %p
+################################################################################
+# prepareProcess info to gather
+################################################################################
+onTimeout=\
+  native.pmap \
+  native.pfiles \
+  native.stack native.core
+################################################################################
+# solaris specific
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+
+native.pmap.app=pmap
+native.pmap.args=-F %p
+
+native.pfiles.app=pfiles
+native.pfiles.args=-F %p
+
+# native.locks  TODO find 'analog for solaris' for Linux lslocks
+
+native.stack.app=pstack
+native.stack.args=-F %p
+native.stack.params.repeat=6
+
+native.core.app=gcore
+native.core.args=-F -o ./core %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+  users.current users.logged users.last \
+  disk \
+  env \
+  system.dmesg system.prtconf system.sysdef \
+  process.ps process.top \
+  memory.swap memory.vmstat.default memory.vmstat.statistics memory.pagesize \
+  netstat.av netstat.m netstat.s netstat.i
+################################################################################
+# common unix
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.prtconf.app=prtconf
+system.sysdef.app=sysdef
+
+memory.swap.app=swap
+memory.swap.args=-l
+
+process.ps.app=ps
+process.ps.args=-Leo pid,lwp,ppid,tty,s,wchan,pcpu,time,stime,pmem,vsz,osz,rss,args
+
+process.top.app=top
+process.top.args=-b -n
+
+memory.vmstat.app=vmstat
+memory.vmstat.default.args=3 3
+memory.vmstat.statistics.args=-s
+
+memory.pagesize.app=pagesize
+
+# TODO: how to start prstat to show statistics and exit?
+# prstat.app=prstat
+# prstat.args=-a
+
+netstat.app=netstat
+netstat.av.args=-av
+netstat.m.args=-m
+netstat.s.args=-s
+netstat.i.args=-i 1 5
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/windows.properties	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=.exe
+config.getChildren.app=bash
+config.getChildren.pattern=%p
+config.getChildren.args=-c\0wmic process where ParentProcessId=%p get ProcessId | tail -n+2
+config.getChildren.args.delimiter=\0
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+  native.info \
+  native.pmap.normal native.pmap.everything \
+  native.files native.locks \
+  native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+native.info.app=wmic
+native.info.args=process where processId=%p list full
+
+native.pmap.app=pmap
+native.pmap.normal.args=%p
+native.pmap.everything.args=-x %p
+
+native.files.app=handle
+native.files.args=-p %p
+# TODO
+native.locks.app=lslocks
+native.locks.args=-u --pid %p
+
+native.stack.app=cdb
+native.stack.args=-c "~*kP n;qd" -p %p
+native.stack.params.repeat=6
+
+native.core.app=cdb
+native.core.args=-c ".dump /f core.%p;qd" -p %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+  users.current users.logged \
+  disk \
+  env \
+  system.events.system system.events.application system.os \
+  process.top process.ps process.tasklist \
+  memory.free memory.vmstat.default memory.vmstat.statistics \
+        memory.vmstat.slabinfo memory.vmstat.disk \
+  files \
+  net.sockets net.statistics
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=query
+users.logged.args=user
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.events.app=powershell
+system.events.delimiter=\0
+system.events.system.args=-NoLogo\0-Command\0Get-EventLog System -After (Get-Date).AddDays(-1) | Format-List
+system.events.application.args=-NoLogo\0-Command\0Get-EventLog Application -After (Get-Date).AddDays(-1) | Format-List
+
+system.os.app=wmic
+system.os.args=os get /format:list
+
+process.top.app=top
+process.top.args=-b -n 1
+process.ps.app=ps
+process.ps.args=-efW
+process.tasklist.app=tasklist
+process.tasklist.args=/V
+
+memory.free.app=free
+memory.vmstat.app=vmstat
+memory.vmstat.statistics.args=-s
+memory.vmstat.slabinfo.args=-m
+memory.vmstat.disk.args=-d
+
+files.app=openfiles
+files.args=/query
+
+net.sockets.app=bash
+net.sockets.args=-c\0netstat -b -a -t -o || netstat -a -t -o
+net.sockets.args.delimiter=\0
+net.statistics.app=netstat
+net.statistics.args=-s -e
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/windows/native/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.c	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#include <jni.h>
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jlong JNICALL Java_jdk_test_failurehandler_jtreg_GatherProcessInfoTimeoutHandler_getWin32Pid
+        (JNIEnv* env, jobject o, jlong handle) {
+    return GetProcessId(handle);
+}
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Crash.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import sun.misc.Unsafe;
+
+import java.lang.reflect.Field;
+
+/*
+ * @test
+ * @run main/othervm Crash
+ */
+public class Crash {
+    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
+        Field f = Unsafe.class.getDeclaredField("theUnsafe");
+        f.setAccessible(true);
+        Unsafe u = (Unsafe) f.get(null);
+        u.setMemory(0, 42, (byte) 0xFF);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Deadlock.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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 Deadlocked client
+ */
+public class Deadlock {
+    public double e;
+    private volatile int i;
+
+    public static void main(String[] args) {
+        new Deadlock().test();
+    }
+    private void test() {
+        final Object a = new Object();
+        final Object b = new Object();
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (a) {
+                    do {
+                        i |= 1;
+                    } while (i != 3);
+
+                    synchronized (b) {
+                        e = 1;
+                    }
+                }
+            }}).start();
+
+        synchronized (b) {
+            do {
+                i |= 2;
+            } while (i != 3);
+            synchronized (a) {
+                e = 2;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Livelock.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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 Busy infinite loop client, calculating E number
+ */
+public class Livelock {
+
+    public static double elim;
+
+    public static void main(String[] args) {
+        System.out.printf(
+                "%24s  %24s  %24s  %24s  %24s  %24s%n",
+                "n", "n!", "e = lim(...)", "e = taylor series",
+                "err e-lim", "err e-taylor");
+
+        while (true) {
+            double esum = 2;
+            double nfac = 1;
+            double iter = 1;
+            for (double n = 1; !Double.isInfinite(n) && !Double.isNaN(n) ; n = n * 2) {
+                elim = Math.pow(1 + 1 / n, n);
+
+                iter += 1;
+                nfac *= iter;
+                esum += 1 / nfac;
+
+                System.out.printf("% 24.16e  % 24.16e  % 24.16e  % 24.16e"
+                                + "%- 24.16e  %- 24.16e%n",
+                        n, nfac, elim, esum, (Math.E - elim), (Math.E - esum));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/OOME.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.util.LinkedList;
+
+/*
+ * @test
+ * @summary Slowly eat all memory in an infinite loop
+ * @run main/othervm Crash
+ */
+public class OOME {
+    @SuppressWarnings ("UnusedDeclaration")
+    private static Object garbage;
+    public static void main(String args[]) {
+
+        int chunkSize = 0x8000;
+        LinkedList<int[]> list = new LinkedList<>();
+        garbage = list;
+
+        while (true) {
+            try {
+                list.add(new int[chunkSize]);
+            } catch (OutOfMemoryError e) {
+                chunkSize >>= 1;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Suicide.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+import java.lang.management.ManagementFactory;
+
+/*
+ * @test
+ * @summary Suicide test
+ * @run main/othervm Crash
+ */
+public class Suicide {
+    public static void main(String[] args) {
+        String cmd = null;
+        try {
+            String pidStr = ManagementFactory.getRuntimeMXBean().getName()
+                    .split("@")[0];
+            String osName = System.getProperty("os.name");
+            if (osName.contains("Windows")) {
+                cmd = "taskkill.exe /F /PID " + pidStr;
+            } else {
+                cmd = "kill -9 " + pidStr;
+            }
+
+            System.out.printf("executing `%s'%n", cmd);
+            Runtime.getRuntime().exec(cmd);
+            Thread.sleep(2000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        System.err.printf("TEST/ENV BUG: %s didn't kill JVM%n", cmd);
+        System.exit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/SystemExit.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 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
+ * @run main/othervm SystemExit
+ */
+public class SystemExit {
+    public static void main(String[] args) {
+        System.exit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/ThrowError.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, 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
+ */
+public class ThrowError {
+    public static void main(String[] args) {
+        throw new Error("TEST FAIL");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/WaitForDeadlock.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.nio.file.Paths;
+
+/*
+ * @test
+ * @build Deadlock
+ * @run driver WaitForDeadlock
+ */
+public class WaitForDeadlock {
+    public static void main(String[] args) throws Exception {
+        System.out.println("START");
+        ProcessBuilder pb = new ProcessBuilder(Paths.get(
+                System.getProperty("test.jdk"), "bin", "java").toString(),
+                "-cp", System.getProperty("java.class.path"),
+                Deadlock.class.getName());
+        pb.redirectError(ProcessBuilder.Redirect.to(Paths.get("out").toFile()));
+        pb.redirectOutput(ProcessBuilder.Redirect.to(Paths.get("err").toFile()));
+        int r = pb.start().waitFor();
+        System.out.println("END. " + r);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/unit/jdk/test/failurehandler/value/DefaultParserTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DefaultParserTest {
+    @Test
+    public void testParseStringArray() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        String line = "a aa   aaa";
+        String[] result = {"a", "aa", "", "", "aaa"};
+        Assert.assertArrayEquals(result,
+                (Object[]) parser.parse(result.getClass(), line, " "));
+
+        line = null;
+        result = new String[]{};
+        Assert.assertArrayEquals(result,
+                (Object[]) parser.parse(result.getClass(), line, " "));
+    }
+
+    @Test
+    public void testParseObjectArray() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        String line = "a aa   aaa";
+        String[] result = {"a", "aa", "", "", "aaa"};
+        Assert.assertArrayEquals(result,
+                (String[]) parser.parse(result.getClass(), line, " "));
+        Object[] result2 = {"a", "aa", "", "", "aaa"};
+        Assert.assertArrayEquals(result2,
+                (Object[]) parser.parse(result.getClass(), line, " "));
+    }
+
+    @Test
+    public void testParseCharArray() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        String line = "a b c a";
+        char[] result = {'a', 'b', 'c', 'a'};
+        Assert.assertArrayEquals(result,
+                (char[]) parser.parse(result.getClass(), line, " "));
+
+        Character[] result2 = {'a', 'b', 'c', 'a'};
+        Assert.assertArrayEquals(result2,
+                (Character[]) parser.parse(result2.getClass(), line, " "));
+    }
+
+    @Test
+    public void testParseBoolean() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        String line = "a b c a";
+        Assert.assertEquals(false,
+                (boolean) parser.parse(boolean.class, line, " "));
+        Assert.assertEquals(Boolean.FALSE,
+                parser.parse(Boolean.class, line, " "));
+        line = "trUe";
+        Assert.assertEquals(true,
+                (boolean) parser.parse(boolean.class, line, " "));
+        Assert.assertEquals(Boolean.TRUE,
+                parser.parse(Boolean.class, line, " "));
+    }
+
+    @Test
+    public void testParseShort() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        Assert.assertSame("10", (short) 10,
+                parser.parse(short.class, "10", " "));
+        Assert.assertSame("010", (short) 8,
+                parser.parse(short.class, "010", " "));
+        Assert.assertSame("0x10", (short) 16,
+                parser.parse(short.class, "0x10", " "));
+    }
+
+    @Test
+    public void testParseByte() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        Assert.assertSame("11", (byte) 11,
+                parser.parse(byte.class, "11", " "));
+        Assert.assertSame("011", (byte) 9,
+                parser.parse(byte.class, "011", " "));
+        Assert.assertSame("0x11", (byte) 17,
+                parser.parse(byte.class, "0x11", " "));
+    }
+
+    @Test
+    public void testParseInt() throws Exception {
+        DefaultParser parser = new DefaultParser();
+        Assert.assertEquals("20", (int) 20,
+                parser.parse(int.class, "20", " "));
+        Assert.assertEquals("020", (int) 16,
+                parser.parse(int.class, "020", " "));
+        Assert.assertEquals("0x20", (int) 32,
+                parser.parse(int.class, "0x20", " "));
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/unit/jdk/test/failurehandler/value/ValueHandlerTest.java	Tue Jan 26 09:11:58 2016 +0100
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2015, 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.test.failurehandler.value;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.util.Properties;
+
+public class ValueHandlerTest {
+    @Test
+    public void testApplyAnonymousPrivateFinalInt() throws Exception {
+        Properties p = new Properties();
+        p.put("int", "010");
+        Object o = new Object() {
+            @Value (name = "int")
+            private final int i1 = -1;
+        };
+        Field f = o.getClass().getDeclaredField("i1");
+        f.setAccessible(true);
+        int value = f.getInt(o);
+        Assert.assertEquals(value, -1);
+        f.setAccessible(false);
+        ValueHandler.apply(o, p, null);
+        f.setAccessible(true);
+        value = f.getInt(o);
+        Assert.assertEquals(value, 8);
+        f.setAccessible(false);
+    }
+
+    @Test
+    public void testApplyPublicStaticWithDefault() throws Exception {
+        Assert.assertEquals(StaticDefaultCase.s, null);
+        Properties p = new Properties();
+        StaticDefaultCase o = new StaticDefaultCase();
+        ValueHandler.apply(o, p, "prefix");
+        Assert.assertEquals(StaticDefaultCase.s, "default");
+        p.put("s", "new2");
+        ValueHandler.apply(o, p, "prefix");
+        Assert.assertEquals(StaticDefaultCase.s, "new2");
+        p.put("prefix.s", "new");
+        ValueHandler.apply(o, p, "prefix");
+        Assert.assertEquals(StaticDefaultCase.s, "new");
+        ValueHandler.apply(o, p, null);
+        Assert.assertEquals(StaticDefaultCase.s, "new2");
+    }
+
+    protected class InnerClass1 {
+        @Value (name = "innerClass")
+        String[] arr = null;
+    }
+
+    public class InnerClass2 extends InnerClass1 {
+        @Value (name = "float")
+        float f = 0.0f;
+
+        @SubValues (prefix = "inner")
+        InnerClass1 inner1 = new InnerClass1();
+
+        @SubValues (prefix = "")
+        InnerClass1 inner2 = new InnerClass1();
+    }
+
+    @Test
+    public void testApplySub() throws Exception {
+        InnerClass2 o = new InnerClass2();
+        Assert.assertArrayEquals(o.arr, null);
+        Assert.assertArrayEquals(o.inner1.arr, null);
+        Assert.assertArrayEquals(o.inner2.arr, null);
+        Assert.assertEquals(o.f, 0.0f, Float.MIN_VALUE);
+
+        Properties p = new Properties();
+        p.put("float", "1.f");
+        p.put("innerClass", "a b");
+        p.put("inner.innerClass", "a b c");
+        ValueHandler.apply(o, p, "");
+        Assert.assertArrayEquals(o.arr, new String[]{"a", "b"});
+        Assert.assertArrayEquals(o.inner1.arr, new String[]{"a", "b", "c"});
+        Assert.assertArrayEquals(o.inner2.arr, new String[]{"a", "b"});
+        Assert.assertEquals(o.f, 1.0f, Float.MIN_VALUE);
+    }
+}
+
+class StaticDefaultCase {
+    @Value (name = "s")
+    @DefaultValue (value = "default")
+    public static String s;
+}
--- a/test/lib/sun/hotspot/WhiteBox.java	Mon Jan 25 14:09:28 2016 -1000
+++ b/test/lib/sun/hotspot/WhiteBox.java	Tue Jan 26 09:11:58 2016 +0100
@@ -140,6 +140,23 @@
     return g1IsHumongous0(o);
   }
 
+  private native boolean g1BelongsToHumongousRegion0(long adr);
+  public         boolean g1BelongsToHumongousRegion(long adr) {
+    if (adr == 0) {
+      throw new IllegalArgumentException("adr argument should not be null");
+    }
+    return g1BelongsToHumongousRegion0(adr);
+  }
+
+
+  private native boolean g1BelongsToFreeRegion0(long adr);
+  public         boolean g1BelongsToFreeRegion(long adr) {
+    if (adr == 0) {
+      throw new IllegalArgumentException("adr argument should not be null");
+    }
+    return g1BelongsToFreeRegion0(adr);
+  }
+
   public native long    g1NumMaxRegions();
   public native long    g1NumFreeRegions();
   public native int     g1RegionSize();