Merge
authorddehaven
Thu, 21 Jan 2016 14:49:02 -0800
changeset 35692 ee66ced7896c
parent 35691 29f060c979c2 (current diff)
parent 35307 50b5ac3cfb59 (diff)
child 35693 5bdca98e8410
Merge
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/CEFormatException.java
jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java
jdk/src/java.base/share/classes/sun/misc/ClassFileTransformer.java
jdk/src/java.base/share/classes/sun/misc/JarFilter.java
jdk/src/java.base/share/classes/sun/misc/Perf.java
jdk/src/java.base/share/classes/sun/misc/PerfCounter.java
jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.java
jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java
jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java
jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java
jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java
jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java
jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java
jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java
jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java
jdk/test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java
langtools/test/tools/javac/api/T6430241.java
langtools/test/tools/javac/file/BootClassPathPrepend.java
langtools/test/tools/sjavac/ExclPattern.java
nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java
--- a/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,4 @@
 d00ad2d9049ac60815f70bff445e95df85648bd2 jdk-9+98
 f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
 4379223f8806626852c46c52d4e7a27a584b406e jdk-9+100
+80f67512daa15cf37b4825c1c62a675d524d7c49 jdk-9+101
--- a/.hgtags-top-repo	Thu Jan 21 13:41:02 2016 +0530
+++ b/.hgtags-top-repo	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,4 @@
 48987460c7d49a29013963ee44d090194396bb61 jdk-9+98
 7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
 c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
+c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
--- a/common/autoconf/basics.m4	Thu Jan 21 13:41:02 2016 +0530
+++ b/common/autoconf/basics.m4	Thu Jan 21 14:49:02 2016 -0800
@@ -23,6 +23,74 @@
 # questions.
 #
 
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+#   AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+#     [
+#         $ECHO hello world
+#     ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+AC_DEFUN([BASIC_DEFUN_NAMED],
+[
+  AC_DEFUN($1, [
+    m4_foreach(arg, m4_split($2), [
+      m4_if(m4_bregexp(arg, [^\*]), -1,
+        [
+          m4_set_add(legal_named_args, arg)
+        ],
+        [
+          m4_set_add(legal_named_args, m4_substr(arg, 1))
+          m4_set_add(required_named_args, m4_substr(arg, 1))
+        ]
+      )
+    ])
+
+    m4_foreach([arg], [$3], [
+      m4_define(arg_name, m4_substr(arg, 0, m4_bregexp(arg, [: ])))
+      m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: arg_name is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(legal_named_args, [ ])'.])])
+      m4_set_remove(required_named_args, arg_name)
+      m4_set_remove(legal_named_args, arg_name)
+      m4_pushdef([ARG_][]arg_name, m4_substr(arg, m4_incr(m4_incr(m4_bregexp(arg, [: ])))))
+      m4_set_add(defined_args, arg_name)
+      m4_undefine([arg_name])
+    ])
+    m4_set_empty(required_named_args, [], [
+      AC_MSG_ERROR([Internal error: Required named arguments are missing for [$1]. Missing arguments: 'm4_set_contents(required_named_args, [ ])'])
+    ])
+    m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([legal_named_args])), [
+      m4_pushdef([ARG_][]arg, [])
+      m4_set_add(defined_args, arg)
+    ])
+    m4_set_delete(legal_named_args)
+    m4_set_delete(required_named_args)
+
+    # Execute function body
+    $4
+
+    m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([defined_args])), [
+      m4_popdef([ARG_][]arg)
+    ])
+
+    m4_set_delete(defined_args)
+  ])
+])
+
 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
 # If so, then append $1 to $2 \
 # Also set JVM_ARG_OK to true/false depending on outcome.
@@ -1122,7 +1190,6 @@
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    echo found it
     $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
   fi
 
--- a/common/autoconf/flags.m4	Thu Jan 21 13:41:02 2016 +0530
+++ b/common/autoconf/flags.m4	Thu Jan 21 14:49:02 2016 -0800
@@ -425,7 +425,7 @@
       # Add runtime stack smashing and undefined behavior checks.
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
-      FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [], [STACK_PROTECTOR_CFLAG=""])
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
 
       CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
@@ -742,7 +742,7 @@
       -I${JDK_TOPDIR}/src/java.base/share/native/include \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
-      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \ 
+      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
 
   # The shared libraries are compiled using the picflag.
@@ -896,17 +896,18 @@
   AC_SUBST(LDFLAGS_TESTEXE)
 ])
 
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                   [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the c and c++ compilers support an argument
-AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
+    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 [
-  AC_MSG_CHECKING([if compiler supports "$1"])
+  AC_MSG_CHECKING([if compiler supports "ARG_ARGUMENT"])
   supports=yes
 
   saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $1"
+  CFLAGS="$CFLAGS ARG_ARGUMENT"
   AC_LANG_PUSH([C])
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
       [supports=no])
@@ -914,7 +915,7 @@
   CFLAGS="$saved_cflags"
 
   saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $1"
+  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
   AC_LANG_PUSH([C++])
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
       [supports=no])
@@ -923,23 +924,26 @@
 
   AC_MSG_RESULT([$supports])
   if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
+    :
+    ARG_IF_TRUE
   else
-    m4_ifval([$3], [$3], [:])
+    :
+    ARG_IF_FALSE
   fi
 ])
 
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the linker support an argument
-AC_DEFUN([FLAGS_LINKER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
+    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 [
-  AC_MSG_CHECKING([if linker supports "$1"])
+  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
   supports=yes
 
   saved_ldflags="$LDFLAGS"
-  LDFLAGS="$LDFLAGS $1"
+  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
   AC_LANG_PUSH([C])
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
       [], [supports=no])
@@ -948,9 +952,11 @@
 
   AC_MSG_RESULT([$supports])
   if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
+    :
+    ARG_IF_TRUE
   else
-    m4_ifval([$3], [$3], [:])
+    :
+    ARG_IF_FALSE
   fi
 ])
 
@@ -965,14 +971,14 @@
     *)
       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   esac
-  FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
+  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
   AC_SUBST(ZERO_ARCHFLAG)
 
   # Check that the compiler supports -mX (or -qX on AIX) flags
   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
-  FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
-      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
-      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
+  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
+      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
+      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 
   AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
@@ -1013,9 +1019,9 @@
       ;;
     gcc)
       # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
-      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
-          [GCC_CAN_DISABLE_WARNINGS=true],
-          [GCC_CAN_DISABLE_WARNINGS=false]
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+          IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
+          IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
       )
       if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         DISABLE_WARNING_PREFIX="-Wno-"
@@ -1026,9 +1032,9 @@
       # Repeate the check for the BUILD_CC
       CC_OLD="$CC"
       CC="$BUILD_CC"
-      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
-          [BUILD_CC_CAN_DISABLE_WARNINGS=true],
-          [BUILD_CC_CAN_DISABLE_WARNINGS=false]
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+          IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
+          IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
       )
       if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
--- a/common/autoconf/generated-configure.sh	Thu Jan 21 13:41:02 2016 +0530
+++ b/common/autoconf/generated-configure.sh	Thu Jan 21 14:49:02 2016 -0800
@@ -3451,6 +3451,31 @@
 # questions.
 #
 
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+#   AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+#     [
+#         $ECHO hello world
+#     ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+
+
 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
 # If so, then append $1 to $2 \
 # Also set JVM_ARG_OK to true/false depending on outcome.
@@ -3886,20 +3911,24 @@
 
 
 
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                   [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the c and c++ compilers support an argument
 
 
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
+
+
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the linker support an argument
 
 
 
 
+
+
 #
 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4810,7 +4839,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1452261921
+DATE_WHEN_GENERATED=1452780299
 
 ###############################################################################
 #
@@ -45358,6 +45387,54 @@
     # "-Og" suppported for GCC 4.8 and later
     CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"... " >&6; }
   supports=yes
@@ -45417,15 +45494,76 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_CFLAG_OPTIMIZE_DEBUG=true
   else
+    :
     HAS_CFLAG_OPTIMIZE_DEBUG=false
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
     # "-z relro" supported in GNU binutils 2.17 and later
     LINKER_RELRO_FLAG="-Wl,-z,relro"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_RELRO_FLAG\"" >&5
 $as_echo_n "checking if linker supports \"$LINKER_RELRO_FLAG\"... " >&6; }
   supports=yes
@@ -45467,15 +45605,76 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_LINKER_RELRO=true
   else
+    :
     HAS_LINKER_RELRO=false
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
     # "-z now" supported in GNU binutils 2.11 and later
     LINKER_NOW_FLAG="-Wl,-z,now"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_NOW_FLAG\"" >&5
 $as_echo_n "checking if linker supports \"$LINKER_NOW_FLAG\"... " >&6; }
   supports=yes
@@ -45517,11 +45716,24 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_LINKER_NOW=true
   else
+    :
     HAS_LINKER_NOW=false
   fi
 
+
+
+
+
+
+
+
+
+
+
+
   fi
 
   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
@@ -46842,6 +47054,49 @@
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"... " >&6; }
   supports=yes
@@ -46902,11 +47157,24 @@
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
     :
-  else
+
+  else
+    :
     STACK_PROTECTOR_CFLAG=""
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
       CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       ;;
@@ -47384,6 +47652,49 @@
       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   esac
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$ZERO_ARCHFLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
   supports=yes
@@ -47444,15 +47755,76 @@
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
     :
-  else
+
+  else
+    :
     ZERO_ARCHFLAG=""
   fi
 
 
 
+
+
+
+
+
+
+
+
+
+
+
   # Check that the compiler supports -mX (or -qX on AIX) flags
   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
 $as_echo_n "checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
   supports=yes
@@ -47512,13 +47884,26 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=true
   else
+    :
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=false
   fi
 
 
 
+
+
+
+
+
+
+
+
+
+
+
   # Check whether --enable-warnings-as-errors was given.
 if test "${enable_warnings_as_errors+set}" = set; then :
   enableval=$enable_warnings_as_errors;
@@ -47565,6 +47950,54 @@
     gcc)
       # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
 $as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
   supports=yes
@@ -47624,12 +48057,25 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     GCC_CAN_DISABLE_WARNINGS=true
   else
+    :
     GCC_CAN_DISABLE_WARNINGS=false
 
   fi
 
+
+
+
+
+
+
+
+
+
+
+
       if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         DISABLE_WARNING_PREFIX="-Wno-"
       else
@@ -47640,6 +48086,54 @@
       CC_OLD="$CC"
       CC="$BUILD_CC"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
 $as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
   supports=yes
@@ -47699,12 +48193,25 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     BUILD_CC_CAN_DISABLE_WARNINGS=true
   else
+    :
     BUILD_CC_CAN_DISABLE_WARNINGS=false
 
   fi
 
+
+
+
+
+
+
+
+
+
+
+
       if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
       else
@@ -61523,7 +62030,6 @@
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    echo found it
     $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
   fi
 
--- a/common/autoconf/toolchain.m4	Thu Jan 21 13:41:02 2016 +0530
+++ b/common/autoconf/toolchain.m4	Thu Jan 21 14:49:02 2016 -0800
@@ -75,8 +75,8 @@
       # For full static builds, we're overloading the SHARED_LIBRARY
       # variables in order to limit the amount of changes required.
       # It would be better to remove SHARED and just use LIBRARY and
-      # LIBRARY_SUFFIX for libraries that can be built either 
-      # shared or static and use STATIC_* for libraries that are 
+      # LIBRARY_SUFFIX for libraries that can be built either
+      # shared or static and use STATIC_* for libraries that are
       # always built statically.
       if test "x$STATIC_BUILD" = xtrue; then
         SHARED_LIBRARY='lib[$]1.a'
@@ -824,21 +824,21 @@
 
     # "-Og" suppported for GCC 4.8 and later
     CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
-    FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_OPTIMIZE_DEBUG_FLAG],
-      [HAS_CFLAG_OPTIMIZE_DEBUG=true],
-      [HAS_CFLAG_OPTIMIZE_DEBUG=false])
+    FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG],
+      IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true],
+      IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false])
 
     # "-z relro" supported in GNU binutils 2.17 and later
     LINKER_RELRO_FLAG="-Wl,-z,relro"
-    FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG],
-      [HAS_LINKER_RELRO=true],
-      [HAS_LINKER_RELRO=false])
+    FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG],
+      IF_TRUE: [HAS_LINKER_RELRO=true],
+      IF_FALSE: [HAS_LINKER_RELRO=false])
 
     # "-z now" supported in GNU binutils 2.11 and later
     LINKER_NOW_FLAG="-Wl,-z,now"
-    FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_NOW_FLAG],
-      [HAS_LINKER_NOW=true],
-      [HAS_LINKER_NOW=false])
+    FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG],
+      IF_TRUE: [HAS_LINKER_NOW=true],
+      IF_FALSE: [HAS_LINKER_NOW=false])
   fi
 
   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
--- a/corba/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/corba/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,4 @@
 ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
 180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
 791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
+30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
--- a/hotspot/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/hotspot/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -503,3 +503,4 @@
 e5b1a23be1e105417ba1c4c576ab373eb3fa2c2b jdk-9+98
 f008e8cc10d5b3212fb22d58c96fa01d38654f19 jdk-9+99
 bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
+9f45d3d57d6948cf526fbc2e2891a9a74ac6941a jdk-9+101
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Jan 21 13:41:02 2016 +0530
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -124,7 +124,7 @@
   { CC"Java_jdk_internal_misc_Unsafe_registerNatives",             NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
   { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
   { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
-  { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         },
+  { CC"Java_jdk_internal_perf_Perf_registerNatives",               NULL, FN_PTR(JVM_RegisterPerfMethods)         },
   { CC"Java_sun_hotspot_WhiteBox_registerNatives",                 NULL, FN_PTR(JVM_RegisterWhiteBoxMethods)     },
 #if INCLUDE_JVMCI
   { CC"Java_jdk_vm_ci_runtime_JVMCI_initializeRuntime",            NULL, FN_PTR(JVM_GetJVMCIRuntime)             },
--- a/hotspot/src/share/vm/prims/perf.cpp	Thu Jan 21 13:41:02 2016 +0530
+++ b/hotspot/src/share/vm/prims/perf.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -34,7 +34,7 @@
 #include "runtime/perfMemory.hpp"
 
 /*
- *      Implementation of class sun.misc.Perf
+ *      Implementation of class jdk.internal.perf.Perf
  */
 
 
--- a/jaxp/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,4 @@
 52b01339235f24c93b679bd6b8fb36a1072ad0ac jdk-9+98
 52774b544850c791f1d1c67db2601b33739b18c9 jdk-9+99
 d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
+d3e834ff74e724a2b92a558e18e8cbf81c6dbc59 jdk-9+101
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -32,7 +32,6 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -43,6 +42,7 @@
 import static javax.xml.catalog.BaseEntry.CatalogEntryType;
 import static javax.xml.catalog.CatalogFeatures.DEFER_TRUE;
 import javax.xml.catalog.CatalogFeatures.Feature;
+import static javax.xml.catalog.CatalogMessages.formatMessage;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -109,25 +109,20 @@
      */
     public CatalogImpl(CatalogImpl parent, CatalogFeatures f, String... file) throws CatalogException {
         super(CatalogEntryType.CATALOG);
-        this.parent = parent;
-        if (parent == null) {
-            level = 0;
-        } else {
-            level = parent.level + 1;
+        if (f == null) {
+            throw new NullPointerException(
+                    formatMessage(CatalogMessages.ERR_NULL_ARGUMENT, new Object[]{"CatalogFeatures"}));
         }
-        if (f == null) {
-            this.features = CatalogFeatures.defaults();
-        } else {
-            this.features = f;
+
+        if (file.length > 0) {
+            CatalogMessages.reportNPEOnNull("The path to the catalog file", file[0]);
         }
-        setPrefer(features.get(Feature.PREFER));
-        setDeferred(features.get(Feature.DEFER));
-        setResolve(features.get(Feature.RESOLVE));
+
+        init(parent, f);
 
         //Path of catalog files
         String[] catalogFile = file;
-        if (level == 0
-                && (file == null || (file.length == 0 || file[0] == null))) {
+        if (level == 0 && file.length == 0) {
             String files = features.get(Feature.FILES);
             if (files != null) {
                 catalogFile = files.split(";[ ]*");
@@ -166,6 +161,23 @@
         }
     }
 
+    private void init(CatalogImpl parent, CatalogFeatures f) {
+        this.parent = parent;
+        if (parent == null) {
+            level = 0;
+        } else {
+            level = parent.level + 1;
+        }
+        if (f == null) {
+            this.features = CatalogFeatures.defaults();
+        } else {
+            this.features = f;
+        }
+        setPrefer(features.get(Feature.PREFER));
+        setDeferred(features.get(Feature.DEFER));
+        setResolve(features.get(Feature.RESOLVE));
+    }
+
     /**
      * Resets the Catalog instance to its initial state.
      */
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Thu Jan 21 14:49:02 2016 -0800
@@ -38,33 +38,38 @@
     }
 
     /**
-     * Creates a Catalog object using the specified feature settings and path to
-     * a catalog file. If the features is null, the default features will be used.
-     * If the path is empty, System property {@code javax.xml.catalog.files} will
-     * be read to locate the initial list of catalog files.
+     * Creates a {@code Catalog} object using the specified feature settings and
+     * path to one or more catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
+     * will be read to locate the initial list of catalog files.
+     * <p>
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path path(s) to one or more catalogs.
+     * @param paths path(s) to one or more catalogs.
      *
-     * @return a catalog instance
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code Catalog}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static Catalog catalog(CatalogFeatures features, String... path) {
-        return new CatalogImpl(features, path);
+    public static Catalog catalog(CatalogFeatures features, String... paths) {
+        return new CatalogImpl(features, paths);
     }
 
     /**
-     * Creates an instance of a CatalogResolver using the specified catalog.
+     * Creates an instance of a {@code CatalogResolver} using the specified catalog.
      *
      * @param catalog the catalog instance
-     * @return an instance of a CatalogResolver
+     * @return an instance of a {@code CatalogResolver}
      */
     public static CatalogResolver catalogResolver(Catalog catalog) {
         if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -72,10 +77,10 @@
     }
 
     /**
-     * Creates an instance of a CatalogUriResolver using the specified catalog.
+     * Creates an instance of a {@code CatalogUriResolver} using the specified catalog.
      *
      * @param catalog the catalog instance
-     * @return an instance of a CatalogResolver
+     * @return an instance of a {@code CatalogResolver}
      */
     public static CatalogUriResolver catalogUriResolver(Catalog catalog) {
         if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -83,50 +88,60 @@
     }
 
     /**
-     * Creates an instance of a CatalogResolver using the specified feature settings
-     * and path to a catalog file. If the features is null, the default features will
-     * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+     * Creates an instance of a {@code CatalogResolver} using the specified feature
+     * settings and path to one or more catalog files.
+     * <p>
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
      * will be read to locate the initial list of catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path the path(s) to one or more catalogs
+     * @param paths the path(s) to one or more catalogs
      *
-     * @return an instance of a CatalogResolver
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code CatalogResolver}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static CatalogResolver catalogResolver(CatalogFeatures features, String... path) {
-        Catalog catalog = catalog(features, path);
+    public static CatalogResolver catalogResolver(CatalogFeatures features, String... paths) {
+        Catalog catalog = catalog(features, paths);
         return new CatalogResolverImpl(catalog);
     }
 
     /**
-     * Creates an instance of a CatalogUriResolver using the specified feature settings
-     * and path to a catalog file. If the features is null, the default features will
-     * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+     * Creates an instance of a {@code CatalogUriResolver} using the specified
+     * feature settings and path to one or more catalog files.
+     * <p>
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
      * will be read to locate the initial list of catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path the path(s) to one or more catalogs
+     * @param paths the path(s) to one or more catalogs
      *
-     * @return an instance of a CatalogResolver
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code CatalogUriResolver}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... path) {
-        Catalog catalog = catalog(features, path);
+    public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... paths) {
+        Catalog catalog = catalog(features, paths);
         return new CatalogUriResolverImpl(catalog);
     }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java	Thu Jan 21 14:49:02 2016 -0800
@@ -43,9 +43,9 @@
      * absolute if the absolute URI is required
      *
      * @return a {@link javax.xml.transform.Source} object if a mapping is found.
-     * If no mapping is found, returns a {@link javax.xml.transform.Source} object
-     * containing an empty {@link java.io.Reader} if the
-     * {@code javax.xml.catalog.resolve} property is set to {@code ignore};
+     * If no mapping is found, returns an empty {@link javax.xml.transform.Source}
+     * object if the {@code javax.xml.catalog.resolve} property is set to
+     * {@code ignore};
      * returns a {@link javax.xml.transform.Source} object with the original URI
      * (href, or href resolved with base if base is not null) if the
      * {@code javax.xml.catalog.resolve} property is set to {@code continue}.
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -72,6 +72,7 @@
     public String getSystemIdStartString () {
         return systemIdStartString;
     }
+
     /**
      * Get the rewritePrefix attribute.
      * @return The rewritePrefix attribute value.
@@ -80,7 +81,6 @@
         return rewritePrefix;
     }
 
-
     /**
      * Try to match the specified systemId with the entry. Return the match if it
      * is successful and the length of the systemIdStartString is longer than the
@@ -91,14 +91,20 @@
      * @return The replacement URI if the match is successful, null if not.
      */
     public String match(String systemId, int currentMatch) {
-        if (systemIdStartString.length() <= systemId.length() &&
+        if (systemIdStartString.length() < systemId.length() &&
                 systemIdStartString.equals(systemId.substring(0, systemIdStartString.length()))) {
             if (currentMatch < systemIdStartString.length()) {
                 String prefix = rewritePrefix.toExternalForm();
-                if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
-                    return prefix + SLASH + systemId.substring(systemIdStartString.length());
+                String sysId;
+                if (systemIdStartString.endsWith(SLASH)) {
+                    sysId = systemId.substring(systemIdStartString.length());
                 } else {
-                    return prefix + systemId.substring(systemIdStartString.length());
+                    sysId = systemId.substring(systemIdStartString.length() + 1);
+                }
+                if (prefix.endsWith(SLASH)) {
+                    return prefix + sysId;
+                } else {
+                    return prefix + SLASH + sysId;
                 }
             }
         }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -72,6 +72,7 @@
     public String getURIStartString () {
         return uriStartString;
     }
+
     /**
      * Get the rewritePrefix attribute.
      * @return The rewritePrefix attribute value.
@@ -91,14 +92,20 @@
      */
     @Override
     public String match(String systemId, int currentMatch) {
-        if (uriStartString.length() <= systemId.length() &&
+        if (uriStartString.length() < systemId.length() &&
                 uriStartString.equals(systemId.substring(0, uriStartString.length()))) {
             if (currentMatch < uriStartString.length()) {
                 String prefix = rewritePrefix.toExternalForm();
-                if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
-                    return prefix + SLASH + systemId.substring(uriStartString.length());
+                String sysId;
+                if (uriStartString.endsWith(SLASH)) {
+                    sysId = systemId.substring(uriStartString.length());
                 } else {
-                    return prefix + systemId.substring(uriStartString.length());
+                    sysId = systemId.substring(uriStartString.length() + 1);
+                }
+                if (prefix.endsWith(SLASH)) {
+                    return prefix + sysId;
+                } else {
+                    return prefix + SLASH + sysId;
                 }
             }
         }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, 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,4 +52,17 @@
      * if setSystemId was not called.
      */
     public String getSystemId();
+
+    /**
+     * Indicates whether the {@code Source} object is empty. Empty means
+     * that there is no input available from this Source.
+     *
+     * @implSpec The default implementation of this method throws
+     * {@link UnsupportedOperationException}.
+     *
+     * @return true if the {@code Source} object is empty, false otherwise
+     */
+    default boolean isEmpty() {
+        throw new UnsupportedOperationException("The isEmpty method is not supported.");
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, 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
@@ -122,6 +122,7 @@
      *
      * @param systemID Base URL for this DOM tree.
      */
+    @Override
     public void setSystemId(String systemID) {
         this.systemID = systemID;
     }
@@ -132,7 +133,25 @@
      *
      * @return Base URL for this DOM tree.
      */
+    @Override
     public String getSystemId() {
         return this.systemID;
     }
+
+    /**
+     * Indicates whether the {@code DOMSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>if the system identifier and node are {@code null};
+     * </li>
+     * <li>if the system identifier is null, and the {@code node} has no child nodes.
+     * </li>
+     * </ul>
+     *
+     * @return true if the {@code DOMSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return systemID == null && (node == null || !node.hasChildNodes());
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, 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
@@ -147,6 +147,7 @@
      *
      * @param systemId The system identifier as a URI string.
      */
+    @Override
     public void setSystemId(String systemId) {
 
         if (null == inputSource) {
@@ -162,6 +163,7 @@
      *
      * @return Base URL for the <code>Source</code>, or <code>null</code>.
      */
+    @Override
     public String getSystemId() {
 
         if (inputSource == null) {
@@ -207,4 +209,22 @@
             return null;
         }
     }
+
+    /**
+     * Indicates whether the {@code SAXSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>if the system identifier and {@code InputSource} are {@code null};
+     * </li>
+     * <li>if the system identifier is {@code null}, and the {@code InputSource}
+     * is empty.
+     * </li>
+     * </ul>
+     *
+     * @return true if the {@code SAXSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return getSystemId() == null && (inputSource == null || inputSource.isEmpty());
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -209,6 +209,7 @@
      * @throws UnsupportedOperationException Is <strong>always</strong>
      *   thrown by this method.
      */
+    @Override
     public void setSystemId(final String systemId) {
 
         throw new UnsupportedOperationException(
@@ -229,8 +230,21 @@
      *
      * @return System identifier used by this <code>StAXSource</code>.
      */
+    @Override
     public String getSystemId() {
 
         return systemId;
     }
+
+    /**
+     * Indicates whether the {@code StAXSource} object is empty. Since a
+     * {@code StAXSource} object can never be empty, this method always returns
+     * false.
+     *
+     * @return unconditionally false
+     */
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, 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,8 +26,10 @@
 package javax.xml.transform.stream;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
+import javax.xml.transform.Result;
 
 import javax.xml.transform.Source;
 
@@ -233,6 +235,7 @@
      *
      * @param systemId The system identifier as a URL string.
      */
+    @Override
     public void setSystemId(String systemId) {
         this.systemId = systemId;
     }
@@ -243,6 +246,7 @@
      * @return The system identifier that was set with setSystemId, or null
      * if setSystemId was not called.
      */
+    @Override
     public String getSystemId() {
         return systemId;
     }
@@ -259,6 +263,59 @@
         this.systemId = f.toURI().toASCIIString();
     }
 
+    /**
+     * Indicates whether the {@code StreamSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>All of the input sources, including the public identifier, system
+     * identifier, byte stream, and character stream, are {@code null}.
+     * </li>
+     * <li>The public identifier and system identifier are {@code null}, and
+     * byte and character stream are either {@code null} or contain no byte or
+     * character.
+     * <p>
+     * Note that this method will reset the byte stream if it is provided, or
+     * the character stream if the byte stream is not provided.
+     * </li>
+     * </ul>
+     * <p>
+     * In case of error while checking the byte or character stream, the method
+     * will return false to allow the XML processor to handle the error.
+     *
+     * @return true if the {@code StreamSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return (publicId == null && systemId == null && isStreamEmpty());
+    }
+
+    private boolean isStreamEmpty() {
+        boolean empty = true;
+        try {
+            if (inputStream != null) {
+                inputStream.reset();
+                int bytesRead = inputStream.available();
+                if (bytesRead > 0) {
+                    return false;
+                }
+            }
+
+            if (reader != null) {
+                reader.reset();
+                int c = reader.read();
+                reader.reset();
+                if (c != -1) {
+                    return false;
+                }
+            }
+        } catch (IOException ex) {
+            //in case of error, return false
+            return false;
+        }
+
+        return empty;
+    }
+
     //////////////////////////////////////////////////////////////////////
     // Internal state.
     //////////////////////////////////////////////////////////////////////
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, 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,6 +30,7 @@
 
 package org.xml.sax;
 
+import java.io.IOException;
 import java.io.Reader;
 import java.io.InputStream;
 
@@ -343,8 +344,57 @@
         return characterStream;
     }
 
+    /**
+     * Indicates whether the {@code InputSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>All of the input sources, including the public identifier, system
+     * identifier, byte stream, and character stream, are {@code null}.
+     * </li>
+     * <li>The public identifier and system identifier are  {@code null}, and
+     * byte and character stream are either  {@code null} or contain no byte
+     * or character.
+     * <p>
+     * Note that this method will reset the byte stream if it is provided, or
+     * the character stream if the byte stream is not provided.
+     * </li>
+     * </ul>
+     * <p>
+     * In case of error while checking the byte or character stream, the method
+     * will return false to allow the XML processor to handle the error.
+     *
+     * @return true if the {@code InputSource} object is empty, false otherwise
+     */
+    public boolean isEmpty() {
+        return (publicId == null && systemId == null && isStreamEmpty());
+    }
 
+    private boolean isStreamEmpty() {
+        boolean empty = true;
+        try {
+            if (byteStream != null) {
+                byteStream.reset();
+                int bytesRead = byteStream.available();
+                if (bytesRead > 0) {
+                    return false;
+                }
+            }
 
+            if (characterStream != null) {
+                characterStream.reset();
+                int c = characterStream.read();
+                characterStream.reset();
+                if (c != -1) {
+                    return false;
+                }
+            }
+        } catch (IOException ex) {
+            //in case of error, return false
+            return false;
+        }
+
+        return empty;
+    }
     ////////////////////////////////////////////////////////////////////
     // Internal state.
     ////////////////////////////////////////////////////////////////////
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -56,23 +56,14 @@
 
     @DataProvider(name = "catalog-countOfLoadedCatalogFile")
     private Object[][] data() {
-        return new Object[][] {
-                // This catalog specifies null catalog explicitly,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(null), 0 },
-
-                // This catalog specifies null catalog implicitly,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(CatalogFeatures.defaults()), 0 },
-
-                // This catalog loads null catalog with true DEFER,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(createDeferFeature(DEFER_TRUE)), 0 },
-
-                // This catalog loads null catalog with false DEFER.
-                // It should load all of none-current catalogs and the
-                // count of loaded catalogs should be 3.
-                { createCatalog(createDeferFeature(DEFER_FALSE)), 3 } };
+        return new Object[][]{
+            // By default, alternative catalogs are not loaded.
+            {createCatalog(CatalogFeatures.defaults()), 0},
+            // Alternative catalogs are not loaded when DEFER is set to true.
+            {createCatalog(createDeferFeature(DEFER_TRUE)), 0},
+            // The 3 alternative catalogs are not pre-loaded
+            //when DEFER is set to false.
+            {createCatalog(createDeferFeature(DEFER_FALSE)), 3}};
     }
 
     private CatalogFeatures createDeferFeature(String defer) {
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Jan 21 14:49:02 2016 -0800
@@ -83,7 +83,7 @@
      * Creates CatalogResolver with a set of catalogs.
      */
     static CatalogResolver catalogResolver(String... catalogName) {
-        return catalogResolver(null, catalogName);
+        return catalogResolver(CatalogFeatures.defaults(), catalogName);
     }
 
     /*
@@ -91,15 +91,16 @@
      */
     static CatalogResolver catalogResolver(CatalogFeatures features,
             String... catalogName) {
-        return CatalogManager.catalogResolver(features,
-                getCatalogPaths(catalogName));
+        return (catalogName == null) ?
+                CatalogManager.catalogResolver(features) :
+                CatalogManager.catalogResolver(features, getCatalogPaths(catalogName));
     }
 
     /*
      * Creates catalogUriResolver with a set of catalogs.
      */
     static CatalogUriResolver catalogUriResolver(String... catalogName) {
-        return catalogUriResolver(null, catalogName);
+        return catalogUriResolver(CatalogFeatures.defaults(), catalogName);
     }
 
     /*
@@ -107,8 +108,9 @@
      */
     static CatalogUriResolver catalogUriResolver(
             CatalogFeatures features, String... catalogName) {
-        return CatalogManager.catalogUriResolver(features,
-                getCatalogPaths(catalogName));
+        return (catalogName == null) ?
+                CatalogManager.catalogUriResolver(features) :
+                CatalogManager.catalogUriResolver(features, getCatalogPaths(catalogName));
     }
 
     // Gets the paths of the specified catalogs.
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -89,7 +89,7 @@
     /**
      * BOM table for storing BOM header.
      */
-    private final static Map<String, byte[]> bom = new HashMap();
+    private final static Map<String, byte[]> bom = new HashMap<>();
 
     /**
      * Initialize all BOM headers.
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -27,14 +27,13 @@
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
 import org.xml.sax.Attributes;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -42,12 +41,66 @@
 import org.xml.sax.ext.DefaultHandler2;
 
 /*
- * @bug 8081248
+ * @bug 8081248, 8144966, 8146606
  * @summary Tests basic Catalog functions.
  */
 
 public class CatalogTest {
     /*
+       @bug 8146606
+       Verifies that the resulting systemId does not contain duplicate slashes
+    */
+    public void testRewriteSystem() {
+        String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+        try {
+            CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
+            String actualSystemId = resolver.resolveEntity(null, "http://remote.com/dtd/book.dtd").getSystemId();
+            Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+    }
+
+    /*
+       @bug 8146606
+       Verifies that the resulting systemId does not contain duplicate slashes
+    */
+    public void testRewriteUri() {
+        String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+        try {
+
+            CatalogUriResolver resolver = CatalogManager.catalogUriResolver(CatalogFeatures.defaults(), catalog);
+            String actualSystemId = resolver.resolve("http://remote.com/import/import.xsl", null).getSystemId();
+            Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    /*
+       @bug 8144966
+       Verifies that passing null as CatalogFeatures will result in a NPE.
+    */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testFeatureNull() {
+        CatalogResolver resolver = CatalogManager.catalogResolver(null, "");
+
+    }
+
+    /*
+       @bug 8144966
+       Verifies that passing null as the path will result in a NPE.
+    */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testPathNull() {
+        String path = null;
+        CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), path);
+    }
+
+    /*
        Tests basic catalog feature by using a CatalogResolver instance to
     resolve a DTD reference to a locally specified DTD file. If the resolution
     is successful, the Handler shall return the value of the entity reference
@@ -61,7 +114,7 @@
         }
         String url = getClass().getResource(xml).getFile();
         try {
-            CatalogResolver cr = CatalogManager.catalogResolver(null, catalog);
+            CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
             XMLReader reader = saxParser.getXMLReader();
             reader.setEntityResolver(cr);
             MyHandler handler = new MyHandler(saxParser);
@@ -84,7 +137,7 @@
 
         String test = "testInvalidCatalog";
         try {
-            CatalogResolver resolver = CatalogManager.catalogResolver(null, catalog);
+            CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
             String actualSystemId = resolver.resolveEntity(null, "http://remote/xml/dtd/sys/alice/docAlice.dtd").getSystemId();
         } catch (Exception e) {
             String msg = e.getMessage();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/rewriteCatalog.xml	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog
+  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+
+    <rewriteSystem systemIdStartString="http://remote.com/dtd"
+                   rewritePrefix="file:///share/docbook/docbook/pass"/> 
+
+    <rewriteURI uriStartString="http://remote.com/import" rewritePrefix="file:///local/import" />
+    
+</catalog>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,202 @@
+/*
+ * 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.
+ */
+package common;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 8144967
+ * @summary Tests related to the javax.xml.transform.Source
+ * and org.xml.sax.InputSource
+ */
+public class Sources {
+
+    /**
+     * @bug 8144967
+     * Tests whether a Source object is empty
+     * @param source the Source object
+     */
+    @Test(dataProvider = "emptySources")
+    public void testIsEmpty(Source source) {
+        Assert.assertTrue(source.isEmpty(), "The source is not empty");
+    }
+
+    /**
+     * @bug 8144967
+     * Tests that the source is not empty
+     * @param source the Source object
+     */
+    @Test(dataProvider = "nonEmptySources")
+    public void testIsNotEmpty(Source source) {
+        Assert.assertTrue(!source.isEmpty(), "The source is empty");
+    }
+
+    /**
+     * @bug 8144967
+     * Tests whether an InputSource object is empty
+     * @param source the InputSource object
+     */
+    @Test(dataProvider = "emptyInputSource")
+    public void testISIsEmpty(InputSource source) {
+        Assert.assertTrue(source.isEmpty(), "The source is not empty");
+    }
+
+    /*
+     * DataProvider: sources that are empty
+     */
+    @DataProvider(name = "emptySources")
+    Object[][] getSources() throws URISyntaxException {
+
+        return new Object[][]{
+            {new DOMSource()},
+            {new DOMSource(getDocument())},
+            {new SAXSource()},
+            {new SAXSource(new InputSource(new StringReader("")))},
+            {new SAXSource(getXMLReader(), new InputSource(new StringReader("")))},
+            {new StreamSource()},
+            {new StreamSource(new ByteArrayInputStream("".getBytes()))},
+            {new StreamSource(new StringReader(""))},
+            {new StreamSource(new StringReader(""), null)},
+            {new StreamSource((String) null)}
+        };
+    }
+
+    /*
+     * DataProvider: sources that are not empty
+     */
+    @DataProvider(name = "nonEmptySources")
+    Object[][] getSourcesEx() throws URISyntaxException {
+        StAXSource ss = null;
+        try {
+            ss = new StAXSource(getXMLEventReader());
+        } catch (XMLStreamException ex) {}
+
+        return new Object[][]{
+            //This will set a non-null systemId on the resulting StreamSource
+            {new StreamSource(new File(""))},
+            //Can't tell because XMLStreamReader is a pull parser, cursor advancement
+            //would have been required in order to examine the reader.
+            {new StAXSource(getXMLStreamReader())},
+            {ss}
+        };
+    }
+
+    /*
+     * DataProvider: sources that are empty
+     */
+    @DataProvider(name = "emptyInputSource")
+    Object[][] getInputSources() throws URISyntaxException {
+        byte[] utf8Bytes = null;
+        try {
+            utf8Bytes = "".getBytes("UTF8");
+        } catch (UnsupportedEncodingException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+        return new Object[][]{
+            {new InputSource()},
+            {new InputSource(new ByteArrayInputStream(utf8Bytes))},
+            {new InputSource(new StringReader(""))},
+            {new InputSource((String) null)}
+        };
+    }
+
+    /**
+     * Returns an instance of Document.
+     *
+     * @return an instance of Document.
+     */
+    private Document getDocument() {
+        Document doc = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            doc = dbf.newDocumentBuilder().newDocument();
+        } catch (ParserConfigurationException ex) {}
+        return doc;
+    }
+
+    /**
+     * Returns an instance of XMLReader.
+     *
+     * @return an instance of XMLReader.
+     */
+    private XMLReader getXMLReader() {
+        XMLReader reader = null;
+        try {
+            reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        } catch (ParserConfigurationException | SAXException ex) {}
+        return reader;
+    }
+
+    /**
+     * Returns an instance of XMLStreamReader.
+     *
+     * @return an instance of XMLStreamReader.
+     */
+    private XMLStreamReader getXMLStreamReader() {
+        XMLStreamReader r = null;
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            r = xif.createXMLStreamReader(new ByteArrayInputStream("".getBytes()));
+        } catch (XMLStreamException ex) {}
+
+        return r;
+    }
+
+    /**
+     * Returns an instance of XMLEventReader.
+     *
+     * @return an instance of XMLEventReader.
+     */
+    private XMLEventReader getXMLEventReader() {
+        XMLEventReader r = null;
+        try {
+            r = XMLInputFactory.newInstance().createXMLEventReader(
+                            new ByteArrayInputStream("".getBytes()));
+        } catch (XMLStreamException ex) {}
+
+        return r;
+    }
+}
--- a/jaxws/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/jaxws/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -346,3 +346,4 @@
 67c84077edc3db6b24998b35970b37c01aae985e jdk-9+98
 97b31ca0dd77483cf20ff99a033a455673639578 jdk-9+99
 d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
+3e99318616da903e0dc8f07f9f9203dc1bd49921 jdk-9+101
--- a/jdk/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,5 @@
 f86ee68d1107dad41a27efc34306e0e56244a12e jdk-9+98
 e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
 3d452840f48299a36842760d17c0c8402f0e1266 jdk-9+100
+5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
+6eb3c8132e489dab81adde4ce29844904ce15482 jdk-9+102
--- a/jdk/make/CompileDemos.gmk	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/CompileDemos.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/CopySamples.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/Import.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/Tools.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/copy/Copy-java.base.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gendata/GendataBreakIterator.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gendata/GendataPolicyJars.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcBuffer.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcExceptions.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcIcons.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcMisc.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcProperties.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcSwing.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/launcher/Launcher-java.base.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/launcher/LauncherCommon.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/CoreLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.base.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.instrument.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.management.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.prefs.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.accessibility.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.attach.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.internal.le.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.management.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/LibCommon.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/NetworkingLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/NioLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/PlatformLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/SecurityLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/lib/SoundLibraries.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/src/classes/build/tools/spp/Spp.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Character.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/ClassLoader.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jan 21 14:49:02 2016 -0800
@@ -50,6 +50,8 @@
 import java.util.Hashtable;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
+
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.reflect.CallerSensitive;
@@ -423,9 +425,9 @@
                     c = findClass(name);
 
                     // this is the defining class loader; record the stats
-                    sun.misc.PerfCounter.getParentDelegationTime().addTime(t1 - t0);
-                    sun.misc.PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
-                    sun.misc.PerfCounter.getFindClasses().increment();
+                    PerfCounter.getParentDelegationTime().addTime(t1 - t0);
+                    PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
+                    PerfCounter.getFindClasses().increment();
                 }
             }
             if (resolve) {
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/MethodHandles.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -3120,6 +3120,8 @@
                                 MethodHandle handler) {
         MethodType ttype = target.type();
         MethodType htype = handler.type();
+        if (!Throwable.class.isAssignableFrom(exType))
+            throw new ClassCastException(exType.getName());
         if (htype.parameterCount() < 1 ||
             !htype.parameterType(0).isAssignableFrom(exType))
             throw newIllegalArgumentException("handler does not accept exception type "+exType);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -373,22 +373,26 @@
      *
      * @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) {
+        if (name == StandardSocketOptions.SO_KEEPALIVE &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_KEEPALIVE, value);
-        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+        } else if (name == StandardSocketOptions.SO_SNDBUF &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_SNDBUF, value);
         } else if (name == StandardSocketOptions.SO_RCVBUF) {
             setOption(SocketOptions.SO_RCVBUF, value);
         } else if (name == StandardSocketOptions.SO_REUSEADDR) {
             setOption(SocketOptions.SO_REUSEADDR, value);
-        } else if (name == StandardSocketOptions.SO_LINGER) {
+        } else if (name == StandardSocketOptions.SO_LINGER &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_LINGER, value);
         } else if (name == StandardSocketOptions.IP_TOS) {
             setOption(SocketOptions.IP_TOS, value);
-        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+        } else if (name == StandardSocketOptions.TCP_NODELAY &&
+                (getSocket() != null)) {
             setOption(SocketOptions.TCP_NODELAY, value);
         } else {
             throw new UnsupportedOperationException("unsupported option");
@@ -408,23 +412,27 @@
      *
      * @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 {
-        if (name == StandardSocketOptions.SO_KEEPALIVE) {
+        if (name == StandardSocketOptions.SO_KEEPALIVE &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_KEEPALIVE);
-        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+        } else if (name == StandardSocketOptions.SO_SNDBUF &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_SNDBUF);
         } else if (name == StandardSocketOptions.SO_RCVBUF) {
             return (T)getOption(SocketOptions.SO_RCVBUF);
         } else if (name == StandardSocketOptions.SO_REUSEADDR) {
             return (T)getOption(SocketOptions.SO_REUSEADDR);
-        } else if (name == StandardSocketOptions.SO_LINGER) {
+        } else if (name == StandardSocketOptions.SO_LINGER &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_LINGER);
         } else if (name == StandardSocketOptions.IP_TOS) {
             return (T)getOption(SocketOptions.IP_TOS);
-        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+        } else if (name == StandardSocketOptions.TCP_NODELAY &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.TCP_NODELAY);
         } else {
             throw new UnsupportedOperationException("unsupported option");
--- a/jdk/src/java.base/share/classes/java/net/URL.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/URLClassLoader.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java	Thu Jan 21 14:49:02 2016 -0800
@@ -52,6 +52,7 @@
 
 import jdk.internal.misc.JavaNetAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.net.www.ParseUtil;
@@ -459,14 +460,14 @@
             // Use (direct) ByteBuffer:
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, bb, cs);
         } else {
             byte[] b = res.getBytes();
             // must read certificates AFTER reading bytes.
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, b, 0, b.length, cs);
         }
     }
--- a/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/net/spi/package-info.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/PermissionCollection.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/ProtectionDomain.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -27,12 +27,12 @@
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
-import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 import jdk.internal.misc.JavaSecurityAccess;
 import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
@@ -472,11 +472,15 @@
      *
      * This class stores ProtectionDomains as weak keys in a ConcurrentHashMap
      * with additional support for checking and removing weak keys that are no
-     * longer in use.
+     * longer in use. There can be cases where the permission collection may
+     * have a chain of strong references back to the ProtectionDomain, which
+     * ordinarily would prevent the entry from being removed from the map. To
+     * address that, we wrap the permission collection in a SoftReference so
+     * that it can be reclaimed by the garbage collector due to memory demand.
      */
     private static class PDCache implements ProtectionDomainCache {
         private final ConcurrentHashMap<WeakProtectionDomainKey,
-                                        PermissionCollection>
+                                        SoftReference<PermissionCollection>>
                                         pdMap = new ConcurrentHashMap<>();
         private final ReferenceQueue<Key> queue = new ReferenceQueue<>();
 
@@ -485,15 +489,15 @@
             processQueue(queue, pdMap);
             WeakProtectionDomainKey weakPd =
                 new WeakProtectionDomainKey(pd, queue);
-            pdMap.putIfAbsent(weakPd, pc);
+            pdMap.put(weakPd, new SoftReference<>(pc));
         }
 
         @Override
         public PermissionCollection get(ProtectionDomain pd) {
             processQueue(queue, pdMap);
-            WeakProtectionDomainKey weakPd =
-                new WeakProtectionDomainKey(pd, queue);
-            return pdMap.get(weakPd);
+            WeakProtectionDomainKey weakPd = new WeakProtectionDomainKey(pd);
+            SoftReference<PermissionCollection> sr = pdMap.get(weakPd);
+            return (sr == null) ? null : sr.get();
         }
 
         /**
@@ -533,11 +537,20 @@
             this((pd == null ? NULL_KEY : pd.key), rq);
         }
 
+        WeakProtectionDomainKey(ProtectionDomain pd) {
+            this(pd == null ? NULL_KEY : pd.key);
+        }
+
         private WeakProtectionDomainKey(Key key, ReferenceQueue<Key> rq) {
             super(key, rq);
             hash = key.hashCode();
         }
 
+        private WeakProtectionDomainKey(Key key) {
+            super(key);
+            hash = key.hashCode();
+        }
+
         /**
          * Returns the identity hash code of the original referent.
          */
--- a/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/Arrays.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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/Enumeration.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Enumeration.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/Locale.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java	Thu Jan 21 14:49:02 2016 -0800
@@ -3144,6 +3144,18 @@
                    && range.equals(other.range)
                    && weight == other.weight;
         }
+
+        /**
+         * Returns an informative string representation of this {@code LanguageRange}
+         * object, consisting of language range and weight if the range is
+         * weighted and the weight is less than the max weight.
+         *
+         * @return a string representation of this {@code LanguageRange} object.
+         */
+        @Override
+        public String toString() {
+            return (weight == MAX_WEIGHT) ? range : range + ";q=" + weight;
+        }
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/java/util/zip/ZipFile.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Thu Jan 21 14:49:02 2016 -0800
@@ -54,6 +54,7 @@
 import java.util.stream.StreamSupport;
 import jdk.internal.misc.JavaUtilZipFileAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 
 import static java.util.zip.ZipConstants.*;
 import static java.util.zip.ZipConstants64.*;
@@ -210,8 +211,8 @@
         this.name = name;
         long t0 = System.nanoTime();
         this.zsrc = Source.get(file, (mode & OPEN_DELETE) != 0);
-        sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
-        sun.misc.PerfCounter.getZipFileCount().increment();
+        PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
+        PerfCounter.getZipFileCount().increment();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/Perf.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.perf;
+
+import java.nio.ByteBuffer;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import jdk.internal.ref.CleanerFactory;
+
+/**
+ * The Perf class provides the ability to attach to an instrumentation
+ * buffer maintained by a Java virtual machine. The instrumentation
+ * buffer may be for the Java virtual machine running the methods of
+ * this class or it may be for another Java virtual machine on the
+ * same system.
+ * <p>
+ * In addition, this class provides methods to create instrumentation
+ * objects in the instrumentation buffer for the Java virtual machine
+ * that is running these methods. It also contains methods for acquiring
+ * the value of a platform specific high resolution clock for time
+ * stamp and interval measurement purposes.
+ *
+ * @author   Brian Doherty
+ * @since    1.4.2
+ * @see      #getPerf
+ * @see      jdk.internal.perf.Perf.GetPerfAction
+ * @see      java.nio.ByteBuffer
+ */
+public final class Perf {
+
+    private static Perf instance;
+
+    private static final int PERF_MODE_RO = 0;
+    private static final int PERF_MODE_RW = 1;
+
+    private Perf() { }    // prevent instantiation
+
+    /**
+     * The GetPerfAction class is a convenience class for acquiring access
+     * to the singleton Perf instance using the
+     * <code>AccessController.doPrivileged()</code> method.
+     * <p>
+     * An instance of this class can be used as the argument to
+     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
+     * <p> Here is a suggested idiom for use of this class:
+     *
+     * <blockquote><pre>{@code
+     * class MyTrustedClass {
+     *   private static final Perf perf =
+     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
+     *   ...
+     * }
+     * }</pre></blockquote>
+     * <p>
+     * In the presence of a security manager, the <code>MyTrustedClass</code>
+     * class in the above example will need to be granted the
+     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
+     * permission in order to successfully acquire the singleton Perf instance.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
+     * @see  java.lang.RuntimePermission
+     */
+    public static class GetPerfAction implements PrivilegedAction<Perf>
+    {
+        /**
+         * Run the <code>Perf.getPerf()</code> method in a privileged context.
+         *
+         * @see #getPerf
+         */
+        public Perf run() {
+            return getPerf();
+        }
+    }
+
+    /**
+     * Return a reference to the singleton Perf instance.
+     * <p>
+     * The getPerf() method returns the singleton instance of the Perf
+     * class. The returned object provides the caller with the capability
+     * for accessing the instrumentation buffer for this or another local
+     * Java virtual machine.
+     * <p>
+     * If a security manager is installed, its <code>checkPermission</code>
+     * method is called with a <code>RuntimePermission</code> with a target
+     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
+     * if the caller has not been granted this permission.
+     * <p>
+     * Access to the returned <code>Perf</code> object should be protected
+     * by its caller and not passed on to untrusted code. This object can
+     * be used to attach to the instrumentation buffer provided by this Java
+     * virtual machine or for those of other Java virtual machines running
+     * on the same system. The instrumentation buffer may contain senstitive
+     * information. API's built on top of this interface may want to provide
+     * finer grained access control to the contents of individual
+     * instrumentation objects contained within the buffer.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @return  A reference to the singleton Perf instance.
+     * @throws SecurityException  if a security manager exists and its
+     *         <code>checkPermission</code> method doesn't allow access
+     *         to the <em>"jdk.internal.perf.Perf.getPerf""</em> target.
+     * @see  java.lang.RuntimePermission
+     * @see  #attach
+     */
+    public static Perf getPerf()
+    {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            Permission perm = new RuntimePermission("jdk.internal.perf.Perf.getPerf");
+            security.checkPermission(perm);
+        }
+
+        return instance;
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine.
+     * <p>
+     * This method will attach to the instrumentation buffer for the
+     * specified virtual machine. It returns a <code>ByteBuffer</code> object
+     * that is initialized to access the instrumentation buffer for the
+     * indicated Java virtual machine. The <code>lvmid</code> parameter is
+     * a integer value that uniquely identifies the target local Java virtual
+     * machine. It is typically, but not necessarily, the process id of
+     * the target Java virtual machine.
+     * <p>
+     * If the <code>lvmid</code> identifies a Java virtual machine different
+     * from the one running this method, then the coherency characteristics
+     * of the buffer are implementation dependent. Implementations that do
+     * not support named, coherent, shared memory may return a
+     * <code>ByteBuffer</code> object that contains only a snap shot of the
+     * data in the instrumentation buffer. Implementations that support named,
+     * coherent, shared memory, may return a <code>ByteBuffer</code> object
+     * that will be changing dynamically over time as the target Java virtual
+     * machine updates its mapping of this buffer.
+     * <p>
+     * If the <code>lvmid</code> is 0 or equal to the actual <code>lvmid</code>
+     * for the Java virtual machine running this method, then the returned
+     * <code>ByteBuffer</code> object will always be coherent and dynamically
+     * changing.
+     * <p>
+     * The attach mode specifies the access permissions requested for the
+     * instrumentation buffer of the target virtual machine. The permitted
+     * access permissions are:
+     * <ul>
+     * <li>"r"  - Read only access. This Java virtual machine has only
+     * read access to the instrumentation buffer for the target Java
+     * virtual machine.
+     * <li>"rw"  - Read/Write access. This Java virtual machine has read and
+     * write access to the instrumentation buffer for the target Java virtual
+     * machine. This mode is currently not supported and is reserved for
+     * future enhancements.
+     * </ul>
+     *
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine owned by the given user.
+     * <p>
+     * This method behaves just as the <code>attach(int lvmid, String mode)
+     * </code> method, except that it only searches for Java virtual machines
+     * owned by the specified user.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(String user, int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Call the implementation specific attach method.
+     * <p>
+     * This method calls into the Java virtual machine to perform the platform
+     * specific attach method. Buffers returned from this method are
+     * internally managed as <code>PhantomRefereces</code> to provide for
+     * guaranteed, secure release of the native resources.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private ByteBuffer attachImpl(String user, int lvmid, int mode)
+            throws IllegalArgumentException, IOException
+    {
+        final ByteBuffer b = attach(user, lvmid, mode);
+
+        if (lvmid == 0) {
+            // The native instrumentation buffer for this Java virtual
+            // machine is never unmapped.
+            return b;
+        }
+        else {
+            // This is an instrumentation buffer for another Java virtual
+            // machine with native resources that need to be managed. We
+            // create a duplicate of the native ByteBuffer and manage it
+            // with a Cleaner. When the duplicate becomes phantom reachable,
+            // the native resources will be released.
+
+            final ByteBuffer dup = b.duplicate();
+
+            CleanerFactory.cleaner()
+                          .register(dup, new CleanerAction(instance, b));
+            return dup;
+        }
+    }
+
+    private static class CleanerAction implements Runnable {
+        private final ByteBuffer bb;
+        private final Perf perf;
+        CleanerAction(Perf perf, ByteBuffer bb) {
+            this.perf = perf;
+            this.bb = bb;
+        }
+        public void run() {
+            try {
+                perf.detach(bb);
+            } catch (Throwable th) {
+                // avoid crashing the reference handler thread,
+                // but provide for some diagnosability
+                assert false : th.toString();
+            }
+        }
+    }
+
+    /**
+     * Native method to perform the implementation specific attach mechanism.
+     * <p>
+     * The implementation of this method may return distinct or identical
+     * <code>ByteBuffer</code> objects for two distinct calls requesting
+     * attachment to the same Java virtual machine.
+     * <p>
+     * For the Sun HotSpot JVM, two distinct calls to attach to the same
+     * target Java virtual machine will result in two distinct ByteBuffer
+     * objects returned by this method. This may change in a future release.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private native ByteBuffer attach(String user, int lvmid, int mode)
+                   throws IllegalArgumentException, IOException;
+
+    /**
+     * Native method to perform the implementation specific detach mechanism.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object that is
+     * not created by the <code>attach</code> method, then the results of
+     * this method are undefined, with unpredictable and potentially damaging
+     * effects to the Java virtual machine. To prevent accidental or malicious
+     * use of this method, all native ByteBuffer created by the <code>
+     * attach</code> method are managed internally as PhantomReferences
+     * and resources are freed by the system.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object created
+     * by the <code>attach</code> method with a lvmid for the Java virtual
+     * machine running this method (lvmid=0, for example), then the detach
+     * request is silently ignored.
+     *
+     * @param bb  A direct allocated byte buffer created by the
+     *                    <code>attach</code> method.
+     * @see   java.nio.ByteBuffer
+     * @see   #attach
+     */
+    private native void detach(ByteBuffer bb);
+
+    /**
+     * Create a <code>long</code> scalar entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object. Typically, this object should be wrapped
+     * with <code>LongBuffer</code> view object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer object that
+     *                      allows write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createLong(String name, int variability,
+                                        int units, long value);
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is given in by <code>maxLength</code> parameter. Updates
+     * to this instrument with <code>String</code> values with lengths greater
+     * than <code>maxLength</code> will be truncated to <code>maxLength</code>.
+     * The truncated value will be terminated by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * value, but will continue to preserve the null terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum string length for this string
+     *                      instrument.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value, int maxLength)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, Math.max(v1.length, maxLength));
+    }
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is implied by the length of the <code>value</code> parameter.
+     * Subsequent updates to the value of this instrument will be truncated
+     * to this implied maximum length. The truncated value will be terminated
+     * by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * initial or subsequent value, but will continue to preserve the null
+     * terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, v1.length);
+    }
+
+    /**
+     * Create a <code>byte</code> vector entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * The <code>maxLength</code> parameter limits the size of the byte
+     * array instrument such that the initial or subsequent updates beyond
+     * this length are silently ignored. No special handling of truncated
+     * updates is provided.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * length of the initial or subsequent value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum length of this byte array.
+     * @return  ByteBuffer  a direct allocated byte buffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createByteArray(String name, int variability,
+                                             int units, byte[] value,
+                                             int maxLength);
+
+
+    /**
+     * convert string to an array of UTF-8 bytes
+     */
+    private static byte[] getBytes(String s)
+    {
+        byte[] bytes = null;
+
+        try {
+            bytes = s.getBytes("UTF-8");
+        }
+        catch (UnsupportedEncodingException e) {
+            // ignore, UTF-8 encoding is always known
+        }
+
+        return bytes;
+    }
+
+    /**
+     * Return the value of the High Resolution Counter.
+     *
+     * The High Resolution Counter returns the number of ticks since
+     * since the start of the Java virtual machine. The resolution of
+     * the counter is machine dependent and can be determined from the
+     * value return by the {@link #highResFrequency} method.
+     *
+     * @return  the number of ticks of machine dependent resolution since
+     *          the start of the Java virtual machine.
+     *
+     * @see #highResFrequency
+     * @see java.lang.System#currentTimeMillis()
+     */
+    public native long highResCounter();
+
+    /**
+     * Returns the frequency of the High Resolution Counter, in ticks per
+     * second.
+     *
+     * This value can be used to convert the value of the High Resolution
+     * Counter, as returned from a call to the {@link #highResCounter} method,
+     * into the number of seconds since the start of the Java virtual machine.
+     *
+     * @return  the frequency of the High Resolution Counter.
+     * @see #highResCounter
+     */
+    public native long highResFrequency();
+
+    private static native void registerNatives();
+
+    static {
+        registerNatives();
+        instance = new Perf();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2009, 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.perf;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.LongBuffer;
+import java.security.AccessController;
+
+/**
+ * Performance counter support for internal JRE classes.
+ * This class defines a fixed list of counters for the platform
+ * to use as an interim solution until RFE# 6209222 is implemented.
+ * The perf counters will be created in the jvmstat perf buffer
+ * that the HotSpot VM creates. The default size is 32K and thus
+ * the number of counters is bounded.  You can alter the size
+ * with {@code -XX:PerfDataMemorySize=<bytes>} option. If there is
+ * insufficient memory in the jvmstat perf buffer, the C heap memory
+ * will be used and thus the application will continue to run if
+ * the counters added exceeds the buffer size but the counters
+ * will be missing.
+ *
+ * See HotSpot jvmstat implementation for certain circumstances
+ * that the jvmstat perf buffer is not supported.
+ *
+ */
+public class PerfCounter {
+    private static final Perf perf =
+        AccessController.doPrivileged(new Perf.GetPerfAction());
+
+    // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp
+    private static final int V_Constant  = 1;
+    private static final int V_Monotonic = 2;
+    private static final int V_Variable  = 3;
+    private static final int U_None      = 1;
+
+    private final String name;
+    private final LongBuffer lb;
+
+    private PerfCounter(String name, int type) {
+        this.name = name;
+        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
+        bb.order(ByteOrder.nativeOrder());
+        this.lb = bb.asLongBuffer();
+    }
+
+    static PerfCounter newPerfCounter(String name) {
+        return new PerfCounter(name, V_Variable);
+    }
+
+    static PerfCounter newConstantPerfCounter(String name) {
+        PerfCounter c = new PerfCounter(name, V_Constant);
+        return c;
+    }
+
+    /**
+     * Returns the current value of the perf counter.
+     */
+    public synchronized long get() {
+        return lb.get(0);
+    }
+
+    /**
+     * Sets the value of the perf counter to the given newValue.
+     */
+    public synchronized void set(long newValue) {
+        lb.put(0, newValue);
+    }
+
+    /**
+     * Adds the given value to the perf counter.
+     */
+    public synchronized void add(long value) {
+        long res = get() + value;
+        lb.put(0, res);
+    }
+
+    /**
+     * Increments the perf counter with 1.
+     */
+    public void increment() {
+        add(1);
+    }
+
+    /**
+     * Adds the given interval to the perf counter.
+     */
+    public void addTime(long interval) {
+        add(interval);
+    }
+
+    /**
+     * Adds the elapsed time from the given start time (ns) to the perf counter.
+     */
+    public void addElapsedTimeFrom(long startTime) {
+        add(System.nanoTime() - startTime);
+    }
+
+    @Override
+    public String toString() {
+        return name + " = " + get();
+    }
+
+    static class CoreCounters {
+        static final PerfCounter pdt   = newPerfCounter("sun.classloader.parentDelegationTime");
+        static final PerfCounter lc    = newPerfCounter("sun.classloader.findClasses");
+        static final PerfCounter lct   = newPerfCounter("sun.classloader.findClassTime");
+        static final PerfCounter rcbt  = newPerfCounter("sun.urlClassLoader.readClassBytesTime");
+        static final PerfCounter zfc   = newPerfCounter("sun.zip.zipFiles");
+        static final PerfCounter zfot  = newPerfCounter("sun.zip.zipFile.openTime");
+    }
+
+    static class WindowsClientCounters {
+        static final PerfCounter d3dAvailable = newConstantPerfCounter("sun.java2d.d3d.available");
+    }
+
+    /**
+     * Number of findClass calls
+     */
+    public static PerfCounter getFindClasses() {
+        return CoreCounters.lc;
+    }
+
+    /**
+     * Time (ns) spent in finding classes that includes
+     * lookup and read class bytes and defineClass
+     */
+    public static PerfCounter getFindClassTime() {
+        return CoreCounters.lct;
+    }
+
+    /**
+     * Time (ns) spent in finding classes
+     */
+    public static PerfCounter getReadClassBytesTime() {
+        return CoreCounters.rcbt;
+    }
+
+    /**
+     * Time (ns) spent in the parent delegation to
+     * the parent of the defining class loader
+     */
+    public static PerfCounter getParentDelegationTime() {
+        return CoreCounters.pdt;
+    }
+
+    /**
+     * Number of zip files opened.
+     */
+    public static PerfCounter getZipFileCount() {
+        return CoreCounters.zfc;
+    }
+
+    /**
+     * Time (ns) spent in opening the zip files that
+     * includes building the entries hash table
+     */
+    public static PerfCounter getZipFileOpenTime() {
+        return CoreCounters.zfot;
+    }
+
+    /**
+     * D3D graphic pipeline available
+     */
+    public static PerfCounter getD3DAvailable() {
+        return WindowsClientCounters.d3dAvailable;
+    }
+}
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 13:41:02 2016 +0530
+++ /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/CEFormatException.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1995, 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.misc;
-
-import java.io.IOException;
-
-public class CEFormatException extends IOException {
-    static final long serialVersionUID = -7139121221067081482L;
-    public CEFormatException(String s) {
-        super(s);
-    }
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1995, 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.misc;
-
-import java.io.IOException;
-
-/** This exception is thrown when EOF is reached */
-public class CEStreamExhausted extends IOException {
-    static final long serialVersionUID = -5889118049525891904L;
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/ClassFileTransformer.java	Thu Jan 21 13:41:02 2016 +0530
+++ /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/JarFilter.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.io.File;
-import java.io.FilenameFilter;
-
-/**
- * This class checks that only jar and zip files are included in the file list.
- * This class is used in extension installation support (ExtensionDependency).
- *
- * @deprecated this class will be removed in a future release.
- * @author  Michael Colburn
- */
-@Deprecated
-public class JarFilter implements FilenameFilter {
-
-    public boolean accept(File dir, String name) {
-        String lower = name.toLowerCase();
-        return lower.endsWith(".jar") || lower.endsWith(".zip");
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Perf.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,538 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.nio.ByteBuffer;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-/**
- * The Perf class provides the ability to attach to an instrumentation
- * buffer maintained by a Java virtual machine. The instrumentation
- * buffer may be for the Java virtual machine running the methods of
- * this class or it may be for another Java virtual machine on the
- * same system.
- * <p>
- * In addition, this class provides methods to create instrumentation
- * objects in the instrumentation buffer for the Java virtual machine
- * that is running these methods. It also contains methods for acquiring
- * the value of a platform specific high resolution clock for time
- * stamp and interval measurement purposes.
- *
- * @author   Brian Doherty
- * @since    1.4.2
- * @see      #getPerf
- * @see      sun.misc.Perf$GetPerfAction
- * @see      java.nio.ByteBuffer
- */
-public final class Perf {
-
-    private static Perf instance;
-
-    private static final int PERF_MODE_RO = 0;
-    private static final int PERF_MODE_RW = 1;
-
-    private Perf() { }    // prevent instantiation
-
-    /**
-     * The GetPerfAction class is a convenience class for acquiring access
-     * to the singleton Perf instance using the
-     * <code>AccessController.doPrivileged()</code> method.
-     * <p>
-     * An instance of this class can be used as the argument to
-     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
-     * <p> Here is a suggested idiom for use of this class:
-     *
-     * <blockquote><pre>{@code
-     * class MyTrustedClass {
-     *   private static final Perf perf =
-     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
-     *   ...
-     * }
-     * }</pre></blockquote>
-     * <p>
-     * In the presence of a security manager, the <code>MyTrustedClass</code>
-     * class in the above example will need to be granted the
-     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
-     * permission in order to successfully acquire the singleton Perf instance.
-     * <p>
-     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
-     * is not a JDK specified permission.
-     *
-     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
-     * @see  java.lang.RuntimePermission
-     */
-    public static class GetPerfAction implements PrivilegedAction<Perf>
-    {
-        /**
-         * Run the <code>Perf.getPerf()</code> method in a privileged context.
-         *
-         * @see #getPerf
-         */
-        public Perf run() {
-            return getPerf();
-        }
-    }
-
-    /**
-     * Return a reference to the singleton Perf instance.
-     * <p>
-     * The getPerf() method returns the singleton instance of the Perf
-     * class. The returned object provides the caller with the capability
-     * for accessing the instrumentation buffer for this or another local
-     * Java virtual machine.
-     * <p>
-     * If a security manager is installed, its <code>checkPermission</code>
-     * method is called with a <code>RuntimePermission</code> with a target
-     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
-     * if the caller has not been granted this permission.
-     * <p>
-     * Access to the returned <code>Perf</code> object should be protected
-     * by its caller and not passed on to untrusted code. This object can
-     * be used to attach to the instrumentation buffer provided by this Java
-     * virtual machine or for those of other Java virtual machines running
-     * on the same system. The instrumentation buffer may contain senstitive
-     * information. API's built on top of this interface may want to provide
-     * finer grained access control to the contents of individual
-     * instrumentation objects contained within the buffer.
-     * <p>
-     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
-     * is not a JDK specified permission.
-     *
-     * @return       A reference to the singleton Perf instance.
-     * @throws AccessControlException  if a security manager exists and
-     *               its <code>checkPermission</code> method doesn't allow
-     *               access to the <em>"sun.misc.Perf.getPerf"</em> target.
-     * @see  java.lang.RuntimePermission
-     * @see  #attach
-     */
-    public static Perf getPerf()
-    {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            Permission perm = new RuntimePermission("sun.misc.Perf.getPerf");
-            security.checkPermission(perm);
-        }
-
-        return instance;
-    }
-
-    /**
-     * Attach to the instrumentation buffer for the specified Java virtual
-     * machine.
-     * <p>
-     * This method will attach to the instrumentation buffer for the
-     * specified virtual machine. It returns a <code>ByteBuffer</code> object
-     * that is initialized to access the instrumentation buffer for the
-     * indicated Java virtual machine. The <code>lvmid</code> parameter is
-     * a integer value that uniquely identifies the target local Java virtual
-     * machine. It is typically, but not necessarily, the process id of
-     * the target Java virtual machine.
-     * <p>
-     * If the <code>lvmid</code> identifies a Java virtual machine different
-     * from the one running this method, then the coherency characteristics
-     * of the buffer are implementation dependent. Implementations that do
-     * not support named, coherent, shared memory may return a
-     * <code>ByteBuffer</code> object that contains only a snap shot of the
-     * data in the instrumentation buffer. Implementations that support named,
-     * coherent, shared memory, may return a <code>ByteBuffer</code> object
-     * that will be changing dynamically over time as the target Java virtual
-     * machine updates its mapping of this buffer.
-     * <p>
-     * If the <code>lvmid</code> is 0 or equal to the actual <code>lvmid</code>
-     * for the Java virtual machine running this method, then the returned
-     * <code>ByteBuffer</code> object will always be coherent and dynamically
-     * changing.
-     * <p>
-     * The attach mode specifies the access permissions requested for the
-     * instrumentation buffer of the target virtual machine. The permitted
-     * access permissions are:
-     * <ul>
-     * <li>"r"  - Read only access. This Java virtual machine has only
-     * read access to the instrumentation buffer for the target Java
-     * virtual machine.
-     * <li>"rw"  - Read/Write access. This Java virtual machine has read and
-     * write access to the instrumentation buffer for the target Java virtual
-     * machine. This mode is currently not supported and is reserved for
-     * future enhancements.
-     * </ul>
-     *
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     * @see     java.nio.ByteBuffer
-     */
-    public ByteBuffer attach(int lvmid, String mode)
-           throws IllegalArgumentException, IOException
-    {
-        if (mode.compareTo("r") == 0) {
-            return attachImpl(null, lvmid, PERF_MODE_RO);
-        }
-        else if (mode.compareTo("rw") == 0) {
-            return attachImpl(null, lvmid, PERF_MODE_RW);
-        }
-        else {
-            throw new IllegalArgumentException("unknown mode");
-        }
-    }
-
-    /**
-     * Attach to the instrumentation buffer for the specified Java virtual
-     * machine owned by the given user.
-     * <p>
-     * This method behaves just as the <code>attach(int lvmid, String mode)
-     * </code> method, except that it only searches for Java virtual machines
-     * owned by the specified user.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     * @see     java.nio.ByteBuffer
-     */
-    public ByteBuffer attach(String user, int lvmid, String mode)
-           throws IllegalArgumentException, IOException
-    {
-        if (mode.compareTo("r") == 0) {
-            return attachImpl(user, lvmid, PERF_MODE_RO);
-        }
-        else if (mode.compareTo("rw") == 0) {
-            return attachImpl(user, lvmid, PERF_MODE_RW);
-        }
-        else {
-            throw new IllegalArgumentException("unknown mode");
-        }
-    }
-
-    /**
-     * Call the implementation specific attach method.
-     * <p>
-     * This method calls into the Java virtual machine to perform the platform
-     * specific attach method. Buffers returned from this method are
-     * internally managed as <code>PhantomRefereces</code> to provide for
-     * guaranteed, secure release of the native resources.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     */
-    private ByteBuffer attachImpl(String user, int lvmid, int mode)
-            throws IllegalArgumentException, IOException
-    {
-        final ByteBuffer b = attach(user, lvmid, mode);
-
-        if (lvmid == 0) {
-            // The native instrumentation buffer for this Java virtual
-            // machine is never unmapped.
-            return b;
-        }
-        else {
-            // This is an instrumentation buffer for another Java virtual
-            // machine with native resources that need to be managed. We
-            // create a duplicate of the native ByteBuffer and manage it
-            // with a Cleaner object (PhantomReference). When the duplicate
-            // becomes only phantomly reachable, the native resources will
-            // be released.
-
-            final ByteBuffer dup = b.duplicate();
-            Cleaner.create(dup, new Runnable() {
-                    public void run() {
-                        try {
-                            instance.detach(b);
-                        }
-                        catch (Throwable th) {
-                            // avoid crashing the reference handler thread,
-                            // but provide for some diagnosability
-                            assert false : th.toString();
-                        }
-                    }
-                });
-            return dup;
-        }
-    }
-
-    /**
-     * Native method to perform the implementation specific attach mechanism.
-     * <p>
-     * The implementation of this method may return distinct or identical
-     * <code>ByteBuffer</code> objects for two distinct calls requesting
-     * attachment to the same Java virtual machine.
-     * <p>
-     * For the Sun HotSpot JVM, two distinct calls to attach to the same
-     * target Java virtual machine will result in two distinct ByteBuffer
-     * objects returned by this method. This may change in a future release.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     */
-    private native ByteBuffer attach(String user, int lvmid, int mode)
-                   throws IllegalArgumentException, IOException;
-
-    /**
-     * Native method to perform the implementation specific detach mechanism.
-     * <p>
-     * If this method is passed a <code>ByteBuffer</code> object that is
-     * not created by the <code>attach</code> method, then the results of
-     * this method are undefined, with unpredictable and potentially damaging
-     * effects to the Java virtual machine. To prevent accidental or malicious
-     * use of this method, all native ByteBuffer created by the <code>
-     * attach</code> method are managed internally as PhantomReferences
-     * and resources are freed by the system.
-     * <p>
-     * If this method is passed a <code>ByteBuffer</code> object created
-     * by the <code>attach</code> method with a lvmid for the Java virtual
-     * machine running this method (lvmid=0, for example), then the detach
-     * request is silently ignored.
-     *
-     * @param ByteBuffer  A direct allocated byte buffer created by the
-     *                    <code>attach</code> method.
-     * @see   java.nio.ByteBuffer
-     * @see   #attach
-     */
-    private native void detach(ByteBuffer bb);
-
-    /**
-     * Create a <code>long</code> scalar entry in the instrumentation buffer
-     * with the given variability characteristic, units, and initial value.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object. Typically, this object should be wrapped
-     * with <code>LongBuffer</code> view object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @return  ByteBuffer  a direct allocated ByteBuffer object that
-     *                      allows write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public native ByteBuffer createLong(String name, int variability,
-                                        int units, long value);
-
-    /**
-     * Create a <code>String</code> entry in the instrumentation buffer with
-     * the given variability characteristic, units, and initial value.
-     * <p>
-     * The maximum length of the <code>String</code> stored in this string
-     * instrument is given in by <code>maxLength</code> parameter. Updates
-     * to this instrument with <code>String</code> values with lengths greater
-     * than <code>maxLength</code> will be truncated to <code>maxLength</code>.
-     * The truncated value will be terminated by a null character.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * value, but will continue to preserve the null terminator.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @param   maxLength   the maximum string length for this string
-     *                      instrument.
-     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public ByteBuffer createString(String name, int variability,
-                                   int units, String value, int maxLength)
-    {
-        byte[] v = getBytes(value);
-        byte[] v1 = new byte[v.length+1];
-        System.arraycopy(v, 0, v1, 0, v.length);
-        v1[v.length] = '\0';
-        return createByteArray(name, variability, units, v1, Math.max(v1.length, maxLength));
-    }
-
-    /**
-     * Create a <code>String</code> entry in the instrumentation buffer with
-     * the given variability characteristic, units, and initial value.
-     * <p>
-     * The maximum length of the <code>String</code> stored in this string
-     * instrument is implied by the length of the <code>value</code> parameter.
-     * Subsequent updates to the value of this instrument will be truncated
-     * to this implied maximum length. The truncated value will be terminated
-     * by a null character.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * initial or subsequent value, but will continue to preserve the null
-     * terminator.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public ByteBuffer createString(String name, int variability,
-                                   int units, String value)
-    {
-        byte[] v = getBytes(value);
-        byte[] v1 = new byte[v.length+1];
-        System.arraycopy(v, 0, v1, 0, v.length);
-        v1[v.length] = '\0';
-        return createByteArray(name, variability, units, v1, v1.length);
-    }
-
-    /**
-     * Create a <code>byte</code> vector entry in the instrumentation buffer
-     * with the given variability characteristic, units, and initial value.
-     * <p>
-     * The <code>maxLength</code> parameter limits the size of the byte
-     * array instrument such that the initial or subsequent updates beyond
-     * this length are silently ignored. No special handling of truncated
-     * updates is provided.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * length of the initial or subsequent value.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @param   maxLength   the maximum length of this byte array.
-     * @return  ByteBuffer  a direct allocated byte buffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public native ByteBuffer createByteArray(String name, int variability,
-                                             int units, byte[] value,
-                                             int maxLength);
-
-
-    /**
-     * convert string to an array of UTF-8 bytes
-     */
-    private static byte[] getBytes(String s)
-    {
-        byte[] bytes = null;
-
-        try {
-            bytes = s.getBytes("UTF-8");
-        }
-        catch (UnsupportedEncodingException e) {
-            // ignore, UTF-8 encoding is always known
-        }
-
-        return bytes;
-    }
-
-    /**
-     * Return the value of the High Resolution Counter.
-     *
-     * The High Resolution Counter returns the number of ticks since
-     * since the start of the Java virtual machine. The resolution of
-     * the counter is machine dependent and can be determined from the
-     * value return by the {@link #highResFrequency} method.
-     *
-     * @return  the number of ticks of machine dependent resolution since
-     *          the start of the Java virtual machine.
-     *
-     * @see #highResFrequency
-     * @see java.lang.System#currentTimeMillis()
-     */
-    public native long highResCounter();
-
-    /**
-     * Returns the frequency of the High Resolution Counter, in ticks per
-     * second.
-     *
-     * This value can be used to convert the value of the High Resolution
-     * Counter, as returned from a call to the {@link #highResCounter} method,
-     * into the number of seconds since the start of the Java virtual machine.
-     *
-     * @return  the frequency of the High Resolution Counter.
-     * @see #highResCounter
-     */
-    public native long highResFrequency();
-
-    private static native void registerNatives();
-
-    static {
-        registerNatives();
-        instance = new Perf();
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2009, 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.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.LongBuffer;
-import java.security.AccessController;
-
-/**
- * Performance counter support for internal JRE classes.
- * This class defines a fixed list of counters for the platform
- * to use as an interim solution until RFE# 6209222 is implemented.
- * The perf counters will be created in the jvmstat perf buffer
- * that the HotSpot VM creates. The default size is 32K and thus
- * the number of counters is bounded.  You can alter the size
- * with {@code -XX:PerfDataMemorySize=<bytes>} option. If there is
- * insufficient memory in the jvmstat perf buffer, the C heap memory
- * will be used and thus the application will continue to run if
- * the counters added exceeds the buffer size but the counters
- * will be missing.
- *
- * See HotSpot jvmstat implementation for certain circumstances
- * that the jvmstat perf buffer is not supported.
- *
- */
-public class PerfCounter {
-    private static final Perf perf =
-        AccessController.doPrivileged(new Perf.GetPerfAction());
-
-    // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp
-    private static final int V_Constant  = 1;
-    private static final int V_Monotonic = 2;
-    private static final int V_Variable  = 3;
-    private static final int U_None      = 1;
-
-    private final String name;
-    private final LongBuffer lb;
-
-    private PerfCounter(String name, int type) {
-        this.name = name;
-        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
-        bb.order(ByteOrder.nativeOrder());
-        this.lb = bb.asLongBuffer();
-    }
-
-    static PerfCounter newPerfCounter(String name) {
-        return new PerfCounter(name, V_Variable);
-    }
-
-    static PerfCounter newConstantPerfCounter(String name) {
-        PerfCounter c = new PerfCounter(name, V_Constant);
-        return c;
-    }
-
-    /**
-     * Returns the current value of the perf counter.
-     */
-    public synchronized long get() {
-        return lb.get(0);
-    }
-
-    /**
-     * Sets the value of the perf counter to the given newValue.
-     */
-    public synchronized void set(long newValue) {
-        lb.put(0, newValue);
-    }
-
-    /**
-     * Adds the given value to the perf counter.
-     */
-    public synchronized void add(long value) {
-        long res = get() + value;
-        lb.put(0, res);
-    }
-
-    /**
-     * Increments the perf counter with 1.
-     */
-    public void increment() {
-        add(1);
-    }
-
-    /**
-     * Adds the given interval to the perf counter.
-     */
-    public void addTime(long interval) {
-        add(interval);
-    }
-
-    /**
-     * Adds the elapsed time from the given start time (ns) to the perf counter.
-     */
-    public void addElapsedTimeFrom(long startTime) {
-        add(System.nanoTime() - startTime);
-    }
-
-    @Override
-    public String toString() {
-        return name + " = " + get();
-    }
-
-    static class CoreCounters {
-        static final PerfCounter pdt   = newPerfCounter("sun.classloader.parentDelegationTime");
-        static final PerfCounter lc    = newPerfCounter("sun.classloader.findClasses");
-        static final PerfCounter lct   = newPerfCounter("sun.classloader.findClassTime");
-        static final PerfCounter rcbt  = newPerfCounter("sun.urlClassLoader.readClassBytesTime");
-        static final PerfCounter zfc   = newPerfCounter("sun.zip.zipFiles");
-        static final PerfCounter zfot  = newPerfCounter("sun.zip.zipFile.openTime");
-    }
-
-    static class WindowsClientCounters {
-        static final PerfCounter d3dAvailable = newConstantPerfCounter("sun.java2d.d3d.available");
-    }
-
-    /**
-     * Number of findClass calls
-     */
-    public static PerfCounter getFindClasses() {
-        return CoreCounters.lc;
-    }
-
-    /**
-     * Time (ns) spent in finding classes that includes
-     * lookup and read class bytes and defineClass
-     */
-    public static PerfCounter getFindClassTime() {
-        return CoreCounters.lct;
-    }
-
-    /**
-     * Time (ns) spent in finding classes
-     */
-    public static PerfCounter getReadClassBytesTime() {
-        return CoreCounters.rcbt;
-    }
-
-    /**
-     * Time (ns) spent in the parent delegation to
-     * the parent of the defining class loader
-     */
-    public static PerfCounter getParentDelegationTime() {
-        return CoreCounters.pdt;
-    }
-
-    /**
-     * Number of zip files opened.
-     */
-    public static PerfCounter getZipFileCount() {
-        return CoreCounters.zfc;
-    }
-
-    /**
-     * Time (ns) spent in opening the zip files that
-     * includes building the entries hash table
-     */
-    public static PerfCounter getZipFileOpenTime() {
-        return CoreCounters.zfot;
-    }
-
-    /**
-     * D3D graphic pipeline available
-     */
-    public static PerfCounter getD3DAvailable() {
-        return WindowsClientCounters.d3dAvailable;
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2002, 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.Vector;
-import java.io.FileWriter;
-import java.io.File;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-/**
- * This class is intended to be a central place for the jdk to
- * log timing events of interest.  There is pre-defined event
- * of startTime, as well as a general
- * mechanism of setting arbitrary times in an array.
- * All unreserved times in the array can be used by callers
- * in application-defined situations.  The caller is responsible
- * for setting and getting all times and for doing whatever
- * analysis is interesting; this class is merely a central container
- * for those timing values.
- * Note that, due to the variables in this class being static,
- * use of particular time values by multiple applets will cause
- * confusing results.  For example, if plugin runs two applets
- * simultaneously, the initTime for those applets will collide
- * and the results may be undefined.
- * <P>
- * To automatically track startup performance in an app or applet,
- * use the command-line parameter sun.perflog as follows:<BR>
- * <pre>{@code
- *     -Dsun.perflog[=file:<filename>]
- * }</pre>
- * <BR>
- * where simply using the parameter with no value will enable output
- * to the console and a value of "{@code file:<filename>}" will cause
- * that given filename to be created and used for all output.
- * <P>
- * By default, times are measured using System.currentTimeMillis().  To use
- * System.nanoTime() instead, add the command-line parameter:<BR>
-       -Dsun.perflog.nano=true
- * <BR>
- * <P>
- * <B>Warning: Use at your own risk!</B>
- * This class is intended for internal testing
- * purposes only and may be removed at any time.  More
- * permanent monitoring and profiling APIs are expected to be
- * developed for future releases and this class will cease to
- * exist once those APIs are in place.
- * @author Chet Haase
- */
-public class PerformanceLogger {
-
-    // Timing values of global interest
-    private static final int START_INDEX    = 0;    // VM start
-    private static final int LAST_RESERVED  = START_INDEX;
-
-    private static boolean perfLoggingOn = false;
-    private static boolean useNanoTime = false;
-    private static Vector<TimeData> times;
-    private static String logFileName = null;
-    private static Writer logWriter = null;
-    private static long baseTime;
-
-    static {
-        String perfLoggingProp =
-            java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.perflog"));
-        if (perfLoggingProp != null) {
-            perfLoggingOn = true;
-
-            // Check if we should use nanoTime
-            String perfNanoProp =
-                java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("sun.perflog.nano"));
-            if (perfNanoProp != null) {
-                useNanoTime = true;
-            }
-
-            // Now, figure out what the user wants to do with the data
-            if (perfLoggingProp.regionMatches(true, 0, "file:", 0, 5)) {
-                logFileName = perfLoggingProp.substring(5);
-            }
-            if (logFileName != null) {
-                if (logWriter == null) {
-                    java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Void>() {
-                        public Void run() {
-                            try {
-                                File logFile = new File(logFileName);
-                                logFile.createNewFile();
-                                logWriter = new FileWriter(logFile);
-                            } catch (Exception e) {
-                                System.out.println(e + ": Creating logfile " +
-                                                   logFileName +
-                                                   ".  Log to console");
-                            }
-                            return null;
-                        }
-                    });
-                }
-            }
-            if (logWriter == null) {
-                logWriter = new OutputStreamWriter(System.out);
-            }
-        }
-        times = new Vector<TimeData>(10);
-        // Reserve predefined slots
-        for (int i = 0; i <= LAST_RESERVED; ++i) {
-            times.add(new TimeData("Time " + i + " not set", 0));
-        }
-    }
-
-    /**
-     * Returns status of whether logging is enabled or not.  This is
-     * provided as a convenience method so that users do not have to
-     * perform the same GetPropertyAction check as above to determine whether
-     * to enable performance logging.
-     */
-    public static boolean loggingEnabled() {
-        return perfLoggingOn;
-    }
-
-
-    /**
-     * Internal class used to store time/message data together.
-     */
-    static class TimeData {
-        String message;
-        long time;
-
-        TimeData(String message, long time) {
-            this.message = message;
-            this.time = time;
-        }
-
-        String getMessage() {
-            return message;
-        }
-
-        long getTime() {
-            return time;
-        }
-    }
-
-    /**
-     * Return the current time, in millis or nanos as appropriate
-     */
-    private static long getCurrentTime() {
-        if (useNanoTime) {
-            return System.nanoTime();
-        } else {
-            return System.currentTimeMillis();
-        }
-    }
-
-    /**
-     * Sets the start time.  Ideally, this is the earliest time available
-     * during the startup of a Java applet or application.  This time is
-     * later used to analyze the difference between the initial startup
-     * time and other events in the system (such as an applet's init time).
-     */
-    public static void setStartTime(String message) {
-        if (loggingEnabled()) {
-            long nowTime = getCurrentTime();
-            setStartTime(message, nowTime);
-        }
-    }
-
-    /**
-     * Sets the base time, output can then
-     * be displayed as offsets from the base time;.
-     */
-    public static void setBaseTime(long time) {
-        if (loggingEnabled()) {
-            baseTime = time;
-        }
-    }
-
-    /**
-     * Sets the start time.
-     * This version of the method is
-     * given the time to log, instead of expecting this method to
-     * get the time itself.  This is done in case the time was
-     * recorded much earlier than this method was called.
-     */
-    public static void setStartTime(String message, long time) {
-        if (loggingEnabled()) {
-            times.set(START_INDEX, new TimeData(message, time));
-        }
-    }
-
-    /**
-     * Gets the start time, which should be the time when
-     * the java process started, prior to the VM actually being
-     * loaded.
-     */
-    public static long getStartTime() {
-        if (loggingEnabled()) {
-            return times.get(START_INDEX).getTime();
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Sets the value of a given time and returns the index of the
-     * slot that that time was stored in.
-     */
-    public static int setTime(String message) {
-        if (loggingEnabled()) {
-            long nowTime = getCurrentTime();
-            return setTime(message, nowTime);
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Sets the value of a given time and returns the index of the
-     * slot that that time was stored in.
-     * This version of the method is
-     * given the time to log, instead of expecting this method to
-     * get the time itself.  This is done in case the time was
-     * recorded much earlier than this method was called.
-     */
-    public static int setTime(String message, long time) {
-        if (loggingEnabled()) {
-            // times is already synchronized, but we need to ensure that
-            // the size used in times.set() is the same used when returning
-            // the index of that operation.
-            synchronized (times) {
-                times.add(new TimeData(message, time));
-                return (times.size() - 1);
-            }
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Returns time at given index.
-     */
-    public static long getTimeAtIndex(int index) {
-        if (loggingEnabled()) {
-            return times.get(index).getTime();
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Returns message at given index.
-     */
-    public static String getMessageAtIndex(int index) {
-        if (loggingEnabled()) {
-            return times.get(index).getMessage();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Outputs all data to parameter-specified Writer object
-     */
-    public static void outputLog(Writer writer) {
-        if (loggingEnabled()) {
-            try {
-                synchronized(times) {
-                    for (int i = 0; i < times.size(); ++i) {
-                        TimeData td = times.get(i);
-                        if (td != null) {
-                            writer.write(i + " " + td.getMessage() + ": " +
-                                         (td.getTime() - baseTime) + "\n");
-
-                        }
-                    }
-                }
-                writer.flush();
-            } catch (Exception e) {
-                System.out.println(e + ": Writing performance log to " +
-                                   writer);
-            }
-        }
-    }
-
-    /**
-     * Outputs all data to whatever location the user specified
-     * via sun.perflog command-line parameter.
-     */
-    public static void outputLog() {
-        outputLog(logWriter);
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/SSLEngineImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -2211,7 +2211,7 @@
 
     @Override
     public synchronized String getHandshakeApplicationProtocol() {
-        if ((handshaker != null) && !handshaker.started()) {
+        if ((handshaker != null) && handshaker.started()) {
             return handshaker.getHandshakeApplicationProtocol();
         }
         return null;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -2598,7 +2598,7 @@
 
     @Override
     public synchronized String getHandshakeApplicationProtocol() {
-        if ((handshaker != null) && !handshaker.started()) {
+        if ((handshaker != null) && handshaker.started()) {
             return handshaker.getHandshakeApplicationProtocol();
         }
         return null;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyUtil.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLDistributionPointsExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLNumberExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/DNSName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/EDIPartyName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IssuingDistributionPointExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/RDN.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/SubjectInfoAccessExtension.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/URIName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509AttributeName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.policy	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/conf/security/java.policy	Thu Jan 21 14:49:02 2016 -0800
@@ -98,17 +98,6 @@
 // default permissions granted to all domains
 
 grant {
-        // Allows any thread to stop itself using the java.lang.Thread.stop()
-        // method that takes no argument.
-        // Note that this permission is granted by default only to remain
-        // backwards compatible.
-        // It is strongly recommended that you either remove this permission
-        // from this policy file or further restrict it to code sources
-        // that you specify, because Thread.stop() is potentially unsafe.
-        // See the API specification of java.lang.Thread.stop() for more
-        // information.
-        permission java.lang.RuntimePermission "stopThread";
-
         // allows anyone to listen on dynamic ports
         permission java.net.SocketPermission "localhost:0", "listen";
 
--- a/jdk/src/java.base/share/conf/security/java.security	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/conf/security/java.security	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/native/include/jvm.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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;
--- a/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -47,6 +47,9 @@
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             super.setOption(name, value);
         } else {
+            if (!flowSupported()) {
+                throw new UnsupportedOperationException("unsupported option");
+            }
             if (isClosed()) {
                 throw new SocketException("Socket closed");
             }
@@ -61,6 +64,9 @@
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             return super.getOption(name);
         }
+        if (!flowSupported()) {
+            throw new UnsupportedOperationException("unsupported option");
+        }
         if (isClosed()) {
             throw new SocketException("Socket closed");
         }
--- a/jdk/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -61,6 +61,9 @@
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             super.setOption(name, value);
         } else {
+            if (getSocket() == null || !flowSupported()) {
+                throw new UnsupportedOperationException("unsupported option");
+            }
             if (isClosedOrPending()) {
                 throw new SocketException("Socket closed");
             }
@@ -75,6 +78,9 @@
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             return super.getOption(name);
         }
+        if (getSocket() == null || !flowSupported()) {
+            throw new UnsupportedOperationException("unsupported option");
+        }
         if (isClosedOrPending()) {
             throw new SocketException("Socket closed");
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg	Thu Jan 21 14:49:02 2016 -0800
@@ -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.base/windows/native/libjli/java_md.c	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c	Thu Jan 21 14:49:02 2016 -0800
@@ -337,6 +337,15 @@
         }
     }
 
+    /* Try getting path to JRE from path to JLI.DLL */
+    if (GetApplicationHomeFromDll(path, pathsize)) {
+        JLI_Snprintf(javadll, sizeof(javadll), "%s\\bin\\" JAVA_DLL, path);
+        if (stat(javadll, &s) == 0) {
+            JLI_TraceLauncher("JRE path is %s\n", path);
+            return JNI_TRUE;
+        }
+    }
+
     JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
     return JNI_FALSE;
 
@@ -404,17 +413,17 @@
 }
 
 /*
- * If app is "c:\foo\bin\javac", then put "c:\foo" into buf.
+ * Removes the trailing file name and one sub-folder from a path.
+ * If buf is "c:\foo\bin\javac", then put "c:\foo" into buf.
  */
 jboolean
-GetApplicationHome(char *buf, jint bufsize)
+TruncatePath(char *buf)
 {
     char *cp;
-    GetModuleFileName(0, buf, bufsize);
     *JLI_StrRChr(buf, '\\') = '\0'; /* remove .exe file name */
     if ((cp = JLI_StrRChr(buf, '\\')) == 0) {
         /* This happens if the application is in a drive root, and
-         * there is no bin directory. */
+        * there is no bin directory. */
         buf[0] = '\0';
         return JNI_FALSE;
     }
@@ -423,6 +432,36 @@
 }
 
 /*
+ * Retrieves the path to the JRE home by locating the executable file
+ * of the current process and then truncating the path to the executable
+ */
+jboolean
+GetApplicationHome(char *buf, jint bufsize)
+{
+    GetModuleFileName(NULL, buf, bufsize);
+    return TruncatePath(buf);
+}
+
+/*
+ * Retrieves the path to the JRE home by locating JLI.DLL and
+ * then truncating the path to JLI.DLL
+ */
+jboolean
+GetApplicationHomeFromDll(char *buf, jint bufsize)
+{
+    HMODULE hModule;
+    DWORD dwFlags =
+        GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+        GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
+
+    if (GetModuleHandleEx(dwFlags, (LPCSTR)&GetJREPath, &hModule) == 0) {
+        return JNI_FALSE;
+    };
+    GetModuleFileName(hModule, buf, bufsize);
+    return TruncatePath(buf);
+}
+
+/*
  * Support for doing cheap, accurate interval timing.
  */
 static jboolean counterAvailable = JNI_FALSE;
--- a/jdk/src/java.base/windows/native/libjli/java_md.h	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.base/windows/native/libjli/java_md.h	Thu Jan 21 14:49:02 2016 -0800
@@ -54,4 +54,7 @@
 
 int UnsetEnv(char *name);
 
+jboolean
+GetApplicationHomeFromDll(char *buf, jint bufsize);
+
 #endif /* JAVA_MD_H */
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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();
 }
--- a/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
      *
      * @return list of resolution variants.
-     * @since 1.9
+     * @since 9
      */
     public List<Image> getResolutionVariants();
 }
--- a/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/JavaBean.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/package.html	Thu Jan 21 14:49:02 2016 -0800
@@ -46,6 +46,6 @@
 <br>
 <br>
 
-@since 1.9
+@since 9
 </body>
 </html>
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingContainer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/applet/AppletPanel.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Thu Jan 21 14:49:02 2016 -0800
@@ -43,8 +43,8 @@
 import sun.awt.AppContext;
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
+import sun.awt.util.PerformanceLogger;
 import sun.misc.ManagedLocalsThread;
-import sun.misc.PerformanceLogger;
 import sun.security.util.SecurityConstants;
 
 /**
--- a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -39,7 +39,7 @@
  * {@code DesktopDatatransferService} interface.
  *
  * @author Petr Pchelko
- * @since 1.9
+ * @since 9
  */
 public class DesktopDatatransferServiceImpl implements DesktopDatatransferService {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/util/PerformanceLogger.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2002, 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.awt.util;
+
+import java.util.Vector;
+import java.io.FileWriter;
+import java.io.File;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+/**
+ * This class is intended to be a central place for the jdk to
+ * log timing events of interest.  There is pre-defined event
+ * of startTime, as well as a general
+ * mechanism of setting arbitrary times in an array.
+ * All unreserved times in the array can be used by callers
+ * in application-defined situations.  The caller is responsible
+ * for setting and getting all times and for doing whatever
+ * analysis is interesting; this class is merely a central container
+ * for those timing values.
+ * Note that, due to the variables in this class being static,
+ * use of particular time values by multiple applets will cause
+ * confusing results.  For example, if plugin runs two applets
+ * simultaneously, the initTime for those applets will collide
+ * and the results may be undefined.
+ * <P>
+ * To automatically track startup performance in an app or applet,
+ * use the command-line parameter sun.perflog as follows:<BR>
+ * <pre>{@code
+ *     -Dsun.perflog[=file:<filename>]
+ * }</pre>
+ * <BR>
+ * where simply using the parameter with no value will enable output
+ * to the console and a value of "{@code file:<filename>}" will cause
+ * that given filename to be created and used for all output.
+ * <P>
+ * By default, times are measured using System.currentTimeMillis().  To use
+ * System.nanoTime() instead, add the command-line parameter:<BR>
+       -Dsun.perflog.nano=true
+ * <BR>
+ * <P>
+ * <B>Warning: Use at your own risk!</B>
+ * This class is intended for internal testing
+ * purposes only and may be removed at any time.  More
+ * permanent monitoring and profiling APIs are expected to be
+ * developed for future releases and this class will cease to
+ * exist once those APIs are in place.
+ * @author Chet Haase
+ */
+public class PerformanceLogger {
+
+    // Timing values of global interest
+    private static final int START_INDEX    = 0;    // VM start
+    private static final int LAST_RESERVED  = START_INDEX;
+
+    private static boolean perfLoggingOn = false;
+    private static boolean useNanoTime = false;
+    private static Vector<TimeData> times;
+    private static String logFileName = null;
+    private static Writer logWriter = null;
+    private static long baseTime;
+
+    static {
+        String perfLoggingProp =
+            java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("sun.perflog"));
+        if (perfLoggingProp != null) {
+            perfLoggingOn = true;
+
+            // Check if we should use nanoTime
+            String perfNanoProp =
+                java.security.AccessController.doPrivileged(
+                new sun.security.action.GetPropertyAction("sun.perflog.nano"));
+            if (perfNanoProp != null) {
+                useNanoTime = true;
+            }
+
+            // Now, figure out what the user wants to do with the data
+            if (perfLoggingProp.regionMatches(true, 0, "file:", 0, 5)) {
+                logFileName = perfLoggingProp.substring(5);
+            }
+            if (logFileName != null) {
+                if (logWriter == null) {
+                    java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedAction<Void>() {
+                        public Void run() {
+                            try {
+                                File logFile = new File(logFileName);
+                                logFile.createNewFile();
+                                logWriter = new FileWriter(logFile);
+                            } catch (Exception e) {
+                                System.out.println(e + ": Creating logfile " +
+                                                   logFileName +
+                                                   ".  Log to console");
+                            }
+                            return null;
+                        }
+                    });
+                }
+            }
+            if (logWriter == null) {
+                logWriter = new OutputStreamWriter(System.out);
+            }
+        }
+        times = new Vector<TimeData>(10);
+        // Reserve predefined slots
+        for (int i = 0; i <= LAST_RESERVED; ++i) {
+            times.add(new TimeData("Time " + i + " not set", 0));
+        }
+    }
+
+    /**
+     * Returns status of whether logging is enabled or not.  This is
+     * provided as a convenience method so that users do not have to
+     * perform the same GetPropertyAction check as above to determine whether
+     * to enable performance logging.
+     */
+    public static boolean loggingEnabled() {
+        return perfLoggingOn;
+    }
+
+
+    /**
+     * Internal class used to store time/message data together.
+     */
+    static class TimeData {
+        String message;
+        long time;
+
+        TimeData(String message, long time) {
+            this.message = message;
+            this.time = time;
+        }
+
+        String getMessage() {
+            return message;
+        }
+
+        long getTime() {
+            return time;
+        }
+    }
+
+    /**
+     * Return the current time, in millis or nanos as appropriate
+     */
+    private static long getCurrentTime() {
+        if (useNanoTime) {
+            return System.nanoTime();
+        } else {
+            return System.currentTimeMillis();
+        }
+    }
+
+    /**
+     * Sets the start time.  Ideally, this is the earliest time available
+     * during the startup of a Java applet or application.  This time is
+     * later used to analyze the difference between the initial startup
+     * time and other events in the system (such as an applet's init time).
+     */
+    public static void setStartTime(String message) {
+        if (loggingEnabled()) {
+            long nowTime = getCurrentTime();
+            setStartTime(message, nowTime);
+        }
+    }
+
+    /**
+     * Sets the base time, output can then
+     * be displayed as offsets from the base time;.
+     */
+    public static void setBaseTime(long time) {
+        if (loggingEnabled()) {
+            baseTime = time;
+        }
+    }
+
+    /**
+     * Sets the start time.
+     * This version of the method is
+     * given the time to log, instead of expecting this method to
+     * get the time itself.  This is done in case the time was
+     * recorded much earlier than this method was called.
+     */
+    public static void setStartTime(String message, long time) {
+        if (loggingEnabled()) {
+            times.set(START_INDEX, new TimeData(message, time));
+        }
+    }
+
+    /**
+     * Gets the start time, which should be the time when
+     * the java process started, prior to the VM actually being
+     * loaded.
+     */
+    public static long getStartTime() {
+        if (loggingEnabled()) {
+            return times.get(START_INDEX).getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Sets the value of a given time and returns the index of the
+     * slot that that time was stored in.
+     */
+    public static int setTime(String message) {
+        if (loggingEnabled()) {
+            long nowTime = getCurrentTime();
+            return setTime(message, nowTime);
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Sets the value of a given time and returns the index of the
+     * slot that that time was stored in.
+     * This version of the method is
+     * given the time to log, instead of expecting this method to
+     * get the time itself.  This is done in case the time was
+     * recorded much earlier than this method was called.
+     */
+    public static int setTime(String message, long time) {
+        if (loggingEnabled()) {
+            // times is already synchronized, but we need to ensure that
+            // the size used in times.set() is the same used when returning
+            // the index of that operation.
+            synchronized (times) {
+                times.add(new TimeData(message, time));
+                return (times.size() - 1);
+            }
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns time at given index.
+     */
+    public static long getTimeAtIndex(int index) {
+        if (loggingEnabled()) {
+            return times.get(index).getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns message at given index.
+     */
+    public static String getMessageAtIndex(int index) {
+        if (loggingEnabled()) {
+            return times.get(index).getMessage();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Outputs all data to parameter-specified Writer object
+     */
+    public static void outputLog(Writer writer) {
+        if (loggingEnabled()) {
+            try {
+                synchronized(times) {
+                    for (int i = 0; i < times.size(); ++i) {
+                        TimeData td = times.get(i);
+                        if (td != null) {
+                            writer.write(i + " " + td.getMessage() + ": " +
+                                         (td.getTime() - baseTime) + "\n");
+
+                        }
+                    }
+                }
+                writer.flush();
+            } catch (Exception e) {
+                System.out.println(e + ": Writing performance log to " +
+                                   writer);
+            }
+        }
+    }
+
+    /**
+     * Outputs all data to whatever location the user specified
+     * via sun.perflog command-line parameter.
+     */
+    public static void outputLog() {
+        outputLog(logWriter);
+    }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Thu Jan 21 14:49:02 2016 -0800
@@ -88,9 +88,9 @@
 import sun.java2d.loops.XORComposite;
 import sun.awt.ConstrainableGraphics;
 import sun.awt.SunHints;
+import sun.awt.util.PerformanceLogger;
 import java.util.Map;
 import java.util.Iterator;
-import sun.misc.PerformanceLogger;
 
 import java.lang.annotation.Native;
 import java.awt.image.MultiResolutionImage;
--- a/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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.)
  *
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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/classes/sun/awt/X11/XToolkit.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Thu Jan 21 14:49:02 2016 -0800
@@ -52,6 +52,7 @@
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.*;
+import sun.awt.util.PerformanceLogger;
 import sun.awt.util.ThreadGroupUtils;
 import sun.print.PrintJob2D;
 import sun.security.action.GetPropertyAction;
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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.desktop/windows/classes/sun/awt/windows/WToolkit.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Thu Jan 21 14:49:02 2016 -0800
@@ -67,10 +67,10 @@
 import java.util.Map;
 import java.util.Properties;
 
+import sun.awt.util.PerformanceLogger;
 import sun.font.FontManager;
 import sun.font.FontManagerFactory;
 import sun.font.SunFontManager;
-import sun.misc.PerformanceLogger;
 import sun.util.logging.PlatformLogger;
 
 public final class WToolkit extends SunToolkit implements Runnable {
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Thu Jan 21 14:49:02 2016 -0800
@@ -38,6 +38,7 @@
 import java.awt.peer.WindowPeer;
 import java.util.ArrayList;
 
+import jdk.internal.perf.PerfCounter;
 import sun.awt.AWTAccessor;
 import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.awt.Win32GraphicsDevice;
@@ -69,9 +70,9 @@
         if (d3dAvailable) {
             // we don't use pixel formats for the d3d pipeline
             pfDisabled = true;
-            sun.misc.PerfCounter.getD3DAvailable().set(1);
+            PerfCounter.getD3DAvailable().set(1);
         } else {
-            sun.misc.PerfCounter.getD3DAvailable().set(0);
+            PerfCounter.getD3DAvailable().set(0);
         }
     }
 
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/package-info.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/ConstructorParameters.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/ConnectorAddressLink.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java	Thu Jan 21 14:49:02 2016 -0800
@@ -34,7 +34,7 @@
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.management.counter.Units;
 import sun.management.counter.Counter;
 import sun.management.counter.perf.PerfInstrumentation;
--- a/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/VMManagementImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/sun/management/VMManagementImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,7 +25,7 @@
 
 package sun.management;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.management.counter.*;
 import sun.management.counter.perf.*;
 import java.nio.ByteBuffer;
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/conf/management.properties	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/native/include/jmm.h	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/Krb5KeyExchangeService.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/ConnectionBuilder.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/DatabaseMetaData.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/java/sql/ShardingKey.java	Thu Jan 21 14:49:02 2016 -0800
@@ -69,7 +69,7 @@
  * }
  * </pre>
  *
- * @since 1.9
+ * @since 9
  */
 public interface ShardingKey {
 
--- a/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/DataSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnection.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/CipherContextRef.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java	Thu Jan 21 14:49:02 2016 -0800
@@ -33,7 +33,7 @@
 /**
  * OracleUcrypto provider main class.
  *
- * @since 1.9
+ * @since 9
  */
 public final class UcryptoProvider extends Provider {
 
--- a/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSignerException.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractMonitoredVm.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractMonitoredVm.java	Thu Jan 21 14:49:02 2016 -0800
@@ -95,7 +95,7 @@
     public void detach() {
         /*
          * no default action required because the detach operation for the
-         * native byte buffer is managed by the sun.misc.Perf class.
+         * native byte buffer is managed by the Perf class.
          */
     }
 
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,7 +25,6 @@
 
 package sun.jvmstat.perfdata.monitor;
 
-import sun.misc.Perf;
 import sun.jvmstat.monitor.*;
 import java.util.*;
 import java.io.*;
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataBuffer.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataBuffer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,7 +25,7 @@
 
 package sun.jvmstat.perfdata.monitor.protocol.local;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.jvmstat.monitor.*;
 import sun.jvmstat.perfdata.monitor.*;
 import java.util.*;
--- a/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/TEST.groups	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/TEST.groups	Thu Jan 21 14:49:02 2016 -0800
@@ -1,4 +1,4 @@
-#  Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+#  Copyright (c) 2013, 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,8 +31,8 @@
     -java/util/zip/TestLocalTime.java \
     :jdk_util \
     -java/util/WeakHashMap/GCDuringIteration.java \
-    -java/util/concurrent/Phaser/Basic.java \
-    -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.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 \
@@ -41,9 +41,9 @@
 tier2 = \
     java/lang/ProcessHandle/TreeTest.java \
     java/util/zip/TestLocalTime.java \
-    java/util/concurrent/Phaser/Basic.java \
     java/util/WeakHashMap/GCDuringIteration.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
+    java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
     :jdk_nio \
     -sun/nio/cs/ISO8859x.java \
--- a/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh	Thu Jan 21 14:49:02 2016 -0800
@@ -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/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/8147078/Test8147078.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,82 @@
+/*
+ * 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 8147078
+ * @run testng/othervm -ea -esa Test8147078
+ */
+
+import org.testng.annotations.Test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+public class Test8147078 {
+
+    static int target(int x) {
+        throw new RuntimeException("ieps");
+    }
+
+    static int handler(String s, int x) {
+        return 4*x;
+    }
+
+    static final MethodHandle MH_target;
+    static final MethodHandle MH_handler;
+    static final MethodHandle MH_catchException;
+
+    static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+
+    static {
+        try {
+            Class<Test8147078> C = Test8147078.class;
+            MH_target = LOOKUP.findStatic(C, "target", methodType(int.class, int.class));
+            MH_handler = LOOKUP.findStatic(C, "handler", methodType(int.class, String.class, int.class));
+            MH_catchException = LOOKUP.findStatic(MethodHandles.class, "catchException",
+                    methodType(MethodHandle.class, MethodHandle.class, Class.class, MethodHandle.class));
+        } catch (Exception e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    @Test
+    public void testNoExceptionType() {
+        boolean caught = false;
+        try {
+            MethodHandle eek = (MethodHandle) MH_catchException.invoke(MH_target, String.class, MH_handler);
+        } catch (ClassCastException cce) {
+            assertEquals("java.lang.String", cce.getMessage());
+            caught = true;
+        } catch (Throwable t) {
+            fail("unexpected exception caught: " + t);
+        }
+        assertTrue(caught);
+    }
+
+}
\ No newline at end of file
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Thu Jan 21 14:49:02 2016 -0800
@@ -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
--- a/jdk/test/java/lang/ref/CleanerTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/lang/ref/CleanerTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -53,7 +53,7 @@
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run testng/othervm
  *      -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
- *      -verbose:gc -Xmx4m CleanerTest
+ *      -verbose:gc CleanerTest
  */
 
 @Test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/PhantomReferentClearing.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,141 @@
+/*
+ * 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 jdk.net.ExtendedSocketOptions;
+
+import java.io.IOException;
+import java.net.*;
+
+/*
+ * @test
+ * @bug 8143554
+ * @run main UnsupportedOptionsTest
+ * @summary Test checks that UnsupportedOperationException for unsupported
+ * SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
+ */
+public class UnsupportedOptionsTest {
+
+    private static final SocketOption[] SOCKET_OPTIONS = {
+            StandardSocketOptions.IP_MULTICAST_IF,
+            StandardSocketOptions.IP_MULTICAST_LOOP,
+            StandardSocketOptions.IP_MULTICAST_TTL,
+            StandardSocketOptions.IP_TOS,
+            StandardSocketOptions.SO_BROADCAST,
+            StandardSocketOptions.SO_KEEPALIVE,
+            StandardSocketOptions.SO_LINGER,
+            StandardSocketOptions.SO_RCVBUF,
+            StandardSocketOptions.SO_REUSEADDR,
+            StandardSocketOptions.SO_SNDBUF,
+            StandardSocketOptions.TCP_NODELAY,
+            ExtendedSocketOptions.SO_FLOW_SLA
+    };
+
+    public static void main(String[] args) throws IOException {
+        Socket s = new Socket();
+        ServerSocket ss = new ServerSocket();
+        DatagramSocket ds = new DatagramSocket();
+        MulticastSocket ms = new MulticastSocket();
+
+        for (SocketOption option : SOCKET_OPTIONS) {
+            if (!s.supportedOptions().contains(option)) {
+                testUnsupportedSocketOption(s, option);
+            }
+
+            if (!ss.supportedOptions().contains(option)) {
+                testUnsupportedSocketOption(ss, option);
+            }
+
+            if (!ms.supportedOptions().contains(option)) {
+                testUnsupportedSocketOption(ms, option);
+            }
+
+            if (!ds.supportedOptions().contains(option)) {
+                testUnsupportedSocketOption(ds, option);
+            }
+        }
+    }
+
+    /*
+     * Check that UnsupportedOperationException for unsupported option is
+     * thrown from both getOption() and setOption() methods.
+     */
+    private static void testUnsupportedSocketOption(Object socket,
+                                                    SocketOption option) {
+        testSet(socket, option);
+        testGet(socket, option);
+    }
+
+    private static void testSet(Object socket, SocketOption option) {
+        try {
+            setOption(socket, option);
+        } catch (UnsupportedOperationException e) {
+            System.out.println("UnsupportedOperationException was throw " +
+                    "as expected. Socket: " + socket + " Option: " + option);
+            return;
+        } catch (Exception e) {
+            throw new RuntimeException("FAIL. Unexpected exception.", e);
+        }
+        throw new RuntimeException("FAIL. UnsupportedOperationException " +
+                "hasn't been thrown. Socket: " + socket + " Option: " + option);
+    }
+
+    private static void testGet(Object socket, SocketOption option) {
+        try {
+            getOption(socket, option);
+        } catch (UnsupportedOperationException e) {
+            System.out.println("UnsupportedOperationException was throw " +
+                    "as expected. Socket: " + socket + " Option: " + option);
+            return;
+        } catch (Exception e) {
+            throw new RuntimeException("FAIL. Unexpected exception.", e);
+        }
+        throw new RuntimeException("FAIL. UnsupportedOperationException " +
+                "hasn't been thrown. Socket: " + socket + " Option: " + option);
+    }
+
+    private static void getOption(Object socket,
+                                  SocketOption option) throws IOException {
+        if (socket instanceof Socket) {
+            ((Socket) socket).getOption(option);
+        } else if (socket instanceof ServerSocket) {
+            ((ServerSocket) socket).getOption(option);
+        } else if (socket instanceof DatagramSocket) {
+            ((DatagramSocket) socket).getOption(option);
+        } else {
+            throw new RuntimeException("Unsupported socket type");
+        }
+    }
+
+    private static void setOption(Object socket,
+                                  SocketOption option) throws IOException {
+        if (socket instanceof Socket) {
+            ((Socket) socket).setOption(option, null);
+        } else if (socket instanceof ServerSocket) {
+            ((ServerSocket) socket).setOption(option, null);
+        } else if (socket instanceof DatagramSocket) {
+            ((DatagramSocket) socket).setOption(option, null);
+        } else {
+            throw new RuntimeException("Unsupported socket type");
+        }
+    }
+}
--- a/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/ServerSocketChannel/Basic.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/Basic.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @bug 4286936 8143100
  * @summary Unit test for server-socket channels
  * @library ..
  */
@@ -130,7 +131,7 @@
         Client client = new Client(port, block);
         server.start();
         client.start();
-        if ((server.finish(2000) & client.finish(100)) == 0)
+        if ((server.finish(0) & client.finish(0)) == 0)
             throw new Exception("Failure");
         log.println();
     }
--- a/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, 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
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4801882 5046333
+ * @bug 4801882 5046333 8141595
  * @summary test ServerSocketAdaptor.accept on nonblocking channel
  * @library ..
  * @build TestUtil
@@ -57,8 +57,17 @@
         SocketChannel sc = SocketChannel.open();
         sc.configureBlocking(false);
         sc.connect(isa);
-        Thread.sleep(100);
-        ss.accept();
+
+        // loop until accepted
+        while (true) {
+            try {
+                ss.accept();
+                break;
+            } catch (IllegalBlockingModeException ex) {
+                System.out.println(ex + ", sleeping ...");
+                Thread.sleep(100);
+            }
+        }
 
     }
 
--- a/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/Locale/Bug8026766.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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 8026766
+ * @summary Confirm that LanguageRange.toString() returns an expected result.
+ * @run main Bug8026766
+ */
+
+import java.util.Locale.LanguageRange;
+
+public class Bug8026766 {
+
+    public static void main(String[] args) {
+        LanguageRange lr1 = new LanguageRange("ja", 1.0);
+        LanguageRange lr2 = new LanguageRange("fr", 0.0);
+
+        if (!lr1.toString().equals("ja") ||
+            !lr2.toString().equals("fr;q=0.0")) {
+            throw new RuntimeException("LanguageRange.toString() returned an unexpected result.");
+        }
+    }
+
+}
--- a/jdk/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java	Thu Jan 21 14:49:02 2016 -0800
@@ -37,6 +37,7 @@
  * @bug 8004138
  * @summary Check if ForkJoinPool table leaks thrown exceptions.
  * @run main/othervm -Xmx2200k FJExceptionTableLeak
+ * @key intermittent
  */
 
 import java.util.concurrent.ForkJoinPool;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/loading/MletParserLocaleTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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/net/ssl/ALPN/MyX509ExtendedKeyManager.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,130 @@
+/*
+ * 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 java.net.Socket;
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.X509ExtendedKeyManager;
+
+public class MyX509ExtendedKeyManager extends X509ExtendedKeyManager {
+
+    static final String ERROR = "ERROR";
+    X509ExtendedKeyManager akm;
+    String expectedAP;
+
+    MyX509ExtendedKeyManager(X509ExtendedKeyManager akm) {
+        this.akm = akm;
+    }
+
+    public MyX509ExtendedKeyManager(
+            X509ExtendedKeyManager akm, String expectedAP) {
+        this.akm = akm;
+        this.expectedAP = expectedAP;
+
+    }
+
+    @Override
+    public String[] getClientAliases(String keyType, Principal[] issuers) {
+        return akm.getClientAliases(keyType, issuers);
+    }
+
+    @Override
+    public String chooseClientAlias(String[] keyType, Principal[] issuers,
+            Socket socket) {
+        String nap = ((SSLSocket) socket).getHandshakeApplicationProtocol();
+        checkALPN(nap);
+
+        return akm.chooseClientAlias(keyType, issuers, socket);
+    }
+
+    @Override
+    public String[] getServerAliases(String keyType, Principal[] issuers) {
+        return akm.getServerAliases(keyType, issuers);
+    }
+
+    @Override
+    public String chooseServerAlias(String keyType, Principal[] issuers,
+            Socket socket) {
+        String nap = ((SSLSocket) socket).getHandshakeApplicationProtocol();
+        checkALPN(nap);
+
+        return akm.chooseServerAlias(keyType, issuers, socket);
+    }
+
+    @Override
+    public X509Certificate[] getCertificateChain(String alias) {
+        return akm.getCertificateChain(alias);
+    }
+
+    @Override
+    public PrivateKey getPrivateKey(String alias) {
+        return akm.getPrivateKey(alias);
+    }
+
+    @Override
+    public String chooseEngineClientAlias(String[] keyType, Principal[] issuers,
+            SSLEngine engine) {
+        String nap = engine.getHandshakeApplicationProtocol();
+        checkALPN(nap);
+
+        return akm.chooseEngineClientAlias(keyType, issuers, engine);
+    }
+
+    @Override
+    public String chooseEngineServerAlias(String keyType, Principal[] issuers,
+            SSLEngine engine) {
+        String nap = engine.getHandshakeApplicationProtocol();
+        checkALPN(nap);
+
+        return akm.chooseEngineServerAlias(keyType, issuers, engine);
+    }
+
+    private void checkALPN(String ap) {
+
+        if (ERROR.equals(expectedAP)) {
+            throw new RuntimeException("Should not reach here");
+        }
+
+        System.out.println("Expected ALPN value: " + expectedAP
+                + " Got: " + ap);
+
+        if (ap == null) {
+            throw new RuntimeException(
+                    "ALPN should be negotiated, but null was received");
+        }
+        if (expectedAP.equals("NONE")) {
+            if (!ap.isEmpty()) {
+                throw new RuntimeException("Expected no ALPN value");
+            } else {
+                System.out.println("No ALPN value negotiated, as expected");
+            }
+        } else if (!expectedAP.equals(ap)) {
+            throw new RuntimeException(expectedAP
+                    + " ALPN value not available on negotiated connection");
+        }
+
+    }
+}
--- a/jdk/test/javax/net/ssl/ALPN/SSLEngineAlpnTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/ALPN/SSLEngineAlpnTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -26,8 +26,9 @@
 
 /*
  * @test
- * @bug 8051498
+ * @bug 8051498 8145849
  * @summary JEP 244: TLS Application-Layer Protocol Negotiation Extension
+ * @compile MyX509ExtendedKeyManager.java
  * @run main/othervm SSLEngineAlpnTest h2          h2          h2
  * @run main/othervm SSLEngineAlpnTest h2          h2,http/1.1 h2
  * @run main/othervm SSLEngineAlpnTest h2,http/1.1 h2,http/1.1 h2
@@ -162,7 +163,7 @@
             throw new Exception("Invalid number of test parameters");
         }
 
-        SSLEngineAlpnTest test = new SSLEngineAlpnTest();
+        SSLEngineAlpnTest test = new SSLEngineAlpnTest(args[2]);
         try {
             test.runTest(convert(args[0]), convert(args[1]), args[2]);
         } catch (SSLHandshakeException she) {
@@ -179,7 +180,7 @@
     /*
      * Create an initialized SSLContext to use for these tests.
      */
-    public SSLEngineAlpnTest() throws Exception {
+    public SSLEngineAlpnTest(String expectedAP) throws Exception {
 
         KeyStore ks = KeyStore.getInstance("JKS");
         KeyStore ts = KeyStore.getInstance("JKS");
@@ -192,12 +193,20 @@
         KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
         kmf.init(ks, passphrase);
 
+        KeyManager [] kms = kmf.getKeyManagers();
+        if (!(kms[0] instanceof X509ExtendedKeyManager)) {
+            throw new Exception("kms[0] not X509ExtendedKeyManager");
+        }
+
+        kms = new KeyManager[] { new MyX509ExtendedKeyManager(
+                (X509ExtendedKeyManager) kms[0], expectedAP) };
+
         TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
         tmf.init(ts);
 
         SSLContext sslCtx = SSLContext.getInstance("TLS");
 
-        sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+        sslCtx.init(kms, tmf.getTrustManagers(), null);
 
         sslc = sslCtx;
     }
@@ -327,6 +336,11 @@
             return;
         }
 
+        if (engine.getHandshakeApplicationProtocol() != null) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null after the handshake is completed");
+        }
+
         String ap = engine.getApplicationProtocol();
         System.out.println("Application Protocol: \"" + ap + "\"");
 
@@ -384,6 +398,12 @@
         sslp = clientEngine.getSSLParameters();
         sslp.setApplicationProtocols(clientAPs);
         clientEngine.setSSLParameters(sslp);
+
+        if ((clientEngine.getHandshakeApplicationProtocol() != null) ||
+                (serverEngine.getHandshakeApplicationProtocol() != null)) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null before the handshake starts");
+        }
     }
 
     /*
--- a/jdk/test/javax/net/ssl/ALPN/SSLSocketAlpnTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/ALPN/SSLSocketAlpnTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -26,8 +26,9 @@
 
 /*
  * @test
- * @bug 8051498
+ * @bug 8051498 8145849
  * @summary JEP 244: TLS Application-Layer Protocol Negotiation Extension
+ * @compile MyX509ExtendedKeyManager.java
  * @run main/othervm SSLSocketAlpnTest h2          h2          h2
  * @run main/othervm SSLSocketAlpnTest h2          h2,http/1.1 h2
  * @run main/othervm SSLSocketAlpnTest h2,http/1.1 h2,http/1.1 h2
@@ -40,6 +41,8 @@
  * @author Brad Wetmore
  */
 import java.io.*;
+import java.security.KeyStore;
+
 import javax.net.ssl.*;
 
 public class SSLSocketAlpnTest {
@@ -65,6 +68,16 @@
     static String trustStoreFile = "truststore";
     static String passwd = "passphrase";
 
+    static String keyFilename = System.getProperty("test.src", ".") + "/"
+            + pathToStores + "/" + keyStoreFile;
+    static String trustFilename = System.getProperty("test.src", ".") + "/"
+            + pathToStores + "/" + trustStoreFile;
+
+    /*
+     * SSLContext
+     */
+    SSLContext mySSLContext = null;
+
     /*
      * Is the server ready to serve?
      */
@@ -82,7 +95,7 @@
     /*
      * If the client or server is doing some kind of object creation
      * that the other side depends on, and that thread prematurely
-     * exits, you may experience a hang.  The test harness will
+     * exits, you may experience a hang. The test harness will
      * terminate all hung threads after its timeout has expired,
      * currently 3 minutes by default, but you might try to be
      * smart about it....
@@ -95,10 +108,11 @@
      * to avoid infinite hangs.
      */
     void doServerSide() throws Exception {
-        SSLServerSocketFactory sslssf
-                = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+        SSLServerSocketFactory sslssf = mySSLContext.getServerSocketFactory();
         SSLServerSocket sslServerSocket
                 = (SSLServerSocket) sslssf.createServerSocket(serverPort);
+        // for both client/server to call into X509KM
+        sslServerSocket.setNeedClientAuth(true);
 
         serverPort = sslServerSocket.getLocalPort();
 
@@ -119,20 +133,30 @@
          */
         String[] suites = sslp.getCipherSuites();
         sslp.setCipherSuites(suites);
-        sslp.setUseCipherSuitesOrder(true);  // Set server side order
+        sslp.setUseCipherSuitesOrder(true); // Set server side order
 
         // Set the ALPN selection.
         sslp.setApplicationProtocols(serverAPs);
         sslSocket.setSSLParameters(sslp);
 
+        if (sslSocket.getHandshakeApplicationProtocol() != null) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null before the handshake starts");
+        }
+
         sslSocket.startHandshake();
 
+        if (sslSocket.getHandshakeApplicationProtocol() != null) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null after the handshake is completed");
+        }
+
         String ap = sslSocket.getApplicationProtocol();
         System.out.println("Application Protocol: \"" + ap + "\"");
 
         if (ap == null) {
             throw new Exception(
-                "Handshake was completed but null was received");
+                    "Handshake was completed but null was received");
         }
         if (expectedAP.equals("NONE")) {
             if (!ap.isEmpty()) {
@@ -141,8 +165,8 @@
                 System.out.println("No ALPN value negotiated, as expected");
             }
         } else if (!expectedAP.equals(ap)) {
-            throw new Exception(expectedAP +
-                " ALPN value not available on negotiated connection");
+            throw new Exception(expectedAP
+                    + " ALPN value not available on negotiated connection");
         }
 
         InputStream sslIS = sslSocket.getInputStream();
@@ -170,8 +194,7 @@
             Thread.sleep(50);
         }
 
-        SSLSocketFactory sslsf
-                = (SSLSocketFactory) SSLSocketFactory.getDefault();
+        SSLSocketFactory sslsf = mySSLContext.getSocketFactory();
         SSLSocket sslSocket
                 = (SSLSocket) sslsf.createSocket("localhost", serverPort);
 
@@ -185,28 +208,35 @@
          */
         String[] suites = sslp.getCipherSuites();
         sslp.setCipherSuites(suites);
-        sslp.setUseCipherSuitesOrder(true);  // Set server side order
+        sslp.setUseCipherSuitesOrder(true); // Set server side order
 
         // Set the ALPN selection.
         sslp.setApplicationProtocols(clientAPs);
         sslSocket.setSSLParameters(sslp);
 
+        if (sslSocket.getHandshakeApplicationProtocol() != null) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null before the handshake starts");
+        }
+
         sslSocket.startHandshake();
 
+        if (sslSocket.getHandshakeApplicationProtocol() != null) {
+            throw new Exception ("getHandshakeApplicationProtocol() should "
+                    + "return null after the handshake is completed");
+        }
+
         /*
          * Check that the resulting connection meets our defined ALPN
          * criteria.  If we were connecting to a non-JSSE implementation,
          * the server might have negotiated something we shouldn't accept.
-         *
-         * We were expecting H2 from server, let's make sure the
-         * conditions match.
          */
         String ap = sslSocket.getApplicationProtocol();
         System.out.println("Application Protocol: \"" + ap + "\"");
 
         if (ap == null) {
             throw new Exception(
-                "Handshake was completed but null was received");
+                    "Handshake was completed but null was received");
         }
         if (expectedAP.equals("NONE")) {
             if (!ap.isEmpty()) {
@@ -215,8 +245,8 @@
                 System.out.println("No ALPN value negotiated, as expected");
             }
         } else if (!expectedAP.equals(ap)) {
-            throw new Exception(expectedAP +
-                " ALPN value not available on negotiated connection");
+            throw new Exception(expectedAP
+                    + " ALPN value not available on negotiated connection");
         }
 
         InputStream sslIS = sslSocket.getInputStream();
@@ -240,17 +270,6 @@
     volatile Exception clientException = null;
 
     public static void main(String[] args) throws Exception {
-        String keyFilename
-                = System.getProperty("test.src", ".") + "/" + pathToStores
-                + "/" + keyStoreFile;
-        String trustFilename
-                = System.getProperty("test.src", ".") + "/" + pathToStores
-                + "/" + trustStoreFile;
-
-        System.setProperty("javax.net.ssl.keyStore", keyFilename);
-        System.setProperty("javax.net.ssl.keyStorePassword", passwd);
-        System.setProperty("javax.net.ssl.trustStore", trustFilename);
-        System.setProperty("javax.net.ssl.trustStorePassword", passwd);
 
         if (debug) {
             System.setProperty("javax.net.debug", "all");
@@ -280,6 +299,39 @@
         System.out.println("Test Passed.");
     }
 
+    SSLContext getSSLContext(String keyFilename, String trustFilename)
+            throws Exception {
+        SSLContext ctx = SSLContext.getInstance("TLS");
+
+        // Keystores
+        KeyStore keyKS = KeyStore.getInstance("JKS");
+        keyKS.load(new FileInputStream(keyFilename), passwd.toCharArray());
+
+        KeyStore trustKS = KeyStore.getInstance("JKS");
+        trustKS.load(new FileInputStream(trustFilename), passwd.toCharArray());
+
+        // Generate KeyManager and TrustManager
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+        kmf.init(keyKS, passwd.toCharArray());
+
+        KeyManager[] kms = kmf.getKeyManagers();
+        if (!(kms[0] instanceof X509ExtendedKeyManager)) {
+            throw new Exception("kms[0] not X509ExtendedKeyManager");
+        }
+
+        kms = new KeyManager[] { new MyX509ExtendedKeyManager(
+                (X509ExtendedKeyManager) kms[0], expectedAP) };
+
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+        tmf.init(trustKS);
+        TrustManager[] tms = tmf.getTrustManagers();
+
+        // initial SSLContext
+        ctx.init(kms, tms, null);
+
+        return ctx;
+    }
+
     /*
      * Convert a comma-separated list into an array of strings.
      */
@@ -309,6 +361,7 @@
      */
     SSLSocketAlpnTest() throws Exception {
         Exception startException = null;
+        mySSLContext = getSSLContext(keyFilename, trustFilename);
         try {
             if (separateServerThread) {
                 startServer(true);
--- a/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/SSLSession/SessionTimeOutTests.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketSNISensitive.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKey512.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/security/auth/SubjectDomainCombiner/Optimize.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/javax/security/auth/SubjectDomainCombiner/Optimize.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -37,13 +37,16 @@
 
         ProtectionDomain pd1 = new ProtectionDomain(
             new CodeSource(null, (java.security.cert.Certificate[]) null),
-            new Permissions());
+            new Permissions(),
+            null, null);
         ProtectionDomain pd2 = new ProtectionDomain(
             new CodeSource(null, (java.security.cert.Certificate[]) null),
-            new Permissions());
+            new Permissions(),
+            null, null);
         ProtectionDomain pd3 = new ProtectionDomain(
             new CodeSource(null, (java.security.cert.Certificate[]) null),
-            new Permissions());
+            new Permissions(),
+            null, null);
 
         ProtectionDomain[] current = new ProtectionDomain[] {pd1, pd2};
         ProtectionDomain[] assigned = new ProtectionDomain[] {pd3, pd2};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/publish/WSTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/lib/testlibrary/ExtendedRobot.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/lib/testlibrary/ExtendedRobot.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/invoke/anon/ConstantPoolPatch/OptimalMapSize.java	Thu Jan 21 13:41:02 2016 +0530
+++ /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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 14:49:02 2016 -0800
@@ -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/protocol/https/HttpsURLConnection/DNSIdentities.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/security/pkcs11/PKCS11Test.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/ssl/SSLContextImpl/MD2InTrustAnchor.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/X509KeyManager/PreferredKey.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/X509KeyManager/PreferredKey.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/BasicConstraints.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/PKIXExtendedTM.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/tools/jinfo/JInfoRunningProcessFlagTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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/tools/launcher/Settings.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/tools/launcher/Settings.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -343,3 +343,4 @@
 345520da2ec17100cb512a53d541a307a195305e jdk-9+98
 cb73b474703e2de266542b505cffd658bcc052da jdk-9+99
 51136404ee5e6cd5868b60d66ebd55a02170b508 jdk-9+100
+3b3bea483542bc08278af529fb25f2e5930da945 jdk-9+101
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1146,14 +1146,21 @@
                     if (!visit(supertype(t), supertype(s)))
                         return false;
 
-                    HashSet<UniqueType> set = new HashSet<>();
-                    for (Type x : interfaces(t))
-                        set.add(new UniqueType(x, Types.this));
-                    for (Type x : interfaces(s)) {
-                        if (!set.remove(new UniqueType(x, Types.this)))
+                    Map<Symbol,Type> tMap = new HashMap<>();
+                    for (Type ti : interfaces(t)) {
+                        if (tMap.containsKey(ti)) {
+                            throw new AssertionError("Malformed intersection");
+                        }
+                        tMap.put(ti.tsym, ti);
+                    }
+                    for (Type si : interfaces(s)) {
+                        if (!tMap.containsKey(si.tsym))
+                            return false;
+                        Type ti = tMap.remove(si.tsym);
+                        if (!visit(ti, si))
                             return false;
                     }
-                    return (set.isEmpty());
+                    return tMap.isEmpty();
                 }
                 return t.tsym == s.tsym
                     && visit(t.getEnclosingType(), s.getEnclosingType())
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1137,7 +1137,56 @@
 
             /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
             private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree) {
-                FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s);
+                Type tDesc = types.findDescriptorType(t);
+                Type sDesc = types.findDescriptorType(s);
+
+                // compare type parameters -- can't use Types.hasSameBounds because bounds may have ivars
+                final List<Type> tTypeParams = tDesc.getTypeArguments();
+                final List<Type> sTypeParams = sDesc.getTypeArguments();
+                List<Type> tIter = tTypeParams;
+                List<Type> sIter = sTypeParams;
+                while (tIter.nonEmpty() && sIter.nonEmpty()) {
+                    Type tBound = tIter.head.getUpperBound();
+                    Type sBound = types.subst(sIter.head.getUpperBound(), sTypeParams, tTypeParams);
+                    if (tBound.containsAny(tTypeParams) && inferenceContext().free(sBound)) {
+                        return false;
+                    }
+                    if (!types.isSameType(tBound, inferenceContext().asUndetVar(sBound))) {
+                        return false;
+                    }
+                    tIter = tIter.tail;
+                    sIter = sIter.tail;
+                }
+                if (!tIter.isEmpty() || !sIter.isEmpty()) {
+                    return false;
+                }
+
+                // compare parameters
+                List<Type> tParams = tDesc.getParameterTypes();
+                List<Type> sParams = sDesc.getParameterTypes();
+                while (tParams.nonEmpty() && sParams.nonEmpty()) {
+                    Type tParam = tParams.head;
+                    Type sParam = types.subst(sParams.head, sTypeParams, tTypeParams);
+                    if (tParam.containsAny(tTypeParams) && inferenceContext().free(sParam)) {
+                        return false;
+                    }
+                    if (!types.isSameType(tParam, inferenceContext().asUndetVar(sParam))) {
+                        return false;
+                    }
+                    tParams = tParams.tail;
+                    sParams = sParams.tail;
+                }
+                if (!tParams.isEmpty() || !sParams.isEmpty()) {
+                    return false;
+                }
+
+                // compare returns
+                Type tRet = tDesc.getReturnType();
+                Type sRet = types.subst(sDesc.getReturnType(), sTypeParams, tTypeParams);
+                if (tRet.containsAny(tTypeParams) && inferenceContext().free(sRet)) {
+                    return false;
+                }
+                MostSpecificFunctionReturnChecker msc = new MostSpecificFunctionReturnChecker(tRet, sRet);
                 msc.scan(tree);
                 return msc.result;
             }
@@ -1146,16 +1195,16 @@
              * Tests whether one functional interface type can be considered more specific
              * than another unrelated functional interface type for the scanned expression.
              */
-            class FunctionalInterfaceMostSpecificChecker extends DeferredAttr.PolyScanner {
-
-                final Type t;
-                final Type s;
+            class MostSpecificFunctionReturnChecker extends DeferredAttr.PolyScanner {
+
+                final Type tRet;
+                final Type sRet;
                 boolean result;
 
                 /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
-                FunctionalInterfaceMostSpecificChecker(Type t, Type s) {
-                    this.t = t;
-                    this.s = s;
+                MostSpecificFunctionReturnChecker(Type tRet, Type sRet) {
+                    this.tRet = tRet;
+                    this.sRet = sRet;
                     result = true;
                 }
 
@@ -1172,29 +1221,18 @@
 
                 @Override
                 public void visitReference(JCMemberReference tree) {
-                    Type desc_t = types.findDescriptorType(t);
-                    Type desc_s = types.findDescriptorType(s);
-                    // use inference variables here for more-specific inference (18.5.4)
-                    if (!types.isSameTypes(desc_t.getParameterTypes(),
-                            inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
+                    if (sRet.hasTag(VOID)) {
+                        result &= true;
+                    } else if (tRet.hasTag(VOID)) {
                         result &= false;
+                    } else if (tRet.isPrimitive() != sRet.isPrimitive()) {
+                        boolean retValIsPrimitive =
+                                tree.refPolyKind == PolyKind.STANDALONE &&
+                                tree.sym.type.getReturnType().isPrimitive();
+                        result &= (retValIsPrimitive == tRet.isPrimitive()) &&
+                                  (retValIsPrimitive != sRet.isPrimitive());
                     } else {
-                        // compare return types
-                        Type ret_t = desc_t.getReturnType();
-                        Type ret_s = desc_s.getReturnType();
-                        if (ret_s.hasTag(VOID)) {
-                            result &= true;
-                        } else if (ret_t.hasTag(VOID)) {
-                            result &= false;
-                        } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) {
-                            boolean retValIsPrimitive =
-                                    tree.refPolyKind == PolyKind.STANDALONE &&
-                                    tree.sym.type.getReturnType().isPrimitive();
-                            result &= (retValIsPrimitive == ret_t.isPrimitive()) &&
-                                      (retValIsPrimitive != ret_s.isPrimitive());
-                        } else {
-                            result &= compatibleBySubtyping(ret_t, ret_s);
-                        }
+                        result &= compatibleBySubtyping(tRet, sRet);
                     }
                 }
 
@@ -1205,32 +1243,24 @@
 
                 @Override
                 public void visitLambda(JCLambda tree) {
-                    Type desc_t = types.findDescriptorType(t);
-                    Type desc_s = types.findDescriptorType(s);
-                    // use inference variables here for more-specific inference (18.5.4)
-                    if (!types.isSameTypes(desc_t.getParameterTypes(),
-                            inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
+                    if (sRet.hasTag(VOID)) {
+                        result &= true;
+                    } else if (tRet.hasTag(VOID)) {
                         result &= false;
                     } else {
-                        // compare return types
-                        Type ret_t = desc_t.getReturnType();
-                        Type ret_s = desc_s.getReturnType();
-                        if (ret_s.hasTag(VOID)) {
-                            result &= true;
-                        } else if (ret_t.hasTag(VOID)) {
-                            result &= false;
-                        } else if (unrelatedFunctionalInterfaces(ret_t, ret_s)) {
-                            for (JCExpression expr : lambdaResults(tree)) {
-                                result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr);
+                        List<JCExpression> lambdaResults = lambdaResults(tree);
+                        if (!lambdaResults.isEmpty() && unrelatedFunctionalInterfaces(tRet, sRet)) {
+                            for (JCExpression expr : lambdaResults) {
+                                result &= functionalInterfaceMostSpecific(tRet, sRet, expr);
                             }
-                        } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) {
-                            for (JCExpression expr : lambdaResults(tree)) {
+                        } else if (!lambdaResults.isEmpty() && tRet.isPrimitive() != sRet.isPrimitive()) {
+                            for (JCExpression expr : lambdaResults) {
                                 boolean retValIsPrimitive = expr.isStandalone() && expr.type.isPrimitive();
-                                result &= (retValIsPrimitive == ret_t.isPrimitive()) &&
-                                          (retValIsPrimitive != ret_s.isPrimitive());
+                                result &= (retValIsPrimitive == tRet.isPrimitive()) &&
+                                        (retValIsPrimitive != sRet.isPrimitive());
                             }
                         } else {
-                            result &= compatibleBySubtyping(ret_t, ret_s);
+                            result &= compatibleBySubtyping(tRet, sRet);
                         }
                     }
                 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, 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
@@ -301,15 +301,16 @@
     }
 
     /** Read a number.
-     *  @param radix  The radix of the number; one of 2, j8, 10, 16.
+     *  @param radix  The radix of the number; one of 2, 8, 10, 16.
      */
     private void scanNumber(int pos, int radix) {
         // for octal, allow base-10 digit in case it's a float literal
         this.radix = radix;
         int digitRadix = (radix == 8 ? 10 : radix);
-        boolean seendigit = false;
-        if (reader.digit(pos, digitRadix) >= 0) {
-            seendigit = true;
+        int firstDigit = reader.digit(pos, Math.max(10, digitRadix));
+        boolean seendigit = firstDigit >= 0;
+        boolean seenValidDigit = firstDigit >= 0 && firstDigit < digitRadix;
+        if (seendigit) {
             scanDigits(pos, digitRadix);
         }
         if (radix == 16 && reader.ch == '.') {
@@ -325,6 +326,16 @@
                     reader.ch == 'd' || reader.ch == 'D')) {
             scanFractionAndSuffix(pos);
         } else {
+            if (!seenValidDigit) {
+                switch (radix) {
+                case 2:
+                    lexError(pos, "invalid.binary.number");
+                    break;
+                case 16:
+                    lexError(pos, "invalid.hex.number");
+                    break;
+                }
+            }
             if (reader.ch == 'l' || reader.ch == 'L') {
                 reader.scanChar();
                 tk = TokenKind.LONGLITERAL;
@@ -491,13 +502,7 @@
                     if (reader.ch == 'x' || reader.ch == 'X') {
                         reader.scanChar();
                         skipIllegalUnderscores();
-                        if (reader.ch == '.') {
-                            scanHexFractionAndSuffix(pos, false);
-                        } else if (reader.digit(pos, 16) < 0) {
-                            lexError(pos, "invalid.hex.number");
-                        } else {
-                            scanNumber(pos, 16);
-                        }
+                        scanNumber(pos, 16);
                     } else if (reader.ch == 'b' || reader.ch == 'B') {
                         if (!allowBinaryLiterals) {
                             lexError(pos, "unsupported.binary.lit", source.name);
@@ -505,11 +510,7 @@
                         }
                         reader.scanChar();
                         skipIllegalUnderscores();
-                        if (reader.digit(pos, 2) < 0) {
-                            lexError(pos, "invalid.binary.number");
-                        } else {
-                            scanNumber(pos, 2);
-                        }
+                        scanNumber(pos, 2);
                     } else {
                         reader.putChar('0');
                         if (reader.ch == '_') {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Source.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Source.java	Thu Jan 21 14:49:02 2016 -0800
@@ -26,11 +26,20 @@
 package com.sun.tools.sjavac;
 
 import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.util.Set;
 import java.util.Collections;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
+import java.util.regex.PatternSyntaxException;
 
 /** A Source object maintains information about a source file.
  * For example which package it belongs to and kind of source it is.
@@ -56,8 +65,6 @@
     private long lastModified;
     // The source File.
     private File file;
-    // The source root under which file resides.
-    private File root;
     // If the source is generated.
     private boolean isGenerated;
     // If the source is only linked to, not compiled.
@@ -78,7 +85,7 @@
         return name.hashCode();
     }
 
-    public Source(Module m, String n, File f, File r) {
+    public Source(Module m, String n, File f) {
         name = n;
         int dp = n.lastIndexOf(".");
         if (dp != -1) {
@@ -87,7 +94,6 @@
             suffix = "";
         }
         file = f;
-        root = r;
         lastModified = f.lastModified();
         linkedOnly = false;
     }
@@ -102,7 +108,6 @@
             suffix = "";
         }
         file = null;
-        root = null;
         lastModified = lm;
         linkedOnly = false;
         int ls = n.lastIndexOf('/');
@@ -112,7 +117,6 @@
     public String suffix() { return suffix; }
     public Package pkg() { return pkg; }
     public File   file() { return file; }
-    public File   root() { return root; }
     public long lastModified() {
         return lastModified;
     }
@@ -183,225 +187,122 @@
      */
     static public void scanRoot(File root,
                                 Set<String> suffixes,
-                                List<String> excludes, List<String> includes,
-                                List<String> excludeFiles, List<String> includeFiles,
+                                List<String> excludes,
+                                List<String> includes,
                                 Map<String,Source> foundFiles,
                                 Map<String,Module> foundModules,
-                                Module currentModule,
+                                final Module currentModule,
                                 boolean permitSourcesWithoutPackage,
                                 boolean inGensrc,
                                 boolean inLinksrc)
-        throws ProblemException {
+                                        throws IOException, ProblemException {
+
+        if (root == null)
+            return;
+
+        FileSystem fs = root.toPath().getFileSystem();
+
+        if (includes.isEmpty()) {
+            includes = Collections.singletonList("**");
+        }
+
+        List<PathMatcher> includeMatchers = createPathMatchers(fs, includes);
+        List<PathMatcher> excludeMatchers = createPathMatchers(fs, excludes);
 
-        if (root == null) return;
-        int root_prefix = root.getPath().length()+1;
-        // This is the root source directory, it must not contain any Java sources files
-        // because we do not allow Java source files without a package.
-        // (Unless of course --permit-sources-without-package has been specified.)
-        // It might contain other source files however, (for -tr and -copy) these will
-        // always be included, since no package pattern can match the root directory.
-        currentModule = addFilesInDir(root, root_prefix, root, suffixes, permitSourcesWithoutPackage,
-                                       excludeFiles, includeFiles,
-                                       foundFiles, foundModules, currentModule,
-                                       inGensrc, inLinksrc);
+        Files.walkFileTree(root.toPath(), new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+
+                Path relToRoot = root.toPath().relativize(file);
 
-        File[] dirfiles = root.listFiles();
-        for (File d : dirfiles) {
-            if (d.isDirectory()) {
-                // Descend into the directory structure.
-                scanDirectory(d, root_prefix, root, suffixes,
-                              excludes, includes, excludeFiles, includeFiles,
-                              foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
-            }
-        }
-    }
+                if (includeMatchers.stream().anyMatch(im -> im.matches(relToRoot))
+                        && excludeMatchers.stream().noneMatch(em -> em.matches(relToRoot))
+                        && suffixes.contains(Util.fileSuffix(file))) {
+
+                    // TODO: Test this.
+                    Source existing = foundFiles.get(file);
+                    if (existing != null) {
+                        throw new IOException("You have already added the file "+file+" from "+existing.file().getPath());
+                    }
+                    existing = currentModule.lookupSource(file.toString());
+                    if (existing != null) {
 
-    /**
-     * Test if a path matches any of the patterns given.
-     * The pattern foo/bar matches only foo/bar
-     * The pattern foo/* matches foo/bar and foo/bar/zoo etc
-     */
-    static private boolean hasMatch(String path, List<String> patterns) {
-
-        // Convert Windows '\' to '/' for the sake of comparing with the patterns
-        path = path.replace(File.separatorChar, '/');
+                            // Oups, the source is already added, could be ok, could be not, lets check.
+                            if (inLinksrc) {
+                                // So we are collecting sources for linking only.
+                                if (existing.isLinkedOnly()) {
+                                    // Ouch, this one is also for linking only. Bad.
+                                    throw new IOException("You have already added the link only file " + file + " from " + existing.file().getPath());
+                                }
+                                // Ok, the existing source is to be compiled. Thus this link only is redundant
+                                // since all compiled are also linked to. Continue to the next source.
+                                // But we need to add the source, so that it will be visible to linking,
+                                // if not the multi core compile will fail because a JavaCompiler cannot
+                                // find the necessary dependencies for its part of the source.
+                                foundFiles.put(file.toString(), existing);
+                            } else {
+                                // We are looking for sources to compile, if we find an existing to be compiled
+                                // source with the same name, it is an internal error, since we must
+                                // find the sources to be compiled before we find the sources to be linked to.
+                                throw new IOException("Internal error: Double add of file " + file + " from " + existing.file().getPath());
+                            }
 
-        for (String p : patterns) {
-            // Exact match
-            if (p.equals(path))
-                return true;
+                    } else {
 
-            // Single dot the end matches this package and all its subpackages.
-            if (p.endsWith("/*")) {
-                // Remove the wildcard
-                String patprefix = p.substring(0,p.length()-2);
-                // Does the path start with the pattern prefix?
-                if (path.startsWith(patprefix)) {
-                    // If the path has the same length as the pattern prefix, then it is a match.
-                    // If the path is longer, then make sure that
-                    // the next part of the path starts with a dot (.) to prevent
-                    // wildcard matching in the middle of a package name.
-                    if (path.length()==patprefix.length() || path.charAt(patprefix.length())=='/') {
-                        return true;
+                        //////////////////////////////////////////////////////////////
+                        // Add source
+                        Source s = new Source(currentModule, file.toString(), file.toFile());
+                        if (inGensrc) {
+                            s.markAsGenerated();
+                        }
+                        if (inLinksrc) {
+                            s.markAsLinkedOnly();
+                        }
+                        String pkg = packageOfJavaFile(root.toPath(), file);
+                        pkg = currentModule.name() + ":" + pkg;
+                        foundFiles.put(file.toString(), s);
+                        currentModule.addSource(pkg, s);
+                        //////////////////////////////////////////////////////////////
                     }
                 }
+
+                return FileVisitResult.CONTINUE;
             }
-        }
-        return false;
-    }
-
-    /**
-     * Matches patterns with the asterisk first. */
-     // The pattern foo/bar.java only matches foo/bar.java
-     // The pattern */bar.java matches foo/bar.java and zoo/bar.java etc
-    static private boolean hasFileMatch(String path, List<String> patterns) {
-        // Convert Windows '\' to '/' for the sake of comparing with the patterns
-        path = path.replace(File.separatorChar, '/');
-
-        path = Util.normalizeDriveLetter(path);
-        for (String p : patterns) {
-            // Exact match
-            if (p.equals(path)) {
-                return true;
-            }
-            // Single dot the end matches this package and all its subpackages.
-            if (p.startsWith("*")) {
-                // Remove the wildcard
-                String patsuffix = p.substring(1);
-                // Does the path start with the pattern prefix?
-                if (path.endsWith(patsuffix)) {
-                    return true;
-                }
-            }
-        }
-        return false;
+        });
     }
 
-    /**
-     * Add the files in the directory, assuming that the file has not been excluded.
-     * Returns a fresh Module object, if this was a dir with a module-info.java file.
-     */
-    static private Module addFilesInDir(File dir, int rootPrefix, File root,
-                                        Set<String> suffixes, boolean allow_javas,
-                                        List<String> excludeFiles, List<String> includeFiles,
-                                        Map<String,Source> foundFiles,
-                                        Map<String,Module> foundModules,
-                                        Module currentModule,
-                                        boolean inGensrc,
-                                        boolean inLinksrc)
-        throws ProblemException
-    {
-        for (File f : dir.listFiles()) {
-
-            if (!f.isFile())
-                continue;
-
-            boolean should_add =
-                (excludeFiles == null || excludeFiles.isEmpty() || !hasFileMatch(f.getPath(), excludeFiles))
-                && (includeFiles == null || includeFiles.isEmpty() || hasFileMatch(f.getPath(), includeFiles));
-
-            if (!should_add)
-                continue;
-
-            if (!allow_javas && f.getName().endsWith(".java")) {
-                throw new ProblemException("No .java files are allowed in the source root "+dir.getPath()+
-                                           ", please remove "+f.getName());
-            }
-            // Extract the file name relative the root.
-            String fn = f.getPath().substring(rootPrefix);
-            // Extract the package name.
-            int sp = fn.lastIndexOf(File.separatorChar);
-            String pkg = "";
-            if (sp != -1) {
-                pkg = fn.substring(0,sp).replace(File.separatorChar,'.');
-            }
-            // Is this a module-info.java file?
-            if (fn.endsWith("module-info.java")) {
-                // Aha! We have recursed into a module!
-                if (!currentModule.name().equals("")) {
-                    throw new ProblemException("You have an extra module-info.java inside a module! Please remove "+fn);
-                }
-                String module_name = fn.substring(0,fn.length()-16);
-                currentModule = new Module(module_name, f.getPath());
-                foundModules.put(module_name, currentModule);
-            }
-            // Extract the suffix.
-            int dp = fn.lastIndexOf(".");
-            String suffix = "";
-            if (dp > 0) {
-                suffix = fn.substring(dp);
-            }
-            // Should the file be added?
-            if (suffixes.contains(suffix)) {
-                Source of = foundFiles.get(f.getPath());
-                if (of != null) {
-                    throw new ProblemException("You have already added the file "+fn+" from "+of.file().getPath());
-                }
-                of = currentModule.lookupSource(f.getPath());
-                if (of != null) {
-                    // Oups, the source is already added, could be ok, could be not, lets check.
-                    if (inLinksrc) {
-                        // So we are collecting sources for linking only.
-                        if (of.isLinkedOnly()) {
-                            // Ouch, this one is also for linking only. Bad.
-                            throw new ProblemException("You have already added the link only file "+fn+" from "+of.file().getPath());
-                        }
-                        // Ok, the existing source is to be compiled. Thus this link only is redundant
-                        // since all compiled are also linked to. Continue to the next source.
-                        // But we need to add the source, so that it will be visible to linking,
-                        // if not the multi core compile will fail because a JavaCompiler cannot
-                        // find the necessary dependencies for its part of the source.
-                        foundFiles.put(f.getPath(), of);
-                        continue;
-                    } else {
-                        // We are looking for sources to compile, if we find an existing to be compiled
-                        // source with the same name, it is an internal error, since we must
-                        // find the sources to be compiled before we find the sources to be linked to.
-                        throw new ProblemException("Internal error: Double add of file "+fn+" from "+of.file().getPath());
-                    }
-                }
-                Source s = new Source(currentModule, f.getPath(), f, root);
-                if (inGensrc) s.markAsGenerated();
-                if (inLinksrc) {
-                    s.markAsLinkedOnly();
-                }
-                pkg = currentModule.name()+":"+pkg;
-                foundFiles.put(f.getPath(), s);
-                currentModule.addSource(pkg, s);
+    private static List<PathMatcher> createPathMatchers(FileSystem fs, List<String> patterns) {
+        List<PathMatcher> matchers = new ArrayList<>();
+        for (String pattern : patterns) {
+            try {
+                matchers.add(fs.getPathMatcher("glob:" + pattern));
+            } catch (PatternSyntaxException e) {
+                Log.error("Invalid pattern: " + pattern);
+                throw e;
             }
         }
-        return currentModule;
+        return matchers;
+    }
+
+    private static String packageOfJavaFile(Path sourceRoot, Path javaFile) {
+        Path javaFileDir = javaFile.getParent();
+        Path packageDir = sourceRoot.relativize(javaFileDir);
+        List<String> separateDirs = new ArrayList<>();
+        for (Path pathElement : packageDir) {
+            separateDirs.add(pathElement.getFileName().toString());
+        }
+        return String.join(".", separateDirs);
     }
 
-    static private void scanDirectory(File dir, int rootPrefix, File root,
-                                      Set<String> suffixes,
-                                      List<String> excludes, List<String> includes,
-                                      List<String> excludeFiles, List<String> includeFiles,
-                                      Map<String,Source> foundFiles,
-                                      Map<String,Module> foundModules,
-                                      Module currentModule, boolean inGensrc, boolean inLinksrc)
-        throws ProblemException {
-
-        String path = "";
-        // Remove the root prefix from the dir path
-        if (dir.getPath().length() > rootPrefix) {
-            path = dir.getPath().substring(rootPrefix);
-        }
-        // Should this package directory be included and not excluded?
-        if ((includes==null || includes.isEmpty() || hasMatch(path, includes)) &&
-            (excludes==null || excludes.isEmpty() || !hasMatch(path, excludes))) {
-            // Add the source files.
-            currentModule = addFilesInDir(dir, rootPrefix, root, suffixes, true, excludeFiles, includeFiles,
-                                          foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
-        }
-
-        for (File d : dir.listFiles()) {
-            if (d.isDirectory()) {
-                // Descend into the directory structure.
-                scanDirectory(d, rootPrefix, root, suffixes,
-                              excludes, includes, excludeFiles, includeFiles,
-                              foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
-            }
-        }
+    @Override
+    public String toString() {
+        return String.format("%s[pkg: %s, name: %s, suffix: %s, file: %s, isGenerated: %b, linkedOnly: %b]",
+                             getClass().getSimpleName(),
+                             pkg,
+                             name,
+                             suffix,
+                             file,
+                             isGenerated,
+                             linkedOnly);
     }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Thu Jan 21 14:49:02 2016 -0800
@@ -230,4 +230,10 @@
                                            Function<? super T, ? extends I> indexFunction) {
         return c.stream().collect(Collectors.<T, I, T>toMap(indexFunction, o -> o));
     }
+
+    public static String fileSuffix(Path file) {
+        String fileNameStr = file.getFileName().toString();
+        int dotIndex = fileNameStr.indexOf('.');
+        return dotIndex == -1 ? "" : fileNameStr.substring(dotIndex);
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -144,77 +144,77 @@
             Module current_module = new Module("", "");
             modules.put("", current_module);
 
-            // Find all sources, use the suffix rules to know which files are sources.
-            Map<String,Source> sources = new HashMap<>();
+            try {
+                // Find all sources, use the suffix rules to know which files are sources.
+                Map<String,Source> sources = new HashMap<>();
 
-            // Find the files, this will automatically populate the found modules
-            // with found packages where the sources are found!
-            findSourceFiles(options.getSources(),
-                            suffixRules.keySet(),
-                            sources,
-                            modules,
-                            current_module,
-                            options.isDefaultPackagePermitted(),
-                            false);
+                // Find the files, this will automatically populate the found modules
+                // with found packages where the sources are found!
+                findSourceFiles(options.getSources(),
+                                suffixRules.keySet(),
+                                sources,
+                                modules,
+                                current_module,
+                                options.isDefaultPackagePermitted(),
+                                false);
 
-            if (sources.isEmpty()) {
-                Log.error("Found nothing to compile!");
-                return RC_FATAL;
-            }
+                if (sources.isEmpty()) {
+                    Log.error("Found nothing to compile!");
+                    return RC_FATAL;
+                }
 
 
-            // Create a map of all source files that are available for linking. Both -src and
-            // -sourcepath point to such files. It is possible to specify multiple
-            // -sourcepath options to enable different filtering rules. If the
-            // filters are the same for multiple sourcepaths, they may be concatenated
-            // using :(;). Before sending the list of sourcepaths to javac, they are
-            // all concatenated. The list created here is used by the SmartFileWrapper to
-            // make sure only the correct sources are actually available.
-            // We might find more modules here as well.
-            Map<String,Source> sources_to_link_to = new HashMap<>();
+                // Create a map of all source files that are available for linking. Both -src and
+                // -sourcepath point to such files. It is possible to specify multiple
+                // -sourcepath options to enable different filtering rules. If the
+                // filters are the same for multiple sourcepaths, they may be concatenated
+                // using :(;). Before sending the list of sourcepaths to javac, they are
+                // all concatenated. The list created here is used by the SmartFileWrapper to
+                // make sure only the correct sources are actually available.
+                // We might find more modules here as well.
+                Map<String,Source> sources_to_link_to = new HashMap<>();
 
-            List<SourceLocation> sourceResolutionLocations = new ArrayList<>();
-            sourceResolutionLocations.addAll(options.getSources());
-            sourceResolutionLocations.addAll(options.getSourceSearchPaths());
-            findSourceFiles(sourceResolutionLocations,
-                            Collections.singleton(".java"),
-                            sources_to_link_to,
-                            modules,
-                            current_module,
-                            options.isDefaultPackagePermitted(),
-                            true);
+                List<SourceLocation> sourceResolutionLocations = new ArrayList<>();
+                sourceResolutionLocations.addAll(options.getSources());
+                sourceResolutionLocations.addAll(options.getSourceSearchPaths());
+                findSourceFiles(sourceResolutionLocations,
+                                Collections.singleton(".java"),
+                                sources_to_link_to,
+                                modules,
+                                current_module,
+                                options.isDefaultPackagePermitted(),
+                                true);
 
-            // Add the set of sources to the build database.
-            javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
-            javac_state.now().checkInternalState("checking sources", false, sources);
-            javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
-            javac_state.setVisibleSources(sources_to_link_to);
+                // Add the set of sources to the build database.
+                javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
+                javac_state.now().checkInternalState("checking sources", false, sources);
+                javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
+                javac_state.setVisibleSources(sources_to_link_to);
 
-            int round = 0;
-            printRound(round);
+                int round = 0;
+                printRound(round);
 
-            // If there is any change in the source files, taint packages
-            // and mark the database in need of saving.
-            javac_state.checkSourceStatus(false);
+                // If there is any change in the source files, taint packages
+                // and mark the database in need of saving.
+                javac_state.checkSourceStatus(false);
 
-            // Find all existing artifacts. Their timestamp will match the last modified timestamps stored
-            // in javac_state, simply because loading of the JavacState will clean out all artifacts
-            // that do not match the javac_state database.
-            javac_state.findAllArtifacts();
+                // Find all existing artifacts. Their timestamp will match the last modified timestamps stored
+                // in javac_state, simply because loading of the JavacState will clean out all artifacts
+                // that do not match the javac_state database.
+                javac_state.findAllArtifacts();
 
-            // Remove unidentified artifacts from the bin, gensrc and header dirs.
-            // (Unless we allow them to be there.)
-            // I.e. artifacts that are not known according to the build database (javac_state).
-            // For examples, files that have been manually copied into these dirs.
-            // Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp
-            // in javac_state) have already been removed when the javac_state was loaded.
-            if (!options.areUnidentifiedArtifactsPermitted()) {
-                javac_state.removeUnidentifiedArtifacts();
-            }
-            // Go through all sources and taint all packages that miss artifacts.
-            javac_state.taintPackagesThatMissArtifacts();
+                // Remove unidentified artifacts from the bin, gensrc and header dirs.
+                // (Unless we allow them to be there.)
+                // I.e. artifacts that are not known according to the build database (javac_state).
+                // For examples, files that have been manually copied into these dirs.
+                // Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp
+                // in javac_state) have already been removed when the javac_state was loaded.
+                if (!options.areUnidentifiedArtifactsPermitted()) {
+                    javac_state.removeUnidentifiedArtifacts();
+                }
+                // Go through all sources and taint all packages that miss artifacts.
+                javac_state.taintPackagesThatMissArtifacts();
 
-            try {
                 // Check recorded classpath public apis. Taint packages that depend on
                 // classpath classes whose public apis have changed.
                 javac_state.taintPackagesDependingOnChangedClasspathPackages();
@@ -229,8 +229,16 @@
                 // (Generated sources must always have a package.)
                 Map<String,Source> generated_sources = new HashMap<>();
 
-                Source.scanRoot(Util.pathToFile(options.getGenSrcDir()), Util.set(".java"), null, null, null, null,
-                        generated_sources, modules, current_module, false, true, false);
+                Source.scanRoot(Util.pathToFile(options.getGenSrcDir()),
+                                Util.set(".java"),
+                                Collections.emptyList(),
+                                Collections.emptyList(),
+                                generated_sources,
+                                modules,
+                                current_module,
+                                false,
+                                true,
+                                false);
                 javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
                 // Recheck the the source files and their timestamps again.
                 javac_state.checkSourceStatus(true);
@@ -254,7 +262,10 @@
                         printRound(round);
                     // Clean out artifacts in tainted packages.
                     javac_state.deleteClassArtifactsInTaintedPackages();
-                    again = javac_state.performJavaCompilations(compilationService, options, recently_compiled, rc);
+                    again = javac_state.performJavaCompilations(compilationService,
+                                                                options,
+                                                                recently_compiled,
+                                                                rc);
                     if (!rc[0]) {
                         Log.debug("Compilation failed.");
                         break;
@@ -344,7 +355,8 @@
                                        Map<String, Module> foundModules,
                                        Module currentModule,
                                        boolean permitSourcesInDefaultPackage,
-                                       boolean inLinksrc) {
+                                       boolean inLinksrc)
+                                               throws IOException {
 
         for (SourceLocation source : sourceLocations) {
             source.findSourceFiles(sourceTypes,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java	Thu Jan 21 14:49:02 2016 -0800
@@ -93,7 +93,7 @@
             CLASSPATH.processMatching(iter, helper);
         }
     },
-    X("-x", "Exclude directory from the subsequent source directory") {
+    X("-x", "Exclude files matching the given pattern") {
         @Override
         protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
             String pattern = getFilePatternArg(iter, helper);
@@ -101,7 +101,7 @@
                 helper.exclude(pattern);
         }
     },
-    I("-i", "Include only the given directory from the subsequent source directory") {
+    I("-i", "Include only files matching the given pattern") {
         @Override
         protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
             String pattern = getFilePatternArg(iter, helper);
@@ -109,22 +109,6 @@
                 helper.include(pattern);
         }
     },
-    XF("-xf", "Exclude a given file") {
-        @Override
-        protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
-            String pattern = getFilePatternArg(iter, helper);
-            if (pattern != null)
-                helper.excludeFile(pattern);
-        }
-    },
-    IF("-if", "Include only the given file") {
-        @Override
-        protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
-            String pattern = getFilePatternArg(iter, helper);
-            if (pattern != null)
-                helper.includeFile(pattern);
-        }
-    },
     TR("-tr", "Translate resources") {
         @Override
         protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
@@ -338,7 +322,7 @@
     String getFilePatternArg(ArgumentIterator iter, OptionHelper helper) {
 
         if (!iter.hasNext()) {
-            helper.reportError(arg + " must be followed by a file or directory pattern.");
+            helper.reportError(arg + " must be followed by a glob pattern.");
             return null;
         }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java	Thu Jan 21 14:49:02 2016 -0800
@@ -53,12 +53,6 @@
     /** Record a package inclusion pattern */
     public abstract void include(String incl);
 
-    /** Record a file exclusion */
-    public abstract void excludeFile(String exclFile);
-
-    /** Record a file inclusion */
-    public abstract void includeFile(String inclFile);
-
     /** Record a root of sources to be compiled */
     public abstract void sourceRoots(List<Path> path);
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java	Thu Jan 21 14:49:02 2016 -0800
@@ -220,8 +220,6 @@
                 for (SourceLocation sl : locs) {
                     for (String pkg : sl.includes) addArg(Option.I, pkg);
                     for (String pkg : sl.excludes) addArg(Option.X, pkg);
-                    for (String f : sl.excludedFiles) addArg(Option.XF, f);
-                    for (String f : sl.includedFiles) addArg(Option.IF, f);
                     addArg(opt, sl.getPath());
                 }
             }
@@ -380,18 +378,6 @@
         }
 
         @Override
-        public void excludeFile(String exclFilePattern) {
-            exclFilePattern = Util.normalizeDriveLetter(exclFilePattern);
-            excludeFiles.add(exclFilePattern);
-        }
-
-        @Override
-        public void includeFile(String inclFilePattern) {
-            inclFilePattern = Util.normalizeDriveLetter(inclFilePattern);
-            includeFiles.add(inclFilePattern);
-        }
-
-        @Override
         public void addTransformer(String suffix, Transformer tr) {
             if (trRules.containsKey(suffix)) {
                 reportError("More than one transformer specified for " +
@@ -519,9 +505,7 @@
                 result.add(new SourceLocation(
                         path,
                         includes,
-                        excludes,
-                        includeFiles,
-                        excludeFiles));
+                        excludes));
             }
             resetFilters();
             return result;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/SourceLocation.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/SourceLocation.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,11 +25,13 @@
 
 package com.sun.tools.sjavac.options;
 
+import java.io.IOException;
 import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.sun.tools.sjavac.Log;
 import com.sun.tools.sjavac.Module;
 import com.sun.tools.sjavac.ProblemException;
 import com.sun.tools.sjavac.Source;
@@ -49,18 +51,14 @@
     private Path path;
 
     // Package include / exclude patterns and file includes / excludes.
-    List<String> includes, excludes, includedFiles, excludedFiles;
+    List<String> includes, excludes;
 
     public SourceLocation(Path path,
                           List<String> includes,
-                          List<String> excludes,
-                          List<String> includedFiles,
-                          List<String> excludedFiles) {
+                          List<String> excludes) {
         this.path = path;
         this.includes = includes;
         this.excludes = excludes;
-        this.includedFiles = includedFiles;
-        this.excludedFiles = excludedFiles;
     }
 
 
@@ -81,17 +79,23 @@
                                 Map<String, Module> foundModules,
                                 Module currentModule,
                                 boolean permitSourcesInDefaultPackage,
-                                boolean inLinksrc) {
+                                boolean inLinksrc)
+                                        throws IOException {
         try {
-            Source.scanRoot(path.toFile(), suffixes, excludes, includes,
-                    excludedFiles, includedFiles, foundFiles, foundModules,
-                    currentModule, permitSourcesInDefaultPackage, false,
-                    inLinksrc);
+            Source.scanRoot(path.toFile(),
+                            suffixes,
+                            excludes,
+                            includes,
+                            foundFiles,
+                            foundModules,
+                            currentModule,
+                            permitSourcesInDefaultPackage,
+                            false,
+                            inLinksrc);
         } catch (ProblemException e) {
             e.printStackTrace();
         }
     }
-
     /** Get the root directory of this source location */
     public Path getPath() {
         return path;
@@ -107,14 +111,9 @@
         return excludes;
     }
 
-    /** Get the file include patterns */
-    public List<String> getIncludedFiles() {
-        return includedFiles;
+    @Override
+    public String toString() {
+        return String.format("%s[\"%s\", includes: %s, excludes: %s]",
+                             getClass().getSimpleName(), path, includes, excludes);
     }
-
-    /** Get the file exclude patterns */
-    public List<String> getExcludedFiles() {
-        return excludedFiles;
-    }
-
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -174,11 +174,20 @@
     /**
      * Delete the port file.
      */
-    public void delete() throws IOException {
+    public void delete() throws IOException, InterruptedException {
         // Access to file must be closed before deleting.
         rwfile.close();
-        // Now delete.
+
         file.delete();
+
+        // Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
+        // might shutdown the server and prevent another one from starting.
+        for (int i = 0; i < 10 && file.exists(); i++) {
+            Thread.sleep(1000);
+        }
+        if (file.exists()) {
+            throw new IOException("Failed to delete file.");
+        }
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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
@@ -279,7 +279,7 @@
         // failed connection attempts
         try {
             portFile.delete();
-        } catch (IOException e) {
+        } catch (IOException | InterruptedException e) {
             e.printStackTrace(theLog);
         }
         try {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, 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
@@ -248,7 +248,7 @@
         for (ProgramElementDoc element : list) {
             Object key = getMemberKey(element);
             Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
-            if (level.equals(memberLevelMap.get(element)))
+            if (memberLevelMap != null && level.equals(memberLevelMap.get(element)))
                 memberLevelMap.remove(element);
         }
     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/remote/RemoteAgent.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/remote/RemoteAgent.java	Thu Jan 21 14:49:02 2016 -0800
@@ -28,6 +28,9 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -35,7 +38,9 @@
 
 import java.util.ArrayList;
 import java.util.List;
+
 import static jdk.internal.jshell.remote.RemoteCodes.*;
+
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -59,7 +64,10 @@
     void commandLoop(Socket socket) throws IOException {
         // in before out -- so we don't hang the controlling process
         ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
-        ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
+        OutputStream socketOut = socket.getOutputStream();
+        System.setOut(new PrintStream(new MultiplexingOutputStream("out", socketOut), true));
+        System.setErr(new PrintStream(new MultiplexingOutputStream("err", socketOut), true));
+        ObjectOutputStream out = new ObjectOutputStream(new MultiplexingOutputStream("command", socketOut));
         while (true) {
             int cmd = in.readInt();
             switch (cmd) {
@@ -260,4 +268,64 @@
         }
         return sb.toString();
     }
+
+    private static final class MultiplexingOutputStream extends OutputStream {
+
+        private static final int PACKET_SIZE = 127;
+
+        private final byte[] name;
+        private final OutputStream delegate;
+
+        public MultiplexingOutputStream(String name, OutputStream delegate) {
+            try {
+                this.name = name.getBytes("UTF-8");
+                this.delegate = delegate;
+            } catch (UnsupportedEncodingException ex) {
+                throw new IllegalStateException(ex); //should not happen
+            }
+        }
+
+        @Override
+        public void write(int b) throws IOException {
+            synchronized (delegate) {
+                delegate.write(name.length); //assuming the len is small enough to fit into byte
+                delegate.write(name);
+                delegate.write(1);
+                delegate.write(b);
+                delegate.flush();
+            }
+        }
+
+        @Override
+        public void write(byte[] b, int off, int len) throws IOException {
+            synchronized (delegate) {
+                int i = 0;
+                while (len > 0) {
+                    int size = Math.min(PACKET_SIZE, len);
+
+                    delegate.write(name.length); //assuming the len is small enough to fit into byte
+                    delegate.write(name);
+                    delegate.write(size);
+                    delegate.write(b, off + i, size);
+                    i += size;
+                    len -= size;
+                }
+
+                delegate.flush();
+            }
+        }
+
+        @Override
+        public void flush() throws IOException {
+            super.flush();
+            delegate.flush();
+        }
+
+        @Override
+        public void close() throws IOException {
+            super.close();
+            delegate.close();
+        }
+
+    }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,8 +91,10 @@
 import java.util.Optional;
 import java.util.ResourceBundle;
 import java.util.Spliterators;
+import java.util.function.Function;
 import java.util.function.Supplier;
 import static java.util.stream.Collectors.toList;
+import static jdk.jshell.Snippet.SubKind.VAR_VALUE_SUBKIND;
 
 /**
  * Command line REPL tool for Java using the JShell API.
@@ -102,6 +105,7 @@
     private static final Pattern LINEBREAK = Pattern.compile("\\R");
     private static final Pattern HISTORY_ALL_START_FILENAME = Pattern.compile(
             "((?<cmd>(all|history|start))(\\z|\\p{javaWhitespace}+))?(?<filename>.*)");
+    private static final String RECORD_SEPARATOR = "\u241E";
 
     final InputStream cmdin;
     final PrintStream cmdout;
@@ -150,9 +154,14 @@
     private String cmdlineStartup = null;
     private String editor = null;
 
-    static final Preferences PREFS = Preferences.userRoot().node("tool/REPL");
+    // Commands and snippets which should be replayed
+    private List<String> replayableHistory;
+    private List<String> replayableHistoryPrevious;
+
+    static final Preferences PREFS = Preferences.userRoot().node("tool/JShell");
 
     static final String STARTUP_KEY = "STARTUP";
+    static final String REPLAY_RESTORE_KEY = "REPLAY_RESTORE";
 
     static final String DEFAULT_STARTUP =
             "\n" +
@@ -165,11 +174,14 @@
             "import java.util.regex.*;\n" +
             "void printf(String format, Object... args) { System.out.printf(format, args); }\n";
 
-    // Tool id (tid) mapping
+    // Tool id (tid) mapping: the three name spaces
     NameSpace mainNamespace;
     NameSpace startNamespace;
     NameSpace errorNamespace;
+
+    // Tool id (tid) mapping: the current name spaces
     NameSpace currentNameSpace;
+
     Map<Snippet,SnippetInfo> mapSnippet;
 
     void debug(String format, Object... args) {
@@ -252,6 +264,12 @@
     private void start(IOContext in, List<String> loadList) {
         resetState(); // Initialize
 
+        // Read replay history from last jshell session into previous history
+        String prevReplay = PREFS.get(REPLAY_RESTORE_KEY, null);
+        if (prevReplay != null) {
+            replayableHistoryPrevious = Arrays.asList(prevReplay.split(RECORD_SEPARATOR));
+        }
+
         for (String loadFile : loadList) {
             cmdOpen(loadFile);
         }
@@ -370,6 +388,10 @@
         mapSnippet = new LinkedHashMap<>();
         currentNameSpace = startNamespace;
 
+        // Reset the replayable history, saving the old for restore
+        replayableHistoryPrevious = replayableHistory;
+        replayableHistory = new ArrayList<>();
+
         state = JShell.builder()
                 .in(userin)
                 .out(userout)
@@ -382,7 +404,8 @@
         analysis = state.sourceCodeAnalysis();
         shutdownSubscription = state.onShutdown((JShell deadState) -> {
             if (deadState == state) {
-                hard("State engine terminated.  See /history");
+                hard("State engine terminated.");
+                hard("Restore definitions with: /reload restore");
                 live = false;
             }
         });
@@ -392,7 +415,6 @@
             state.addToClasspath(cmdlineClasspath);
         }
 
-
         String start;
         if (cmdlineStartup == null) {
             start = PREFS.get(STARTUP_KEY, "<nada>");
@@ -431,7 +453,7 @@
             String incomplete = "";
             while (live) {
                 String prompt;
-                if (in.interactiveOutput() && displayPrompt) {
+                if (displayPrompt) {
                     prompt = testPrompt
                                     ? incomplete.isEmpty()
                                             ? "\u0005" //ENQ
@@ -480,6 +502,12 @@
         }
     }
 
+    private void addToReplayHistory(String s) {
+        if (currentNameSpace == mainNamespace) {
+            replayableHistory.add(s);
+        }
+    }
+
     private String processSourceCatchingReset(String src) {
         try {
             input.beforeUserCode();
@@ -516,7 +544,12 @@
                 fluff("Type /help for help.");
             }
         } else if (candidates.length == 1) {
-            candidates[0].run.accept(arg);
+            Command command = candidates[0];
+
+            // If comand was successful and is of a replayable kind, add it the replayable history
+            if (command.run.apply(arg) && command.kind == CommandKind.REPLAY) {
+                addToReplayHistory((command.command + " " + arg).trim());
+            }
         } else {
             hard("Command: %s is ambiguous: %s", cmd, Arrays.stream(candidates).map(c -> c.command).collect(Collectors.joining(", ")));
             fluff("Type /help for help.");
@@ -546,15 +579,15 @@
         public final String command;
         public final String params;
         public final String description;
-        public final Consumer<String> run;
+        public final Function<String,Boolean> run;
         public final CompletionProvider completions;
         public final CommandKind kind;
 
-        public Command(String command, String params, String description, Consumer<String> run, CompletionProvider completions) {
+        public Command(String command, String params, String description, Function<String,Boolean> run, CompletionProvider completions) {
             this(command, params, description, run, completions, CommandKind.NORMAL);
         }
 
-        public Command(String command, String params, String description, Consumer<String> run, CompletionProvider completions, CommandKind kind) {
+        public Command(String command, String params, String description, Function<String,Boolean> run, CompletionProvider completions, CommandKind kind) {
             this.command = command;
             this.params = params;
             this.description = description;
@@ -571,6 +604,7 @@
 
     enum CommandKind {
         NORMAL,
+        REPLAY,
         HIDDEN,
         HELP_ONLY;
     }
@@ -602,6 +636,7 @@
 
     private static final CompletionProvider EMPTY_COMPLETION_PROVIDER = new FixedCompletionProvider();
     private static final CompletionProvider KEYWORD_COMPLETION_PROVIDER = new FixedCompletionProvider("all ", "start ", "history ");
+    private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("restore", "quiet");
     private static final CompletionProvider FILE_COMPLETION_PROVIDER = fileCompletions(p -> true);
     private final Map<String, Command> commands = new LinkedHashMap<>();
     private void registerCommand(Command cmd) {
@@ -674,6 +709,16 @@
         };
     }
 
+    private static CompletionProvider reloadCompletion() {
+        return (code, cursor, anchor) -> {
+            List<Suggestion> result = new ArrayList<>();
+            int pastSpace = code.indexOf(' ') + 1; // zero if no space
+            result.addAll(RELOAD_OPTIONS_COMPLETION_PROVIDER.completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor));
+            anchor[0] += pastSpace;
+            return result;
+        };
+    }
+
     // Table of commands -- with command forms, argument kinds, help message, implementation, ...
 
     {
@@ -688,7 +733,8 @@
                                     editCompletion()));
         registerCommand(new Command("/drop", "<name or id>", "delete a source entry referenced by name or id",
                                     arg -> cmdDrop(arg),
-                                    editCompletion()));
+                                    editCompletion(),
+                                    CommandKind.REPLAY));
         registerCommand(new Command("/save", "[all|history|start] <file>", "save: <none> - current source;\n" +
                                                                            "      all - source including overwritten, failed, and start-up code;\n" +
                                                                            "      history - editing history;\n" +
@@ -716,6 +762,9 @@
         registerCommand(new Command("/reset", null, "reset everything in the REPL",
                                     arg -> cmdReset(),
                                     EMPTY_COMPLETION_PROVIDER));
+        registerCommand(new Command("/reload", "[restore] [quiet]", "reset and replay relevant history -- current or previous (restore)",
+                                    arg -> cmdReload(arg),
+                                    reloadCompletion()));
         registerCommand(new Command("/feedback", "<level>", "feedback information: off, concise, normal, verbose, default, or ?",
                                     arg -> cmdFeedback(arg),
                                     new FixedCompletionProvider("off", "concise", "normal", "verbose", "default", "?")));
@@ -724,7 +773,8 @@
                                     EMPTY_COMPLETION_PROVIDER));
         registerCommand(new Command("/classpath", "<path>", "add a path to the classpath",
                                     arg -> cmdClasspath(arg),
-                                    classPathCompletion()));
+                                    classPathCompletion(),
+                                    CommandKind.REPLAY));
         registerCommand(new Command("/history", null, "history of what you have typed",
                                     arg -> cmdHistory(),
                                     EMPTY_COMPLETION_PROVIDER));
@@ -801,25 +851,29 @@
 
     // --- Command implementations ---
 
-    void cmdSetEditor(String arg) {
+    boolean cmdSetEditor(String arg) {
         if (arg.isEmpty()) {
             hard("/seteditor requires a path argument");
+            return false;
         } else {
             editor = arg;
             fluff("Editor set to: %s", arg);
+            return true;
         }
     }
 
-    void cmdClasspath(String arg) {
+    boolean cmdClasspath(String arg) {
         if (arg.isEmpty()) {
             hard("/classpath requires a path argument");
+            return false;
         } else {
             state.addToClasspath(toPathResolvingUserHome(arg).toString());
             fluff("Path %s added to classpath", arg);
+            return true;
         }
     }
 
-    void cmdDebug(String arg) {
+    boolean cmdDebug(String arg) {
         if (arg.isEmpty()) {
             debug = !debug;
             InternalDebugControl.setDebugFlags(state, debug ? InternalDebugControl.DBG_GEN : 0);
@@ -860,20 +914,26 @@
                     default:
                         hard("Unknown debugging option: %c", ch);
                         fluff("Use: 0 r g f c d");
-                        break;
+                        return false;
                 }
             }
             InternalDebugControl.setDebugFlags(state, flags);
         }
+        return true;
     }
 
-    private void cmdExit() {
+    private boolean cmdExit() {
         regenerateOnDeath = false;
         live = false;
+        if (!replayableHistory.isEmpty()) {
+            PREFS.put(REPLAY_RESTORE_KEY, replayableHistory.stream().reduce(
+                    (a, b) -> a + RECORD_SEPARATOR + b).get());
+        }
         fluff("Goodbye\n");
+        return true;
     }
 
-    private void cmdFeedback(String arg) {
+    private boolean cmdFeedback(String arg) {
         switch (arg) {
             case "":
             case "d":
@@ -905,12 +965,13 @@
                 hard("  default");
                 hard("You may also use just the first letter, for example: /f c");
                 hard("In interactive mode 'default' is the same as 'normal', from a file it is the same as 'off'");
-                return;
+                return false;
         }
         fluff("Feedback mode: %s", feedback.name().toLowerCase());
+        return true;
     }
 
-    void cmdHelp() {
+    boolean cmdHelp() {
         int synopsisLen = 0;
         Map<String, String> synopsis2Description = new LinkedHashMap<>();
         for (Command cmd : new LinkedHashSet<>(commands.values())) {
@@ -936,14 +997,16 @@
         cmdout.println("Supported shortcuts include:");
         cmdout.println("<tab>       -- show possible completions for the current text");
         cmdout.println("Shift-<tab> -- for current method or constructor invocation, show a synopsis of the method/constructor");
+        return true;
     }
 
-    private void cmdHistory() {
+    private boolean cmdHistory() {
         cmdout.println();
         for (String s : input.currentSessionHistory()) {
             // No number prefix, confusing with snippet ids
             cmdout.printf("%s\n", s);
         }
+        return true;
     }
 
     /**
@@ -1010,23 +1073,23 @@
         }
     }
 
-    private void cmdDrop(String arg) {
+    private boolean cmdDrop(String arg) {
         if (arg.isEmpty()) {
             hard("In the /drop argument, please specify an import, variable, method, or class to drop.");
             hard("Specify by id or name. Use /list to see ids. Use /reset to reset all state.");
-            return;
+            return false;
         }
         Stream<Snippet> stream = argToSnippets(arg, false);
         if (stream == null) {
             hard("No definition or id named %s found.  See /classes, /methods, /vars, or /list", arg);
-            return;
+            return false;
         }
         List<Snippet> snippets = stream
                 .filter(sn -> state.status(sn).isActive && sn instanceof PersistentSnippet)
                 .collect(toList());
         if (snippets.isEmpty()) {
             hard("The argument did not specify an active import, variable, method, or class to drop.");
-            return;
+            return false;
         }
         if (snippets.size() > 1) {
             hard("The argument references more than one import, variable, method, or class.");
@@ -1034,17 +1097,18 @@
             for (Snippet sn : snippets) {
                 cmdout.printf("%4s : %s\n", sn.id(), sn.source().replace("\n", "\n       "));
             }
-            return;
+            return false;
         }
         PersistentSnippet psn = (PersistentSnippet) snippets.get(0);
         state.drop(psn).forEach(this::handleEvent);
+        return true;
     }
 
-    private void cmdEdit(String arg) {
+    private boolean cmdEdit(String arg) {
         Stream<Snippet> stream = argToSnippets(arg, true);
         if (stream == null) {
             hard("No definition or id named %s found.  See /classes, /methods, /vars, or /list", arg);
-            return;
+            return false;
         }
         Set<String> srcSet = new LinkedHashSet<>();
         stream.forEachOrdered(sn -> {
@@ -1078,6 +1142,7 @@
         } else {
             ExternalEditor.edit(editor, errorHandler, src, saveHandler, input);
         }
+        return true;
     }
     //where
     // receives editor requests to save
@@ -1135,10 +1200,9 @@
         }
     }
 
-    private void cmdList(String arg) {
+    private boolean cmdList(String arg) {
         if (arg.equals("history")) {
-            cmdHistory();
-            return;
+            return cmdHistory();
         }
         Stream<Snippet> stream = argToSnippets(arg, true);
         if (stream == null) {
@@ -1148,7 +1212,7 @@
             } else {
                 hard("No definition or id named %s found.  There are no active definitions.", arg);
             }
-            return;
+            return false;
         }
 
         // prevent double newline on empty list
@@ -1160,38 +1224,72 @@
             }
             cmdout.printf("%4s : %s\n", sn.id(), sn.source().replace("\n", "\n       "));
         });
+        return true;
     }
 
-    private void cmdOpen(String filename) {
+    private boolean cmdOpen(String filename) {
         if (filename.isEmpty()) {
             hard("The /open command requires a filename argument.");
+            return false;
         } else {
             try {
                 run(new FileScannerIOContext(toPathResolvingUserHome(filename).toString()));
             } catch (FileNotFoundException e) {
                 hard("File '%s' is not found: %s", filename, e.getMessage());
+                return false;
             } catch (Exception e) {
                 hard("Exception while reading file: %s", e);
+                return false;
             }
         }
+        return true;
     }
 
-    private void cmdPrompt() {
+    private boolean cmdPrompt() {
         displayPrompt = !displayPrompt;
         fluff("Prompt will %sdisplay. Use /prompt to toggle.", displayPrompt ? "" : "NOT ");
         concise("Prompt: %s", displayPrompt ? "on" : "off");
+        return true;
+    }
+
+    private boolean cmdReset() {
+        live = false;
+        fluff("Resetting state.");
+        return true;
     }
 
-    private void cmdReset() {
-        live = false;
-        fluff("Resetting state.");
+    private boolean cmdReload(String arg) {
+        Iterable<String> history = replayableHistory;
+        boolean echo = true;
+        if (arg.length() > 0) {
+            if ("restore".startsWith(arg)) {
+                if (replayableHistoryPrevious == null) {
+                    hard("No previous history to restore\n", arg);
+                    return false;
+                }
+                history = replayableHistoryPrevious;
+            } else if ("quiet".startsWith(arg)) {
+                echo = false;
+            } else {
+                hard("Invalid argument to reload command: %s\nUse 'restore', 'quiet', or no argument\n", arg);
+                return false;
+            }
+        }
+        fluff("Restarting and restoring %s.",
+                history == replayableHistoryPrevious
+                        ? "from previous state"
+                        : "state");
+        resetState();
+        run(new ReloadIOContext(history,
+                echo? cmdout : null));
+        return true;
     }
 
-    private void cmdSave(String arg_filename) {
+    private boolean cmdSave(String arg_filename) {
         Matcher mat = HISTORY_ALL_START_FILENAME.matcher(arg_filename);
         if (!mat.find()) {
             hard("Malformed argument to the /save command: %s", arg_filename);
-            return;
+            return false;
         }
         boolean useHistory = false;
         String saveAll = "";
@@ -1211,7 +1309,7 @@
         String filename = mat.group("filename");
         if (filename == null ||filename.isEmpty()) {
             hard("The /save command requires a filename argument.");
-            return;
+            return false;
         }
         try (BufferedWriter writer = Files.newBufferedWriter(toPathResolvingUserHome(filename),
                 Charset.defaultCharset(),
@@ -1234,12 +1332,15 @@
             }
         } catch (FileNotFoundException e) {
             hard("File '%s' for save is not accessible: %s", filename, e.getMessage());
+            return false;
         } catch (Exception e) {
             hard("Exception while saving: %s", e);
+            return false;
         }
+        return true;
     }
 
-    private void cmdSetStart(String filename) {
+    private boolean cmdSetStart(String filename) {
         if (filename.isEmpty()) {
             hard("The /setstart command requires a filename argument.");
         } else {
@@ -1249,30 +1350,36 @@
                 PREFS.put(STARTUP_KEY, init);
             } catch (AccessDeniedException e) {
                 hard("File '%s' for /setstart is not accessible.", filename);
+                return false;
             } catch (NoSuchFileException e) {
                 hard("File '%s' for /setstart is not found.", filename);
+                return false;
             } catch (Exception e) {
                 hard("Exception while reading start set file: %s", e);
+                return false;
             }
         }
+        return true;
     }
 
-    private void cmdVars() {
+    private boolean cmdVars() {
         for (VarSnippet vk : state.variables()) {
             String val = state.status(vk) == Status.VALID
                     ? state.varValue(vk)
                     : "(not-active)";
             hard("  %s %s = %s", vk.typeName(), vk.name(), val);
         }
+        return true;
     }
 
-    private void cmdMethods() {
+    private boolean cmdMethods() {
         for (MethodSnippet mk : state.methods()) {
             hard("  %s %s", mk.name(), mk.signature());
         }
+        return true;
     }
 
-    private void cmdClasses() {
+    private boolean cmdClasses() {
         for (TypeDeclSnippet ck : state.types()) {
             String kind;
             switch (ck.subKind()) {
@@ -1295,15 +1402,17 @@
             }
             hard("  %s %s", kind, ck.name());
         }
+        return true;
     }
 
-    private void cmdImports() {
+    private boolean cmdImports() {
         state.imports().forEach(ik -> {
             hard("  import %s%s", ik.isStatic() ? "static " : "", ik.fullname());
         });
+        return true;
     }
 
-    private void cmdUseHistoryEntry(int index) {
+    private boolean cmdUseHistoryEntry(int index) {
         List<Snippet> keys = state.snippets();
         if (index < 0)
             index += keys.size();
@@ -1313,7 +1422,9 @@
             rerunSnippet(keys.get(index));
         } else {
             hard("Cannot find snippet %d", index + 1);
+            return false;
         }
+        return true;
     }
 
     private boolean rerunHistoryEntryById(String id) {
@@ -1357,7 +1468,7 @@
                 }
             }
 
-            for (String line : diag.getMessage(null).split("\\r?\\n")) {
+            for (String line : diag.getMessage(null).split("\\r?\\n")) { // TODO: Internationalize
                 if (!line.trim().startsWith("location:")) {
                     hard("%s%s", padding, line);
                 }
@@ -1425,10 +1536,24 @@
     private boolean processCompleteSource(String source) throws IllegalStateException {
         debug("Compiling: %s", source);
         boolean failed = false;
+        boolean isActive = false;
         List<SnippetEvent> events = state.eval(source);
         for (SnippetEvent e : events) {
+            // Report the event, recording failure
             failed |= handleEvent(e);
+
+            // If any main snippet is active, this should be replayable
+            // also ignore var value queries
+            isActive |= e.causeSnippet() == null &&
+                    e.status().isActive &&
+                    e.snippet().subKind() != VAR_VALUE_SUBKIND;
         }
+        // If this is an active snippet and it didn't cause the backend to die,
+        // add it to the replayable history
+        if (isActive && live) {
+            addToReplayHistory(source);
+        }
+
         return failed;
     }
 
@@ -1784,31 +1909,11 @@
     }
 }
 
-class ScannerIOContext extends IOContext {
-
-    private final Scanner scannerIn;
-    private final PrintStream pStream;
-
-    public ScannerIOContext(Scanner scannerIn, PrintStream pStream) {
-        this.scannerIn = scannerIn;
-        this.pStream = pStream;
-    }
-
-    @Override
-    public String readLine(String prompt, String prefix) {
-        if (pStream != null && prompt != null) {
-            pStream.print(prompt);
-        }
-        if (scannerIn.hasNextLine()) {
-            return scannerIn.nextLine();
-        } else {
-            return null;
-        }
-    }
+abstract class NonInteractiveIOContext extends IOContext {
 
     @Override
     public boolean interactiveOutput() {
-        return true;
+        return false;
     }
 
     @Override
@@ -1817,11 +1922,6 @@
     }
 
     @Override
-    public void close() {
-        scannerIn.close();
-    }
-
-    @Override
     public boolean terminalEditorRunning() {
         return false;
     }
@@ -1847,19 +1947,62 @@
     }
 }
 
+class ScannerIOContext extends NonInteractiveIOContext {
+    private final Scanner scannerIn;
+
+    ScannerIOContext(Scanner scannerIn) {
+        this.scannerIn = scannerIn;
+    }
+
+    @Override
+    public String readLine(String prompt, String prefix) {
+        if (scannerIn.hasNextLine()) {
+            return scannerIn.nextLine();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public void close() {
+        scannerIn.close();
+    }
+}
+
 class FileScannerIOContext extends ScannerIOContext {
 
-    public FileScannerIOContext(String fn) throws FileNotFoundException {
+    FileScannerIOContext(String fn) throws FileNotFoundException {
         this(new FileReader(fn));
     }
 
-    public FileScannerIOContext(Reader rdr) throws FileNotFoundException {
-        super(new Scanner(rdr), null);
+    FileScannerIOContext(Reader rdr) throws FileNotFoundException {
+        super(new Scanner(rdr));
+    }
+}
+
+class ReloadIOContext extends NonInteractiveIOContext {
+    private final Iterator<String> it;
+    private final PrintStream echoStream;
+
+    ReloadIOContext(Iterable<String> history, PrintStream echoStream) {
+        this.it = history.iterator();
+        this.echoStream = echoStream;
     }
 
     @Override
-    public boolean interactiveOutput() {
-        return false;
+    public String readLine(String prompt, String prefix) {
+        String s = it.hasNext()
+                ? it.next()
+                : null;
+        if (echoStream != null && s != null) {
+            String p = "-: ";
+            String p2 = "\n   ";
+            echoStream.printf("%s%s\n", p, s.replace("\n", p2));
+        }
+        return s;
+    }
+
+    @Override
+    public void close() {
     }
 }
-
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExecutionControl.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExecutionControl.java	Thu Jan 21 14:49:02 2016 -0800
@@ -26,9 +26,12 @@
 package jdk.jshell;
 
 import static jdk.internal.jshell.remote.RemoteCodes.*;
+import java.io.DataInputStream;
+import java.io.InputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.PrintStream;
 import java.net.ServerSocket;
 import java.net.Socket;
 import com.sun.jdi.*;
@@ -69,7 +72,9 @@
             socket = listener.accept();
             // out before in -- match remote creation so we don't hang
             out = new ObjectOutputStream(socket.getOutputStream());
-            in = new ObjectInputStream(socket.getInputStream());
+            PipeInputStream commandIn = new PipeInputStream();
+            new DemultiplexInput(socket.getInputStream(), commandIn, proc.out, proc.err).start();
+            in = new ObjectInputStream(commandIn);
         }
     }
 
@@ -117,11 +122,13 @@
                 String result = in.readUTF();
                 return result;
             }
-        } catch (EOFException ex) {
-            env.shutdown();
         } catch (IOException | ClassNotFoundException ex) {
-            proc.debug(DBG_GEN, "Exception on remote invoke: %s\n", ex);
-            return "Execution failure: " + ex.getMessage();
+            if (!env.connection().isRunning()) {
+                env.shutdown();
+            } else {
+                proc.debug(DBG_GEN, "Exception on remote invoke: %s\n", ex);
+                return "Execution failure: " + ex.getMessage();
+            }
         } finally {
             synchronized (STOP_LOCK) {
                 userCodeRunning = false;
@@ -310,4 +317,112 @@
             }
         }
     }
+
+    private final class DemultiplexInput extends Thread {
+
+        private final DataInputStream delegate;
+        private final PipeInputStream command;
+        private final PrintStream out;
+        private final PrintStream err;
+
+        public DemultiplexInput(InputStream input,
+                                         PipeInputStream command,
+                                         PrintStream out,
+                                         PrintStream err) {
+            super("output reader");
+            this.delegate = new DataInputStream(input);
+            this.command = command;
+            this.out = out;
+            this.err = err;
+        }
+
+        public void run() {
+            try {
+                while (true) {
+                    int nameLen = delegate.read();
+                    if (nameLen == (-1))
+                        break;
+                    byte[] name = new byte[nameLen];
+                    DemultiplexInput.this.delegate.readFully(name);
+                    int dataLen = delegate.read();
+                    byte[] data = new byte[dataLen];
+                    DemultiplexInput.this.delegate.readFully(data);
+                    switch (new String(name, "UTF-8")) {
+                        case "err":
+                            err.write(data);
+                            break;
+                        case "out":
+                            out.write(data);
+                            break;
+                        case "command":
+                            for (byte b : data) {
+                                command.write(Byte.toUnsignedInt(b));
+                            }
+                            break;
+                    }
+                }
+            } catch (IOException ex) {
+                proc.debug(ex, "Failed reading output");
+            } finally {
+                command.close();
+            }
+        }
+
+    }
+
+    public static final class PipeInputStream extends InputStream {
+        public static final int INITIAL_SIZE = 128;
+
+        private int[] buffer = new int[INITIAL_SIZE];
+        private int start;
+        private int end;
+        private boolean closed;
+
+        @Override
+        public synchronized int read() {
+            while (start == end) {
+                if (closed) {
+                    return -1;
+                }
+                try {
+                    wait();
+                } catch (InterruptedException ex) {
+                    //ignore
+                }
+            }
+            try {
+                return buffer[start];
+            } finally {
+                start = (start + 1) % buffer.length;
+            }
+        }
+
+        public synchronized void write(int b) {
+            if (closed)
+                throw new IllegalStateException("Already closed.");
+            int newEnd = (end + 1) % buffer.length;
+            if (newEnd == start) {
+                //overflow:
+                int[] newBuffer = new int[buffer.length * 2];
+                int rightPart = (end > start ? end : buffer.length) - start;
+                int leftPart = end > start ? 0 : start - 1;
+                System.arraycopy(buffer, start, newBuffer, 0, rightPart);
+                System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart);
+                buffer = newBuffer;
+                start = 0;
+                end = rightPart + leftPart;
+                newEnd = end + 1;
+            }
+            buffer[end] = b;
+            end = newEnd;
+            notifyAll();
+        }
+
+        @Override
+        public synchronized void close() {
+            closed = true;
+            notifyAll();
+        }
+
+    }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JDIConnection.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JDIConnection.java	Thu Jan 21 14:49:02 2016 -0800
@@ -133,7 +133,7 @@
         return vm;
     }
 
-    boolean setConnectorArg(String name, String value) {
+    synchronized boolean setConnectorArg(String name, String value) {
         /*
          * Too late if the connection already made
          */
@@ -165,7 +165,7 @@
         }
     }
 
-    boolean isOpen() {
+    synchronized boolean isOpen() {
         return (vm != null);
     }
 
@@ -173,13 +173,17 @@
         return (connector instanceof LaunchingConnector);
     }
 
-    public void disposeVM() {
+    synchronized boolean isRunning() {
+        return process != null && process.isAlive();
+    }
+
+    public synchronized void disposeVM() {
         try {
             if (vm != null) {
                 vm.dispose(); // This could NPE, so it is caught below
                 vm = null;
             }
-        } catch (VMDisconnectedException | NullPointerException ex) {
+        } catch (VMDisconnectedException ex) {
             // Ignore if already closed
         } finally {
             if (process != null) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterWrap.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterWrap.java	Thu Jan 21 14:49:02 2016 -0800
@@ -182,9 +182,9 @@
             return null;
         }
 
-    @Override
-    public String toString() {
-        return "WrappedDiagnostic(" + getMessage(null) + ":" + getPosition() + ")";
-    }
+        @Override
+        public String toString() {
+            return "WrappedDiagnostic(" + getMessage(null) + ":" + getPosition() + ")";
+        }
     }
 }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Thu Jan 21 14:49:02 2016 -0800
@@ -33,7 +33,6 @@
 import com.sun.tools.javac.util.Context;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticCollector;
@@ -395,7 +394,7 @@
                 LinkedHashMap<String, Diag> diagMap = new LinkedHashMap<>();
                 for (Diagnostic<? extends JavaFileObject> in : diagnostics.getDiagnostics()) {
                     Diag d = diag(in);
-                    String uniqueKey = d.getCode() + ":" + d.getPosition() + ":" + d.getMessage(null);
+                    String uniqueKey = d.getCode() + ":" + d.getPosition() + ":" + d.getMessage(PARSED_LOCALE);
                     diagMap.put(uniqueKey, d);
                 }
                 diags = new DiagList(diagMap.values());
@@ -410,7 +409,7 @@
         String shortErrorMessage() {
             StringBuilder sb = new StringBuilder();
             for (Diag diag : getDiagnostics()) {
-                for (String line : diag.getMessage(null).split("\\r?\\n")) {
+                for (String line : diag.getMessage(PARSED_LOCALE).split("\\r?\\n")) {
                     if (!line.trim().startsWith("location:")) {
                         sb.append(line);
                     }
@@ -422,7 +421,7 @@
         void debugPrintDiagnostics(String src) {
             for (Diag diag : getDiagnostics()) {
                 state.debug(DBG_GEN, "ERROR --\n");
-                for (String line : diag.getMessage(null).split("\\r?\\n")) {
+                for (String line : diag.getMessage(PARSED_LOCALE).split("\\r?\\n")) {
                     if (!line.trim().startsWith("location:")) {
                         state.debug(DBG_GEN, "%s\n", line);
                     }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java	Thu Jan 21 14:49:02 2016 -0800
@@ -50,6 +50,7 @@
 import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
 import static jdk.jshell.Snippet.Status.REJECTED;
 import static jdk.jshell.Snippet.Status.VALID;
+import static jdk.jshell.Util.PARSED_LOCALE;
 import static jdk.jshell.Util.expunge;
 
 /**
@@ -456,7 +457,7 @@
             for (Diag diag : diags) {
                 if (diag.isError()) {
                     if (diag.isResolutionError()) {
-                        String m = diag.getMessage(null);
+                        String m = diag.getMessage(PARSED_LOCALE);
                         int symPos = m.indexOf(RESOLVE_ERROR_SYMBOL);
                         if (symPos >= 0) {
                             m = m.substring(symPos + RESOLVE_ERROR_SYMBOL.length());
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,6 +25,7 @@
 
 package jdk.jshell;
 
+import java.util.Locale;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import javax.lang.model.element.Name;
@@ -40,6 +41,8 @@
     static final String REPL_CLASS_PREFIX = "$REPL";
     static final String REPL_DOESNOTMATTER_CLASS_NAME = REPL_CLASS_PREFIX+"00DOESNOTMATTER";
 
+    static final Locale PARSED_LOCALE = Locale.ROOT;
+
     static boolean isDoIt(Name name) {
         return isDoIt(name.toString());
     }
--- a/langtools/test/jdk/jshell/ReplToolTesting.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/jdk/jshell/ReplToolTesting.java	Thu Jan 21 14:49:02 2016 -0800
@@ -152,13 +152,13 @@
     }
 
     public String getCommandOutput() {
-        String s = cmdout.toString();
+        String s = normalizeLineEndings(cmdout.toString());
         cmdout.reset();
         return s;
     }
 
     public String getCommandErrorOutput() {
-        String s = cmderr.toString();
+        String s = normalizeLineEndings(cmderr.toString());
         cmderr.reset();
         return s;
     }
@@ -168,13 +168,13 @@
     }
 
     public String getUserOutput() {
-        String s = userout.toString();
+        String s = normalizeLineEndings(userout.toString());
         userout.reset();
         return s;
     }
 
     public String getUserErrorOutput() {
-        String s = usererr.toString();
+        String s = normalizeLineEndings(usererr.toString());
         usererr.reset();
         return s;
     }
@@ -461,6 +461,10 @@
         }
     }
 
+    private String normalizeLineEndings(String text) {
+        return text.replace(System.getProperty("line.separator"), "\n");
+    }
+
     public static abstract class MemberInfo {
         public final String source;
         public final String type;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/T8146368/JShellTest8146368.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8146368
+ * @summary Test Smashing Error when user language is Japanese
+ * @library /tools/lib /jdk/jshell
+ * @build KullaTesting
+ * @run testng/othervm -Duser.language=ja JShellTest8146368
+ */
+
+import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
+import org.testng.annotations.Test;
+
+@Test
+public class JShellTest8146368 extends KullaTesting {
+    public void test() {
+        assertEval("class A extends B {}", added(RECOVERABLE_NOT_DEFINED));
+        assertEval("und m() { return new und(); }", added(RECOVERABLE_NOT_DEFINED));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/T8146368/JShellToolTest8146368.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,43 @@
+/*
+ * 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 8146368
+ * @summary Test Smashing Error when user language is Japanese
+ * @library /tools/lib /jdk/jshell
+ * @build ReplToolTesting
+ * @run testng/othervm -Duser.language=ja JShellToolTest8146368
+ */
+
+import org.testng.annotations.Test;
+
+@Test
+public class JShellToolTest8146368 extends ReplToolTesting {
+    public void test() {
+        test(
+                a -> assertCommand(a, "class A extends B {}", "|  Added class A, however, it cannot be referenced until class B is declared\n"),
+                a -> assertCommand(a, "und m() { return new und(); }", "|  Added method m(), however, it cannot be referenced until class und is declared\n")
+        );
+    }
+}
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -23,14 +23,16 @@
 
 /*
  * @test
- * @bug 8143037 8142447 8144095 8140265
+ * @bug 8143037 8142447 8144095 8140265 8144906
+ * @requires os.family != "solaris"
  * @summary Tests for Basic tests for REPL tool
  * @library /tools/lib
  * @ignore 8139873
  * @build KullaTesting TestingInputStream ToolBox Compiler
- * @run testng ToolBasicTest
+ * @run testng/timeout=600 ToolBasicTest
  */
 
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -460,8 +462,7 @@
         Path unknown = compiler.getPath("UNKNOWN.jar");
         test(true, new String[]{unknown.toString()},
                 "|  File '" + unknown
-                + "' is not found: " + unknown
-                + " (No such file or directory)\n");
+                + "' is not found: " + unresolvableMessage(unknown) + "\n");
     }
 
     public void testReset() {
@@ -514,8 +515,7 @@
             test(
                     (a) -> assertCommand(a, s + " " + unknown,
                             "|  File '" + unknown
-                                    + "' is not found: " + unknown
-                                    + " (No such file or directory)\n")
+                                    + "' is not found: " + unresolvableMessage(unknown) + "\n")
             );
         }
     }
@@ -874,6 +874,15 @@
         );
     }
 
+    private String unresolvableMessage(Path p) {
+        try {
+            new FileInputStream(p.toFile());
+            throw new AssertionError("Expected exception did not occur.");
+        } catch (IOException ex) {
+            return ex.getMessage();
+        }
+    }
+
     public void testCommandPrefix() {
         test(a -> assertCommandCheckOutput(a, "/s",
                       assertStartsWith("|  Command: /s is ambiguous: /seteditor, /save, /setstart")),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,197 @@
+/*
+ * 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 8081845
+ * @summary Tests for /reload in JShell tool
+ * @library /tools/lib
+ * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @run testng ToolReloadTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.function.Function;
+
+import org.testng.annotations.Test;
+
+
+@Test
+public class ToolReloadTest extends ReplToolTesting {
+
+    public void testReloadSnippets() {
+        test(
+                (a) -> assertVariable(a, "int", "x", "5", "5"),
+                (a) -> assertMethod(a, "int m(int z) { return z * z; }",
+                        "(int)int", "m"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommand(a, "/reload",
+                        "|  Restarting and restoring state.\n" +
+                        "-: int x = 5;\n" +
+                        "-: int m(int z) { return z * z; }\n" +
+                        "-: m(x)\n"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
+        );
+    }
+
+    public void testReloadClasspath() {
+        Function<String,String> prog = (s) -> String.format(
+                "package pkg; public class A { public String toString() { return \"%s\"; } }\n", s);
+        Compiler compiler = new Compiler();
+        Path outDir = Paths.get("testClasspathDirectory");
+        compiler.compile(outDir, prog.apply("A"));
+        Path classpath = compiler.getPath(outDir);
+        test(
+                (a) -> assertCommand(a, "/classpath " + classpath,
+                        String.format("|  Path %s added to classpath\n", classpath)),
+                (a) -> assertMethod(a, "String foo() { return (new pkg.A()).toString(); }",
+                        "()String", "foo"),
+                (a) -> assertVariable(a, "String", "v", "foo()", "\"A\""),
+                (a) -> {
+                       if (!a) compiler.compile(outDir, prog.apply("Aprime"));
+                       assertCommand(a, "/reload",
+                        "|  Restarting and restoring state.\n" +
+                        "-: /classpath " + classpath + "\n" +
+                        "-: String foo() { return (new pkg.A()).toString(); }\n" +
+                        "-: String v = foo();\n");
+                       },
+                (a) -> assertCommand(a, "v", "|  Variable v of type String has value \"Aprime\"\n"),
+                (a) -> evaluateExpression(a, "String", "foo()", "\"Aprime\""),
+                (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "\"Aprime\"")
+        );
+    }
+
+    public void testReloadDrop() {
+        test(false, new String[]{"-nostartup"},
+                a -> assertVariable(a, "int", "a"),
+                a -> dropVariable(a, "/dr 1", "int a = 0"),
+                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
+                a -> dropMethod(a, "/drop b", "b ()I"),
+                a -> assertClass(a, "class A {}", "class", "A"),
+                a -> dropClass(a, "/dr A", "class A"),
+                a -> assertCommand(a, "/reload",
+                        "|  Restarting and restoring state.\n" +
+                        "-: int a;\n" +
+                        "-: /drop 1\n" +
+                        "-: int b() { return 0; }\n" +
+                        "-: /drop b\n" +
+                        "-: class A {}\n" +
+                        "-: /drop A\n"),
+                a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
+                a -> assertCommandCheckOutput(a, "/classes", assertClasses()),
+                a -> assertCommandCheckOutput(a, "/imports", assertImports())
+        );
+    }
+
+    public void testReloadRepeat() {
+        test(false, new String[]{"-nostartup"},
+                (a) -> assertVariable(a, "int", "c", "7", "7"),
+                (a) -> assertCommand(a, "++c", null),
+                (a) -> assertCommand(a, "/!", null),
+                (a) -> assertCommand(a, "/2", null),
+                (a) -> assertCommand(a, "/-1", null),
+                (a) -> assertCommand(a, "/reload",
+                        "|  Restarting and restoring state.\n" +
+                        "-: int c = 7;\n" +
+                        "-: ++c\n" +
+                        "-: ++c\n" +
+                        "-: ++c\n" +
+                        "-: ++c\n"
+                ),
+                (a) -> assertCommand(a, "c", "|  Variable c of type int has value 11\n"),
+                (a) -> assertCommand(a, "$4", "|  Variable $4 of type int has value 10\n")
+        );
+    }
+
+    public void testReloadIgnore() {
+        test(false, new String[]{"-nostartup"},
+                (a) -> assertCommand(a, "(-)", null),
+                (a) -> assertCommand(a, "/list", null),
+                (a) -> assertCommand(a, "/history", null),
+                (a) -> assertCommand(a, "/help", null),
+                (a) -> assertCommand(a, "/vars", null),
+                (a) -> assertCommand(a, "/save abcd", null),
+                (a) -> assertCommand(a, "/reload",
+                        "|  Restarting and restoring state.\n")
+        );
+    }
+
+    public void testReloadResetRestore() {
+        test(
+                (a) -> assertVariable(a, "int", "x", "5", "5"),
+                (a) -> assertMethod(a, "int m(int z) { return z * z; }",
+                        "(int)int", "m"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommand(a, "/reset", "|  Resetting state.\n"),
+                (a) -> assertCommand(a, "/reload restore",
+                        "|  Restarting and restoring from previous state.\n" +
+                        "-: int x = 5;\n" +
+                        "-: int m(int z) { return z * z; }\n" +
+                        "-: m(x)\n"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
+        );
+    }
+
+    public void testReloadCrashRestore() {
+        test(
+                (a) -> assertVariable(a, "int", "x", "5", "5"),
+                (a) -> assertMethod(a, "int m(int z) { return z * z; }",
+                        "(int)int", "m"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommand(a, "System.exit(1);",
+                        "|  State engine terminated.\n" +
+                        "|  Restore definitions with: /reload restore\n"),
+                (a) -> assertCommand(a, "/reload restore",
+                        "|  Restarting and restoring from previous state.\n" +
+                        "-: int x = 5;\n" +
+                        "-: int m(int z) { return z * z; }\n" +
+                        "-: m(x)\n"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+                (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+                (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
+        );
+    }
+
+    public void testReloadExitRestore() {
+        test(false, new String[]{"-nostartup"},
+                (a) -> assertVariable(a, "int", "x", "5", "5"),
+                (a) -> assertMethod(a, "int m(int z) { return z * z; }",
+                        "(int)int", "m"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25")
+        );
+        test(false, new String[]{"-nostartup"},
+                (a) -> assertCommand(a, "/reload restore",
+                        "|  Restarting and restoring from previous state.\n" +
+                        "-: int x = 5;\n" +
+                        "-: int m(int z) { return z * z; }\n" +
+                        "-: m(x)\n"),
+                (a) -> evaluateExpression(a, "int", "m(x)", "25")
+        );
+    }
+}
--- a/langtools/test/tools/javac/BadHexConstant.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/javac/BadHexConstant.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 4049982
+ * @bug 4049982 8056897
  * @summary Compiler permitted invalid hex literal.
  * @author turnidge
  *
--- a/langtools/test/tools/javac/BadHexConstant.out	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/javac/BadHexConstant.out	Thu Jan 21 14:49:02 2016 -0800
@@ -1,3 +1,2 @@
 BadHexConstant.java:12:14: compiler.err.invalid.hex.number
-BadHexConstant.java:12:17: compiler.err.expected: token.identifier
-2 errors
+1 error
--- a/langtools/test/tools/javac/api/T6430241.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
- * 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 6430241
- * @summary Hard to disable symbol file feature through API
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
- *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.compiler/com.sun.tools.javac.util
- * @build ToolBox
- * @run main T6430241
- */
-
-import java.io.*;
-import java.util.*;
-
-import javax.tools.*;
-
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-
-public class T6430241 {
-    public static void main(String... args) throws Exception {
-        new T6430241().run();
-    }
-
-    void run() throws Exception {
-        setup();
-        testCommandLine();
-        testSimpleAPI();
-        testTaskAPI();
-
-        if (errors > 0)
-            throw new Exception(errors + " errors found");
-    }
-
-    void setup() throws Exception {
-        classesDir = new File("classes");
-        classesDir.mkdirs();
-
-        emptyDir = new File("empty");
-        emptyDir.mkdirs();
-
-        bootClassPath = createJar().getPath();
-
-        File srcDir = new File("src");
-        String test = "import sun.misc.Unsafe; class Test { }";
-        testFile = writeFile(srcDir, "Test.java", test);
-    }
-
-    //----- tests for command line invocation
-
-    void testCommandLine() throws Exception {
-        testCommandLine(true);
-        testCommandLine(false, "-Xbootclasspath/p:" + emptyDir);
-        testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
-        testCommandLine(false, "-Xbootclasspath/a:" + emptyDir);
-        testCommandLine(false, "-XDignore.symbol.file");
-        System.err.println();
-    }
-
-    void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
-        System.err.println("test command line: " + Arrays.asList(opts));
-
-        String[] args = initArgs(opts);
-
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        int rc = com.sun.tools.javac.Main.compile(args, pw);
-        String out = showOutput(sw.toString());
-
-        checkCompilationOK(rc);
-        checkOutput(out, expectWarnings);
-    }
-
-    //----- tests for simple API invocation
-
-    void testSimpleAPI() {
-        testSimpleAPI(true);
-        testSimpleAPI(false, "-Xbootclasspath/p:" + emptyDir);
-        testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
-        testSimpleAPI(false, "-Xbootclasspath/a:" + emptyDir);
-        testSimpleAPI(false, "-XDignore.symbol.file");
-        System.err.println();
-    }
-
-    void testSimpleAPI(boolean expectWarnings, String... opts) {
-        System.err.println("test simple API: " + Arrays.asList(opts));
-
-        String[] args = initArgs(opts);
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        PrintStream ps = new PrintStream(baos);
-
-        JavacTool tool = JavacTool.create();
-        int rc = tool.run(null, null, ps, args);
-
-        String out = showOutput(baos.toString());
-
-        checkCompilationOK(rc);
-        checkOutput(out, expectWarnings);
-    }
-
-    //----- tests for CompilationTask API invocation
-
-    void testTaskAPI() throws Exception {
-        List<File> bcp = new ArrayList<File>();
-        for (String f: bootClassPath.split(File.pathSeparator)) {
-            if (!f.isEmpty())
-                bcp.add(new File(f));
-        }
-
-        testTaskAPI(true, null);
-        testTaskAPI(false, bcp);
-        System.err.println();
-    }
-
-    void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
-        System.err.println("test task API: " + pcp);
-
-        JavacTool tool = JavacTool.create();
-        try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
-
-            if (pcp != null)
-                fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
-
-            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
-
-            StringWriter sw = new StringWriter();
-            PrintWriter pw = new PrintWriter(sw);
-            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
-            boolean ok = task.call();
-            String out = showOutput(sw.toString());
-
-            checkCompilationOK(ok);
-            checkOutput(out, expectWarnings);
-        }
-    }
-
-    //----- utility methods
-
-    File createJar() throws IOException {
-        File f = new File("test.jar");
-        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
-            ToolBox tb = new ToolBox();
-            tb.new JarTask(f.getPath())
-                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*", "sun.misc.*")
-                .run();
-        }
-        return f;
-    }
-
-    /**
-     * Create a file with given content.
-     */
-    File writeFile(File dir, String path, String content) throws IOException {
-        File f = new File(dir, path);
-        f.getParentFile().mkdirs();
-        FileWriter out = new FileWriter(f);
-        try {
-            out.write(content);
-        } finally {
-            out.close();
-        }
-        return f;
-    }
-
-    /**
-     * Initialize args for compilation with given opts.
-     * @return opts -d classesDir testFile
-     */
-    String[] initArgs(String[] opts) {
-        List<String> args = new ArrayList<String>();
-        args.addAll(Arrays.asList(opts));
-        args.add("-d");
-        args.add(classesDir.getPath());
-        args.add(testFile.getPath());
-        return args.toArray(new String[args.size()]);
-    }
-
-    /**
-     * Show output from compilation if non empty.
-     */
-    String showOutput(String out) {
-        if (!out.isEmpty())
-            System.err.println(out);
-        return out;
-    }
-
-    /**
-     * Verify compilation succeeded.
-     */
-    void checkCompilationOK(boolean ok) {
-        if (!ok)
-            error("compilation failed");
-    }
-
-    /**
-     * Verify compilation succeeded.
-     */
-    void checkCompilationOK(int rc) {
-        if (rc != 0)
-            error("compilation failed, rc: " + rc);
-    }
-
-    /**
-     * Check whether output contains warnings if and only if warnings
-     * are expected.
-     */
-    void checkOutput(String out, boolean expectWarnings) {
-        boolean foundWarnings = out.contains("warning");
-        if (foundWarnings) {
-            if (!expectWarnings)
-                error("unexpected warnings found");
-        } else {
-            if (expectWarnings)
-                error("expected warnings not found");
-        }
-    }
-
-    /**
-     * Report an error.
-     */
-    void error(String msg) {
-        System.err.println("error: " + msg);
-        errors++;
-    }
-
-    String bootClassPath;
-    File classesDir;
-    File emptyDir;
-    File testFile;
-    int errors;
-}
--- a/langtools/test/tools/javac/diags/examples/IdentifierExpected.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/javac/diags/examples/IdentifierExpected.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, 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
@@ -23,11 +23,9 @@
 
 // key: compiler.misc.token.identifier
 // key: compiler.err.expected
-// key: compiler.err.invalid.binary.number
-// key: compiler.misc.count.error.plural
+// key: compiler.misc.count.error
 // key: compiler.err.error
 // run: backdoor
 
-class IdentifierExpected {
-    long bl = 0BL;
+class {
 }
--- a/langtools/test/tools/javac/file/BootClassPathPrepend.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2014, 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 8067445
- * @summary Verify that file.Locations analyze sun.boot.class.path for BCP prepends/appends
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
- *          jdk.compiler/com.sun.tools.javac.main
- */
-
-import java.io.IOException;
-import java.util.EnumSet;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.JavaFileObject.Kind;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-
-public class BootClassPathPrepend {
-    public static void main(String... args) throws IOException {
-        if (args.length == 0) {
-            new BootClassPathPrepend().reRun();
-        } else {
-            new BootClassPathPrepend().run();
-        }
-    }
-
-    void reRun() {
-        String testClasses = System.getProperty("test.classes");
-        ToolBox tb = new ToolBox();
-        tb.new JavaTask().vmOptions("-Xbootclasspath/p:" + testClasses)
-                         .classArgs("real-run")
-                         .className("BootClassPathPrepend")
-                         .run()
-                         .writeAll();
-    }
-
-    EnumSet<Kind> classKind = EnumSet.of(JavaFileObject.Kind.CLASS);
-
-    void run() throws IOException {
-        JavaCompiler toolProvider = ToolProvider.getSystemJavaCompiler();
-        try (JavaFileManager fm = toolProvider.getStandardFileManager(null, null, null)) {
-            Iterable<JavaFileObject> files =
-                    fm.list(StandardLocation.PLATFORM_CLASS_PATH, "", classKind, false);
-            for (JavaFileObject fo : files) {
-                if (fo.isNameCompatible("BootClassPathPrepend", JavaFileObject.Kind.CLASS)) {
-                    System.err.println("Found BootClassPathPrepend on bootclasspath");
-                    return ;//found
-                }
-            }
-
-            throw new AssertionError("Cannot find class that was prepended on BCP");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific15.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8143852
+ * @summary Rename functional interface method type parameters during most specific test
+ * @compile MostSpecific15.java
+ */
+class MostSpecific15 {
+    interface F1 { <X> Object apply(X arg); }
+    interface F2 { <Y> String apply(Y arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific15::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific16.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Rename functional interface method type parameters during most specific test
+ * @compile/fail/ref=MostSpecific16.out -XDrawDiagnostics MostSpecific16.java
+ */
+class MostSpecific16 {
+    interface F1 { <X> Object apply(Object arg); }
+    interface F2 { String apply(Object arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific16::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific16.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific16.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific16.F1), MostSpecific16, kindname.method, m1(MostSpecific16.F2), MostSpecific16
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific17.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,47 @@
+/*
+ * 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 8143852
+ * @summary Rename functional interface method type parameters during most specific test
+ * @compile MostSpecific17.java
+ */
+class MostSpecific17 {
+
+    interface A<T> {}
+    interface B<T> extends A<T> {}
+
+    interface F1 { <X> A<? super X> apply(Object arg); }
+    interface F2 { <Y> B<? super Y> apply(Object arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static B<Object> foo(Object in) { return null; }
+
+    void test() {
+        m1(MostSpecific17::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific18.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8143852
+ * @summary Test that generic function interface method bounds are the same
+ * @compile MostSpecific18.java
+ */
+class MostSpecific18 {
+    interface F1 { <X extends Number> Object apply(X arg); }
+    interface F2 { <Y extends Number> String apply(Y arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific18::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific19.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Test that generic function interface method bounds are the same
+ * @compile/fail/ref=MostSpecific19.out -XDrawDiagnostics MostSpecific19.java
+ */
+class MostSpecific19 {
+    interface F1 { <X extends Number> Object apply(X arg); }
+    interface F2 { <Y extends Integer> String apply(Y arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific19::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific19.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific19.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific19.F1), MostSpecific19, kindname.method, m1(MostSpecific19.F2), MostSpecific19
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific20.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8143852
+ * @summary Test that generic function interface method bounds are the same
+ * @compile MostSpecific20.java
+ */
+class MostSpecific20 {
+    interface F1 { <X extends Iterable<X>> Object apply(X arg); }
+    interface F2 { <Y extends Iterable<Y>> String apply(Y arg); }
+
+    static void m1(F1 f) {}
+    static void m1(F2 f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific20::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific21.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Most specific inference constraints derived from both functional interface method parameters and tparam bounds
+ * @compile/fail/ref=MostSpecific21.out -XDrawDiagnostics MostSpecific21.java
+ */
+class MostSpecific21 {
+    interface F1<T> { <X extends T> Object apply(T arg); }
+    interface F2 { <Y extends Number> String apply(Integer arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific21::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific21.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific21.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, <T>m1(MostSpecific21.F1<T>), MostSpecific21, kindname.method, m1(MostSpecific21.F2), MostSpecific21
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific22.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8143852
+ * @summary Most specific inference constraints derived from both functional interface method parameters and tparam bounds
+ * @compile MostSpecific22.java
+ */
+class MostSpecific22 {
+    interface F1<T> { <X extends T> Object apply(T arg); }
+    interface F2 { <Y extends Number> String apply(Number arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific22::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific23.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Most specific failure if ivar can be bounded by functional interface method tparam
+ * @compile/fail/ref=MostSpecific23.out -XDrawDiagnostics MostSpecific23.java
+ */
+class MostSpecific23 {
+    interface F1<T> { <X extends T> Object apply(Integer arg); }
+    interface F2 { <Y extends Class<Y>> String apply(Integer arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific23::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific23.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific23.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, <T>m1(MostSpecific23.F1<T>), MostSpecific23, kindname.method, m1(MostSpecific23.F2), MostSpecific23
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific24.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Most specific failure if ivar can be bounded by functional interface method tparam
+ * @compile/fail/ref=MostSpecific24.out -XDrawDiagnostics MostSpecific24.java
+ */
+class MostSpecific24 {
+    interface F1<T> { <X> Object apply(Class<T> arg); }
+    interface F2 { <Y> String apply(Class<Y> arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific24::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific24.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific24.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, <T>m1(MostSpecific24.F1<T>), MostSpecific24, kindname.method, m1(MostSpecific24.F2), MostSpecific24
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific25.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Most specific failure if ivar can be bounded by functional interface method tparam
+ * @compile/fail/ref=MostSpecific25.out -XDrawDiagnostics MostSpecific25.java
+ */
+class MostSpecific25 {
+    interface F1<T> { <X> T apply(Integer arg); }
+    interface F2 { <Y> Class<? super Y> apply(Integer arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static Class<Object> foo(Object in) { return Object.class; }
+
+    void test() {
+        m1(MostSpecific25::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific25.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific25.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, <T>m1(MostSpecific25.F1<T>), MostSpecific25, kindname.method, m1(MostSpecific25.F2), MostSpecific25
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific26.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Most specific inference constraints derived from intersection bound
+ * @compile/fail/ref=MostSpecific26.out -XDrawDiagnostics MostSpecific26.java
+ */
+class MostSpecific26 {
+    interface F1<T> { <X extends Iterable<T> & Runnable> Object apply(T arg); }
+    interface F2 { <Y extends Iterable<Number> & Runnable> String apply(Integer arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific26::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific26.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific26.java:17:9: compiler.err.ref.ambiguous: m1, kindname.method, <T>m1(MostSpecific26.F1<T>), MostSpecific26, kindname.method, m1(MostSpecific26.F2), MostSpecific26
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific27.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8143852
+ * @summary Most specific inference constraints derived from intersection bound
+ * @compile MostSpecific27.java
+ */
+class MostSpecific27 {
+    interface F1<T> { <X extends Iterable<T> & Runnable> Object apply(T arg); }
+    interface F2 { <Y extends Iterable<Number> & Runnable> String apply(Number arg); }
+
+    static <T> T m1(F1<T> f) { return null; }
+    static Object m1(F2 f) { return null; }
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1(MostSpecific27::foo);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific28.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8143852
+ * @summary Test that functional interface method parameter types are equal, even for an explicit lambda
+ * @compile/fail/ref=MostSpecific28.out -XDrawDiagnostics MostSpecific28.java
+ */
+class MostSpecific28 {
+
+    interface Pred<T> { boolean test(T arg); }
+    interface Fun<T,R> { R apply(T arg); }
+
+    static void m1(Pred<? super Integer> f) {}
+    static void m1(Fun<Number, Boolean> f) {}
+
+    static String foo(Object in) { return "a"; }
+
+    void test() {
+        m1((Number n) -> true);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific28.out	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,2 @@
+MostSpecific28.java:18:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific28.Pred<? super java.lang.Integer>), MostSpecific28, kindname.method, m1(MostSpecific28.Fun<java.lang.Number,java.lang.Boolean>), MostSpecific28
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lexer/JavaLexerTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,81 @@
+/*
+ * 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 8056897
+ * @summary Proper lexing of integer literals.
+ */
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Objects;
+
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+import com.sun.tools.javac.parser.JavaTokenizer;
+import com.sun.tools.javac.parser.ScannerFactory;
+import com.sun.tools.javac.parser.Tokens.Token;
+import com.sun.tools.javac.parser.Tokens.TokenKind;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+
+public class JavaLexerTest {
+    public static void main(String... args) throws Exception {
+        new JavaLexerTest().run();
+    }
+
+    void run() throws Exception {
+        Context ctx = new Context();
+        Log log = Log.instance(ctx);
+        String input = "0bL 0b20L 0xL ";
+        log.useSource(new SimpleJavaFileObject(new URI("mem://Test.java"), JavaFileObject.Kind.SOURCE) {
+            @Override
+            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                return input;
+            }
+        });
+        char[] inputArr = input.toCharArray();
+        JavaTokenizer tokenizer = new JavaTokenizer(ScannerFactory.instance(ctx), inputArr, inputArr.length) {
+        };
+
+        assertKind(input, tokenizer, TokenKind.LONGLITERAL, "0bL");
+        assertKind(input, tokenizer, TokenKind.LONGLITERAL, "0b20L");
+        assertKind(input, tokenizer, TokenKind.LONGLITERAL, "0xL");
+    }
+
+    void assertKind(String input, JavaTokenizer tokenizer, TokenKind kind, String expectedText) {
+        Token token = tokenizer.readToken();
+
+        if (token.kind != kind) {
+            throw new AssertionError("Unexpected token kind: " + token.kind);
+        }
+
+        String actualText = input.substring(token.pos, token.endPos);
+
+        if (!Objects.equals(actualText, expectedText)) {
+            throw new AssertionError("Unexpected token text: " + actualText);
+        }
+    }
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/literals/T6891079.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/javac/literals/T6891079.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1,5 +1,5 @@
 /* @test /nodynamiccopyright/
- * @bug 6891079
+ * @bug 6891079 8056897
  * @summary Compiler allows invalid binary literals 0b and oBL
  * @compile/fail/ref=T6891079.out -XDrawDiagnostics T6891079.java
  */
--- a/langtools/test/tools/javac/literals/T6891079.out	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/javac/literals/T6891079.out	Thu Jan 21 14:49:02 2016 -0800
@@ -1,7 +1,5 @@
 T6891079.java:8:14: compiler.err.invalid.binary.number
 T6891079.java:9:15: compiler.err.invalid.binary.number
-T6891079.java:9:18: compiler.err.expected: token.identifier
 T6891079.java:10:14: compiler.err.invalid.hex.number
 T6891079.java:11:15: compiler.err.invalid.hex.number
-T6891079.java:11:18: compiler.err.expected: token.identifier
-6 errors
+4 errors
--- a/langtools/test/tools/sjavac/CompileExcludingDependency.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/CompileExcludingDependency.java	Thu Jan 21 14:49:02 2016 -0800
@@ -55,9 +55,9 @@
         tb.writeFile(GENSRC.resolve("beta/B.java"),
                      "package beta; public class B { }");
 
-        compile("-x", "beta",
+        compile("-x", "beta/*",
                 "-src", GENSRC.toString(),
-                "-x", "alfa/omega",
+                "-x", "alfa/omega/*",
                 "-sourcepath", GENSRC.toString(),
                 "-d", BIN.toString(),
                 "--state-dir=" + BIN,
--- a/langtools/test/tools/sjavac/CompileWithAtFile.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/CompileWithAtFile.java	Thu Jan 21 14:49:02 2016 -0800
@@ -47,8 +47,8 @@
 
     void test() throws Exception {
         tb.writeFile(GENSRC.resolve("list.txt"),
-                     "-if */alfa/omega/A.java\n" +
-                     "-if */beta/B.java\n" +
+                     "-i alfa/omega/A.java\n" +
+                     "-i beta/B.java\n" +
                      GENSRC + "\n" +
                      "-d " + BIN + "\n" +
                      "--state-dir=" + BIN + "\n");
--- a/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Thu Jan 21 14:49:02 2016 -0800
@@ -64,7 +64,7 @@
                      "package beta; public class B { }");
 
         compile(GENSRC.toString(),
-                "-x", "beta",
+                "-x", "beta/*",
                 "-sourcepath", GENSRC2.toString(),
                 "-sourcepath", GENSRC3.toString(),
                 "-d", BIN.toString(),
--- a/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Thu Jan 21 14:49:02 2016 -0800
@@ -62,7 +62,7 @@
         tb.writeFile(GENSRC2.resolve("beta/B.java"),
                      "package beta; public class B { }");
 
-        compile("-x", "beta",
+        compile("-x", "beta/*",
                 GENSRC.toString(),
                 GENSRC2.toString(),
                 "-d", BIN.toString(),
--- a/langtools/test/tools/sjavac/ExclPattern.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014, 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 8037085
- * @summary Ensures that sjavac can handle various exclusion patterns.
- *
- * @modules jdk.compiler/com.sun.tools.sjavac
- * @build Wrapper
- * @run main Wrapper ExclPattern
- */
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-public class ExclPattern {
-
-    public static void main(String[] ignore) throws IOException {
-
-        String toBeExcluded = "pkg/excl-dir/excluded.txt";
-        String toBeIncluded = "pkg/incl-dir/included.txt";
-
-        // Set up source directory with directory to be excluded
-        populate(Paths.get("srcdir"),
-            "pkg/SomeClass.java",
-            "package pkg; public class SomeClass { }",
-
-            toBeExcluded,
-            "This file should not end up in the dest directory.",
-
-            toBeIncluded,
-            "This file should end up in the dest directory.");
-
-        String[] args = {
-                "-x", "pkg/excl-dir/*",
-                "-src", "srcdir",
-                "-d", "dest",
-                "--state-dir=dest",
-                "-j", "1",
-                "-copy", ".txt",
-                "--server:portfile=testserver,background=false",
-                "--log=debug"
-        };
-
-        int rc = com.sun.tools.sjavac.Main.go(args);
-        if (rc != 0) throw new RuntimeException("Error during compile!");
-
-        if (!Files.exists(Paths.get("dest/" + toBeIncluded)))
-            throw new AssertionError("File missing: " + toBeIncluded);
-
-        if (Files.exists(Paths.get("dest/" + toBeExcluded)))
-            throw new AssertionError("File present: " + toBeExcluded);
-    }
-
-    static void populate(Path root, String... args) throws IOException {
-        if (!Files.exists(root))
-            Files.createDirectory(root);
-        for (int i = 0; i < args.length; i += 2) {
-            String filename = args[i];
-            String content = args[i+1];
-            Path p = root.resolve(filename);
-            Files.createDirectories(p.getParent());
-            try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(p,
-                    Charset.defaultCharset()))) {
-                out.println(content);
-            }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/HiddenFiles.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8144226
+ * @summary Ensures that excluded files are inaccessible (even for implicit
+ *          compilation)
+ *
+ * @modules jdk.compiler/com.sun.tools.sjavac
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper HiddenFiles
+ */
+
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.sjavac.server.Sjavac;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class HiddenFiles extends SjavacBase {
+
+    public static void main(String[] ignore) throws Exception {
+        Path BIN = Paths.get("bin");
+        Path STATE_DIR = Paths.get("state-dir");
+        Path SRC = Paths.get("src");
+
+        Files.createDirectories(BIN);
+        Files.createDirectories(STATE_DIR);
+
+        toolbox.writeJavaFiles(SRC, "package pkg; class A { B b; }");
+        toolbox.writeJavaFiles(SRC, "package pkg; class B { }");
+
+        // 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);
+
+        Assert.check(rc == Sjavac.RC_FATAL, "Compilation succeeded unexpectedly.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncludeExcludePatterns.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,167 @@
+/*
+ * 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
+ * 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 8037085
+ * @summary Ensures that sjavac can handle various exclusion patterns.
+ *
+ * @modules jdk.compiler/com.sun.tools.sjavac
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncludeExcludePatterns
+ */
+
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.sjavac.server.Sjavac;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class IncludeExcludePatterns extends SjavacBase {
+
+    final Path SRC = Paths.get("src");
+    final Path BIN = Paths.get("bin");
+    final Path STATE_DIR = Paths.get("state-dir");
+
+    // An arbitrarily but sufficiently complicated source tree.
+    final Path A = Paths.get("pkga/A.java");
+    final Path X1 = Paths.get("pkga/subpkg/Xx.java");
+    final Path Y = Paths.get("pkga/subpkg/subsubpkg/Y.java");
+    final Path B = Paths.get("pkgb/B.java");
+    final Path C = Paths.get("pkgc/C.java");
+    final Path X2 = Paths.get("pkgc/Xx.java");
+
+    final Path[] ALL_PATHS = {A, X1, Y, B, C, X2};
+
+    public static void main(String[] ignore) throws Exception {
+        new IncludeExcludePatterns().runTest();
+    }
+
+    public void runTest() throws IOException, ReflectiveOperationException {
+        Files.createDirectories(BIN);
+        Files.createDirectories(STATE_DIR);
+        for (Path p : ALL_PATHS) {
+            writeDummyClass(p);
+        }
+
+        // Single file
+        testPattern("pkga/A.java", A);
+
+        // Leading wild cards
+        testPattern("*/A.java", A);
+        testPattern("**/Xx.java", X1, X2);
+        testPattern("**x.java", X1, X2);
+
+        // Wild card in middle of path
+        testPattern("pkga/*/Xx.java", X1);
+        testPattern("pkga/**/Y.java", Y);
+
+        // Trailing wild cards
+        testPattern("pkga/*", A);
+        testPattern("pkga/**", A, X1, Y);
+
+        // Multiple wildcards
+        testPattern("pkga/*/*/Y.java", Y);
+        testPattern("**/*/**", X1, Y);
+
+    }
+
+    // Given "src/pkg/subpkg/A.java" this method returns "A"
+    String classNameOf(Path javaFile) {
+        return javaFile.getFileName()
+                       .toString()
+                       .replace(".java", "");
+    }
+
+    // Puts an empty (dummy) class definition in the given path.
+    void writeDummyClass(Path javaFile) throws IOException {
+        String pkg = javaFile.getParent().toString().replace(File.separatorChar, '.');
+        String cls = javaFile.getFileName().toString().replace(".java", "");
+        toolbox.writeFile(SRC.resolve(javaFile), "package " + pkg + "; class " + cls + " {}");
+    }
+
+    void testPattern(String filterArgs, Path... sourcesExpectedToBeVisible)
+            throws ReflectiveOperationException, IOException {
+        testFilter("-i " + filterArgs, Arrays.asList(sourcesExpectedToBeVisible));
+
+        Set<Path> complement = new HashSet<>(Arrays.asList(ALL_PATHS));
+        complement.removeAll(Arrays.asList(sourcesExpectedToBeVisible));
+        testFilter("-x " + filterArgs, complement);
+    }
+
+    void testFilter(String filterArgs, Collection<Path> sourcesExpectedToBeVisible)
+            throws IOException, ReflectiveOperationException {
+        System.out.println("Testing filter: " + filterArgs);
+        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(" "));
+
+        // Compilation should always pass in these tests
+        Assert.check(rc == Sjavac.RC_OK, "Compilation failed unexpectedly.");
+
+        // The resulting .class files should correspond to the visible source files
+        Set<Path> result = allFilesInDir(BIN);
+        Set<Path> expected = correspondingClassFiles(sourcesExpectedToBeVisible);
+        if (!result.equals(expected)) {
+            System.out.println("Result:");
+            printPaths(result);
+            System.out.println("Expected:");
+            printPaths(expected);
+            Assert.error("Test case failed: " + filterArgs);
+        }
+    }
+
+    void printPaths(Collection<Path> paths) {
+        paths.stream()
+             .sorted()
+             .forEachOrdered(p -> System.out.println("    " + p));
+    }
+
+    // Given "pkg/A.java, pkg/B.java" this method returns "bin/pkg/A.class, bin/pkg/B.class"
+    Set<Path> correspondingClassFiles(Collection<Path> javaFiles) {
+        return javaFiles.stream()
+                        .map(javaFile -> javaFile.resolveSibling(classNameOf(javaFile) + ".class"))
+                        .map(BIN::resolve)
+                        .collect(Collectors.toSet());
+    }
+
+    Set<Path> allFilesInDir(Path p) throws IOException {
+        try (Stream<Path> files = Files.walk(p).filter(Files::isRegularFile)) {
+            return files.collect(Collectors.toSet());
+        }
+    }
+}
--- a/langtools/test/tools/sjavac/OptionDecoding.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/OptionDecoding.java	Thu Jan 21 14:49:02 2016 -0800
@@ -61,7 +61,6 @@
     public static void main(String[] args) throws IOException {
         testPaths();
         testDupPaths();
-        testSourceLocations();
         testSimpleOptions();
         testServerConf();
         testSearchPaths();
@@ -110,78 +109,6 @@
         }
     }
 
-    // Test source locations and -x, -i, -xf, -if filters
-    static void testSourceLocations() throws IOException {
-        Path a1 = Paths.get("root/pkg1/ClassA1.java");
-        Path a2 = Paths.get("root/pkg1/ClassA2.java");
-        Path b1 = Paths.get("root/pkg1/pkg2/ClassB1.java");
-        Path b2 = Paths.get("root/pkg1/pkg2/ClassB2.java");
-        Path c1 = Paths.get("root/pkg3/ClassC1.java");
-        Path c2 = Paths.get("root/pkg3/ClassC2.java");
-
-        for (Path p : Arrays.asList(a1, a2, b1, b2, c1, c2)) {
-            Files.createDirectories(p.getParent());
-            Files.createFile(p);
-        }
-
-        // Test -if
-        {
-            Options options = Options.parseArgs("-if", "root/pkg1/ClassA1.java", "root");
-
-            Map<String, Source> foundFiles = new HashMap<>();
-            SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
-                    new HashMap<String, Module>(), new Module("", ""), false, true);
-
-            checkFilesFound(foundFiles.keySet(), a1);
-        }
-
-        // Test -i
-        System.out.println("--------------------------- CHECKING -i ----------------");
-        {
-            Options options = Options.parseArgs("-i", "pkg1/*", "root");
-
-            Map<String, Source> foundFiles = new HashMap<>();
-            SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
-                    new HashMap<String, Module>(), new Module("", ""), false, true);
-
-            checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
-        }
-        System.out.println("--------------------------------------------------------");
-
-        // Test -xf
-        {
-            Options options = Options.parseArgs("-xf", "root/pkg1/ClassA1.java", "root");
-
-            Map<String, Source> foundFiles = new HashMap<>();
-            SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
-                    new HashMap<String, Module>(), new Module("", ""), false, true);
-
-            checkFilesFound(foundFiles.keySet(), a2, b1, b2, c1, c2);
-        }
-
-        // Test -x
-        {
-            Options options = Options.parseArgs("-i", "pkg1/*", "root");
-
-            Map<String, Source> foundFiles = new HashMap<>();
-            SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
-                    new HashMap<String, Module>(), new Module("", ""), false, true);
-
-            checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
-        }
-
-        // Test -x and -i
-        {
-            Options options = Options.parseArgs("-i", "pkg1/*", "-x", "pkg1/pkg2/*", "root");
-
-            Map<String, Source> foundFiles = new HashMap<>();
-            SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
-                    new HashMap<String, Module>(), new Module("", ""), false, true);
-
-            checkFilesFound(foundFiles.keySet(), a1, a2);
-        }
-    }
-
     // Test basic options
     static void testSimpleOptions() {
         Options options = Options.parseArgs("-j", "17", "--log=debug");
@@ -216,8 +143,8 @@
         List<String> i, x, iF, xF;
         i = x = iF = xF = new ArrayList<>();
 
-        SourceLocation dir1 = new SourceLocation(Paths.get("dir1"), i, x, iF, xF);
-        SourceLocation dir2 = new SourceLocation(Paths.get("dir2"), i, x, iF, xF);
+        SourceLocation dir1 = new SourceLocation(Paths.get("dir1"), i, x);
+        SourceLocation dir2 = new SourceLocation(Paths.get("dir2"), i, x);
         String dir1_PS_dir2 = "dir1" + File.pathSeparator + "dir2";
 
         Options options = Options.parseArgs("-sourcepath", dir1_PS_dir2);
--- a/langtools/test/tools/sjavac/Serialization.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/Serialization.java	Thu Jan 21 14:49:02 2016 -0800
@@ -58,8 +58,6 @@
                 Option.D.arg, "dest",
                 Option.I.arg, "pkg/*",
                 Option.X.arg, "pkg/pkg/*",
-                Option.IF.arg, "root/pkg/MyClass1.java",
-                Option.XF.arg, "root/pkg/MyClass2.java",
                 Option.SRC.arg, "root",
                 Option.SOURCEPATH.arg, "sourcepath",
                 Option.CLASSPATH.arg, "classpath",
@@ -87,8 +85,6 @@
         assertEquals(sl1.getPath(), sl2.getPath());
         assertEquals(sl1.getIncludes(), sl2.getIncludes());
         assertEquals(sl1.getExcludes(), sl2.getExcludes());
-        assertEquals(sl1.getIncludedFiles(), sl2.getIncludedFiles());
-        assertEquals(sl1.getExcludedFiles(), sl2.getExcludedFiles());
 
         assertEquals(options1.getClassSearchPath(), options2.getClassSearchPath());
         assertEquals(options1.getSourceSearchPaths(), options2.getSourceSearchPaths());
--- a/langtools/test/tools/sjavac/util/OptionTestUtil.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/langtools/test/tools/sjavac/util/OptionTestUtil.java	Thu Jan 21 14:49:02 2016 -0800
@@ -62,9 +62,7 @@
 
             if (!sl1.getPath().equals(sl2.getPath()) ||
                     !sl1.getIncludes().equals(sl2.getIncludes()) ||
-                    !sl1.getExcludes().equals(sl2.getExcludes()) ||
-                    !sl1.getIncludedFiles().equals(sl2.getIncludedFiles()) ||
-                    !sl1.getExcludedFiles().equals(sl2.getExcludedFiles()))
+                    !sl1.getExcludes().equals(sl2.getExcludes()))
                 throw new AssertionError("Expected " + sl1 + " but got " + sl2);
         }
     }
--- a/make/common/JavaCompilation.gmk	Thu Jan 21 13:41:02 2016 +0530
+++ b/make/common/JavaCompilation.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -202,23 +202,28 @@
   # CacheFind does not preserve order so need to call it for each root.
   $1_ALL_SRCS += $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s)))
   # Extract the java files.
-  ifneq ($$($1_EXCLUDE_FILES),)
-    $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
+  $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
+
+  # Translate include/exclude into patterns
+  ifneq ($$($1_EXCLUDE_FILES), )
+    $1_EXCLUDE_PATTERN := $$(addprefix %, $$($1_EXCLUDE_FILES))
   endif
-  $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
-  ifneq ($$($1_INCLUDE_FILES),)
-    $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
-    $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
+  ifneq ($$($1_INCLUDE_FILES), )
+    $1_INCLUDE_PATTERN := $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$($1_INCLUDE_FILES)))
+  endif
+  ifneq ($$($1_EXCLUDES), )
+    $1_EXCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_EXCLUDES))))
+  endif
+  ifneq ($$($1_INCLUDES), )
+    $1_INCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_INCLUDES))))
   endif
 
-  # Prepend the source/bin path to the filter expressions.
-  ifneq ($$($1_INCLUDES),)
-    $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
-    $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
+  # Apply include/exclude patterns to java sources
+  ifneq ($$($1_EXCLUDE_PATTERN), )
+    $1_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_SRCS))
   endif
-  ifneq ($$($1_EXCLUDES),)
-    $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
-    $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
+  ifneq ($$($1_INCLUDE_PATTERN), )
+    $1_SRCS := $$(filter $$($1_INCLUDE_PATTERN), $$($1_SRCS))
   endif
 
   ifneq ($$($1_KEEP_DUPS), true)
@@ -242,10 +247,10 @@
   $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 -xf *,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \
-      $$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
+  $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.
@@ -258,14 +263,11 @@
     $1_ALL_COPIES += $$($1_COPY_FILES)
   endif
   # Copy must also respect filters.
-  ifneq (,$$($1_INCLUDES))
-    $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
+  ifneq (,$$($1_INCLUDE_PATTERN))
+    $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
   endif
-  ifneq (,$$($1_EXCLUDES))
-    $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
-  endif
-  ifneq (,$$($1_EXCLUDE_FILES))
-    $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
+  ifneq (,$$($1_EXCLUDE_PATTERN))
+    $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
   endif
   ifneq (,$$($1_ALL_COPIES))
     # Yep, there are files to be copied!
@@ -281,14 +283,11 @@
     # Clean these explicitly
     $1_ALL_CLEANS += $$($1_CLEAN_FILES)
     # Copy and clean must also respect filters.
-    ifneq (,$$($1_INCLUDES))
-      $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
+    ifneq (,$$($1_INCLUDE_PATTERN))
+      $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
     endif
-    ifneq (,$$($1_EXCLUDES))
-      $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
-    endif
-    ifneq (,$$($1_EXCLUDE_FILES))
-      $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
+    ifneq (,$$($1_EXCLUDE_PATTERN))
+      $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
     endif
     ifneq (,$$($1_ALL_CLEANS))
       # Yep, there are files to be copied and cleaned!
--- a/modules.xml	Thu Jan 21 13:41:02 2016 +0530
+++ b/modules.xml	Thu Jan 21 14:49:02 2016 -0800
@@ -239,6 +239,12 @@
       <to>jdk.scripting.nashorn</to>
     </export>
     <export>
+      <name>jdk.internal.perf</name>
+      <to>java.desktop</to>
+      <to>java.management</to>
+      <to>jdk.jvmstat</to>
+    </export>
+    <export>
       <name>jdk.internal.org.objectweb.asm</name>
       <to>java.instrument</to>
       <to>jdk.jfr</to>
--- a/nashorn/.hgtags	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/.hgtags	Thu Jan 21 14:49:02 2016 -0800
@@ -334,3 +334,4 @@
 68a36216f70c0de4c7e36f8978995934fc72ec03 jdk-9+98
 74ddd1339c57cf2c2a13e34e1760006c2e54d1fc jdk-9+99
 da397aea8adad7e6f743b60bfe0c415fc8508df5 jdk-9+100
+1916a2c680d8c33b59943dbb6dc2dd2000ec821a jdk-9+101
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/AbstractJavaLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/AbstractJavaLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -349,55 +349,121 @@
             throws Exception {
         final CallSiteDescriptor callSiteDescriptor = request.getCallSiteDescriptor();
 
+        final MissingMemberHandlerFactory missingMemberHandlerFactory;
+        final LinkerServices directLinkerServices;
+        if (linkerServices instanceof LinkerServicesWithMissingMemberHandlerFactory) {
+            final LinkerServicesWithMissingMemberHandlerFactory lswmmhf = ((LinkerServicesWithMissingMemberHandlerFactory)linkerServices);
+            missingMemberHandlerFactory = lswmmhf.missingMemberHandlerFactory;
+            directLinkerServices = lswmmhf.linkerServices;
+        } else {
+            missingMemberHandlerFactory = null;
+            directLinkerServices = linkerServices;
+        }
+
         // Handle NamedOperation(CALL_METHOD, name) separately
         final Operation operation = callSiteDescriptor.getOperation();
         if (operation instanceof NamedOperation) {
             final NamedOperation namedOperation = (NamedOperation)operation;
             if (namedOperation.getBaseOperation() == StandardOperation.CALL_METHOD) {
-                return createGuardedDynamicMethodInvocation(callSiteDescriptor,
-                        linkerServices, namedOperation.getName().toString(), methods);
+                final GuardedInvocation inv =
+                        createGuardedDynamicMethodInvocation(callSiteDescriptor,
+                        directLinkerServices, namedOperation.getName().toString(), methods);
+                if (inv == null) {
+                    return createNoSuchMemberHandler(missingMemberHandlerFactory,
+                            request, directLinkerServices).getGuardedInvocation();
+                }
+                return inv;
             }
         }
 
-        List<Operation> operations = Arrays.asList(
-                CompositeOperation.getOperations(
-                        NamedOperation.getBaseOperation(operation)));
-        final Object name = NamedOperation.getName(operation);
+        final GuardedInvocationComponent gic = getGuardedInvocationComponent(
+                new ComponentLinkRequest(request, directLinkerServices,
+                        missingMemberHandlerFactory));
+        return gic != null ? gic.getGuardedInvocation() : null;
+    }
+
+    static final class ComponentLinkRequest {
+        final LinkRequest linkRequest;
+        final LinkerServices linkerServices;
+        final MissingMemberHandlerFactory missingMemberHandlerFactory;
+        final List<Operation> operations;
+        final Object name;
+
+        ComponentLinkRequest(final LinkRequest linkRequest,
+                final LinkerServices linkerServices,
+                final MissingMemberHandlerFactory missingMemberHandlerFactory) {
+            this.linkRequest = linkRequest;
+            this.linkerServices = linkerServices;
+            this.missingMemberHandlerFactory = missingMemberHandlerFactory;
+            final Operation operation = linkRequest.getCallSiteDescriptor().getOperation();
+            this.operations = Arrays.asList(
+                    CompositeOperation.getOperations(
+                            NamedOperation.getBaseOperation(operation)));
+            this.name = NamedOperation.getName(operation);
+        }
 
-        while(!operations.isEmpty()) {
-            final GuardedInvocationComponent gic =
-                    getGuardedInvocationComponent(callSiteDescriptor,
-                            linkerServices, operations, name);
-            if(gic != null) {
-                return gic.getGuardedInvocation();
+        private ComponentLinkRequest(final LinkRequest linkRequest,
+                final LinkerServices linkerServices,
+                final MissingMemberHandlerFactory missingMemberHandlerFactory,
+                final List<Operation> operations, final Object name) {
+            this.linkRequest = linkRequest;
+            this.linkerServices = linkerServices;
+            this.missingMemberHandlerFactory = missingMemberHandlerFactory;
+            this.operations = operations;
+            this.name = name;
+        }
+
+        CallSiteDescriptor getDescriptor() {
+            return linkRequest.getCallSiteDescriptor();
+        }
+
+        ComponentLinkRequest popOperations() {
+            return new ComponentLinkRequest(linkRequest, linkerServices,
+                    missingMemberHandlerFactory,
+                    operations.subList(1, operations.size()), name);
+        }
+    }
+
+    protected GuardedInvocationComponent getGuardedInvocationComponent(final ComponentLinkRequest req)
+    throws Exception {
+        final Operation op = req.operations.get(0);
+        if (op instanceof StandardOperation) {
+            switch((StandardOperation)op) {
+            case GET_PROPERTY: return getPropertyGetter(req.popOperations());
+            case SET_PROPERTY: return getPropertySetter(req.popOperations());
+            case GET_METHOD: return getMethodGetter(req.popOperations());
+            default:
             }
-            operations = pop(operations);
         }
         return null;
     }
 
-    protected GuardedInvocationComponent getGuardedInvocationComponent(
-            final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices,
-            final List<Operation> operations, final Object name)
-    throws Exception {
-        if(operations.isEmpty()) {
+    GuardedInvocationComponent getNextComponent(final ComponentLinkRequest req) throws Exception {
+        if (req.operations.isEmpty()) {
+            return createNoSuchMemberHandler(req.missingMemberHandlerFactory,
+                    req.linkRequest, req.linkerServices);
+        }
+        final GuardedInvocationComponent gic = getGuardedInvocationComponent(req);
+        if (gic != null) {
+            return gic;
+        }
+        return getNextComponent(req.popOperations());
+    }
+
+    private GuardedInvocationComponent createNoSuchMemberHandler(
+            final MissingMemberHandlerFactory missingMemberHandlerFactory,
+            final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+        if (missingMemberHandlerFactory == null) {
             return null;
         }
-        final Operation op = operations.get(0);
-        // Either GET_PROPERTY:name(this) or GET_PROPERTY(this, name)
-        if(op == StandardOperation.GET_PROPERTY) {
-            return getPropertyGetter(callSiteDescriptor, linkerServices, pop(operations), name);
+        final MethodHandle handler = missingMemberHandlerFactory.createMissingMemberHandler(linkRequest, linkerServices);
+        if (handler == null) {
+            return null;
         }
-        // Either SET_PROPERTY:name(this, value) or SET_PROPERTY(this, name, value)
-        if(op == StandardOperation.SET_PROPERTY) {
-            return getPropertySetter(callSiteDescriptor, linkerServices, pop(operations), name);
-        }
-        // Either GET_METHOD:name(this), or GET_METHOD(this, name)
-        if(op == StandardOperation.GET_METHOD) {
-            return getMethodGetter(callSiteDescriptor, linkerServices, pop(operations), name);
-        }
-        return null;
+        final MethodType type = linkRequest.getCallSiteDescriptor().getMethodType();
+        // The returned handler is allowed to differ in return type.
+        assert handler.type().changeReturnType(type.returnType()).equals(type);
+        return getClassGuardedInvocationComponent(handler, type);
     }
 
     static final <T> List<T> pop(final List<T> l) {
@@ -483,16 +549,15 @@
     private static final MethodHandle CONSTANT_NULL_DROP_METHOD_HANDLE = MethodHandles.dropArguments(
             MethodHandles.constant(Object.class, null), 0, MethodHandle.class);
 
-    private GuardedInvocationComponent getPropertySetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations, final Object name) throws Exception {
-        if (name == null) {
-            return getUnnamedPropertySetter(callSiteDescriptor, linkerServices, operations);
+    private GuardedInvocationComponent getPropertySetter(final ComponentLinkRequest req) throws Exception {
+        if (req.name == null) {
+            return getUnnamedPropertySetter(req);
         }
-        return getNamedPropertySetter(callSiteDescriptor, linkerServices, operations, name);
+        return getNamedPropertySetter(req);
     }
 
-    private GuardedInvocationComponent getUnnamedPropertySetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations) throws Exception {
+    private GuardedInvocationComponent getUnnamedPropertySetter(final ComponentLinkRequest req) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
         // Must have three arguments: target object, property name, and property value.
         assertParameterCount(callSiteDescriptor, 3);
 
@@ -501,6 +566,7 @@
         // invoked, we'll conservatively presume Object return type. The one exception is void return.
         final MethodType origType = callSiteDescriptor.getMethodType();
         final MethodType type = origType.returnType() == void.class ? origType : origType.changeReturnType(Object.class);
+        final LinkerServices linkerServices = req.linkerServices;
 
         // What's below is basically:
         //   foldArguments(guardWithTest(isNotNull, invoke, null|nextComponent.invocation),
@@ -527,11 +593,10 @@
         // Handle to invoke the setter, dropping unnecessary fold arguments R(MethodHandle, O, N, V)
         final MethodHandle invokeHandleFolded = MethodHandles.dropArguments(invokeHandle, 2, type.parameterType(
                 1));
-        final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
-                linkerServices, operations, null);
+        final GuardedInvocationComponent nextComponent = getNextComponent(req);
 
         final MethodHandle fallbackFolded;
-        if(nextComponent == null) {
+        if (nextComponent == null) {
             // Object(MethodHandle)->Object(MethodHandle, O, N, V); returns constant null
             fallbackFolded = MethodHandles.dropArguments(CONSTANT_NULL_DROP_METHOD_HANDLE, 1,
                     type.parameterList()).asType(type.insertParameterTypes(0, MethodHandle.class));
@@ -551,19 +616,19 @@
         return nextComponent.compose(compositeSetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
     }
 
-    private GuardedInvocationComponent getNamedPropertySetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations, final Object name) throws Exception {
+    private GuardedInvocationComponent getNamedPropertySetter(final ComponentLinkRequest req) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
         // Must have two arguments: target object and property value
         assertParameterCount(callSiteDescriptor, 2);
-        final GuardedInvocation gi = createGuardedDynamicMethodInvocation(callSiteDescriptor, linkerServices,
-                name.toString(), propertySetters);
+        final GuardedInvocation gi = createGuardedDynamicMethodInvocation(callSiteDescriptor, req.linkerServices,
+                req.name.toString(), propertySetters);
         // If we have a property setter with this name, this composite operation will always stop here
         if(gi != null) {
             return new GuardedInvocationComponent(gi, clazz, ValidationType.EXACT_CLASS);
         }
         // If we don't have a property setter with this name, always fall back to the next operation in the
         // composite (if any)
-        return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, operations, name);
+        return getNextComponent(req);
     }
 
     private static final Lookup privateLookup = new Lookup(MethodHandles.lookup());
@@ -576,20 +641,18 @@
             "getTarget", MethodType.methodType(MethodHandle.class, CallSiteDescriptor.class, LinkerServices.class));
     private static final MethodHandle GETTER_INVOKER = MethodHandles.invoker(MethodType.methodType(Object.class, Object.class));
 
-    private GuardedInvocationComponent getPropertyGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops, final Object name) throws Exception {
-        if (name == null) {
-            return getUnnamedPropertyGetter(callSiteDescriptor, linkerServices, ops);
+    private GuardedInvocationComponent getPropertyGetter(final ComponentLinkRequest req) throws Exception {
+        if (req.name == null) {
+            return getUnnamedPropertyGetter(req);
         }
-
-        return getNamedPropertyGetter(callSiteDescriptor, linkerServices, ops, name);
+        return getNamedPropertyGetter(req);
     }
 
-    private GuardedInvocationComponent getUnnamedPropertyGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops) throws Exception {
+    private GuardedInvocationComponent getUnnamedPropertyGetter(final ComponentLinkRequest req) throws Exception {
         // Since we can't know what kind of a getter we'll get back on different invocations, we'll just
         // conservatively presume Object. Note we can't just coerce to a narrower call site type as the linking
         // runtime might not allow coercing at that call site.
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
         final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
         // Must have exactly two arguments: receiver and name
         assertParameterCount(callSiteDescriptor, 2);
@@ -600,6 +663,7 @@
         // AnnotatedDynamicMethod; if it is non-null, invoke its "handle" field, otherwise either return null,
         // or delegate to next component's invocation.
 
+        final LinkerServices linkerServices = req.linkerServices;
         final MethodHandle typedGetter = linkerServices.asType(getPropertyGetterHandle, type.changeReturnType(
                 AnnotatedDynamicMethod.class));
         final MethodHandle callSiteBoundMethodGetter = MethodHandles.insertArguments(
@@ -613,8 +677,7 @@
         // Object(AnnotatedDynamicMethod, T0)->Object(AnnotatedDynamicMethod, T0, T1)
         final MethodHandle invokeHandleFolded = MethodHandles.dropArguments(invokeHandleTyped, 2,
                 type.parameterType(1));
-        final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
-                linkerServices, ops, null);
+        final GuardedInvocationComponent nextComponent = getNextComponent(req);
 
         final MethodHandle fallbackFolded;
         if(nextComponent == null) {
@@ -639,17 +702,17 @@
         return nextComponent.compose(compositeGetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
     }
 
-    private GuardedInvocationComponent getNamedPropertyGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops, final Object name) throws Exception {
+    private GuardedInvocationComponent getNamedPropertyGetter(final ComponentLinkRequest req) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
         // Must have exactly one argument: receiver
         assertParameterCount(callSiteDescriptor, 1);
         // Fixed name
-        final AnnotatedDynamicMethod annGetter = propertyGetters.get(name.toString());
+        final AnnotatedDynamicMethod annGetter = propertyGetters.get(req.name.toString());
         if(annGetter == null) {
             // We have no such property, always delegate to the next component operation
-            return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, ops, name);
+            return getNextComponent(req);
         }
-        final MethodHandle getter = annGetter.getInvocation(callSiteDescriptor, linkerServices);
+        final MethodHandle getter = annGetter.getInvocation(req);
         // NOTE: since property getters (not field getters!) are no-arg, we don't have to worry about them being
         // overloaded in a subclass. Therefore, we can discover the most abstract superclass that has the
         // method, and use that as the guard with Guards.isInstance() for a more stably linked call site. If
@@ -686,28 +749,27 @@
             MethodType.methodType(boolean.class, Object.class));
     private static final MethodHandle OBJECT_IDENTITY = MethodHandles.identity(Object.class);
 
-    private GuardedInvocationComponent getMethodGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops, final Object name) throws Exception {
+    private GuardedInvocationComponent getMethodGetter(final ComponentLinkRequest req) throws Exception {
+        if (req.name == null) {
+            return getUnnamedMethodGetter(req);
+        }
+        return getNamedMethodGetter(req);
+    }
+
+    private static MethodType getMethodGetterType(final ComponentLinkRequest req) {
         // The created method handle will always return a DynamicMethod (or null), but since we don't want that type to
         // be visible outside of this linker, declare it to return Object.
-        final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
-        if (name == null) {
-            return getUnnamedMethodGetter(callSiteDescriptor, linkerServices, ops, type);
-        }
-
-        return getNamedMethodGetter(callSiteDescriptor, linkerServices, ops, name, type);
+        return req.getDescriptor().getMethodType().changeReturnType(Object.class);
     }
 
-    private GuardedInvocationComponent getUnnamedMethodGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops, final MethodType type) throws Exception {
+    private GuardedInvocationComponent getUnnamedMethodGetter(final ComponentLinkRequest req) throws Exception {
         // Must have exactly two arguments: receiver and name
-        assertParameterCount(callSiteDescriptor, 2);
-        final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
-                linkerServices, ops, null);
-        if(nextComponent == null || !InternalTypeUtilities.areAssignable(DynamicMethod.class,
-                nextComponent.getGuardedInvocation().getInvocation().type().returnType())) {
-            // No next component operation, or it can never produce a dynamic method; just return a component
-            // for this operation.
+        assertParameterCount(req.getDescriptor(), 2);
+        final GuardedInvocationComponent nextComponent = getNextComponent(req);
+        final LinkerServices linkerServices = req.linkerServices;
+        final MethodType type = getMethodGetterType(req);
+        if(nextComponent == null) {
+            // No next component operation; just return a component for this operation.
             return getClassGuardedInvocationComponent(linkerServices.asType(getDynamicMethod, type), type);
         }
 
@@ -728,25 +790,28 @@
         final MethodHandle nextCombinedInvocation = MethodHandles.dropArguments(nextComponentInvocation, 0,
                 Object.class);
         // Assemble it all into a fold(guard(isNotNull, identity, nextInvocation), get)
+        // Note that nextCombinedInvocation needs to have its return type changed to Object
         final MethodHandle compositeGetter = MethodHandles.foldArguments(MethodHandles.guardWithTest(
-                IS_DYNAMIC_METHOD, returnMethodHandle, nextCombinedInvocation), typedGetter);
+                IS_DYNAMIC_METHOD, returnMethodHandle,
+                nextCombinedInvocation.asType(nextCombinedInvocation.type().changeReturnType(Object.class))),
+                typedGetter);
 
         return nextComponent.compose(compositeGetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
     }
 
-    private GuardedInvocationComponent getNamedMethodGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> ops, final Object name, final MethodType type)
+    private GuardedInvocationComponent getNamedMethodGetter(final ComponentLinkRequest req)
             throws Exception {
         // Must have exactly one argument: receiver
-        assertParameterCount(callSiteDescriptor, 1);
-        final DynamicMethod method = getDynamicMethod(name.toString());
+        assertParameterCount(req.getDescriptor(), 1);
+        final DynamicMethod method = getDynamicMethod(req.name.toString());
         if(method == null) {
             // We have no such method, always delegate to the next component
-            return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, ops, name);
+            return getNextComponent(req);
         }
         // No delegation to the next component of the composite operation; if we have a method with that name,
         // we'll always return it at this point.
-        return getClassGuardedInvocationComponent(linkerServices.asType(MethodHandles.dropArguments(
+        final MethodType type = getMethodGetterType(req);
+        return getClassGuardedInvocationComponent(req.linkerServices.asType(MethodHandles.dropArguments(
                 MethodHandles.constant(Object.class, method), 0, type.parameterType(0)), type), type);
     }
 
@@ -876,8 +941,8 @@
             this.validationType = validationType;
         }
 
-        MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) {
-            return method.getInvocation(callSiteDescriptor, linkerServices);
+        MethodHandle getInvocation(final ComponentLinkRequest req) {
+            return method.getInvocation(req.getDescriptor(), req.linkerServices);
         }
 
         @SuppressWarnings("unused")
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -88,6 +88,7 @@
 import java.lang.invoke.MethodType;
 import java.lang.reflect.Array;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import jdk.dynalink.CallSiteDescriptor;
@@ -129,25 +130,21 @@
     }
 
     @Override
-    protected GuardedInvocationComponent getGuardedInvocationComponent(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations, final Object name) throws Exception {
-        final GuardedInvocationComponent superGic = super.getGuardedInvocationComponent(callSiteDescriptor,
-                linkerServices, operations, name);
+    protected GuardedInvocationComponent getGuardedInvocationComponent(final ComponentLinkRequest req) throws Exception {
+        final GuardedInvocationComponent superGic = super.getGuardedInvocationComponent(req);
         if(superGic != null) {
             return superGic;
         }
-        if(operations.isEmpty()) {
-            return null;
-        }
-        final Operation op = operations.get(0);
-        if(op == StandardOperation.GET_ELEMENT) {
-            return getElementGetter(callSiteDescriptor, linkerServices, pop(operations), name);
-        }
-        if(op == StandardOperation.SET_ELEMENT) {
-            return getElementSetter(callSiteDescriptor, linkerServices, pop(operations), name);
-        }
-        if(op == StandardOperation.GET_LENGTH) {
-            return getLengthGetter(callSiteDescriptor);
+        if (!req.operations.isEmpty()) {
+            final Operation op = req.operations.get(0);
+            if (op instanceof StandardOperation) {
+                switch ((StandardOperation)op) {
+                case GET_ELEMENT: return getElementGetter(req.popOperations());
+                case SET_ELEMENT: return getElementSetter(req.popOperations());
+                case GET_LENGTH:  return getLengthGetter(req.getDescriptor());
+                default:
+                }
+            }
         }
         return null;
     }
@@ -166,16 +163,31 @@
     private static final MethodHandle LIST_GUARD = Guards.getInstanceOfGuard(List.class);
     private static final MethodHandle MAP_GUARD = Guards.getInstanceOfGuard(Map.class);
 
+    private static final MethodHandle NULL_GETTER_1;
+    private static final MethodHandle NULL_GETTER_2;
+    static {
+        final MethodHandle constantNull = MethodHandles.constant(Object.class, null);
+        NULL_GETTER_1 = dropObjectArguments(constantNull, 1);
+        NULL_GETTER_2 = dropObjectArguments(constantNull, 2);
+    }
+
+    private static MethodHandle dropObjectArguments(final MethodHandle m, final int n) {
+        return MethodHandles.dropArguments(m, 0, Collections.nCopies(n, Object.class));
+    }
+
     private enum CollectionType {
         ARRAY, LIST, MAP
     };
 
-    private GuardedInvocationComponent getElementGetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations, final Object name) throws Exception {
+    private GuardedInvocationComponent getElementGetter(final ComponentLinkRequest req) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
+        final Object name = req.name;
+        final boolean isFixedKey = name != null;
+        assertParameterCount(callSiteDescriptor, isFixedKey ? 1 : 2);
+        final LinkerServices linkerServices = req.linkerServices;
         final MethodType callSiteType = callSiteDescriptor.getMethodType();
         final Class<?> declaredType = callSiteType.parameterType(0);
-        final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
-                linkerServices, operations, name);
+        final GuardedInvocationComponent nextComponent = getNextComponent(req);
 
         // If declared type of receiver at the call site is already an array, a list or map, bind without guard. Thing
         // is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance they're
@@ -211,12 +223,14 @@
 
         // Convert the key to a number if we're working with a list or array
         final Object typedName;
-        if(collectionType != CollectionType.MAP && name != null) {
-            typedName = convertKeyToInteger(name, linkerServices);
-            if(typedName == null) {
-                // key is not numeric, it can never succeed
+        if (collectionType != CollectionType.MAP && isFixedKey) {
+            final Integer integer = convertKeyToInteger(name, linkerServices);
+            if (integer == null || integer.intValue() < 0) {
+                // key is not a non-negative integer, it can never address an
+                // array or list element
                 return nextComponent;
             }
+            typedName = integer;
         } else {
             typedName = name;
         }
@@ -225,30 +239,33 @@
         final Binder binder = new Binder(linkerServices, callSiteType, typedName);
         final MethodHandle invocation = gi.getInvocation();
 
-        if(nextComponent == null) {
-            return gic.replaceInvocation(binder.bind(invocation));
-        }
-
         final MethodHandle checkGuard;
         switch(collectionType) {
         case LIST:
-            checkGuard = convertArgToInt(RANGE_CHECK_LIST, linkerServices, callSiteDescriptor);
+            checkGuard = convertArgToNumber(RANGE_CHECK_LIST, linkerServices, callSiteDescriptor);
             break;
         case MAP:
-            // TODO: A more complex solution could be devised for maps, one where we do a get() first, and fold it
-            // into a GWT that tests if it returned null, and if it did, do another GWT with containsKey()
-            // that returns constant null (on true), or falls back to next component (on false)
             checkGuard = linkerServices.filterInternalObjects(CONTAINS_MAP);
             break;
         case ARRAY:
-            checkGuard = convertArgToInt(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
+            checkGuard = convertArgToNumber(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
             break;
         default:
             throw new AssertionError();
         }
+
+        // If there's no next component, produce a fixed null-returning one
+        final GuardedInvocationComponent finalNextComponent;
+        if (nextComponent != null) {
+            finalNextComponent = nextComponent;
+        } else {
+            final MethodHandle nullGetterHandle = isFixedKey ? NULL_GETTER_1 : NULL_GETTER_2;
+            finalNextComponent = createGuardedInvocationComponentAsType(nullGetterHandle, callSiteType, linkerServices);
+        }
+
         final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
-                nextComponent.getGuardedInvocation().getInvocation());
-        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
+                finalNextComponent.getGuardedInvocation().getInvocation());
+        return finalNextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
                 gic.getValidatorClass(), gic.getValidationType());
     }
 
@@ -257,6 +274,11 @@
         return new GuardedInvocationComponent(linkerServices.filterInternalObjects(invocation));
     }
 
+    private static GuardedInvocationComponent createGuardedInvocationComponentAsType(
+            final MethodHandle invocation, final MethodType fromType, final LinkerServices linkerServices) {
+        return new GuardedInvocationComponent(linkerServices.asType(invocation, fromType));
+    }
+
     private static GuardedInvocationComponent createInternalFilteredGuardedInvocationComponent(
             final MethodHandle invocation, final MethodHandle guard, final Class<?> validatorClass,
             final ValidationType validationType, final LinkerServices linkerServices) {
@@ -310,7 +332,7 @@
         return intIndex;
     }
 
-    private static MethodHandle convertArgToInt(final MethodHandle mh, final LinkerServices ls, final CallSiteDescriptor desc) {
+    private static MethodHandle convertArgToNumber(final MethodHandle mh, final LinkerServices ls, final CallSiteDescriptor desc) {
         final Class<?> sourceType = desc.getMethodType().parameterType(1);
         if(TypeUtilities.isMethodInvocationConvertible(sourceType, Number.class)) {
             return mh;
@@ -366,14 +388,10 @@
         }
         final Number n = (Number)index;
         final int intIndex = n.intValue();
-        final double doubleValue = n.doubleValue();
-        if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinite trigger IOOBE
+        if (intIndex != n.doubleValue()) {
             return false;
         }
-        if(0 <= intIndex && intIndex < Array.getLength(array)) {
-            return true;
-        }
-        throw new ArrayIndexOutOfBoundsException("Array index out of range: " + n);
+        return 0 <= intIndex && intIndex < Array.getLength(array);
     }
 
     @SuppressWarnings("unused")
@@ -383,14 +401,14 @@
         }
         final Number n = (Number)index;
         final int intIndex = n.intValue();
-        final double doubleValue = n.doubleValue();
-        if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinite trigger IOOBE
+        if (intIndex != n.doubleValue()) {
             return false;
         }
-        if(0 <= intIndex && intIndex < list.size()) {
-            return true;
-        }
-        throw new IndexOutOfBoundsException("Index: " + n + ", Size: " + list.size());
+        return 0 <= intIndex && intIndex < list.size();
+    }
+
+    @SuppressWarnings("unused")
+    private static void noOpSetter() {
     }
 
     private static final MethodHandle SET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "set",
@@ -399,8 +417,20 @@
     private static final MethodHandle PUT_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "put",
             MethodType.methodType(Object.class, Object.class, Object.class));
 
-    private GuardedInvocationComponent getElementSetter(final CallSiteDescriptor callSiteDescriptor,
-            final LinkerServices linkerServices, final List<Operation> operations, final Object name) throws Exception {
+    private static final MethodHandle NO_OP_SETTER_2;
+    private static final MethodHandle NO_OP_SETTER_3;
+    static {
+        final MethodHandle noOpSetter = Lookup.findOwnStatic(MethodHandles.lookup(), "noOpSetter", void.class);
+        NO_OP_SETTER_2 = dropObjectArguments(noOpSetter, 2);
+        NO_OP_SETTER_3 = dropObjectArguments(noOpSetter, 3);
+    }
+
+    private GuardedInvocationComponent getElementSetter(final ComponentLinkRequest req) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = req.getDescriptor();
+        final Object name = req.name;
+        final boolean isFixedKey = name != null;
+        assertParameterCount(callSiteDescriptor, isFixedKey ? 2 : 3);
+        final LinkerServices linkerServices = req.linkerServices;
         final MethodType callSiteType = callSiteDescriptor.getMethodType();
         final Class<?> declaredType = callSiteType.parameterType(0);
 
@@ -441,20 +471,21 @@
         // In contrast to, say, getElementGetter, we only compute the nextComponent if the target object is not a map,
         // as maps will always succeed in setting the element and will never need to fall back to the next component
         // operation.
-        final GuardedInvocationComponent nextComponent = collectionType == CollectionType.MAP ? null : getGuardedInvocationComponent(
-                callSiteDescriptor, linkerServices, operations, name);
+        final GuardedInvocationComponent nextComponent = collectionType == CollectionType.MAP ? null : getNextComponent(req);
         if(gic == null) {
             return nextComponent;
         }
 
         // Convert the key to a number if we're working with a list or array
         final Object typedName;
-        if(collectionType != CollectionType.MAP && name != null) {
-            typedName = convertKeyToInteger(name, linkerServices);
-            if(typedName == null) {
-                // key is not numeric, it can never succeed
+        if (collectionType != CollectionType.MAP && isFixedKey) {
+            final Integer integer = convertKeyToInteger(name, linkerServices);
+            if (integer == null || integer.intValue() < 0) {
+                // key is not a non-negative integer, it can never address an
+                // array or list element
                 return nextComponent;
             }
+            typedName = integer;
         } else {
             typedName = name;
         }
@@ -463,16 +494,27 @@
         final Binder binder = new Binder(linkerServices, callSiteType, typedName);
         final MethodHandle invocation = gi.getInvocation();
 
-        if(nextComponent == null) {
+        if (collectionType == CollectionType.MAP) {
+            assert nextComponent == null;
             return gic.replaceInvocation(binder.bind(invocation));
         }
 
         assert collectionType == CollectionType.LIST || collectionType == CollectionType.ARRAY;
-        final MethodHandle checkGuard = convertArgToInt(collectionType == CollectionType.LIST ? RANGE_CHECK_LIST :
+        final MethodHandle checkGuard = convertArgToNumber(collectionType == CollectionType.LIST ? RANGE_CHECK_LIST :
             RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
+
+        // If there's no next component, produce a no-op one.
+        final GuardedInvocationComponent finalNextComponent;
+        if (nextComponent != null) {
+            finalNextComponent = nextComponent;
+        } else {
+            final MethodHandle noOpSetterHandle = isFixedKey ? NO_OP_SETTER_2 : NO_OP_SETTER_3;
+            finalNextComponent = createGuardedInvocationComponentAsType(noOpSetterHandle, callSiteType, linkerServices);
+        }
+
         final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
-                nextComponent.getGuardedInvocation().getInvocation());
-        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
+                finalNextComponent.getGuardedInvocation().getInvocation());
+        return finalNextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
                 gic.getValidatorClass(), gic.getValidationType());
     }
 
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeansLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeansLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -146,7 +146,11 @@
  * are otherwise public and link requests have call site descriptors carrying
  * full-strength {@link Lookup} objects and not weakened lookups or the public
  * lookup.</p>
- * <p>The class also exposes various static methods for discovery of available
+ * <p><strong>The behavior for handling missing members</strong> can be
+ * customized by passing a {@link MissingMemberHandlerFactory} to the
+ * {@link BeansLinker#BeansLinker(MissingMemberHandlerFactory) constructor}.
+ * </p>
+ * <p>The class also exposes various methods for discovery of available
  * property and method names on classes and class instances, as well as access
  * to per-class linkers using the {@link #getLinkerForClass(Class)}
  * method.</p>
@@ -164,10 +168,27 @@
         }
     };
 
+    private final MissingMemberHandlerFactory missingMemberHandlerFactory;
+
     /**
-     * Creates a new beans linker.
+     * Creates a new beans linker. Equivalent to
+     * {@link BeansLinker#BeansLinker(MissingMemberHandlerFactory)} with
+     * {@code null} passed as the missing member handler factory, resulting in
+     * the default behavior for linking and evaluating missing members.
      */
     public BeansLinker() {
+        this(null);
+    }
+
+    /**
+     * Creates a new beans linker with the specified factory for creating
+     * missing member handlers. The passed factory can be null if the default
+     * behavior is adequate. See {@link MissingMemberHandlerFactory} for details.
+     * @param missingMemberHandlerFactory a factory for creating handlers for
+     * operations on missing members.
+     */
+    public BeansLinker(final MissingMemberHandlerFactory missingMemberHandlerFactory) {
+        this.missingMemberHandlerFactory = missingMemberHandlerFactory;
     }
 
     /**
@@ -178,7 +199,37 @@
      * @param clazz the class
      * @return a bean linker for that class
      */
-    public static TypeBasedGuardingDynamicLinker getLinkerForClass(final Class<?> clazz) {
+    public TypeBasedGuardingDynamicLinker getLinkerForClass(final Class<?> clazz) {
+        final TypeBasedGuardingDynamicLinker staticLinker = getStaticLinkerForClass(clazz);
+        if (missingMemberHandlerFactory == null) {
+            return staticLinker;
+        }
+        return new NoSuchMemberHandlerBindingLinker(staticLinker, missingMemberHandlerFactory);
+    }
+
+    private static class NoSuchMemberHandlerBindingLinker implements TypeBasedGuardingDynamicLinker {
+        private final TypeBasedGuardingDynamicLinker linker;
+        private final MissingMemberHandlerFactory missingMemberHandlerFactory;
+
+        NoSuchMemberHandlerBindingLinker(final TypeBasedGuardingDynamicLinker linker, final MissingMemberHandlerFactory missingMemberHandlerFactory) {
+            this.linker = linker;
+            this.missingMemberHandlerFactory = missingMemberHandlerFactory;
+        }
+
+        @Override
+        public boolean canLinkType(final Class<?> type) {
+            return linker.canLinkType(type);
+        }
+
+        @Override
+        public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+            return linker.getGuardedInvocation(linkRequest,
+                    LinkerServicesWithMissingMemberHandlerFactory.get(
+                            linkerServices, missingMemberHandlerFactory));
+        }
+    }
+
+    static TypeBasedGuardingDynamicLinker getStaticLinkerForClass(final Class<?> clazz) {
         return linkers.get(clazz);
     }
 
@@ -234,7 +285,7 @@
      * @return a set of names of all readable instance properties of a class.
      */
     public static Set<String> getReadableInstancePropertyNames(final Class<?> clazz) {
-        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        final TypeBasedGuardingDynamicLinker linker = getStaticLinkerForClass(clazz);
         if(linker instanceof BeanLinker) {
             return ((BeanLinker)linker).getReadablePropertyNames();
         }
@@ -247,7 +298,7 @@
      * @return a set of names of all writable instance properties of a class.
      */
     public static Set<String> getWritableInstancePropertyNames(final Class<?> clazz) {
-        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        final TypeBasedGuardingDynamicLinker linker = getStaticLinkerForClass(clazz);
         if(linker instanceof BeanLinker) {
             return ((BeanLinker)linker).getWritablePropertyNames();
         }
@@ -260,7 +311,7 @@
      * @return a set of names of all instance methods of a class.
      */
     public static Set<String> getInstanceMethodNames(final Class<?> clazz) {
-        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        final TypeBasedGuardingDynamicLinker linker = getStaticLinkerForClass(clazz);
         if(linker instanceof BeanLinker) {
             return ((BeanLinker)linker).getMethodNames();
         }
@@ -302,6 +353,8 @@
             // Can't operate on null
             return null;
         }
-        return getLinkerForClass(receiver.getClass()).getGuardedInvocation(request, linkerServices);
+        return getLinkerForClass(receiver.getClass()).getGuardedInvocation(request,
+                LinkerServicesWithMissingMemberHandlerFactory.get(linkerServices,
+                        missingMemberHandlerFactory));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/LinkerServicesWithMissingMemberHandlerFactory.java	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,80 @@
+/*
+ * 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.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
+import jdk.dynalink.linker.ConversionComparator.Comparison;
+import jdk.dynalink.linker.GuardedInvocation;
+import jdk.dynalink.linker.LinkRequest;
+import jdk.dynalink.linker.LinkerServices;
+
+final class LinkerServicesWithMissingMemberHandlerFactory implements LinkerServices {
+    final LinkerServices linkerServices;
+    final MissingMemberHandlerFactory missingMemberHandlerFactory;
+
+    static LinkerServices get(final LinkerServices linkerServices, final MissingMemberHandlerFactory missingMemberHandlerFactory) {
+        if (missingMemberHandlerFactory == null) {
+            return linkerServices;
+        }
+        return new LinkerServicesWithMissingMemberHandlerFactory(linkerServices, missingMemberHandlerFactory);
+    }
+
+    private LinkerServicesWithMissingMemberHandlerFactory(final LinkerServices linkerServices, final MissingMemberHandlerFactory missingMemberHandlerFactory) {
+        this.linkerServices = linkerServices;
+        this.missingMemberHandlerFactory = missingMemberHandlerFactory;
+    }
+
+    @Override
+    public MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
+        return linkerServices.asType(handle, fromType);
+    }
+
+    @Override
+    public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
+        return linkerServices.getTypeConverter(sourceType, targetType);
+    }
+
+    @Override
+    public boolean canConvert(final Class<?> from, final Class<?> to) {
+        return linkerServices.canConvert(from, to);
+    }
+
+    @Override
+    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
+        return linkerServices.getGuardedInvocation(linkRequest);
+    }
+
+    @Override
+    public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
+        return linkerServices.compareConversion(sourceType, targetType1, targetType2);
+    }
+
+    @Override
+    public MethodHandle filterInternalObjects(final MethodHandle target) {
+        return linkerServices.filterInternalObjects(target);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/MissingMemberHandlerFactory.java	Thu Jan 21 14:49:02 2016 -0800
@@ -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.  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.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import jdk.dynalink.DynamicLinkerFactory;
+import jdk.dynalink.NamedOperation;
+import jdk.dynalink.NoSuchDynamicMethodException;
+import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.LinkRequest;
+import jdk.dynalink.linker.LinkerServices;
+
+/**
+ * A factory for creating method handles for linking missing member behavior
+ * in {@link BeansLinker}. BeansLinker links these method handles into guarded
+ * invocations for link requests specifying {@code GET_*} and {@code SET_*}
+ * {@link StandardOperation}s when it is either certain or possible that the
+ * requested member (property, method, or element) is missing. They will be
+ * linked both for {@link NamedOperation named} and unnamed operations. The
+ * implementer must ensure that the parameter types of the returned method
+ * handle match the parameter types of the call site described in the link
+ * request. The return types can differ, though, to allow
+ * {@link DynamicLinkerFactory#setPrelinkTransformer(jdk.dynalink.linker.GuardedInvocationTransformer)}
+ * late return type transformations}. It is allowed to return {@code null} for a
+ * method handle if the default behavior is sufficient.
+ * <h2>Default missing member behavior</h2>
+ * When a {@link BeansLinker} is configured without a missing member handler
+ * factory, or the factory returns {@code null} for a particular handler
+ * creation invocation, the default behavior is used. The default behavior is to
+ * return {@code null} from
+ * {@link BeansLinker#getGuardedInvocation(LinkRequest, LinkerServices)} when it
+ * can be determined at link time that the linked operation will never address
+ * an existing member. This lets the {@code DynamicLinker} attempt the next
+ * linker if there is one, or ultimately fail the link request with
+ * {@link NoSuchDynamicMethodException}. For other cases (typically all unnamed
+ * member operations as well as most named operations on collection elements)
+ * {@code BeansLinker} will produce a conditional linkage that will return
+ * {@code null} when invoked at runtime with a name that does not match any
+ * member for getters and silently ignore the passed values for setters.
+ * <h2>Implementing exception-throwing behavior</h2>
+ * Note that if the language-specific behavior for an operation on a missing
+ * member is to throw an exception then the factory should produce a method
+ * handle that throws the exception when invoked, and must not throw an
+ * exception itself, as the linkage for the missing member is often conditional.
+ *
+ * @see BeansLinker#BeansLinker(MissingMemberHandlerFactory)
+ */
+@FunctionalInterface
+public interface MissingMemberHandlerFactory {
+    /**
+     * Returns a method handle suitable for implementing missing member behavior
+     * for a particular link request. See the class description for details.
+     * @param linkRequest the current link request
+     * @param linkerServices the current link services
+     * @return a method handle that can be invoked if the property, element, or
+     * method being addressed by an operation is missing. The return value can
+     * be null.
+     * @throws Exception if the operation fails for any reason. Please observe
+     * the class documentation notes for implementing exception-throwing
+     * missing member behavior.
+     */
+    public MethodHandle createMissingMemberHandler(LinkRequest linkRequest, LinkerServices linkerServices) throws Exception;
+}
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/StaticClassLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/StaticClassLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -91,6 +91,7 @@
 import java.util.Set;
 import jdk.dynalink.CallSiteDescriptor;
 import jdk.dynalink.NamedOperation;
+import jdk.dynalink.Operation;
 import jdk.dynalink.StandardOperation;
 import jdk.dynalink.beans.GuardedInvocationComponent.ValidationType;
 import jdk.dynalink.linker.GuardedInvocation;
@@ -162,6 +163,27 @@
         }
 
         @Override
+        protected GuardedInvocationComponent getGuardedInvocationComponent(final ComponentLinkRequest req) throws Exception {
+            final GuardedInvocationComponent superGic = super.getGuardedInvocationComponent(req);
+            if (superGic != null) {
+                return superGic;
+            }
+            if (!req.operations.isEmpty()) {
+                final Operation op = req.operations.get(0);
+                if (op instanceof StandardOperation) {
+                    switch ((StandardOperation)op) {
+                    case GET_ELEMENT:
+                    case SET_ELEMENT:
+                        // StaticClass doesn't behave as a collection
+                        return getNextComponent(req.popOperations());
+                    default:
+                    }
+                }
+            }
+            return null;
+        }
+
+        @Override
         SingleDynamicMethod getConstructorMethod(final String signature) {
             return constructor != null? constructor.getMethodForExactParamTypes(signature) : null;
         }
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/GuardedInvocation.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/GuardedInvocation.java	Thu Jan 21 14:49:02 2016 -0800
@@ -202,6 +202,9 @@
         this.invocation = Objects.requireNonNull(invocation);
         this.guard = guard;
         this.switchPoints = switchPoint == null ? null : new SwitchPoint[] { switchPoint };
+        if (exception != null && !Throwable.class.isAssignableFrom(exception)) {
+            throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable");
+        }
         this.exception = exception;
     }
 
@@ -228,6 +231,9 @@
         this.invocation = Objects.requireNonNull(invocation);
         this.guard = guard;
         this.switchPoints = switchPoints == null ? null : switchPoints.clone();
+        if (exception != null && !Throwable.class.isAssignableFrom(exception)) {
+            throw new IllegalArgumentException(exception.getName() + " is not assignable from Throwable");
+        }
         this.exception = exception;
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Thu Jan 21 14:49:02 2016 -0800
@@ -1133,6 +1133,8 @@
             return NativeNumber.lookupPrimitive(request, self);
         } else if (self instanceof Boolean) {
             return NativeBoolean.lookupPrimitive(request, self);
+        } else if (self instanceof Symbol) {
+            return NativeSymbol.lookupPrimitive(request, self);
         }
         throw new IllegalArgumentException("Unsupported primitive: " + self);
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java	Thu Jan 21 14:49:02 2016 -0800
@@ -284,8 +284,8 @@
         // Step 3c and 3d - get new length and convert to long
         final long newLen = NativeArray.validLength(newLenDesc.getValue());
 
-        // Step 3e
-        newLenDesc.setValue(newLen);
+        // 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));
 
         // Step 3f
         // increasing array length - just need to set new length value (and attributes if any) and return
@@ -918,21 +918,6 @@
      * @throws ClassCastException if array is empty, facilitating Undefined return value
      */
     @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class)
-    public static long popLong(final Object self) {
-        //must be non empty Int or LongArrayData
-        return getContinuousNonEmptyArrayDataCCE(self, IntOrLongElements.class).fastPopLong();
-    }
-
-    /**
-     * Specialization of pop for ContinuousArrayData
-     *
-     * Primitive specialization, {@link LinkLogic}
-     *
-     * @param self self reference
-     * @return element popped
-     * @throws ClassCastException if array is empty, facilitating Undefined return value
-     */
-    @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class)
     public static double popDouble(final Object self) {
         //must be non empty int long or double array data
         return getContinuousNonEmptyArrayDataCCE(self, NumericElements.class).fastPopDouble();
@@ -997,7 +982,7 @@
      * @return array length after push
      */
     @SpecializedFunction(linkLogic=PushLinkLogic.class)
-    public static long push(final Object self, final int arg) {
+    public static double push(final Object self, final int arg) {
         return getContinuousArrayDataCCE(self, Integer.class).fastPush(arg);
     }
 
@@ -1011,7 +996,7 @@
      * @return array length after push
      */
     @SpecializedFunction(linkLogic=PushLinkLogic.class)
-    public static long push(final Object self, final long arg) {
+    public static double push(final Object self, final long arg) {
         return getContinuousArrayDataCCE(self, Long.class).fastPush(arg);
     }
 
@@ -1025,7 +1010,7 @@
      * @return array length after push
      */
     @SpecializedFunction(linkLogic=PushLinkLogic.class)
-    public static long push(final Object self, final double arg) {
+    public static double push(final Object self, final double arg) {
         return getContinuousArrayDataCCE(self, Double.class).fastPush(arg);
     }
 
@@ -1039,7 +1024,7 @@
      * @return array length after push
      */
     @SpecializedFunction(name="push", linkLogic=PushLinkLogic.class)
-    public static long pushObject(final Object self, final Object arg) {
+    public static double pushObject(final Object self, final Object arg) {
         return getContinuousArrayDataCCE(self, Object.class).fastPush(arg);
     }
 
@@ -1081,7 +1066,7 @@
      * @return array after pushes
      */
     @SpecializedFunction
-    public static long push(final Object self, final Object arg) {
+    public static double push(final Object self, final Object arg) {
         try {
             final ScriptObject sobj = (ScriptObject)self;
             final ArrayData arrayData = sobj.getArray();
@@ -1498,7 +1483,7 @@
      * @return index of element, or -1 if not found
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
-    public static long indexOf(final Object self, final Object searchElement, final Object fromIndex) {
+    public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) {
         try {
             final ScriptObject sobj = (ScriptObject)Global.toObject(self);
             final long         len  = JSType.toUint32(sobj.getLength());
@@ -1534,7 +1519,7 @@
      * @return index of element, or -1 if not found
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
-    public static long lastIndexOf(final Object self, final Object... args) {
+    public static double lastIndexOf(final Object self, final Object... args) {
         try {
             final ScriptObject sobj = (ScriptObject)Global.toObject(self);
             final long         len  = JSType.toUint32(sobj.getLength());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeBoolean.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeBoolean.java	Thu Jan 21 14:49:02 2016 -0800
@@ -168,9 +168,9 @@
     }
 
     /**
-     * Wrap a native string in a NativeString object.
+     * Wrap a native boolean in a NativeBoolean object.
      *
-     * @param receiver Native string.
+     * @param receiver Native boolean.
      * @return Wrapped object.
      */
     @SuppressWarnings("unused")
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java	Thu Jan 21 14:49:02 2016 -0800
@@ -256,8 +256,9 @@
      * @return a Date that points to the current moment in time
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
-    public static long now(final Object self) {
-        return System.currentTimeMillis();
+    public static double now(final Object self) {
+        // convert to double as long does not represent the primitive JS number type
+        return (double) System.currentTimeMillis();
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeNumber.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeNumber.java	Thu Jan 21 14:49:02 2016 -0800
@@ -48,6 +48,7 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.doubleconv.DoubleConversion;
+import jdk.nashorn.internal.runtime.linker.NashornGuards;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 
 /**
@@ -315,7 +316,7 @@
      * @return Link to be invoked at call site.
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
-        return PrimitiveLookup.lookupPrimitive(request, Number.class, new NativeNumber(((Number)receiver).doubleValue()), WRAPFILTER, PROTOFILTER);
+        return PrimitiveLookup.lookupPrimitive(request, NashornGuards.getNumberGuard(), new NativeNumber(((Number)receiver).doubleValue()), WRAPFILTER, PROTOFILTER);
     }
 
     @SuppressWarnings("unused")
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java	Thu Jan 21 14:49:02 2016 -0800
@@ -776,7 +776,7 @@
         final MethodType getterType = MethodType.methodType(Object.class, clazz);
         final MethodType setterType = MethodType.methodType(Object.class, clazz, Object.class);
 
-        final GuardingDynamicLinker linker = BeansLinker.getLinkerForClass(clazz);
+        final GuardingDynamicLinker linker = Bootstrap.getBeanLinkerForClass(clazz);
 
         final List<AccessorProperty> properties = new ArrayList<>(propertyNames.size() + methodNames.size());
         for(final String methodName: methodNames) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Thu Jan 21 14:49:02 2016 -0800
@@ -74,7 +74,7 @@
     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
     public static Object length(final Object self) {
         if (self instanceof ScriptObject) {
-            return JSType.toUint32(((ScriptObject)self).getArray().length());
+            return (double) JSType.toUint32(((ScriptObject)self).getArray().length());
         }
 
         return 0;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java	Thu Jan 21 14:49:02 2016 -0800
@@ -146,7 +146,7 @@
 
         if (returnType == Object.class && JSType.isString(self)) {
             try {
-                return new GuardedInvocation(MH.findStatic(MethodHandles.lookup(), NativeString.class, "get", desc.getMethodType()), NashornGuards.getInstanceOf2Guard(String.class, ConsString.class));
+                return new GuardedInvocation(MH.findStatic(MethodHandles.lookup(), NativeString.class, "get", desc.getMethodType()), NashornGuards.getStringGuard());
             } catch (final LookupException e) {
                 //empty. Shouldn't happen. Fall back to super
             }
@@ -1235,8 +1235,8 @@
      * @return Link to be invoked at call site.
      */
     public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
-        final MethodHandle guard = NashornGuards.getInstanceOf2Guard(String.class, ConsString.class);
-        return PrimitiveLookup.lookupPrimitive(request, guard, new NativeString((CharSequence)receiver), WRAPFILTER, PROTOFILTER);
+        return PrimitiveLookup.lookupPrimitive(request, NashornGuards.getStringGuard(),
+                new NativeString((CharSequence)receiver), WRAPFILTER, PROTOFILTER);
     }
 
     @SuppressWarnings("unused")
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeSymbol.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeSymbol.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,8 +25,14 @@
 
 package jdk.nashorn.internal.objects;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import jdk.dynalink.linker.GuardedInvocation;
+import jdk.dynalink.linker.LinkRequest;
 import jdk.nashorn.internal.WeakValueCache;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -39,6 +45,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.Symbol;
 import jdk.nashorn.internal.runtime.Undefined;
+import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 
 /**
  * ECMAScript 6 - 19.4 Symbol Objects
@@ -48,12 +55,21 @@
 
     private final Symbol symbol;
 
+    /** Method handle to create an object wrapper for a primitive symbol. */
+    static final MethodHandle WRAPFILTER = findOwnMH("wrapFilter", MH.type(NativeSymbol.class, Object.class));
+    /** Method handle to retrieve the Symbol prototype object. */
+    private static final MethodHandle PROTOFILTER = findOwnMH("protoFilter", MH.type(Object.class, Object.class));
+
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
     /** See ES6 19.4.2.1 */
     private static WeakValueCache<String, Symbol> globalSymbolRegistry = new WeakValueCache<>();
 
+    NativeSymbol(final Symbol symbol) {
+        this(symbol, Global.instance());
+    }
+
     NativeSymbol(final Symbol symbol, final Global global) {
         this(symbol, global.getSymbolPrototype(), $nasgenmap$);
     }
@@ -73,6 +89,17 @@
         }
     }
 
+    /**
+     * Lookup the appropriate method for an invoke dynamic call.
+     *
+     * @param request  The link request
+     * @param receiver The receiver for the call
+     * @return Link to be invoked at call site.
+     */
+    public static GuardedInvocation lookupPrimitive(final LinkRequest request, final Object receiver) {
+        return PrimitiveLookup.lookupPrimitive(request, Symbol.class, new NativeSymbol((Symbol)receiver), WRAPFILTER, PROTOFILTER);
+    }
+
     // ECMA 6 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint )
     @Override
     public Object getDefaultValue(final Class<?> typeHint) {
@@ -149,4 +176,19 @@
         final String name = ((Symbol) arg).getName();
         return globalSymbolRegistry.get(name) == arg ? name : Undefined.getUndefined();
     }
+
+    @SuppressWarnings("unused")
+    private static NativeSymbol wrapFilter(final Object receiver) {
+        return new NativeSymbol((Symbol)receiver);
+    }
+
+    @SuppressWarnings("unused")
+    private static Object protoFilter(final Object object) {
+        return Global.instance().getSymbolPrototype();
+    }
+
+    private static MethodHandle findOwnMH(final String name, final MethodType type) {
+        return MH.findStatic(MethodHandles.lookup(), NativeSymbol.class, name, type);
+    }
+
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Thu Jan 21 14:49:02 2016 -0800
@@ -178,6 +178,12 @@
     /** Method handle for void returns. */
     public static final Call VOID_RETURN = staticCall(JSTYPE_LOOKUP, JSType.class, "voidReturn", void.class);
 
+    /** Method handle for isString method */
+    public static final Call IS_STRING = staticCall(JSTYPE_LOOKUP, JSType.class, "isString", boolean.class, Object.class);
+
+    /** Method handle for isNumber method */
+    public static final Call IS_NUMBER = staticCall(JSTYPE_LOOKUP, JSType.class, "isNumber", boolean.class, Object.class);
+
     /**
      * The list of available accessor types in width order. This order is used for type guesses narrow{@literal ->} wide
      *  in the dual--fields world
@@ -280,7 +286,7 @@
             return JSType.STRING;
         }
 
-        if (obj instanceof Number) {
+        if (isNumber(obj)) {
             return JSType.NUMBER;
         }
 
@@ -322,7 +328,7 @@
             return JSType.STRING;
         }
 
-        if (obj instanceof Number) {
+        if (isNumber(obj)) {
             return JSType.NUMBER;
         }
 
@@ -434,7 +440,7 @@
         return obj == null ||
                obj == ScriptRuntime.UNDEFINED ||
                isString(obj) ||
-               obj instanceof Number ||
+               isNumber(obj) ||
                obj instanceof Boolean ||
                obj instanceof Symbol;
     }
@@ -610,6 +616,24 @@
     }
 
     /**
+     * Returns true if object represents a primitive JavaScript number value. Note that we only
+     * treat wrapper objects of Java primitive number types as objects that can be fully represented
+     * as JavaScript numbers (doubles). This means we exclude {@code long} and special purpose Number
+     * instances such as {@link java.util.concurrent.atomic.AtomicInteger}, as well as arbitrary precision
+     * numbers such as {@link java.math.BigInteger}.
+     *
+     * @param obj the object
+     * @return true if the object represents a primitive JavaScript number value.
+     */
+    public static boolean isNumber(final Object obj) {
+        if (obj != null) {
+            final Class<?> c = obj.getClass();
+            return c == Integer.class || c == Double.class || c == Float.class || c == Short.class || c == Byte.class;
+        }
+        return false;
+    }
+
+    /**
      * JavaScript compliant conversion of integer to String
      *
      * @param num an integer
@@ -761,7 +785,7 @@
         if (obj instanceof Double) {
             return (Double)obj;
         }
-        if (obj instanceof Number) {
+        if (isNumber(obj)) {
             return ((Number)obj).doubleValue();
         }
         return Double.NaN;
@@ -1337,7 +1361,7 @@
             return obj.toString();
         }
 
-        if (obj instanceof Number) {
+        if (isNumber(obj)) {
             return toString(((Number)obj).doubleValue());
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java	Thu Jan 21 14:49:02 2016 -0800
@@ -94,6 +94,9 @@
      */
     public static GuardedInvocation lookup(final CallSiteDescriptor desc) {
         final StandardOperation op = NashornCallSiteDescriptor.getFirstStandardOperation(desc);
+        if (op == null) {
+            return null;
+        }
         switch (op) {
         case CALL:
         case NEW:
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java	Thu Jan 21 14:49:02 2016 -0800
@@ -287,7 +287,7 @@
      * @param arg argument
      * @return new array length
      */
-    public long fastPush(final int arg) {
+    public double fastPush(final int arg) {
         throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
     }
 
@@ -296,7 +296,7 @@
      * @param arg argument
      * @return new array length
      */
-    public long fastPush(final long arg) {
+    public double fastPush(final long arg) {
         throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
     }
 
@@ -305,7 +305,7 @@
      * @param arg argument
      * @return new array length
      */
-    public long fastPush(final double arg) {
+    public double fastPush(final double arg) {
         throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
     }
 
@@ -314,7 +314,7 @@
      * @param arg argument
      * @return new array length
      */
-    public long fastPush(final Object arg) {
+    public double fastPush(final Object arg) {
         throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
     }
 
@@ -330,14 +330,6 @@
      * Specialization - fast pop implementation
      * @return element value
      */
-    public long fastPopLong() {
-        throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
-    }
-
-    /**
-     * Specialization - fast pop implementation
-     * @return element value
-     */
     public double fastPopDouble() {
        throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Thu Jan 21 14:49:02 2016 -0800
@@ -340,7 +340,7 @@
     }
 
     @Override
-    public long fastPush(final int arg) {
+    public double fastPush(final int arg) {
         final int len = (int)length();
         if (len == array.length) {
             array = Arrays.copyOf(array, nextSize(len));
@@ -362,11 +362,6 @@
     }
 
     @Override
-    public long fastPopLong() {
-        return fastPopInt();
-    }
-
-    @Override
     public double fastPopDouble() {
         return fastPopInt();
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Thu Jan 21 14:49:02 2016 -0800
@@ -303,17 +303,17 @@
     }
 
     @Override
-    public long fastPush(final int arg) {
+    public double fastPush(final int arg) {
         return fastPush((double)arg);
     }
 
     @Override
-    public long fastPush(final long arg) {
+    public double fastPush(final long arg) {
         return fastPush((double)arg);
     }
 
     @Override
-    public long fastPush(final double arg) {
+    public double fastPush(final double arg) {
         final int len = (int)length();
         if (len == array.length) {
            //note that fastpush never creates spares arrays, there is nothing to gain by that - it will just use even more memory
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Thu Jan 21 14:49:02 2016 -0800
@@ -236,22 +236,22 @@
     }
 
     @Override
-    public long fastPush(final int arg) {
+    public double fastPush(final int arg) {
         return fastPush((Object)arg);
     }
 
     @Override
-    public long fastPush(final long arg) {
+    public double fastPush(final long arg) {
         return fastPush((Object)arg);
     }
 
     @Override
-    public long fastPush(final double arg) {
+    public double fastPush(final double arg) {
         return fastPush((Object)arg);
     }
 
     @Override
-    public long fastPush(final Object arg) {
+    public double fastPush(final Object arg) {
         final int len = (int)length();
         if (len == array.length) {
             array = Arrays.copyOf(array, nextSize(len));
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Thu Jan 21 14:49:02 2016 -0800
@@ -40,10 +40,11 @@
 import jdk.dynalink.beans.BeansLinker;
 import jdk.dynalink.beans.StaticClass;
 import jdk.dynalink.linker.GuardedInvocation;
-import jdk.dynalink.linker.GuardedInvocationTransformer;
+import jdk.dynalink.linker.GuardingDynamicLinker;
 import jdk.dynalink.linker.LinkRequest;
 import jdk.dynalink.linker.LinkerServices;
 import jdk.dynalink.linker.MethodTypeConversionStrategy;
+import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
 import jdk.dynalink.linker.support.TypeUtilities;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
@@ -67,6 +68,24 @@
 
     private static final MethodHandle VOID_TO_OBJECT = MH.constant(Object.class, ScriptRuntime.UNDEFINED);
 
+    private static final BeansLinker beansLinker = new BeansLinker(Bootstrap::createMissingMemberHandler);
+    private static final GuardingDynamicLinker[] prioritizedLinkers;
+    private static final GuardingDynamicLinker[] fallbackLinkers;
+    static {
+        final NashornBeansLinker nashornBeansLinker = new NashornBeansLinker(beansLinker);
+        prioritizedLinkers = new GuardingDynamicLinker[] {
+            new NashornLinker(),
+            new NashornPrimitiveLinker(),
+            new NashornStaticClassLinker(beansLinker),
+            new BoundCallableLinker(),
+            new JavaSuperAdapterLinker(beansLinker),
+            new JSObjectLinker(nashornBeansLinker),
+            new BrowserJSObjectLinker(nashornBeansLinker),
+            new ReflectionCheckLinker()
+        };
+        fallbackLinkers = new GuardingDynamicLinker[] {nashornBeansLinker, new NashornBottomLinker() };
+    }
+
     // do not create me!!
     private Bootstrap() {
     }
@@ -81,31 +100,14 @@
     public static DynamicLinker createDynamicLinker(final ClassLoader appLoader,
             final int unstableRelinkThreshold) {
         final DynamicLinkerFactory factory = new DynamicLinkerFactory();
-        final NashornBeansLinker nashornBeansLinker = new NashornBeansLinker();
-        factory.setPrioritizedLinkers(
-            new NashornLinker(),
-            new NashornPrimitiveLinker(),
-            new NashornStaticClassLinker(),
-            new BoundCallableLinker(),
-            new JavaSuperAdapterLinker(),
-            new JSObjectLinker(nashornBeansLinker),
-            new BrowserJSObjectLinker(nashornBeansLinker),
-            new ReflectionCheckLinker());
-        factory.setFallbackLinkers(nashornBeansLinker, new NashornBottomLinker());
+        factory.setPrioritizedLinkers(prioritizedLinkers);
+        factory.setFallbackLinkers(fallbackLinkers);
         factory.setSyncOnRelink(true);
-        factory.setPrelinkTransformer(new GuardedInvocationTransformer() {
-            @Override
-            public GuardedInvocation filter(final GuardedInvocation inv, final LinkRequest request, final LinkerServices linkerServices) {
-                final CallSiteDescriptor desc = request.getCallSiteDescriptor();
-                return OptimisticReturnFilters.filterOptimisticReturnValue(inv, desc).asType(linkerServices, desc.getMethodType());
-            }
+        factory.setPrelinkTransformer((inv, request, linkerServices) -> {
+            final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+            return OptimisticReturnFilters.filterOptimisticReturnValue(inv, desc).asType(linkerServices, desc.getMethodType());
         });
-        factory.setAutoConversionStrategy(new MethodTypeConversionStrategy() {
-            @Override
-            public MethodHandle asType(final MethodHandle target, final MethodType newType) {
-                return unboxReturnType(target, newType);
-            }
-        });
+        factory.setAutoConversionStrategy(Bootstrap::unboxReturnType);
         factory.setInternalObjectsFilter(NashornBeansLinker.createHiddenObjectFilter());
         factory.setUnstableRelinkThreshold(unstableRelinkThreshold);
 
@@ -115,6 +117,15 @@
     }
 
     /**
+     * Returns a dynamic linker for the specific Java class using beans semantics.
+     * @param clazz the Java class
+     * @return a dynamic linker for the specific Java class using beans semantics.
+     */
+    public static TypeBasedGuardingDynamicLinker getBeanLinkerForClass(final Class<?> clazz) {
+        return beansLinker.getLinkerForClass(clazz);
+    }
+
+    /**
      * Returns if the given object is a "callable"
      * @param obj object to be checked for callability
      * @return true if the obj is callable
@@ -475,4 +486,14 @@
         }
         return target;
     }
+
+    private static MethodHandle createMissingMemberHandler(
+            final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+        if (BrowserJSObjectLinker.canLinkTypeStatic(linkRequest.getReceiver().getClass())) {
+            // Don't create missing member handlers for the browser JS objects as they
+            // have their own logic.
+            return null;
+        }
+        return NashornBottomLinker.linkMissingBeanMember(linkRequest, linkerServices);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
-import static jdk.nashorn.internal.lookup.Lookup.EMPTY_GETTER;
 import static jdk.nashorn.internal.runtime.linker.JavaAdapterBytecodeGenerator.SUPER_PREFIX;
 
 import java.lang.invoke.MethodHandle;
@@ -62,6 +61,12 @@
         IS_ADAPTER_OF_CLASS = lookup.findOwnStatic("isAdapterOfClass", boolean.class, Class.class, Object.class);
     }
 
+    private final BeansLinker beansLinker;
+
+    JavaSuperAdapterLinker(final BeansLinker beansLinker) {
+        this.beansLinker = beansLinker;
+    }
+
     @Override
     public boolean canLinkType(final Class<?> type) {
         return type == JavaSuperAdapter.class;
@@ -101,17 +106,13 @@
 
         // Delegate to BeansLinker
         final GuardedInvocation guardedInv = NashornBeansLinker.getGuardedInvocation(
-                BeansLinker.getLinkerForClass(adapterClass), linkRequest.replaceArguments(newDescriptor, args),
+                beansLinker, linkRequest.replaceArguments(newDescriptor, args),
                 linkerServices);
+        // Even for non-existent methods, Bootstrap's BeansLinker will link a
+        // noSuchMember handler.
+        assert guardedInv != null;
 
         final MethodHandle guard = IS_ADAPTER_OF_CLASS.bindTo(adapterClass);
-        if(guardedInv == null) {
-            // Short circuit the lookup here for non-existent methods by linking an empty getter. If we just returned
-            // null instead, BeansLinker would find final methods on the JavaSuperAdapter instead: getClass() and
-            // wait().
-            return new GuardedInvocation(MethodHandles.dropArguments(EMPTY_GETTER, 1,type.parameterList().subList(1,
-                    type.parameterCount())), guard).asType(descriptor);
-        }
 
         final MethodHandle invocation = guardedInv.getInvocation();
         final MethodType invType = invocation.type();
@@ -165,7 +166,7 @@
      */
     @SuppressWarnings("unused")
     private static Object bindDynamicMethod(final Object dynamicMethod, final Object boundThis) {
-        return dynamicMethod == null ? ScriptRuntime.UNDEFINED : Bootstrap.bindCallable(dynamicMethod, boundThis, null);
+        return dynamicMethod == ScriptRuntime.UNDEFINED ? ScriptRuntime.UNDEFINED : Bootstrap.bindCallable(dynamicMethod, boundThis, null);
     }
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -85,7 +85,11 @@
         }
     };
 
-    private final BeansLinker beansLinker = new BeansLinker();
+    private final BeansLinker beansLinker;
+
+    NashornBeansLinker(final BeansLinker beansLinker) {
+        this.beansLinker = beansLinker;
+    }
 
     @Override
     public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -27,26 +27,27 @@
 
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
-import static jdk.nashorn.internal.runtime.JSType.GET_UNDEFINED;
-import static jdk.nashorn.internal.runtime.JSType.TYPE_OBJECT_INDEX;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.function.Supplier;
 import jdk.dynalink.CallSiteDescriptor;
 import jdk.dynalink.NamedOperation;
 import jdk.dynalink.Operation;
+import jdk.dynalink.StandardOperation;
 import jdk.dynalink.beans.BeansLinker;
 import jdk.dynalink.linker.GuardedInvocation;
 import jdk.dynalink.linker.GuardingDynamicLinker;
 import jdk.dynalink.linker.GuardingTypeConverterFactory;
 import jdk.dynalink.linker.LinkRequest;
 import jdk.dynalink.linker.LinkerServices;
-import jdk.dynalink.linker.support.Guards;
+import jdk.dynalink.linker.support.Lookup;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
@@ -73,7 +74,7 @@
         // this point is a generic Java bean. Therefore, reaching here with a ScriptObject is a Nashorn bug.
         assert isExpectedObject(self) : "Couldn't link " + linkRequest.getCallSiteDescriptor() + " for " + self.getClass().getName();
 
-        return linkBean(linkRequest, linkerServices);
+        return linkBean(linkRequest);
     }
 
     private static final MethodHandle EMPTY_PROP_GETTER =
@@ -85,7 +86,18 @@
     private static final MethodHandle EMPTY_ELEM_SETTER =
             MH.dropArguments(EMPTY_PROP_SETTER, 0, Object.class);
 
-    private static GuardedInvocation linkBean(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+    private static final MethodHandle THROW_NO_SUCH_FUNCTION;
+    private static final MethodHandle THROW_STRICT_PROPERTY_SETTER;
+    private static final MethodHandle THROW_OPTIMISTIC_UNDEFINED;
+
+    static {
+        final Lookup lookup = new Lookup(MethodHandles.lookup());
+        THROW_NO_SUCH_FUNCTION = lookup.findOwnStatic("throwNoSuchFunction", Object.class, Object.class, Object.class);
+        THROW_STRICT_PROPERTY_SETTER = lookup.findOwnStatic("throwStrictPropertySetter", void.class, Object.class, Object.class);
+        THROW_OPTIMISTIC_UNDEFINED = lookup.findOwnStatic("throwOptimisticUndefined", Object.class, int.class);
+    }
+
+    private static GuardedInvocation linkBean(final LinkRequest linkRequest) throws Exception {
         final CallSiteDescriptor desc = linkRequest.getCallSiteDescriptor();
         final Object self = linkRequest.getReceiver();
         switch (NashornCallSiteDescriptor.getFirstStandardOperation(desc)) {
@@ -105,35 +117,79 @@
                 throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
             }
             throw typeError("not.a.function", NashornCallSiteDescriptor.getFunctionErrorMessage(desc, self));
-        case CALL_METHOD:
-            throw typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self));
-        case GET_METHOD:
-            // evaluate to undefined, later on Undefined will take care of throwing TypeError
-            return getInvocation(MH.dropArguments(GET_UNDEFINED.get(TYPE_OBJECT_INDEX), 0, Object.class), self, linkerServices, desc);
-        case GET_PROPERTY:
-        case GET_ELEMENT:
-            if(NashornCallSiteDescriptor.isOptimistic(desc)) {
-                throw new UnwarrantedOptimismException(UNDEFINED, NashornCallSiteDescriptor.getProgramPoint(desc), Type.OBJECT);
-            }
-            if (NashornCallSiteDescriptor.getOperand(desc) != null) {
-                return getInvocation(EMPTY_PROP_GETTER, self, linkerServices, desc);
-            }
-            return getInvocation(EMPTY_ELEM_GETTER, self, linkerServices, desc);
-        case SET_PROPERTY:
-        case SET_ELEMENT:
-            final boolean strict = NashornCallSiteDescriptor.isStrict(desc);
-            if (strict) {
-                throw typeError("cant.set.property", getArgument(linkRequest), ScriptRuntime.safeToString(self));
-            }
-            if (NashornCallSiteDescriptor.getOperand(desc) != null) {
-                return getInvocation(EMPTY_PROP_SETTER, self, linkerServices, desc);
-            }
-            return getInvocation(EMPTY_ELEM_SETTER, self, linkerServices, desc);
         default:
+            // Everything else is supposed to have been already handled by Bootstrap.beansLinker
+            // delegating to linkNoSuchBeanMember
             throw new AssertionError("unknown call type " + desc);
         }
     }
 
+    static MethodHandle linkMissingBeanMember(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+        final CallSiteDescriptor desc = linkRequest.getCallSiteDescriptor();
+        final StandardOperation op = NashornCallSiteDescriptor.getFirstStandardOperation(desc);
+        if (op != null) {
+            final String operand = NashornCallSiteDescriptor.getOperand(desc);
+            switch (op) {
+            case CALL_METHOD:
+                return adaptThrower(bindOperand(THROW_NO_SUCH_FUNCTION, operand), desc);
+            case GET_METHOD:
+            case GET_PROPERTY:
+            case GET_ELEMENT: {
+                if (NashornCallSiteDescriptor.isOptimistic(desc)) {
+                    return adaptThrower(MethodHandles.insertArguments(THROW_OPTIMISTIC_UNDEFINED, 0, NashornCallSiteDescriptor.getProgramPoint(desc)), desc);
+                }
+                if (NashornCallSiteDescriptor.getOperand(desc) != null) {
+                    return getInvocation(EMPTY_PROP_GETTER, linkerServices, desc);
+                }
+                return getInvocation(EMPTY_ELEM_GETTER, linkerServices, desc);
+            }
+            case SET_PROPERTY:
+            case SET_ELEMENT:
+                final boolean strict = NashornCallSiteDescriptor.isStrict(desc);
+                if (strict) {
+                    return adaptThrower(bindOperand(THROW_STRICT_PROPERTY_SETTER, operand), desc);
+                }
+                if (NashornCallSiteDescriptor.getOperand(desc) != null) {
+                    return getInvocation(EMPTY_PROP_SETTER, linkerServices, desc);
+                }
+                return getInvocation(EMPTY_ELEM_SETTER, linkerServices, desc);
+            default:
+            }
+        }
+        throw new AssertionError("unknown call type " + desc);
+    }
+
+    private static MethodHandle bindOperand(final MethodHandle handle, final String operand) {
+        return operand == null ? handle : MethodHandles.insertArguments(handle, 1, operand);
+    }
+
+    private static MethodHandle adaptThrower(final MethodHandle handle, final CallSiteDescriptor desc) {
+        final MethodType targetType = desc.getMethodType();
+        final int paramCount = handle.type().parameterCount();
+        return MethodHandles
+                .dropArguments(handle, paramCount, targetType.parameterList().subList(paramCount, targetType.parameterCount()))
+                .asType(targetType);
+    }
+
+    @SuppressWarnings("unused")
+    private static Object throwNoSuchFunction(final Object self, final Object name) {
+        throw createTypeError(self, name, "no.such.function");
+    }
+
+    @SuppressWarnings("unused")
+    private static void throwStrictPropertySetter(final Object self, final Object name) {
+        throw createTypeError(self, name, "cant.set.property");
+    }
+
+    private static ECMAException createTypeError(final Object self, final Object name, final String msg) {
+        return typeError(msg, String.valueOf(name), ScriptRuntime.safeToString(self));
+    }
+
+    @SuppressWarnings("unused")
+    private static Object throwOptimisticUndefined(final int programPoint) {
+        throw new UnwarrantedOptimismException(UNDEFINED, programPoint, Type.OBJECT);
+    }
+
     @Override
     public GuardedInvocation convertToType(final Class<?> sourceType, final Class<?> targetType, final Supplier<MethodHandles.Lookup> lookupSupplier) throws Exception {
         final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType);
@@ -158,8 +214,8 @@
         return null;
     }
 
-    private static GuardedInvocation getInvocation(final MethodHandle handle, final Object self, final LinkerServices linkerServices, final CallSiteDescriptor desc) {
-        return Bootstrap.asTypeSafeReturn(new GuardedInvocation(handle, Guards.getClassGuard(self.getClass())), linkerServices, desc);
+    private static MethodHandle getInvocation(final MethodHandle handle, final LinkerServices linkerServices, final CallSiteDescriptor desc) {
+        return linkerServices.asTypeLosslessReturn(handle, desc.getMethodType());
     }
 
     // Used solely in an assertion to figure out if the object we get here is something we in fact expect. Objects
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Thu Jan 21 14:49:02 2016 -0800
@@ -34,6 +34,7 @@
 import jdk.dynalink.linker.LinkRequest;
 import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -46,10 +47,9 @@
 public final class NashornGuards {
     private static final MethodHandle IS_MAP              = findOwnMH("isMap", boolean.class, ScriptObject.class, PropertyMap.class);
     private static final MethodHandle IS_MAP_SCRIPTOBJECT = findOwnMH("isMap", boolean.class, Object.class, PropertyMap.class);
-    private static final MethodHandle IS_INSTANCEOF_2     = findOwnMH("isInstanceOf2", boolean.class, Object.class, Class.class, Class.class);
     private static final MethodHandle IS_SCRIPTOBJECT     = findOwnMH("isScriptObject", boolean.class, Object.class);
     private static final MethodHandle IS_NOT_JSOBJECT     = findOwnMH("isNotJSObject", boolean.class, Object.class);
-    private static final MethodHandle SAME_OBJECT       = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class);
+    private static final MethodHandle SAME_OBJECT         = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class);
     //TODO - maybe put this back in ScriptFunction instead of the ClassCastException.class relinkage
     //private static final MethodHandle IS_SCRIPTFUNCTION = findOwnMH("isScriptFunction", boolean.class, Object.class);
 
@@ -165,14 +165,21 @@
     }
 
     /**
-     * Get a guard that checks if in item is an instance of either of two classes.
+     * Get a guard that checks if in item is a JS string.
      *
-     * @param class1 the first class
-     * @param class2 the second class
      * @return method handle for guard
      */
-    public static MethodHandle getInstanceOf2Guard(final Class<?> class1, final Class<?> class2) {
-        return MH.insertArguments(IS_INSTANCEOF_2, 1, class1, class2);
+    public static MethodHandle getStringGuard() {
+        return JSType.IS_STRING.methodHandle();
+    }
+
+    /**
+     * Get a guard that checks if in item is a JS number.
+     *
+     * @return method handle for guard
+     */
+    public static MethodHandle getNumberGuard() {
+        return JSType.IS_NUMBER.methodHandle();
     }
 
     /**
@@ -224,11 +231,6 @@
     }
 
     @SuppressWarnings("unused")
-    private static boolean isInstanceOf2(final Object self, final Class<?> class1, final Class<?> class2) {
-        return class1.isInstance(self) || class2.isInstance(self);
-    }
-
-    @SuppressWarnings("unused")
     private static boolean isScriptFunction(final Object self) {
         return self instanceof ScriptFunction;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -41,6 +41,7 @@
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.Symbol;
 
 /**
  * Internal linker for String, Boolean, and Number objects, only ever used by Nashorn engine and not exposed to other
@@ -57,7 +58,9 @@
     }
 
     private static boolean canLinkTypeStatic(final Class<?> type) {
-        return type == String.class || type == Boolean.class || type == ConsString.class || Number.class.isAssignableFrom(type);
+        return type == String.class || type == Boolean.class || type == ConsString.class || type == Integer.class
+                || type == Double.class || type == Float.class || type == Short.class || type == Byte.class
+                || type == Symbol.class;
     }
 
     @Override
@@ -167,7 +170,7 @@
 
     @SuppressWarnings("unused")
     private static boolean isJavaScriptPrimitive(final Object o) {
-        return JSType.isString(o) || o instanceof Boolean || o instanceof Number || o == null;
+        return JSType.isString(o) || o instanceof Boolean || JSType.isNumber(o) || o == null || o instanceof Symbol;
     }
 
     private static final MethodHandle GUARD_PRIMITIVE = findOwnMH("isJavaScriptPrimitive", boolean.class, Object.class);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Thu Jan 21 14:49:02 2016 -0800
@@ -53,7 +53,11 @@
  * </pre>
  */
 final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker {
-    private static final GuardingDynamicLinker staticClassLinker = BeansLinker.getLinkerForClass(StaticClass.class);
+    private final GuardingDynamicLinker staticClassLinker;
+
+    NashornStaticClassLinker(final BeansLinker beansLinker) {
+        this.staticClassLinker = beansLinker.getLinkerForClass(StaticClass.class);
+    }
 
     @Override
     public boolean canLinkType(final Class<?> type) {
@@ -100,7 +104,7 @@
         return delegate(linkerServices, request);
     }
 
-    private static GuardedInvocation delegate(final LinkerServices linkerServices, final LinkRequest request) throws Exception {
+    private GuardedInvocation delegate(final LinkerServices linkerServices, final LinkRequest request) throws Exception {
         return NashornBeansLinker.getGuardedInvocation(staticClassLinker, request, linkerServices);
     }
 
--- a/nashorn/test/script/basic/JDK-8030200.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/JDK-8030200.js	Thu Jan 21 14:49:02 2016 -0800
@@ -33,4 +33,4 @@
 var s = n.toString(5);
 var m = parseInt(s, 5);
 print(m === n);
-print(n);
+print(m);
--- a/nashorn/test/script/basic/JDK-8049242.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/JDK-8049242.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -1,10 +1,10 @@
 abc
 [jdk.dynalink.beans.SimpleDynamicMethod java.lang.String(char[],int,int)]
 ava
-TypeError: null is not a function
-TypeError: null is not a function
-TypeError: null is not a function
+TypeError: Java.type("java.lang.Object")["()xxxxx"] is not a function
+TypeError: Java.type("java.lang.Object")["("] is not a function
+TypeError: Java.type("java.lang.Object")[")"] is not a function
 TypeError: Constructor [jdk.dynalink.beans.SimpleDynamicMethod java.lang.String(char[],int,int)] requires "new".
-TypeError: null is not a function
-TypeError: null is not a function
+TypeError: Java.type("java.lang.Runnable")["()"] is not a function
+TypeError: Java.type("java.lang.Runnable")["(int)"] is not a function
 java.lang.InstantiationException: java.io.InputStream
--- a/nashorn/test/script/basic/JDK-8066669.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/JDK-8066669.js	Thu Jan 21 14:49:02 2016 -0800
@@ -29,12 +29,13 @@
  */
 
 // Make sure index access on Java objects is working as expected.
-var map = new java.util.HashMap();
+var map = new java.util.LinkedHashMap();
 
 map["foo"] = "bar";
 map[1] = 2;
 map[false] = true;
 map[null] = 0;
+map["a"] = null;
 
 print(map);
 
@@ -49,10 +50,12 @@
 print(typeof map[1], map[1]);
 print(typeof map[false], map[false]);
 print(typeof map[null], map[null]);
+print(typeof map["a"], map["a"]);
 
-print(map.foo);
-print(map.false);
-print(map.null);
+print("map.foo=" + map.foo);
+print("map.false=" + map.false);
+print("map.null=" + map.null);
+print("map.a=" + map.a);
 
 map.foo = "baz";
 print(map);
--- a/nashorn/test/script/basic/JDK-8066669.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/JDK-8066669.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -1,13 +1,16 @@
-{null=0, 1=2, false=true, foo=bar}
-object null
+{foo=bar, 1=2, false=true, null=0, a=null}
+string foo
 number 1
 boolean false
-string foo
+object null
+string a
 string bar
 number 2
 boolean true
 number 0
-bar
-null
-null
-{null=0, 1=2, false=true, foo=baz}
+object null
+map.foo=bar
+map.false=undefined
+map.null=undefined
+map.a=null
+{foo=baz, 1=2, false=true, null=0, a=null}
--- a/nashorn/test/script/basic/JDK-8079145.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/JDK-8079145.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -5,8 +5,8 @@
 int array: check widen for true [class java.lang.Boolean]
 int array: check widen for 34 [class java.lang.Byte]
 int array: check widen for 344454 [class java.lang.Integer]
-int array: check widen for 454545 [class java.lang.Long]
-int array: check widen for 2147483648 [class java.lang.Long]
+int array: check widen for 454545
+int array: check widen for 2147483648
 int array: check widen for 34.29999923706055 [class java.lang.Float]
 int array: check widen for 3.141592653589793 [class java.lang.Double]
 int array: check widen for s
@@ -17,8 +17,8 @@
 long array: check widen for true [class java.lang.Boolean]
 long array: check widen for 34 [class java.lang.Byte]
 long array: check widen for 344454 [class java.lang.Integer]
-long array: check widen for 454545 [class java.lang.Long]
-long array: check widen for 2147483648 [class java.lang.Long]
+long array: check widen for 454545
+long array: check widen for 2147483648
 long array: check widen for 34.29999923706055 [class java.lang.Float]
 long array: check widen for 3.141592653589793 [class java.lang.Double]
 long array: check widen for s
@@ -29,8 +29,8 @@
 number array: check widen for true [class java.lang.Boolean]
 number array: check widen for 34 [class java.lang.Byte]
 number array: check widen for 344454 [class java.lang.Integer]
-number array: check widen for 454545 [class java.lang.Long]
-number array: check widen for 2147483648 [class java.lang.Long]
+number array: check widen for 454545
+number array: check widen for 2147483648
 number array: check widen for 34.29999923706055 [class java.lang.Float]
 number array: check widen for 3.141592653589793 [class java.lang.Double]
 number array: check widen for s
@@ -41,8 +41,8 @@
 object array: check widen for true [class java.lang.Boolean]
 object array: check widen for 34 [class java.lang.Byte]
 object array: check widen for 344454 [class java.lang.Integer]
-object array: check widen for 454545 [class java.lang.Long]
-object array: check widen for 2147483648 [class java.lang.Long]
+object array: check widen for 454545
+object array: check widen for 2147483648
 object array: check widen for 34.29999923706055 [class java.lang.Float]
 object array: check widen for 3.141592653589793 [class java.lang.Double]
 object array: check widen for s
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8143896.js	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,107 @@
+/*
+ * 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-8143896: java.lang.Long is implicitly converted to double
+ *
+ * @test
+ * @run
+ */
+
+Assert.assertTrue(java.lang.Long.valueOf("301077366599181567").toString() === "301077366599181567");
+Assert.assertTrue(java.lang.Long.valueOf("-301077366599181567").toString() === "-301077366599181567");
+Assert.assertTrue(java.lang.Long.valueOf("301077366599181567") == 301077366599181567);
+Assert.assertFalse(java.lang.Long.valueOf("301077366599181567") === 301077366599181567);
+
+Assert.assertTrue(new java.math.BigInteger("301077366599181567").toString() === "301077366599181567");
+Assert.assertTrue(new java.math.BigInteger("-301077366599181567").toString() === "-301077366599181567");
+Assert.assertTrue(new java.math.BigInteger("301077366599181567") == 301077366599181567);
+Assert.assertFalse(new java.math.BigInteger("301077366599181567") === 301077366599181567);
+
+
+var n = new java.lang.Byte("123");
+Assert.assertTrue(typeof n === "number");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertTrue(n === 123);
+
+n = new java.lang.Short("123");
+Assert.assertTrue(typeof n === "number");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertTrue(n === 123);
+
+n = new java.lang.Integer("123");
+Assert.assertTrue(typeof n === "number");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertTrue(n === 123);
+
+n = new java.lang.Float("123");
+Assert.assertTrue(typeof n === "number");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertTrue(n === 123);
+
+n = new java.lang.Double("123");
+Assert.assertTrue(typeof n === "number");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertTrue(n === 123);
+
+n = new java.lang.Long("123");
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
+
+n = new java.util.concurrent.atomic.DoubleAdder();
+n.add("123");
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
+
+n = new java.util.concurrent.atomic.AtomicInteger(123);
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
+
+n = new java.util.concurrent.atomic.AtomicLong(123);
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
+
+n = new java.math.BigInteger("123");
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
+
+n = new java.math.BigDecimal("123");
+Assert.assertTrue(typeof n === "object");
+Assert.assertTrue(n + 1 === 124);
+Assert.assertTrue(n == 123);
+Assert.assertFalse(n === 123);
--- a/nashorn/test/script/basic/es6/symbols.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/es6/symbols.js	Thu Jan 21 14:49:02 2016 -0800
@@ -40,11 +40,11 @@
 Assert.assertTrue(Symbol(null).toString() === 'Symbol(null)');
 Assert.assertTrue(Symbol(undefined).toString() === 'Symbol()');
 
-var s1 = Symbol();
-var s2 = Symbol("s2");
+const s1 = Symbol();
+const s2 = Symbol("s2");
 Assert.assertFalse(s1 instanceof Symbol); // not an object
 
-var obj = {};
+let obj = {};
 obj['foo'] = 'foo';
 obj[s1] = s1;
 obj['bar'] = 'bar';
@@ -57,17 +57,17 @@
 Assert.assertTrue(obj[1] === 1);
 Assert.assertTrue(obj[s2] === s2);
 
-var expectedNames = ['1', 'foo', 'bar'];
-var expectedSymbols = [s1, s2];
-var actualNames = Object.getOwnPropertyNames(obj);
-var actualSymbols = Object.getOwnPropertySymbols(obj);
+const expectedNames = ['1', 'foo', 'bar'];
+const expectedSymbols = [s1, s2];
+const actualNames = Object.getOwnPropertyNames(obj);
+let actualSymbols = Object.getOwnPropertySymbols(obj);
 Assert.assertTrue(expectedNames.length == actualNames.length);
 Assert.assertTrue(expectedSymbols.length == actualSymbols.length);
 
-for (var key in expectedNames) {
+for (let key in expectedNames) {
     Assert.assertTrue(expectedNames[key] === actualNames[key]);
 }
-for (var key in expectedSymbols) {
+for (let key in expectedSymbols) {
     Assert.assertTrue(expectedSymbols[key] === actualSymbols[key]);
 }
 
@@ -114,8 +114,8 @@
 
 // Symbol.for and Symbol.keyFor
 
-var uncached = Symbol('foo');
-var cached = Symbol.for('foo');
+const uncached = Symbol('foo');
+const cached = Symbol.for('foo');
 
 Assert.assertTrue(uncached !== cached);
 Assert.assertTrue(Symbol.keyFor(uncached) === undefined);
@@ -123,9 +123,15 @@
 Assert.assertTrue(cached === Symbol.for('foo'));
 Assert.assertTrue(cached === Symbol.for('f' + 'oo'));
 
+// JDK-8147008: Make sure symbols are handled by primitive linker
+Symbol.prototype.foo = 123;
+Symbol.prototype[s2] = s2;
+Assert.assertEquals(s1.foo, 123);
+Assert.assertEquals(s2[s2], s2);
+
 // Object wrapper
 
-var o = Object(s1);
+const o = Object(s1);
 obj = {};
 obj[s1] = "s1";
 Assert.assertTrue(o == s1);
@@ -134,6 +140,8 @@
 Assert.assertTrue(o instanceof Symbol);
 Assert.assertTrue(obj[o] == 's1');
 Assert.assertTrue(o in obj);
+Assert.assertEquals(o.foo, 123);
+Assert.assertEquals(o[s2], s2);
 
 // various non-strict comparisons that should fail
 
--- a/nashorn/test/script/basic/list.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/list.js	Thu Jan 21 14:49:02 2016 -0800
@@ -54,15 +54,14 @@
 var size_name = "size"
 print("l[size_name]()=" + l[size_name]()) // ... but existing methods can be accessed with []
 
-expectException(2) // Java lists don't auto-expand to accommodate new indices
-expectException(java.lang.Double.POSITIVE_INFINITY) // Dynalink will throw IOOBE
-expectException(java.lang.Double.NEGATIVE_INFINITY) // Dynalink will throw IOOBE
+// All illegal indices, even those out of bounds, return undefined
+print("l[2]=" + l[2]);
+print("l[-1]=" + l[-1]);
+print("l[2.1]=" + l[2.1]);
+print("l[-1.1]=" + l[-1.1]);
+print("l[Infinity]=" + l[Infinity]);
+print("l[-Infinity]=" + l[-Infinity]);
+print("l[NaN]=" + l[NaN]);
 
-function expectException(index) {
-    try {
-        l[index] = "x"
-        print("Not caught out-of-bounds assignment for " + index)
-    }  catch(e) {
-        print(e)
-    }
-}
+l[1.1]="b"; // should be no-op
+print("l[0]=" + l[0]);
--- a/nashorn/test/script/basic/list.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/list.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -9,9 +9,14 @@
 --for each end--
 l[0]=foo
 l[1]=a
-l[0.9]=null
+l[0.9]=undefined
 l['blah']=undefined
 l[size_name]()=2
-java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
-java.lang.IndexOutOfBoundsException: Index: Infinity, Size: 2
-java.lang.IndexOutOfBoundsException: Index: -Infinity, Size: 2
+l[2]=undefined
+l[-1]=undefined
+l[2.1]=undefined
+l[-1.1]=undefined
+l[Infinity]=undefined
+l[-Infinity]=undefined
+l[NaN]=undefined
+l[0]=foo
--- a/nashorn/test/script/basic/map.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/map.js	Thu Jan 21 14:49:02 2016 -0800
@@ -44,8 +44,8 @@
 print("m['empty'] = " + m['empty'])
 print("m[empty_key] = " + m[empty_key]) // prints "foo"
 
-print("m.bwah = " + m.bwah) // prints "null"
-print("m['bwah'] = " + m['bwah']) // prints "null"
+print("m.bwah = " + m.bwah) // prints "undefined"
+print("m['bwah'] = " + m['bwah']) // prints "undefined"
 
 m.put("twonk", "ding")
 print("m.twonk = " + m.twonk) // prints "ding"
--- a/nashorn/test/script/basic/map.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/basic/map.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -7,8 +7,8 @@
 m.empty = false
 m['empty'] = foo
 m[empty_key] = foo
-m.bwah = null
-m['bwah'] = null
+m.bwah = undefined
+m['bwah'] = undefined
 m.twonk = ding
 m['twonk'] = ding
 m.size()=2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/context-dependent-logging.js	Thu Jan 21 14:49:02 2016 -0800
@@ -0,0 +1,68 @@
+/*
+ * 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 that logging configuration is per engine, rather than per process.
+ *
+ * @test
+ * @bug 8036977
+ * @run/ignore-std-error
+ * @fork
+ * @option -scripting
+ */
+
+// To test, start another engine (testEngine) with a time logger and ensure the
+// logger exists.
+
+var NashornFactory = new (Java.type('jdk.nashorn.api.scripting.NashornScriptEngineFactory'))(),
+    testEngine     = NashornFactory.getScriptEngine("-scripting", "--log=time")
+
+if (!testEngine.eval('$OPTIONS._loggers.time')) {
+    throw 'fresh testEngine does not have time logger'
+}
+
+// To test further, have the testEngine start yet another engine (e) without
+// time logging, but with compiler logging. Check the logging is as configured,
+// and verify the testEngine still has time logging, but no compiler logging.
+
+var script = <<EOS
+    var F = new (Java.type('jdk.nashorn.api.scripting.NashornScriptEngineFactory'))(),
+        e = F.getScriptEngine('-scripting', '--log=compiler')
+    if (!e.eval('$OPTIONS._loggers.compiler')) {
+        throw 'e does not have compiler logger'
+    }
+    if (e.eval('$OPTIONS._loggers.time')) {
+        throw 'e has time logger'
+    }
+EOS
+
+testEngine.eval(script)
+
+if (!testEngine.eval('$OPTIONS._loggers.time')) {
+    throw 'after-test testEngine does not have time logger'
+}
+if (testEngine.eval('$OPTIONS._loggers.compiler')) {
+    throw 'after-test testEngine has compiler logger'
+}
--- a/nashorn/test/script/nosecurity/parserapi.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/parserapi.js	Thu Jan 21 14:49:02 2016 -0800
@@ -30,8 +30,8 @@
  */
 
 function Parser() {
-   // create nashorn parser
-   this._parser = Parser.create();
+    // create nashorn parser
+    this._parser = Parser.create();
 }
 
 // Java types used
@@ -54,59 +54,60 @@
 
 // convert Nashorn parser Tree, Diagnostic as a script friendly object
 Parser.prototype.convert = function(tree) {
-    if (!tree || typeof tree != 'object') {
+    if (!tree || typeof tree != 'object' || tree instanceof java.lang.Long) {
         return tree;
     }
 
     var obj = Object.bindProperties({}, tree);
     var result = {};
     for (var i in obj) {
-       var val = obj[i];
-       if (val instanceof Parser.Tree) {
-          result[i] = this.convert(val);
-       } else if (val instanceof Parser.List) {
-          var arr = new Array(val.size());
-          for (var j in val) {
-              arr[j] = this.convert(val[j]);
-          }
-      
-          result[i] = arr;
-      } else {
-          switch (typeof val) {
-              case 'number':
-              case 'string':
-              case 'boolean':
-                  result[i] = String(val);
-              default:
-                  if (val instanceof Parser.Enum) {
-                      result[i] = String(val);
-                  }
-          }
-      }
-   }
-   return result;
+        var val = obj[i];
+        if (val instanceof Parser.Tree) {
+            result[i] = this.convert(val);
+        } else if (val instanceof Parser.List) {
+            var arr = new Array(val.size());
+            for (var j in val) {
+                arr[j] = this.convert(val[j]);
+            }
+
+            result[i] = arr;
+        } else {
+            switch (typeof val) {
+                case 'number':
+                case 'string':
+                case 'boolean':
+                    result[i] = String(val);
+                    break;
+                default:
+                    if (val instanceof java.lang.Long || val instanceof Parser.Enum) {
+                        result[i] = String(val);
+                    }
+            }
+        }
+    }
+    return result;
 }
 
 function processFiles(subdir) {
-   var File = Java.type("java.io.File");
-   var files = new File(__DIR__ + subdir).listFiles();
-   java.util.Arrays.sort(files);
-   for each (var file in files) {
-       if (file.name.endsWith(".js")) {
-           var script = readFully(file);
-           var parser = new Parser();
-           var tree = parser.parse(subdir + "/" + file.name, script,
-               function(diagnostic) {
-                   print(JSON.stringify(parser.convert(diagnostic), null, 2).replace(/\\r/g, ''));
-                   print(",");
-               });
+    var File = Java.type("java.io.File");
+    var files = new File(__DIR__ + subdir).listFiles();
+    java.util.Arrays.sort(files);
+    for each (var file in files) {
+        if (file.name.endsWith(".js")) {
+            var script = readFully(file);
+            var parser = new Parser();
+            var tree = parser.parse(subdir + "/" + file.name, script,
+                function(diagnostic) {
+                    print(JSON.stringify(parser.convert(diagnostic), null, 2).replace(/\\r/g, ''));
+                    print(",");
+                });
 
-           if (tree != null) {
-               print(JSON.stringify(tree, null, 2));
-               print(",");
-           }
-       }
-   }
+            if (tree != null) {
+                print(JSON.stringify(tree, null, 2));
+                print(",");
+            }
+        }
+    }
 }
 
 // parse files in parsertests directory
--- a/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Thu Jan 21 14:49:02 2016 -0800
@@ -1,4 +1,4 @@
-[
+[
 {
   "endPosition": "1113",
   "kind": "COMPILATION_UNIT",
@@ -132,8 +132,8 @@
   "sourceName": "parsertests/array_literal.js",
   "strict": "false",
   "startPosition": "1113"
-}
-,
+}
+,
 {
   "endPosition": "1126",
   "kind": "COMPILATION_UNIT",
@@ -406,8 +406,8 @@
   "sourceName": "parsertests/assignmentExpr.js",
   "strict": "false",
   "startPosition": "1126"
-}
-,
+}
+,
 {
   "endPosition": "1116",
   "kind": "COMPILATION_UNIT",
@@ -912,8 +912,8 @@
   "sourceName": "parsertests/binaryExpr.js",
   "strict": "false",
   "startPosition": "1116"
-}
-,
+}
+,
 {
   "endPosition": "1117",
   "kind": "COMPILATION_UNIT",
@@ -959,8 +959,8 @@
   "sourceName": "parsertests/block.js",
   "strict": "false",
   "startPosition": "1117"
-}
-,
+}
+,
 {
   "endPosition": "1117",
   "kind": "COMPILATION_UNIT",
@@ -1060,8 +1060,8 @@
   "sourceName": "parsertests/breakStat.js",
   "strict": "false",
   "startPosition": "1117"
-}
-,
+}
+,
 {
   "endPosition": "1117",
   "kind": "COMPILATION_UNIT",
@@ -1098,8 +1098,8 @@
   "sourceName": "parsertests/condExpr.js",
   "strict": "false",
   "startPosition": "1117"
-}
-,
+}
+,
 {
   "endPosition": "1120",
   "kind": "COMPILATION_UNIT",
@@ -1199,8 +1199,8 @@
   "sourceName": "parsertests/continueStat.js",
   "strict": "false",
   "startPosition": "1120"
-}
-,
+}
+,
 {
   "endPosition": "1118",
   "kind": "COMPILATION_UNIT",
@@ -1214,8 +1214,8 @@
   "sourceName": "parsertests/debuggerStat.js",
   "strict": "false",
   "startPosition": "1118"
-}
-,
+}
+,
 {
   "endPosition": "1137",
   "kind": "COMPILATION_UNIT",
@@ -1500,8 +1500,8 @@
   "sourceName": "parsertests/functions.js",
   "strict": "false",
   "startPosition": "1137"
-}
-,
+}
+,
 {
   "endPosition": "1114",
   "kind": "COMPILATION_UNIT",
@@ -1604,8 +1604,8 @@
   "sourceName": "parsertests/ifStat.js",
   "strict": "false",
   "startPosition": "1114"
-}
-,
+}
+,
 {
   "endPosition": "1113",
   "kind": "COMPILATION_UNIT",
@@ -1668,8 +1668,8 @@
   "sourceName": "parsertests/labelledStat.js",
   "strict": "false",
   "startPosition": "1113"
-}
-,
+}
+,
 {
   "endPosition": "1125",
   "kind": "COMPILATION_UNIT",
@@ -2066,8 +2066,8 @@
   "sourceName": "parsertests/lhsExpr.js",
   "strict": "false",
   "startPosition": "1125"
-}
-,
+}
+,
 {
   "endPosition": "1110",
   "kind": "COMPILATION_UNIT",
@@ -2350,8 +2350,8 @@
   "sourceName": "parsertests/loopStat.js",
   "strict": "false",
   "startPosition": "1110"
-}
-,
+}
+,
 {
   "endPosition": "1125",
   "kind": "COMPILATION_UNIT",
@@ -2705,8 +2705,8 @@
   "sourceName": "parsertests/objectLitExpr.js",
   "strict": "false",
   "startPosition": "1125"
-}
-,
+}
+,
 {
   "endPosition": "1118",
   "kind": "COMPILATION_UNIT",
@@ -2781,8 +2781,8 @@
   "sourceName": "parsertests/parenExpr.js",
   "strict": "false",
   "startPosition": "1118"
-}
-,
+}
+,
 {
   "endPosition": "1119",
   "kind": "COMPILATION_UNIT",
@@ -2995,8 +2995,8 @@
   "sourceName": "parsertests/primaryExpr.js",
   "strict": "false",
   "startPosition": "1119"
-}
-,
+}
+,
 {
   "endPosition": "1114",
   "kind": "COMPILATION_UNIT",
@@ -3044,8 +3044,8 @@
   "sourceName": "parsertests/regexp_literal.js",
   "strict": "false",
   "startPosition": "1114"
-}
-,
+}
+,
 {
   "endPosition": "1118",
   "kind": "COMPILATION_UNIT",
@@ -3144,8 +3144,8 @@
   "sourceName": "parsertests/returnStat.js",
   "strict": "false",
   "startPosition": "1118"
-}
-,
+}
+,
 {
   "endPosition": "1111",
   "kind": "COMPILATION_UNIT",
@@ -3309,8 +3309,8 @@
   "sourceName": "parsertests/switchStat.js",
   "strict": "false",
   "startPosition": "1111"
-}
-,
+}
+,
 {
   "endPosition": "1110",
   "kind": "COMPILATION_UNIT",
@@ -3421,8 +3421,8 @@
   "sourceName": "parsertests/throwStat.js",
   "strict": "false",
   "startPosition": "1110"
-}
-,
+}
+,
 {
   "endPosition": "1121",
   "kind": "COMPILATION_UNIT",
@@ -3783,8 +3783,8 @@
   "sourceName": "parsertests/tryCatchStat.js",
   "strict": "false",
   "startPosition": "1121"
-}
-,
+}
+,
 {
   "endPosition": "1115",
   "kind": "COMPILATION_UNIT",
@@ -3969,8 +3969,8 @@
   "sourceName": "parsertests/unaryExpr.js",
   "strict": "false",
   "startPosition": "1115"
-}
-,
+}
+,
 {
   "endPosition": "1122",
   "kind": "COMPILATION_UNIT",
@@ -4016,8 +4016,8 @@
   "sourceName": "parsertests/useStrict.js",
   "strict": "true",
   "startPosition": "1122"
-}
-,
+}
+,
 {
   "endPosition": "1143",
   "kind": "COMPILATION_UNIT",
@@ -4092,8 +4092,8 @@
   "sourceName": "parsertests/varDecl.js",
   "strict": "false",
   "startPosition": "1143"
-}
-,
+}
+,
 {
   "endPosition": "1111",
   "kind": "COMPILATION_UNIT",
@@ -4142,8 +4142,8 @@
   "sourceName": "parsertests/withStat.js",
   "strict": "false",
   "startPosition": "1111"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/caseoutofswitch.js",
   "code": "case (1090, 4)",
@@ -4152,8 +4152,8 @@
   "position": "1090",
   "message": "parsernegativetests/caseoutofswitch.js:29:0 Expected an operand but found case\ncase 23:\n^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/caseoutofswitch.js",
   "code": "default (1112, 7)",
@@ -4162,8 +4162,8 @@
   "position": "1112",
   "message": "parsernegativetests/caseoutofswitch.js:31:0 Expected an operand but found default\ndefault:\n^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4240,8 +4240,8 @@
   "sourceName": "parsernegativetests/caseoutofswitch.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegalbreak.js",
   "code": "break (1090, 5)",
@@ -4250,8 +4250,8 @@
   "position": "1090",
   "message": "parsernegativetests/illegalbreak.js:29:0 Illegal break statement\nbreak;\n^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegalbreak.js",
   "code": "ident (1103, 3)",
@@ -4260,8 +4260,8 @@
   "position": "1103",
   "message": "parsernegativetests/illegalbreak.js:30:6 Undefined Label \"foo\"\nbreak foo;\n      ^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4290,8 +4290,8 @@
   "sourceName": "parsernegativetests/illegalbreak.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegalcontinue.js",
   "code": "continue (1090, 8)",
@@ -4300,8 +4300,8 @@
   "position": "1090",
   "message": "parsernegativetests/illegalcontinue.js:29:0 Illegal continue statement\ncontinue;\n^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegalcontinue.js",
   "code": "ident (1109, 3)",
@@ -4310,8 +4310,8 @@
   "position": "1109",
   "message": "parsernegativetests/illegalcontinue.js:30:9 Undefined Label \"foo\"\ncontinue foo;\n         ^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4340,8 +4340,8 @@
   "sourceName": "parsernegativetests/illegalcontinue.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegallvalue.js",
   "code": "decimal (1090, 2)",
@@ -4350,8 +4350,8 @@
   "position": "1090",
   "message": "parsernegativetests/illegallvalue.js:29:0 Invalid left hand side for assignment\n44 = 54;\n^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegallvalue.js",
   "code": "decimal (1099, 3)",
@@ -4360,8 +4360,8 @@
   "position": "1099",
   "message": "parsernegativetests/illegallvalue.js:30:0 Invalid left hand side for assignment\n233 += 33;\n^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegallvalue.js",
   "code": "decimal (1110, 4)",
@@ -4370,8 +4370,8 @@
   "position": "1110",
   "message": "parsernegativetests/illegallvalue.js:31:0 Invalid left hand side for assignment\n3423 -= 234;\n^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4410,8 +4410,8 @@
   "sourceName": "parsernegativetests/illegallvalue.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/illegaloperator.js",
   "code": "* (1093, 1)",
@@ -4420,8 +4420,8 @@
   "position": "1093",
   "message": "parsernegativetests/illegaloperator.js:29:3 Expected an operand but found *\nx ** y\n   ^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4440,8 +4440,8 @@
   "sourceName": "parsernegativetests/illegaloperator.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/keywordident.js",
   "code": "var (1094, 3)",
@@ -4450,8 +4450,8 @@
   "position": "1094",
   "message": "parsernegativetests/keywordident.js:29:4 Expected ident but found var\nvar var = 23;\n    ^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4482,8 +4482,8 @@
   "sourceName": "parsernegativetests/keywordident.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/parenmissing.js",
   "code": "; (1096, 1)",
@@ -4492,8 +4492,8 @@
   "position": "1096",
   "message": "parsernegativetests/parenmissing.js:29:6 Expected ) but found ;\n(1 + 2;\n      ^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/parenmissing.js",
   "code": ") (1103, 1)",
@@ -4502,8 +4502,8 @@
   "position": "1103",
   "message": "parsernegativetests/parenmissing.js:30:5 Expected ; but found )\nx * y);\n     ^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4554,8 +4554,8 @@
   "sourceName": "parsernegativetests/parenmissing.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/repeatedproperty.js",
   "code": "ident (1111, 3)",
@@ -4564,8 +4564,8 @@
   "position": "1111",
   "message": "parsernegativetests/repeatedproperty.js:29:21 Property \"foo\" already defined\nvar obj = { foo: 34, get foo() { return 'hello' } };\n                     ^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/repeatedproperty.js",
   "code": "ident (1165, 3)",
@@ -4574,8 +4574,8 @@
   "position": "1165",
   "message": "parsernegativetests/repeatedproperty.js:30:22 Property \"foo\" already defined\nvar obj1 = { foo: 34, set foo(x) { } };\n                      ^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/repeatedproperty.js",
   "code": "ident (1205, 3)",
@@ -4584,8 +4584,8 @@
   "position": "1205",
   "message": "parsernegativetests/repeatedproperty.js:31:22 Property \"foo\" already defined\nvar obj2 = { foo: 34, set foo(x) { } };\n                      ^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/repeatedproperty.js",
   "code": "ident (1251, 3)",
@@ -4594,8 +4594,8 @@
   "position": "1251",
   "message": "parsernegativetests/repeatedproperty.js:32:28 Property \"bar\" already defined\nvar obj3 = { get bar() { }, get bar() {} };\n                            ^",
   "lineNumber": "32"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/repeatedproperty.js",
   "code": "ident (1296, 3)",
@@ -4604,8 +4604,8 @@
   "position": "1296",
   "message": "parsernegativetests/repeatedproperty.js:33:29 Property \"bar\" already defined\nvar obj4 = { set bar(x) { }, set bar(x) {} };\n                             ^",
   "lineNumber": "33"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4664,8 +4664,8 @@
   "sourceName": "parsernegativetests/repeatedproperty.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/strict_repeatedproperty.js",
   "code": "ident (1126, 3)",
@@ -4674,8 +4674,8 @@
   "position": "1126",
   "message": "parsernegativetests/strict_repeatedproperty.js:31:21 Property \"foo\" already defined\nvar obj = { foo: 34, foo: 'hello' };\n                     ^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4705,8 +4705,8 @@
   "sourceName": "parsernegativetests/strict_repeatedproperty.js",
   "strict": "true",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/strict_repeatparam.js",
   "code": "ident (1119, 1)",
@@ -4715,8 +4715,8 @@
   "position": "1119",
   "message": "parsernegativetests/strict_repeatparam.js:31:14 strict mode function cannot have duplicate parameter name \"x\"\nfunction func(x, x) {}\n              ^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4746,8 +4746,8 @@
   "sourceName": "parsernegativetests/strict_repeatparam.js",
   "strict": "true",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/strict_with.js",
   "code": "with (1105, 4)",
@@ -4756,8 +4756,8 @@
   "position": "1105",
   "message": "parsernegativetests/strict_with.js:31:0 \"with\" statement cannot be used in strict mode\nwith({}) {}\n^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/strict_with.js",
   "code": ") (1112, 1)",
@@ -4766,8 +4766,8 @@
   "position": "1112",
   "message": "parsernegativetests/strict_with.js:31:7 Expected ; but found )\nwith({}) {}\n       ^",
   "lineNumber": "31"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4807,8 +4807,8 @@
   "sourceName": "parsernegativetests/strict_with.js",
   "strict": "true",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/toplevelreturn.js",
   "code": "return (1090, 6)",
@@ -4817,8 +4817,8 @@
   "position": "1090",
   "message": "parsernegativetests/toplevelreturn.js:29:0 Invalid return statement\nreturn;\n^",
   "lineNumber": "29"
-}
-,
+}
+,
 {
   "fileName": "parsernegativetests/toplevelreturn.js",
   "code": "return (1098, 6)",
@@ -4827,8 +4827,8 @@
   "position": "1098",
   "message": "parsernegativetests/toplevelreturn.js:30:0 Invalid return statement\nreturn 23;\n^",
   "lineNumber": "30"
-}
-,
+}
+,
 {
   "endPosition": "1090",
   "kind": "COMPILATION_UNIT",
@@ -4857,59 +4857,59 @@
   "sourceName": "parsernegativetests/toplevelreturn.js",
   "strict": "false",
   "startPosition": "1090"
-}
-,
+}
+,
 {
   "endPosition": "1136",
   "kind": "COMPILATION_UNIT",
   "sourceElements": [
     {
-      "endPosition": "1240",
+      "endPosition": "1242",
       "kind": "FUNCTION",
       "name": "Parser",
       "body": {
-        "endPosition": "1218",
+        "endPosition": "1220",
         "kind": "BLOCK",
         "statements": [
           {
             "expression": {
               "expression": {
-                "endPosition": "1217",
+                "endPosition": "1219",
                 "kind": "FUNCTION_INVOCATION",
                 "functionSelect": {
                   "identifier": "create",
                   "expression": {
-                    "endPosition": "1208",
+                    "endPosition": "1210",
                     "kind": "IDENTIFIER",
                     "name": "Parser",
-                    "startPosition": "1202"
+                    "startPosition": "1204"
                   },
-                  "endPosition": "1215",
+                  "endPosition": "1217",
                   "kind": "MEMBER_SELECT",
-                  "startPosition": "1202"
+                  "startPosition": "1204"
                 },
                 "arguments": [],
-                "startPosition": "1202"
+                "startPosition": "1204"
               },
-              "endPosition": "1217",
+              "endPosition": "1219",
               "kind": "ASSIGNMENT",
               "variable": {
                 "identifier": "_parser",
                 "expression": {
-                  "endPosition": "1191",
+                  "endPosition": "1193",
                   "kind": "IDENTIFIER",
                   "name": "this",
-                  "startPosition": "1187"
+                  "startPosition": "1189"
                 },
-                "endPosition": "1199",
+                "endPosition": "1201",
                 "kind": "MEMBER_SELECT",
-                "startPosition": "1187"
+                "startPosition": "1189"
               },
-              "startPosition": "1187"
+              "startPosition": "1189"
             },
-            "endPosition": "1217",
+            "endPosition": "1219",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "1187"
+            "startPosition": "1189"
           }
         ],
         "startPosition": "1154"
@@ -4921,1368 +4921,1489 @@
     {
       "expression": {
         "expression": {
-          "endPosition": "1305",
+          "endPosition": "1307",
           "kind": "FUNCTION_INVOCATION",
           "functionSelect": {
             "identifier": "type",
             "expression": {
-              "endPosition": "1265",
+              "endPosition": "1267",
               "kind": "IDENTIFIER",
               "name": "Java",
-              "startPosition": "1261"
+              "startPosition": "1263"
             },
-            "endPosition": "1270",
+            "endPosition": "1272",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1261"
+            "startPosition": "1263"
           },
           "arguments": [
             {
-              "endPosition": "1303",
+              "endPosition": "1305",
               "kind": "STRING_LITERAL",
               "value": "jdk.nashorn.api.tree.Diagnostic",
-              "startPosition": "1272"
+              "startPosition": "1274"
             }
           ],
-          "startPosition": "1261"
-        },
-        "endPosition": "1305",
+          "startPosition": "1263"
+        },
+        "endPosition": "1307",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "Diagnostic",
           "expression": {
-            "endPosition": "1247",
+            "endPosition": "1249",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1241"
+            "startPosition": "1243"
           },
-          "endPosition": "1258",
+          "endPosition": "1260",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1241"
-        },
-        "startPosition": "1241"
-      },
-      "endPosition": "1305",
+          "startPosition": "1243"
+        },
+        "startPosition": "1243"
+      },
+      "endPosition": "1307",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1241"
+      "startPosition": "1243"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1390",
+          "endPosition": "1392",
           "kind": "FUNCTION_INVOCATION",
           "functionSelect": {
             "identifier": "type",
             "expression": {
-              "endPosition": "1338",
+              "endPosition": "1340",
               "kind": "IDENTIFIER",
               "name": "Java",
-              "startPosition": "1334"
+              "startPosition": "1336"
             },
-            "endPosition": "1343",
+            "endPosition": "1345",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1334"
+            "startPosition": "1336"
           },
           "arguments": [
             {
-              "endPosition": "1388",
+              "endPosition": "1390",
               "kind": "STRING_LITERAL",
               "value": "jdk.nashorn.api.tree.SimpleTreeVisitorES5_1",
-              "startPosition": "1345"
+              "startPosition": "1347"
             }
           ],
-          "startPosition": "1334"
-        },
-        "endPosition": "1390",
+          "startPosition": "1336"
+        },
+        "endPosition": "1392",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "SimpleTreeVisitor",
           "expression": {
-            "endPosition": "1313",
+            "endPosition": "1315",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1307"
+            "startPosition": "1309"
           },
-          "endPosition": "1331",
+          "endPosition": "1333",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1307"
-        },
-        "startPosition": "1307"
-      },
-      "endPosition": "1390",
+          "startPosition": "1309"
+        },
+        "startPosition": "1309"
+      },
+      "endPosition": "1392",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1307"
+      "startPosition": "1309"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1444",
+          "endPosition": "1446",
           "kind": "FUNCTION_INVOCATION",
           "functionSelect": {
             "identifier": "type",
             "expression": {
-              "endPosition": "1410",
+              "endPosition": "1412",
               "kind": "IDENTIFIER",
               "name": "Java",
-              "startPosition": "1406"
+              "startPosition": "1408"
             },
-            "endPosition": "1415",
+            "endPosition": "1417",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1406"
+            "startPosition": "1408"
           },
           "arguments": [
             {
-              "endPosition": "1442",
+              "endPosition": "1444",
               "kind": "STRING_LITERAL",
               "value": "jdk.nashorn.api.tree.Tree",
-              "startPosition": "1417"
+              "startPosition": "1419"
             }
           ],
-          "startPosition": "1406"
-        },
-        "endPosition": "1444",
+          "startPosition": "1408"
+        },
+        "endPosition": "1446",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "Tree",
           "expression": {
-            "endPosition": "1398",
+            "endPosition": "1400",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1392"
+            "startPosition": "1394"
           },
-          "endPosition": "1403",
+          "endPosition": "1405",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1392"
-        },
-        "startPosition": "1392"
-      },
-      "endPosition": "1444",
+          "startPosition": "1394"
+        },
+        "startPosition": "1394"
+      },
+      "endPosition": "1446",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1392"
+      "startPosition": "1394"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1487",
+          "endPosition": "1489",
           "kind": "FUNCTION_INVOCATION",
           "functionSelect": {
             "identifier": "type",
             "expression": {
-              "endPosition": "1464",
+              "endPosition": "1466",
               "kind": "IDENTIFIER",
               "name": "Java",
-              "startPosition": "1460"
+              "startPosition": "1462"
             },
-            "endPosition": "1469",
+            "endPosition": "1471",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1460"
+            "startPosition": "1462"
           },
           "arguments": [
             {
-              "endPosition": "1485",
+              "endPosition": "1487",
               "kind": "STRING_LITERAL",
               "value": "java.util.List",
-              "startPosition": "1471"
+              "startPosition": "1473"
             }
           ],
-          "startPosition": "1460"
-        },
-        "endPosition": "1487",
+          "startPosition": "1462"
+        },
+        "endPosition": "1489",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "List",
           "expression": {
-            "endPosition": "1452",
+            "endPosition": "1454",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1446"
+            "startPosition": "1448"
           },
-          "endPosition": "1457",
+          "endPosition": "1459",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1446"
-        },
-        "startPosition": "1446"
-      },
-      "endPosition": "1487",
+          "startPosition": "1448"
+        },
+        "startPosition": "1448"
+      },
+      "endPosition": "1489",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1446"
+      "startPosition": "1448"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1530",
+          "endPosition": "1532",
           "kind": "FUNCTION_INVOCATION",
           "functionSelect": {
             "identifier": "type",
             "expression": {
-              "endPosition": "1507",
+              "endPosition": "1509",
               "kind": "IDENTIFIER",
               "name": "Java",
-              "startPosition": "1503"
+              "startPosition": "1505"
             },
-            "endPosition": "1512",
+            "endPosition": "1514",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1503"
+            "startPosition": "1505"
           },
           "arguments": [
             {
-              "endPosition": "1528",
+              "endPosition": "1530",
               "kind": "STRING_LITERAL",
               "value": "java.lang.Enum",
-              "startPosition": "1514"
+              "startPosition": "1516"
             }
           ],
-          "startPosition": "1503"
-        },
-        "endPosition": "1530",
+          "startPosition": "1505"
+        },
+        "endPosition": "1532",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "Enum",
           "expression": {
-            "endPosition": "1495",
+            "endPosition": "1497",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1489"
+            "startPosition": "1491"
           },
-          "endPosition": "1500",
+          "endPosition": "1502",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1489"
-        },
-        "startPosition": "1489"
-      },
-      "endPosition": "1530",
+          "startPosition": "1491"
+        },
+        "startPosition": "1491"
+      },
+      "endPosition": "1532",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1489"
+      "startPosition": "1491"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1657",
+          "endPosition": "1659",
           "kind": "FUNCTION_EXPRESSION",
           "body": {
-            "endPosition": "1803",
+            "endPosition": "1805",
             "kind": "BLOCK",
             "statements": [
               {
-                "endPosition": "1716",
+                "endPosition": "1718",
                 "kind": "VARIABLE",
                 "name": "tree",
-                "startPosition": "1667",
+                "startPosition": "1669",
                 "initializer": {
-                  "endPosition": "1716",
+                  "endPosition": "1718",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "parse",
                     "expression": {
                       "identifier": "_parser",
                       "expression": {
-                        "endPosition": "1678",
+                        "endPosition": "1680",
                         "kind": "IDENTIFIER",
                         "name": "this",
-                        "startPosition": "1674"
+                        "startPosition": "1676"
                       },
-                      "endPosition": "1686",
+                      "endPosition": "1688",
                       "kind": "MEMBER_SELECT",
-                      "startPosition": "1674"
+                      "startPosition": "1676"
                     },
-                    "endPosition": "1692",
+                    "endPosition": "1694",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "1674"
+                    "startPosition": "1676"
                   },
                   "arguments": [
                     {
-                      "endPosition": "1697",
+                      "endPosition": "1699",
                       "kind": "IDENTIFIER",
                       "name": "name",
-                      "startPosition": "1693"
+                      "startPosition": "1695"
                     },
                     {
-                      "endPosition": "1705",
+                      "endPosition": "1707",
                       "kind": "IDENTIFIER",
                       "name": "script",
-                      "startPosition": "1699"
+                      "startPosition": "1701"
                     },
                     {
-                      "endPosition": "1715",
+                      "endPosition": "1717",
                       "kind": "IDENTIFIER",
                       "name": "listener",
-                      "startPosition": "1707"
+                      "startPosition": "1709"
                     }
                   ],
-                  "startPosition": "1674"
+                  "startPosition": "1676"
                 }
               },
               {
                 "expression": {
-                  "endPosition": "1771",
+                  "endPosition": "1773",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "accept",
                     "expression": {
-                      "endPosition": "1726",
+                      "endPosition": "1728",
                       "kind": "IDENTIFIER",
                       "name": "tree",
-                      "startPosition": "1722"
+                      "startPosition": "1724"
                     },
-                    "endPosition": "1733",
+                    "endPosition": "1735",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "1722"
+                    "startPosition": "1724"
                   },
                   "arguments": [
                     {
                       "constructorExpression": {
-                        "endPosition": "1764",
+                        "endPosition": "1766",
                         "kind": "FUNCTION_INVOCATION",
                         "functionSelect": {
                           "identifier": "SimpleTreeVisitor",
                           "expression": {
-                            "endPosition": "1744",
+                            "endPosition": "1746",
                             "kind": "IDENTIFIER",
                             "name": "Parser",
-                            "startPosition": "1738"
+                            "startPosition": "1740"
                           },
-                          "endPosition": "1762",
+                          "endPosition": "1764",
                           "kind": "MEMBER_SELECT",
-                          "startPosition": "1738"
+                          "startPosition": "1740"
                         },
                         "arguments": [],
-                        "startPosition": "1744"
+                        "startPosition": "1746"
                       },
-                      "endPosition": "1764",
+                      "endPosition": "1766",
                       "kind": "NEW",
-                      "startPosition": "1734"
+                      "startPosition": "1736"
                     },
                     {
-                      "endPosition": "1770",
+                      "endPosition": "1772",
                       "kind": "NULL_LITERAL",
-                      "startPosition": "1766"
+                      "startPosition": "1768"
                     }
                   ],
-                  "startPosition": "1722"
+                  "startPosition": "1724"
                 },
-                "endPosition": "1771",
+                "endPosition": "1773",
                 "kind": "EXPRESSION_STATEMENT",
-                "startPosition": "1722"
+                "startPosition": "1724"
               },
               {
                 "expression": {
-                  "endPosition": "1802",
+                  "endPosition": "1804",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "convert",
                     "expression": {
-                      "endPosition": "1788",
+                      "endPosition": "1790",
                       "kind": "IDENTIFIER",
                       "name": "this",
-                      "startPosition": "1784"
+                      "startPosition": "1786"
                     },
-                    "endPosition": "1796",
+                    "endPosition": "1798",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "1784"
+                    "startPosition": "1786"
                   },
                   "arguments": [
                     {
-                      "endPosition": "1801",
+                      "endPosition": "1803",
                       "kind": "IDENTIFIER",
                       "name": "tree",
-                      "startPosition": "1797"
+                      "startPosition": "1799"
                     }
                   ],
-                  "startPosition": "1784"
+                  "startPosition": "1786"
                 },
-                "endPosition": "1803",
+                "endPosition": "1805",
                 "kind": "RETURN",
-                "startPosition": "1777"
+                "startPosition": "1779"
               }
             ],
-            "startPosition": "1657"
+            "startPosition": "1659"
           },
           "strict": "false",
-          "startPosition": "1657",
+          "startPosition": "1659",
           "parameters": [
             {
-              "endPosition": "1637",
+              "endPosition": "1639",
               "kind": "IDENTIFIER",
               "name": "name",
-              "startPosition": "1633"
+              "startPosition": "1635"
             },
             {
-              "endPosition": "1645",
+              "endPosition": "1647",
               "kind": "IDENTIFIER",
               "name": "script",
-              "startPosition": "1639"
+              "startPosition": "1641"
             },
             {
-              "endPosition": "1655",
+              "endPosition": "1657",
               "kind": "IDENTIFIER",
               "name": "listener",
-              "startPosition": "1647"
+              "startPosition": "1649"
             }
           ]
         },
-        "endPosition": "1657",
+        "endPosition": "1659",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "parse",
           "expression": {
             "identifier": "prototype",
             "expression": {
-              "endPosition": "1605",
+              "endPosition": "1607",
               "kind": "IDENTIFIER",
               "name": "Parser",
-              "startPosition": "1599"
+              "startPosition": "1601"
             },
-            "endPosition": "1615",
+            "endPosition": "1617",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1599"
+            "startPosition": "1601"
           },
-          "endPosition": "1621",
+          "endPosition": "1623",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1599"
-        },
-        "startPosition": "1599"
-      },
-      "endPosition": "1805",
+          "startPosition": "1601"
+        },
+        "startPosition": "1601"
+      },
+      "endPosition": "1807",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1599"
+      "startPosition": "1601"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "1834",
+          "endPosition": "1836",
           "kind": "FUNCTION_EXPRESSION",
           "body": {
-            "endPosition": "1897",
+            "endPosition": "1899",
             "kind": "BLOCK",
             "statements": [
               {
                 "expression": {
-                  "endPosition": "1896",
+                  "endPosition": "1898",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "create",
                     "expression": {
-                      "endPosition": "1887",
+                      "endPosition": "1889",
                       "kind": "FUNCTION_INVOCATION",
                       "functionSelect": {
                         "identifier": "type",
                         "expression": {
-                          "endPosition": "1851",
+                          "endPosition": "1853",
                           "kind": "IDENTIFIER",
                           "name": "Java",
-                          "startPosition": "1847"
+                          "startPosition": "1849"
                         },
-                        "endPosition": "1856",
+                        "endPosition": "1858",
                         "kind": "MEMBER_SELECT",
-                        "startPosition": "1847"
+                        "startPosition": "1849"
                       },
                       "arguments": [
                         {
-                          "endPosition": "1885",
+                          "endPosition": "1887",
                           "kind": "STRING_LITERAL",
                           "value": "jdk.nashorn.api.tree.Parser",
-                          "startPosition": "1858"
+                          "startPosition": "1860"
                         }
                       ],
-                      "startPosition": "1847"
+                      "startPosition": "1849"
                     },
-                    "endPosition": "1894",
+                    "endPosition": "1896",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "1847"
+                    "startPosition": "1849"
                   },
                   "arguments": [],
-                  "startPosition": "1894"
+                  "startPosition": "1896"
                 },
-                "endPosition": "1897",
+                "endPosition": "1899",
                 "kind": "RETURN",
-                "startPosition": "1840"
+                "startPosition": "1842"
               }
             ],
-            "startPosition": "1834"
+            "startPosition": "1836"
           },
           "strict": "false",
-          "startPosition": "1834",
+          "startPosition": "1836",
           "parameters": []
         },
-        "endPosition": "1834",
+        "endPosition": "1836",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "create",
           "expression": {
-            "endPosition": "1813",
+            "endPosition": "1815",
             "kind": "IDENTIFIER",
             "name": "Parser",
-            "startPosition": "1807"
+            "startPosition": "1809"
           },
-          "endPosition": "1820",
+          "endPosition": "1822",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1807"
-        },
-        "startPosition": "1807"
-      },
-      "endPosition": "1971",
+          "startPosition": "1809"
+        },
+        "startPosition": "1809"
+      },
+      "endPosition": "1973",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1807"
+      "startPosition": "1809"
     },
     {
       "expression": {
         "expression": {
-          "endPosition": "2014",
+          "endPosition": "2016",
           "kind": "FUNCTION_EXPRESSION",
           "body": {
-            "endPosition": "2863",
+            "endPosition": "2994",
             "kind": "BLOCK",
             "statements": [
               {
                 "condition": {
                   "leftOperand": {
-                    "expression": {
-                      "endPosition": "2029",
-                      "kind": "IDENTIFIER",
-                      "name": "tree",
-                      "startPosition": "2025"
+                    "leftOperand": {
+                      "expression": {
+                        "endPosition": "2031",
+                        "kind": "IDENTIFIER",
+                        "name": "tree",
+                        "startPosition": "2027"
+                      },
+                      "endPosition": "2031",
+                      "kind": "LOGICAL_COMPLEMENT",
+                      "startPosition": "2026"
                     },
-                    "endPosition": "2029",
-                    "kind": "LOGICAL_COMPLEMENT",
-                    "startPosition": "2024"
+                    "endPosition": "2057",
+                    "kind": "CONDITIONAL_OR",
+                    "rightOperand": {
+                      "leftOperand": {
+                        "expression": {
+                          "endPosition": "2046",
+                          "kind": "IDENTIFIER",
+                          "name": "tree",
+                          "startPosition": "2042"
+                        },
+                        "endPosition": "2046",
+                        "kind": "TYPEOF",
+                        "startPosition": "2035"
+                      },
+                      "endPosition": "2057",
+                      "kind": "NOT_EQUAL_TO",
+                      "rightOperand": {
+                        "endPosition": "2057",
+                        "kind": "STRING_LITERAL",
+                        "value": "object",
+                        "startPosition": "2051"
+                      },
+                      "startPosition": "2035"
+                    },
+                    "startPosition": "2026"
                   },
-                  "endPosition": "2055",
+                  "endPosition": "2092",
                   "kind": "CONDITIONAL_OR",
                   "rightOperand": {
                     "leftOperand": {
-                      "expression": {
-                        "endPosition": "2044",
-                        "kind": "IDENTIFIER",
-                        "name": "tree",
-                        "startPosition": "2040"
-                      },
-                      "endPosition": "2044",
-                      "kind": "TYPEOF",
-                      "startPosition": "2033"
+                      "endPosition": "2066",
+                      "kind": "IDENTIFIER",
+                      "name": "tree",
+                      "startPosition": "2062"
                     },
-                    "endPosition": "2055",
-                    "kind": "NOT_EQUAL_TO",
+                    "expression": {
+                      "endPosition": "2066",
+                      "kind": "IDENTIFIER",
+                      "name": "tree",
+                      "startPosition": "2062"
+                    },
+                    "endPosition": "2092",
+                    "kind": "INSTANCE_OF",
                     "rightOperand": {
-                      "endPosition": "2055",
-                      "kind": "STRING_LITERAL",
-                      "value": "object",
-                      "startPosition": "2049"
+                      "identifier": "Long",
+                      "expression": {
+                        "identifier": "lang",
+                        "expression": {
+                          "endPosition": "2082",
+                          "kind": "IDENTIFIER",
+                          "name": "java",
+                          "startPosition": "2078"
+                        },
+                        "endPosition": "2087",
+                        "kind": "MEMBER_SELECT",
+                        "startPosition": "2078"
+                      },
+                      "endPosition": "2092",
+                      "kind": "MEMBER_SELECT",
+                      "startPosition": "2078"
                     },
-                    "startPosition": "2033"
+                    "type": {
+                      "identifier": "Long",
+                      "expression": {
+                        "identifier": "lang",
+                        "expression": {
+                          "endPosition": "2082",
+                          "kind": "IDENTIFIER",
+                          "name": "java",
+                          "startPosition": "2078"
+                        },
+                        "endPosition": "2087",
+                        "kind": "MEMBER_SELECT",
+                        "startPosition": "2078"
+                      },
+                      "endPosition": "2092",
+                      "kind": "MEMBER_SELECT",
+                      "startPosition": "2078"
+                    },
+                    "startPosition": "2062"
                   },
-                  "startPosition": "2024"
+                  "startPosition": "2026"
                 },
-                "endPosition": "2086",
+                "endPosition": "2122",
                 "kind": "IF",
-                "startPosition": "2020",
+                "startPosition": "2022",
                 "thenStatement": {
-                  "endPosition": "2086",
+                  "endPosition": "2122",
                   "kind": "BLOCK",
                   "statements": [
                     {
                       "expression": {
-                        "endPosition": "2079",
+                        "endPosition": "2115",
                         "kind": "IDENTIFIER",
                         "name": "tree",
-                        "startPosition": "2075"
+                        "startPosition": "2111"
                       },
-                      "endPosition": "2080",
+                      "endPosition": "2116",
                       "kind": "RETURN",
-                      "startPosition": "2068"
+                      "startPosition": "2104"
                     }
                   ],
-                  "startPosition": "2058"
+                  "startPosition": "2094"
                 }
               },
               {
-                "endPosition": "2133",
+                "endPosition": "2169",
                 "kind": "VARIABLE",
                 "name": "obj",
-                "startPosition": "2096",
+                "startPosition": "2132",
                 "initializer": {
-                  "endPosition": "2133",
+                  "endPosition": "2169",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "bindProperties",
                     "expression": {
-                      "endPosition": "2108",
+                      "endPosition": "2144",
                       "kind": "IDENTIFIER",
                       "name": "Object",
-                      "startPosition": "2102"
+                      "startPosition": "2138"
                     },
-                    "endPosition": "2123",
+                    "endPosition": "2159",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "2102"
+                    "startPosition": "2138"
                   },
                   "arguments": [
                     {
-                      "endPosition": "2126",
+                      "endPosition": "2162",
                       "kind": "OBJECT_LITERAL",
-                      "startPosition": "2124",
+                      "startPosition": "2160",
                       "properties": []
                     },
                     {
-                      "endPosition": "2132",
+                      "endPosition": "2168",
                       "kind": "IDENTIFIER",
                       "name": "tree",
-                      "startPosition": "2128"
+                      "startPosition": "2164"
                     }
                   ],
-                  "startPosition": "2102"
+                  "startPosition": "2138"
                 }
               },
               {
-                "endPosition": "2154",
+                "endPosition": "2190",
                 "kind": "VARIABLE",
                 "name": "result",
-                "startPosition": "2143",
+                "startPosition": "2179",
                 "initializer": {
-                  "endPosition": "2154",
+                  "endPosition": "2190",
                   "kind": "OBJECT_LITERAL",
-                  "startPosition": "2152",
+                  "startPosition": "2188",
                   "properties": []
                 }
               },
               {
-                "endPosition": "2170",
+                "endPosition": "2206",
                 "kind": "VARIABLE",
                 "name": "i",
-                "startPosition": "2169"
+                "startPosition": "2205"
               },
               {
                 "expression": {
-                  "endPosition": "2177",
+                  "endPosition": "2213",
                   "kind": "IDENTIFIER",
                   "name": "obj",
-                  "startPosition": "2174"
+                  "startPosition": "2210"
                 },
-                "endPosition": "2845",
+                "endPosition": "2975",
                 "kind": "FOR_IN_LOOP",
                 "forEach": "false",
                 "variable": {
-                  "endPosition": "2170",
+                  "endPosition": "2206",
                   "kind": "IDENTIFIER",
                   "name": "i",
-                  "startPosition": "2169"
+                  "startPosition": "2205"
                 },
                 "statement": {
-                  "endPosition": "2845",
+                  "endPosition": "2975",
                   "kind": "BLOCK",
                   "statements": [
                     {
-                      "endPosition": "2204",
+                      "endPosition": "2241",
                       "kind": "VARIABLE",
                       "name": "val",
-                      "startPosition": "2192",
+                      "startPosition": "2229",
                       "initializer": {
                         "expression": {
-                          "endPosition": "2201",
+                          "endPosition": "2238",
                           "kind": "IDENTIFIER",
                           "name": "obj",
-                          "startPosition": "2198"
+                          "startPosition": "2235"
                         },
-                        "endPosition": "2204",
+                        "endPosition": "2241",
                         "kind": "ARRAY_ACCESS",
                         "index": {
-                          "endPosition": "2203",
+                          "endPosition": "2240",
                           "kind": "IDENTIFIER",
                           "name": "i",
-                          "startPosition": "2202"
+                          "startPosition": "2239"
                         },
-                        "startPosition": "2198"
+                        "startPosition": "2235"
                       }
                     },
                     {
                       "condition": {
                         "leftOperand": {
-                          "endPosition": "2220",
+                          "endPosition": "2258",
                           "kind": "IDENTIFIER",
                           "name": "val",
-                          "startPosition": "2217"
+                          "startPosition": "2255"
                         },
                         "expression": {
-                          "endPosition": "2220",
+                          "endPosition": "2258",
                           "kind": "IDENTIFIER",
                           "name": "val",
-                          "startPosition": "2217"
+                          "startPosition": "2255"
                         },
-                        "endPosition": "2243",
+                        "endPosition": "2281",
                         "kind": "INSTANCE_OF",
                         "rightOperand": {
                           "identifier": "Tree",
                           "expression": {
-                            "endPosition": "2238",
+                            "endPosition": "2276",
                             "kind": "IDENTIFIER",
                             "name": "Parser",
-                            "startPosition": "2232"
+                            "startPosition": "2270"
                           },
-                          "endPosition": "2243",
+                          "endPosition": "2281",
                           "kind": "MEMBER_SELECT",
-                          "startPosition": "2232"
+                          "startPosition": "2270"
                         },
                         "type": {
                           "identifier": "Tree",
                           "expression": {
-                            "endPosition": "2238",
+                            "endPosition": "2276",
                             "kind": "IDENTIFIER",
                             "name": "Parser",
-                            "startPosition": "2232"
+                            "startPosition": "2270"
                           },
-                          "endPosition": "2243",
+                          "endPosition": "2281",
                           "kind": "MEMBER_SELECT",
-                          "startPosition": "2232"
+                          "startPosition": "2270"
                         },
-                        "startPosition": "2217"
+                        "startPosition": "2255"
                       },
                       "elseStatement": {
                         "condition": {
                           "leftOperand": {
-                            "endPosition": "2309",
+                            "endPosition": "2350",
                             "kind": "IDENTIFIER",
                             "name": "val",
-                            "startPosition": "2306"
+                            "startPosition": "2347"
                           },
                           "expression": {
-                            "endPosition": "2309",
+                            "endPosition": "2350",
                             "kind": "IDENTIFIER",
                             "name": "val",
-                            "startPosition": "2306"
+                            "startPosition": "2347"
                           },
-                          "endPosition": "2332",
+                          "endPosition": "2373",
                           "kind": "INSTANCE_OF",
                           "rightOperand": {
                             "identifier": "List",
                             "expression": {
-                              "endPosition": "2327",
+                              "endPosition": "2368",
                               "kind": "IDENTIFIER",
                               "name": "Parser",
-                              "startPosition": "2321"
+                              "startPosition": "2362"
                             },
-                            "endPosition": "2332",
+                            "endPosition": "2373",
                             "kind": "MEMBER_SELECT",
-                            "startPosition": "2321"
+                            "startPosition": "2362"
                           },
                           "type": {
                             "identifier": "List",
                             "expression": {
-                              "endPosition": "2327",
+                              "endPosition": "2368",
                               "kind": "IDENTIFIER",
                               "name": "Parser",
-                              "startPosition": "2321"
+                              "startPosition": "2362"
                             },
-                            "endPosition": "2332",
+                            "endPosition": "2373",
                             "kind": "MEMBER_SELECT",
-                            "startPosition": "2321"
+                            "startPosition": "2362"
                           },
-                          "startPosition": "2306"
+                          "startPosition": "2347"
                         },
                         "elseStatement": {
-                          "endPosition": "2840",
+                          "endPosition": "2969",
                           "kind": "BLOCK",
                           "statements": [
                             {
                               "cases": [
                                 {
                                   "expression": {
-                                    "endPosition": "2574",
+                                    "endPosition": "2625",
                                     "kind": "STRING_LITERAL",
                                     "value": "number",
-                                    "startPosition": "2568"
+                                    "startPosition": "2619"
                                   },
-                                  "endPosition": "2576",
+                                  "endPosition": "2627",
                                   "kind": "CASE",
                                   "statements": [],
-                                  "startPosition": "2562"
+                                  "startPosition": "2613"
                                 },
                                 {
                                   "expression": {
-                                    "endPosition": "2603",
+                                    "endPosition": "2656",
                                     "kind": "STRING_LITERAL",
                                     "value": "string",
-                                    "startPosition": "2597"
+                                    "startPosition": "2650"
                                   },
-                                  "endPosition": "2605",
+                                  "endPosition": "2658",
                                   "kind": "CASE",
                                   "statements": [],
-                                  "startPosition": "2591"
+                                  "startPosition": "2644"
                                 },
                                 {
                                   "expression": {
-                                    "endPosition": "2633",
+                                    "endPosition": "2688",
                                     "kind": "STRING_LITERAL",
                                     "value": "boolean",
-                                    "startPosition": "2626"
+                                    "startPosition": "2681"
                                   },
-                                  "endPosition": "2678",
+                                  "endPosition": "2762",
                                   "kind": "CASE",
                                   "statements": [
                                     {
                                       "expression": {
                                         "expression": {
-                                          "endPosition": "2677",
+                                          "endPosition": "2734",
                                           "kind": "FUNCTION_INVOCATION",
                                           "functionSelect": {
-                                            "endPosition": "2672",
+                                            "endPosition": "2729",
                                             "kind": "IDENTIFIER",
                                             "name": "String",
-                                            "startPosition": "2666"
+                                            "startPosition": "2723"
                                           },
                                           "arguments": [
                                             {
-                                              "endPosition": "2676",
+                                              "endPosition": "2733",
                                               "kind": "IDENTIFIER",
                                               "name": "val",
-                                              "startPosition": "2673"
+                                              "startPosition": "2730"
                                             }
                                           ],
-                                          "startPosition": "2666"
+                                          "startPosition": "2723"
                                         },
-                                        "endPosition": "2677",
+                                        "endPosition": "2734",
                                         "kind": "ASSIGNMENT",
                                         "variable": {
                                           "expression": {
-                                            "endPosition": "2660",
+                                            "endPosition": "2717",
                                             "kind": "IDENTIFIER",
                                             "name": "result",
-                                            "startPosition": "2654"
+                                            "startPosition": "2711"
                                           },
-                                          "endPosition": "2663",
+                                          "endPosition": "2720",
                                           "kind": "ARRAY_ACCESS",
                                           "index": {
-                                            "endPosition": "2662",
+                                            "endPosition": "2719",
                                             "kind": "IDENTIFIER",
                                             "name": "i",
-                                            "startPosition": "2661"
+                                            "startPosition": "2718"
                                           },
-                                          "startPosition": "2654"
+                                          "startPosition": "2711"
                                         },
-                                        "startPosition": "2654"
+                                        "startPosition": "2711"
                                       },
-                                      "endPosition": "2677",
+                                      "endPosition": "2734",
                                       "kind": "EXPRESSION_STATEMENT",
-                                      "startPosition": "2654"
+                                      "startPosition": "2711"
+                                    },
+                                    {
+                                      "endPosition": "2762",
+                                      "kind": "BREAK",
+                                      "startPosition": "2756"
                                     }
                                   ],
-                                  "startPosition": "2620"
+                                  "startPosition": "2675"
                                 },
                                 {
-                                  "endPosition": "2820",
+                                  "endPosition": "2945",
                                   "kind": "CASE",
                                   "statements": [
                                     {
                                       "condition": {
                                         "leftOperand": {
-                                          "endPosition": "2727",
-                                          "kind": "IDENTIFIER",
-                                          "name": "val",
-                                          "startPosition": "2724"
-                                        },
-                                        "expression": {
-                                          "endPosition": "2727",
-                                          "kind": "IDENTIFIER",
-                                          "name": "val",
-                                          "startPosition": "2724"
-                                        },
-                                        "endPosition": "2750",
-                                        "kind": "INSTANCE_OF",
-                                        "rightOperand": {
-                                          "identifier": "Enum",
+                                          "leftOperand": {
+                                            "endPosition": "2815",
+                                            "kind": "IDENTIFIER",
+                                            "name": "val",
+                                            "startPosition": "2812"
+                                          },
                                           "expression": {
-                                            "endPosition": "2745",
+                                            "endPosition": "2815",
                                             "kind": "IDENTIFIER",
-                                            "name": "Parser",
-                                            "startPosition": "2739"
+                                            "name": "val",
+                                            "startPosition": "2812"
+                                          },
+                                          "endPosition": "2841",
+                                          "kind": "INSTANCE_OF",
+                                          "rightOperand": {
+                                            "identifier": "Long",
+                                            "expression": {
+                                              "identifier": "lang",
+                                              "expression": {
+                                                "endPosition": "2831",
+                                                "kind": "IDENTIFIER",
+                                                "name": "java",
+                                                "startPosition": "2827"
+                                              },
+                                              "endPosition": "2836",
+                                              "kind": "MEMBER_SELECT",
+                                              "startPosition": "2827"
+                                            },
+                                            "endPosition": "2841",
+                                            "kind": "MEMBER_SELECT",
+                                            "startPosition": "2827"
+                                          },
+                                          "type": {
+                                            "identifier": "Long",
+                                            "expression": {
+                                              "identifier": "lang",
+                                              "expression": {
+                                                "endPosition": "2831",
+                                                "kind": "IDENTIFIER",
+                                                "name": "java",
+                                                "startPosition": "2827"
+                                              },
+                                              "endPosition": "2836",
+                                              "kind": "MEMBER_SELECT",
+                                              "startPosition": "2827"
+                                            },
+                                            "endPosition": "2841",
+                                            "kind": "MEMBER_SELECT",
+                                            "startPosition": "2827"
                                           },
-                                          "endPosition": "2750",
-                                          "kind": "MEMBER_SELECT",
-                                          "startPosition": "2739"
+                                          "startPosition": "2812"
                                         },
-                                        "type": {
-                                          "identifier": "Enum",
+                                        "endPosition": "2871",
+                                        "kind": "CONDITIONAL_OR",
+                                        "rightOperand": {
+                                          "leftOperand": {
+                                            "endPosition": "2848",
+                                            "kind": "IDENTIFIER",
+                                            "name": "val",
+                                            "startPosition": "2845"
+                                          },
                                           "expression": {
-                                            "endPosition": "2745",
+                                            "endPosition": "2848",
                                             "kind": "IDENTIFIER",
-                                            "name": "Parser",
-                                            "startPosition": "2739"
+                                            "name": "val",
+                                            "startPosition": "2845"
                                           },
-                                          "endPosition": "2750",
-                                          "kind": "MEMBER_SELECT",
-                                          "startPosition": "2739"
+                                          "endPosition": "2871",
+                                          "kind": "INSTANCE_OF",
+                                          "rightOperand": {
+                                            "identifier": "Enum",
+                                            "expression": {
+                                              "endPosition": "2866",
+                                              "kind": "IDENTIFIER",
+                                              "name": "Parser",
+                                              "startPosition": "2860"
+                                            },
+                                            "endPosition": "2871",
+                                            "kind": "MEMBER_SELECT",
+                                            "startPosition": "2860"
+                                          },
+                                          "type": {
+                                            "identifier": "Enum",
+                                            "expression": {
+                                              "endPosition": "2866",
+                                              "kind": "IDENTIFIER",
+                                              "name": "Parser",
+                                              "startPosition": "2860"
+                                            },
+                                            "endPosition": "2871",
+                                            "kind": "MEMBER_SELECT",
+                                            "startPosition": "2860"
+                                          },
+                                          "startPosition": "2845"
                                         },
-                                        "startPosition": "2724"
+                                        "startPosition": "2812"
                                       },
-                                      "endPosition": "2820",
+                                      "endPosition": "2945",
                                       "kind": "IF",
-                                      "startPosition": "2720",
+                                      "startPosition": "2808",
                                       "thenStatement": {
-                                        "endPosition": "2820",
+                                        "endPosition": "2945",
                                         "kind": "BLOCK",
                                         "statements": [
                                           {
                                             "expression": {
                                               "expression": {
-                                                "endPosition": "2799",
+                                                "endPosition": "2922",
                                                 "kind": "FUNCTION_INVOCATION",
                                                 "functionSelect": {
-                                                  "endPosition": "2794",
+                                                  "endPosition": "2917",
                                                   "kind": "IDENTIFIER",
                                                   "name": "String",
-                                                  "startPosition": "2788"
+                                                  "startPosition": "2911"
                                                 },
                                                 "arguments": [
                                                   {
-                                                    "endPosition": "2798",
+                                                    "endPosition": "2921",
                                                     "kind": "IDENTIFIER",
                                                     "name": "val",
-                                                    "startPosition": "2795"
+                                                    "startPosition": "2918"
                                                   }
                                                 ],
-                                                "startPosition": "2788"
+                                                "startPosition": "2911"
                                               },
-                                              "endPosition": "2799",
+                                              "endPosition": "2922",
                                               "kind": "ASSIGNMENT",
                                               "variable": {
                                                 "expression": {
-                                                  "endPosition": "2782",
+                                                  "endPosition": "2905",
                                                   "kind": "IDENTIFIER",
                                                   "name": "result",
-                                                  "startPosition": "2776"
+                                                  "startPosition": "2899"
                                                 },
-                                                "endPosition": "2785",
+                                                "endPosition": "2908",
                                                 "kind": "ARRAY_ACCESS",
                                                 "index": {
-                                                  "endPosition": "2784",
+                                                  "endPosition": "2907",
                                                   "kind": "IDENTIFIER",
                                                   "name": "i",
-                                                  "startPosition": "2783"
+                                                  "startPosition": "2906"
                                                 },
-                                                "startPosition": "2776"
+                                                "startPosition": "2899"
                                               },
-                                              "startPosition": "2776"
+                                              "startPosition": "2899"
                                             },
-                                            "endPosition": "2799",
+                                            "endPosition": "2922",
                                             "kind": "EXPRESSION_STATEMENT",
-                                            "startPosition": "2776"
+                                            "startPosition": "2899"
                                           }
                                         ],
-                                        "startPosition": "2752"
+                                        "startPosition": "2873"
                                       }
                                     }
                                   ],
-                                  "startPosition": "2693"
+                                  "startPosition": "2779"
                                 }
                               ],
                               "expression": {
                                 "expression": {
-                                  "endPosition": "2544",
+                                  "endPosition": "2593",
                                   "kind": "IDENTIFIER",
                                   "name": "val",
-                                  "startPosition": "2541"
+                                  "startPosition": "2590"
                                 },
-                                "endPosition": "2544",
+                                "endPosition": "2593",
                                 "kind": "TYPEOF",
-                                "startPosition": "2534"
+                                "startPosition": "2583"
                               },
-                              "endPosition": "2832",
+                              "endPosition": "2959",
                               "kind": "SWITCH",
-                              "startPosition": "2526"
+                              "startPosition": "2575"
                             }
                           ],
-                          "startPosition": "2514"
+                          "startPosition": "2561"
                         },
-                        "endPosition": "2840",
+                        "endPosition": "2969",
                         "kind": "IF",
-                        "startPosition": "2302",
+                        "startPosition": "2343",
                         "thenStatement": {
-                          "endPosition": "2508",
+                          "endPosition": "2555",
                           "kind": "BLOCK",
                           "statements": [
                             {
-                              "endPosition": "2377",
+                              "endPosition": "2420",
                               "kind": "VARIABLE",
                               "name": "arr",
-                              "startPosition": "2350",
+                              "startPosition": "2393",
                               "initializer": {
                                 "constructorExpression": {
-                                  "endPosition": "2377",
+                                  "endPosition": "2420",
                                   "kind": "FUNCTION_INVOCATION",
                                   "functionSelect": {
-                                    "endPosition": "2365",
+                                    "endPosition": "2408",
                                     "kind": "IDENTIFIER",
                                     "name": "Array",
-                                    "startPosition": "2360"
+                                    "startPosition": "2403"
                                   },
                                   "arguments": [
                                     {
-                                      "endPosition": "2376",
+                                      "endPosition": "2419",
                                       "kind": "FUNCTION_INVOCATION",
                                       "functionSelect": {
                                         "identifier": "size",
                                         "expression": {
-                                          "endPosition": "2369",
+                                          "endPosition": "2412",
                                           "kind": "IDENTIFIER",
                                           "name": "val",
-                                          "startPosition": "2366"
+                                          "startPosition": "2409"
                                         },
-                                        "endPosition": "2374",
+                                        "endPosition": "2417",
                                         "kind": "MEMBER_SELECT",
-                                        "startPosition": "2366"
+                                        "startPosition": "2409"
                                       },
                                       "arguments": [],
-                                      "startPosition": "2366"
+                                      "startPosition": "2409"
                                     }
                                   ],
-                                  "startPosition": "2360"
+                                  "startPosition": "2403"
                                 },
-                                "endPosition": "2377",
+                                "endPosition": "2420",
                                 "kind": "NEW",
-                                "startPosition": "2356"
+                                "startPosition": "2399"
                               }
                             },
                             {
-                              "endPosition": "2399",
+                              "endPosition": "2444",
                               "kind": "VARIABLE",
                               "name": "j",
-                              "startPosition": "2398"
+                              "startPosition": "2443"
                             },
                             {
                               "expression": {
-                                "endPosition": "2406",
+                                "endPosition": "2451",
                                 "kind": "IDENTIFIER",
                                 "name": "val",
-                                "startPosition": "2403"
+                                "startPosition": "2448"
                               },
-                              "endPosition": "2466",
+                              "endPosition": "2515",
                               "kind": "FOR_IN_LOOP",
                               "forEach": "false",
                               "variable": {
-                                "endPosition": "2399",
+                                "endPosition": "2444",
                                 "kind": "IDENTIFIER",
                                 "name": "j",
-                                "startPosition": "2398"
+                                "startPosition": "2443"
                               },
                               "statement": {
-                                "endPosition": "2466",
+                                "endPosition": "2515",
                                 "kind": "BLOCK",
                                 "statements": [
                                   {
                                     "expression": {
                                       "expression": {
-                                        "endPosition": "2453",
+                                        "endPosition": "2500",
                                         "kind": "FUNCTION_INVOCATION",
                                         "functionSelect": {
                                           "identifier": "convert",
                                           "expression": {
-                                            "endPosition": "2437",
+                                            "endPosition": "2484",
                                             "kind": "IDENTIFIER",
                                             "name": "this",
-                                            "startPosition": "2433"
+                                            "startPosition": "2480"
                                           },
-                                          "endPosition": "2445",
+                                          "endPosition": "2492",
                                           "kind": "MEMBER_SELECT",
-                                          "startPosition": "2433"
+                                          "startPosition": "2480"
                                         },
                                         "arguments": [
                                           {
                                             "expression": {
-                                              "endPosition": "2449",
+                                              "endPosition": "2496",
                                               "kind": "IDENTIFIER",
                                               "name": "val",
-                                              "startPosition": "2446"
+                                              "startPosition": "2493"
                                             },
-                                            "endPosition": "2452",
+                                            "endPosition": "2499",
                                             "kind": "ARRAY_ACCESS",
                                             "index": {
-                                              "endPosition": "2451",
+                                              "endPosition": "2498",
                                               "kind": "IDENTIFIER",
                                               "name": "j",
-                                              "startPosition": "2450"
+                                              "startPosition": "2497"
                                             },
-                                            "startPosition": "2446"
+                                            "startPosition": "2493"
                                           }
                                         ],
-                                        "startPosition": "2433"
+                                        "startPosition": "2480"
                                       },
-                                      "endPosition": "2453",
+                                      "endPosition": "2500",
                                       "kind": "ASSIGNMENT",
                                       "variable": {
                                         "expression": {
-                                          "endPosition": "2427",
+                                          "endPosition": "2474",
                                           "kind": "IDENTIFIER",
                                           "name": "arr",
-                                          "startPosition": "2424"
+                                          "startPosition": "2471"
                                         },
-                                        "endPosition": "2430",
+                                        "endPosition": "2477",
                                         "kind": "ARRAY_ACCESS",
                                         "index": {
-                                          "endPosition": "2429",
+                                          "endPosition": "2476",
                                           "kind": "IDENTIFIER",
                                           "name": "j",
-                                          "startPosition": "2428"
+                                          "startPosition": "2475"
                                         },
-                                        "startPosition": "2424"
+                                        "startPosition": "2471"
                                       },
-                                      "startPosition": "2424"
+                                      "startPosition": "2471"
                                     },
-                                    "endPosition": "2453",
+                                    "endPosition": "2500",
                                     "kind": "EXPRESSION_STATEMENT",
-                                    "startPosition": "2424"
+                                    "startPosition": "2471"
                                   }
                                 ],
-                                "startPosition": "2408"
+                                "startPosition": "2453"
                               },
-                              "startPosition": "2389"
+                              "startPosition": "2434"
                             },
                             {
                               "expression": {
                                 "expression": {
-                                  "endPosition": "2499",
+                                  "endPosition": "2544",
                                   "kind": "IDENTIFIER",
                                   "name": "arr",
-                                  "startPosition": "2496"
+                                  "startPosition": "2541"
                                 },
-                                "endPosition": "2499",
+                                "endPosition": "2544",
                                 "kind": "ASSIGNMENT",
                                 "variable": {
                                   "expression": {
-                                    "endPosition": "2490",
+                                    "endPosition": "2535",
                                     "kind": "IDENTIFIER",
                                     "name": "result",
-                                    "startPosition": "2484"
+                                    "startPosition": "2529"
                                   },
-                                  "endPosition": "2493",
+                                  "endPosition": "2538",
                                   "kind": "ARRAY_ACCESS",
                                   "index": {
-                                    "endPosition": "2492",
+                                    "endPosition": "2537",
                                     "kind": "IDENTIFIER",
                                     "name": "i",
-                                    "startPosition": "2491"
+                                    "startPosition": "2536"
                                   },
-                                  "startPosition": "2484"
+                                  "startPosition": "2529"
                                 },
-                                "startPosition": "2484"
+                                "startPosition": "2529"
                               },
-                              "endPosition": "2499",
+                              "endPosition": "2544",
                               "kind": "EXPRESSION_STATEMENT",
-                              "startPosition": "2484"
+                              "startPosition": "2529"
                             }
                           ],
-                          "startPosition": "2334"
+                          "startPosition": "2375"
                         }
                       },
-                      "endPosition": "2840",
+                      "endPosition": "2969",
                       "kind": "IF",
-                      "startPosition": "2213",
+                      "startPosition": "2251",
                       "thenStatement": {
-                        "endPosition": "2296",
+                        "endPosition": "2337",
                         "kind": "BLOCK",
                         "statements": [
                           {
                             "expression": {
                               "expression": {
-                                "endPosition": "2286",
+                                "endPosition": "2326",
                                 "kind": "FUNCTION_INVOCATION",
                                 "functionSelect": {
                                   "identifier": "convert",
                                   "expression": {
-                                    "endPosition": "2273",
+                                    "endPosition": "2313",
                                     "kind": "IDENTIFIER",
                                     "name": "this",
-                                    "startPosition": "2269"
+                                    "startPosition": "2309"
                                   },
-                                  "endPosition": "2281",
+                                  "endPosition": "2321",
                                   "kind": "MEMBER_SELECT",
-                                  "startPosition": "2269"
+                                  "startPosition": "2309"
                                 },
                                 "arguments": [
                                   {
-                                    "endPosition": "2285",
+                                    "endPosition": "2325",
                                     "kind": "IDENTIFIER",
                                     "name": "val",
-                                    "startPosition": "2282"
+                                    "startPosition": "2322"
                                   }
                                 ],
-                                "startPosition": "2269"
+                                "startPosition": "2309"
                               },
-                              "endPosition": "2286",
+                              "endPosition": "2326",
                               "kind": "ASSIGNMENT",
                               "variable": {
                                 "expression": {
-                                  "endPosition": "2263",
+                                  "endPosition": "2303",
                                   "kind": "IDENTIFIER",
                                   "name": "result",
-                                  "startPosition": "2257"
+                                  "startPosition": "2297"
                                 },
-                                "endPosition": "2266",
+                                "endPosition": "2306",
                                 "kind": "ARRAY_ACCESS",
                                 "index": {
-                                  "endPosition": "2265",
+                                  "endPosition": "2305",
                                   "kind": "IDENTIFIER",
                                   "name": "i",
-                                  "startPosition": "2264"
+                                  "startPosition": "2304"
                                 },
-                                "startPosition": "2257"
+                                "startPosition": "2297"
                               },
-                              "startPosition": "2257"
+                              "startPosition": "2297"
                             },
-                            "endPosition": "2286",
+                            "endPosition": "2326",
                             "kind": "EXPRESSION_STATEMENT",
-                            "startPosition": "2257"
+                            "startPosition": "2297"
                           }
                         ],
-                        "startPosition": "2245"
+                        "startPosition": "2283"
                       }
                     }
                   ],
-                  "startPosition": "2179"
+                  "startPosition": "2215"
                 },
-                "startPosition": "2160"
+                "startPosition": "2196"
               },
               {
                 "expression": {
-                  "endPosition": "2862",
+                  "endPosition": "2993",
                   "kind": "IDENTIFIER",
                   "name": "result",
-                  "startPosition": "2856"
+                  "startPosition": "2987"
                 },
-                "endPosition": "2863",
+                "endPosition": "2994",
                 "kind": "RETURN",
-                "startPosition": "2849"
+                "startPosition": "2980"
               }
             ],
-            "startPosition": "2014"
+            "startPosition": "2016"
           },
           "strict": "false",
-          "startPosition": "2014",
+          "startPosition": "2016",
           "parameters": [
             {
-              "endPosition": "2012",
+              "endPosition": "2014",
               "kind": "IDENTIFIER",
               "name": "tree",
-              "startPosition": "2008"
+              "startPosition": "2010"
             }
           ]
         },
-        "endPosition": "2014",
+        "endPosition": "2016",
         "kind": "ASSIGNMENT",
         "variable": {
           "identifier": "convert",
           "expression": {
             "identifier": "prototype",
             "expression": {
-              "endPosition": "1978",
+              "endPosition": "1980",
               "kind": "IDENTIFIER",
               "name": "Parser",
-              "startPosition": "1972"
+              "startPosition": "1974"
             },
-            "endPosition": "1988",
+            "endPosition": "1990",
             "kind": "MEMBER_SELECT",
-            "startPosition": "1972"
+            "startPosition": "1974"
           },
-          "endPosition": "1996",
+          "endPosition": "1998",
           "kind": "MEMBER_SELECT",
-          "startPosition": "1972"
-        },
-        "startPosition": "1972"
-      },
-      "endPosition": "2865",
+          "startPosition": "1974"
+        },
+        "startPosition": "1974"
+      },
+      "endPosition": "2996",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1972"
-    },
-    {
-      "endPosition": "3618",
+      "startPosition": "1974"
+    },
+    {
+      "endPosition": "3767",
       "kind": "FUNCTION",
       "name": "processFiles",
       "body": {
-        "endPosition": "3575",
+        "endPosition": "3724",
         "kind": "BLOCK",
         "statements": [
           {
-            "endPosition": "2938",
+            "endPosition": "3070",
             "kind": "VARIABLE",
             "name": "File",
-            "startPosition": "2906",
+            "startPosition": "3038",
             "initializer": {
-              "endPosition": "2938",
+              "endPosition": "3070",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
                 "identifier": "type",
                 "expression": {
-                  "endPosition": "2917",
+                  "endPosition": "3049",
                   "kind": "IDENTIFIER",
                   "name": "Java",
-                  "startPosition": "2913"
+                  "startPosition": "3045"
                 },
-                "endPosition": "2922",
+                "endPosition": "3054",
                 "kind": "MEMBER_SELECT",
-                "startPosition": "2913"
+                "startPosition": "3045"
               },
               "arguments": [
                 {
-                  "endPosition": "2936",
+                  "endPosition": "3068",
                   "kind": "STRING_LITERAL",
                   "value": "java.io.File",
-                  "startPosition": "2924"
+                  "startPosition": "3056"
                 }
               ],
-              "startPosition": "2913"
+              "startPosition": "3045"
             }
           },
           {
-            "endPosition": "2993",
+            "endPosition": "3126",
             "kind": "VARIABLE",
             "name": "files",
-            "startPosition": "2947",
+            "startPosition": "3080",
             "initializer": {
-              "endPosition": "2993",
+              "endPosition": "3126",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
                 "identifier": "listFiles",
                 "expression": {
                   "constructorExpression": {
-                    "endPosition": "2981",
+                    "endPosition": "3114",
                     "kind": "FUNCTION_INVOCATION",
                     "functionSelect": {
-                      "endPosition": "2963",
+                      "endPosition": "3096",
                       "kind": "IDENTIFIER",
                       "name": "File",
-                      "startPosition": "2959"
+                      "startPosition": "3092"
                     },
                     "arguments": [
                       {
                         "leftOperand": {
-                          "endPosition": "2971",
+                          "endPosition": "3104",
                           "kind": "IDENTIFIER",
                           "name": "__DIR__",
-                          "startPosition": "2964"
+                          "startPosition": "3097"
                         },
-                        "endPosition": "2980",
+                        "endPosition": "3113",
                         "kind": "PLUS",
                         "rightOperand": {
-                          "endPosition": "2980",
+                          "endPosition": "3113",
                           "kind": "IDENTIFIER",
                           "name": "subdir",
-                          "startPosition": "2974"
+                          "startPosition": "3107"
                         },
-                        "startPosition": "2964"
+                        "startPosition": "3097"
                       }
                     ],
-                    "startPosition": "2959"
+                    "startPosition": "3092"
                   },
-                  "endPosition": "2981",
+                  "endPosition": "3114",
                   "kind": "NEW",
-                  "startPosition": "2955"
+                  "startPosition": "3088"
                 },
-                "endPosition": "2991",
+                "endPosition": "3124",
                 "kind": "MEMBER_SELECT",
-                "startPosition": "2955"
+                "startPosition": "3088"
               },
               "arguments": [],
-              "startPosition": "2955"
+              "startPosition": "3088"
             }
           },
           {
             "expression": {
-              "endPosition": "3026",
+              "endPosition": "3160",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
                 "identifier": "sort",
@@ -6291,751 +6412,751 @@
                   "expression": {
                     "identifier": "util",
                     "expression": {
-                      "endPosition": "3002",
+                      "endPosition": "3136",
                       "kind": "IDENTIFIER",
                       "name": "java",
-                      "startPosition": "2998"
+                      "startPosition": "3132"
                     },
-                    "endPosition": "3007",
+                    "endPosition": "3141",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "2998"
+                    "startPosition": "3132"
                   },
-                  "endPosition": "3014",
+                  "endPosition": "3148",
                   "kind": "MEMBER_SELECT",
-                  "startPosition": "2998"
+                  "startPosition": "3132"
                 },
-                "endPosition": "3019",
+                "endPosition": "3153",
                 "kind": "MEMBER_SELECT",
-                "startPosition": "2998"
+                "startPosition": "3132"
               },
               "arguments": [
                 {
-                  "endPosition": "3025",
+                  "endPosition": "3159",
                   "kind": "IDENTIFIER",
                   "name": "files",
-                  "startPosition": "3020"
+                  "startPosition": "3154"
                 }
               ],
-              "startPosition": "2998"
+              "startPosition": "3132"
             },
-            "endPosition": "3026",
+            "endPosition": "3160",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "2998"
+            "startPosition": "3132"
           },
           {
-            "endPosition": "3049",
+            "endPosition": "3184",
             "kind": "VARIABLE",
             "name": "file",
-            "startPosition": "3045"
+            "startPosition": "3180"
           },
           {
             "expression": {
-              "endPosition": "3058",
+              "endPosition": "3193",
               "kind": "IDENTIFIER",
               "name": "files",
-              "startPosition": "3053"
+              "startPosition": "3188"
             },
-            "endPosition": "3575",
+            "endPosition": "3724",
             "kind": "FOR_IN_LOOP",
             "forEach": "true",
             "variable": {
-              "endPosition": "3049",
+              "endPosition": "3184",
               "kind": "IDENTIFIER",
               "name": "file",
-              "startPosition": "3045"
+              "startPosition": "3180"
             },
             "statement": {
-              "endPosition": "3575",
+              "endPosition": "3724",
               "kind": "BLOCK",
               "statements": [
                 {
                   "condition": {
-                    "endPosition": "3098",
+                    "endPosition": "3234",
                     "kind": "FUNCTION_INVOCATION",
                     "functionSelect": {
                       "identifier": "endsWith",
                       "expression": {
                         "identifier": "name",
                         "expression": {
-                          "endPosition": "3077",
+                          "endPosition": "3213",
                           "kind": "IDENTIFIER",
                           "name": "file",
-                          "startPosition": "3073"
+                          "startPosition": "3209"
                         },
-                        "endPosition": "3082",
+                        "endPosition": "3218",
                         "kind": "MEMBER_SELECT",
-                        "startPosition": "3073"
+                        "startPosition": "3209"
                       },
-                      "endPosition": "3091",
+                      "endPosition": "3227",
                       "kind": "MEMBER_SELECT",
-                      "startPosition": "3073"
+                      "startPosition": "3209"
                     },
                     "arguments": [
                       {
-                        "endPosition": "3096",
+                        "endPosition": "3232",
                         "kind": "STRING_LITERAL",
                         "value": ".js",
-                        "startPosition": "3093"
+                        "startPosition": "3229"
                       }
                     ],
-                    "startPosition": "3073"
+                    "startPosition": "3209"
                   },
-                  "endPosition": "3570",
+                  "endPosition": "3718",
                   "kind": "IF",
-                  "startPosition": "3069",
+                  "startPosition": "3205",
                   "thenStatement": {
-                    "endPosition": "3570",
+                    "endPosition": "3718",
                     "kind": "BLOCK",
                     "statements": [
                       {
-                        "endPosition": "3141",
+                        "endPosition": "3278",
                         "kind": "VARIABLE",
                         "name": "script",
-                        "startPosition": "3117",
+                        "startPosition": "3254",
                         "initializer": {
-                          "endPosition": "3141",
+                          "endPosition": "3278",
                           "kind": "FUNCTION_INVOCATION",
                           "functionSelect": {
-                            "endPosition": "3135",
+                            "endPosition": "3272",
                             "kind": "IDENTIFIER",
                             "name": "readFully",
-                            "startPosition": "3126"
+                            "startPosition": "3263"
                           },
                           "arguments": [
                             {
-                              "endPosition": "3140",
+                              "endPosition": "3277",
                               "kind": "IDENTIFIER",
                               "name": "file",
-                              "startPosition": "3136"
+                              "startPosition": "3273"
                             }
                           ],
-                          "startPosition": "3126"
+                          "startPosition": "3263"
                         }
                       },
                       {
-                        "endPosition": "3179",
+                        "endPosition": "3317",
                         "kind": "VARIABLE",
                         "name": "parser",
-                        "startPosition": "3158",
+                        "startPosition": "3296",
                         "initializer": {
                           "constructorExpression": {
-                            "endPosition": "3179",
+                            "endPosition": "3317",
                             "kind": "FUNCTION_INVOCATION",
                             "functionSelect": {
-                              "endPosition": "3177",
+                              "endPosition": "3315",
                               "kind": "IDENTIFIER",
                               "name": "Parser",
-                              "startPosition": "3171"
+                              "startPosition": "3309"
                             },
                             "arguments": [],
-                            "startPosition": "3171"
+                            "startPosition": "3309"
                           },
-                          "endPosition": "3179",
+                          "endPosition": "3317",
                           "kind": "NEW",
-                          "startPosition": "3167"
+                          "startPosition": "3305"
                         }
                       },
                       {
-                        "endPosition": "3435",
+                        "endPosition": "3578",
                         "kind": "VARIABLE",
                         "name": "tree",
-                        "startPosition": "3196",
+                        "startPosition": "3335",
                         "initializer": {
-                          "endPosition": "3435",
+                          "endPosition": "3578",
                           "kind": "FUNCTION_INVOCATION",
                           "functionSelect": {
                             "identifier": "parse",
                             "expression": {
-                              "endPosition": "3209",
+                              "endPosition": "3348",
                               "kind": "IDENTIFIER",
                               "name": "parser",
-                              "startPosition": "3203"
+                              "startPosition": "3342"
                             },
-                            "endPosition": "3215",
+                            "endPosition": "3354",
                             "kind": "MEMBER_SELECT",
-                            "startPosition": "3203"
+                            "startPosition": "3342"
                           },
                           "arguments": [
                             {
                               "leftOperand": {
                                 "leftOperand": {
-                                  "endPosition": "3222",
+                                  "endPosition": "3361",
                                   "kind": "IDENTIFIER",
                                   "name": "subdir",
-                                  "startPosition": "3216"
+                                  "startPosition": "3355"
                                 },
-                                "endPosition": "3227",
+                                "endPosition": "3366",
                                 "kind": "PLUS",
                                 "rightOperand": {
-                                  "endPosition": "3227",
+                                  "endPosition": "3366",
                                   "kind": "STRING_LITERAL",
                                   "value": "/",
-                                  "startPosition": "3226"
+                                  "startPosition": "3365"
                                 },
-                                "startPosition": "3216"
+                                "startPosition": "3355"
                               },
-                              "endPosition": "3240",
+                              "endPosition": "3379",
                               "kind": "PLUS",
                               "rightOperand": {
                                 "identifier": "name",
                                 "expression": {
-                                  "endPosition": "3235",
+                                  "endPosition": "3374",
                                   "kind": "IDENTIFIER",
                                   "name": "file",
-                                  "startPosition": "3231"
+                                  "startPosition": "3370"
                                 },
-                                "endPosition": "3240",
+                                "endPosition": "3379",
                                 "kind": "MEMBER_SELECT",
-                                "startPosition": "3231"
+                                "startPosition": "3370"
                               },
-                              "startPosition": "3216"
+                              "startPosition": "3355"
                             },
                             {
-                              "endPosition": "3248",
+                              "endPosition": "3387",
                               "kind": "IDENTIFIER",
                               "name": "script",
-                              "startPosition": "3242"
+                              "startPosition": "3381"
                             },
                             {
-                              "endPosition": "3286",
+                              "endPosition": "3426",
                               "kind": "FUNCTION_EXPRESSION",
                               "body": {
-                                "endPosition": "3417",
+                                "endPosition": "3559",
                                 "kind": "BLOCK",
                                 "statements": [
                                   {
                                     "expression": {
-                                      "endPosition": "3385",
+                                      "endPosition": "3526",
                                       "kind": "FUNCTION_INVOCATION",
                                       "functionSelect": {
-                                        "endPosition": "3312",
+                                        "endPosition": "3453",
                                         "kind": "IDENTIFIER",
                                         "name": "print",
-                                        "startPosition": "3307"
+                                        "startPosition": "3448"
                                       },
                                       "arguments": [
                                         {
-                                          "endPosition": "3384",
+                                          "endPosition": "3525",
                                           "kind": "FUNCTION_INVOCATION",
                                           "functionSelect": {
                                             "identifier": "replace",
                                             "expression": {
-                                              "endPosition": "3364",
+                                              "endPosition": "3505",
                                               "kind": "FUNCTION_INVOCATION",
                                               "functionSelect": {
                                                 "identifier": "stringify",
                                                 "expression": {
-                                                  "endPosition": "3317",
+                                                  "endPosition": "3458",
                                                   "kind": "IDENTIFIER",
                                                   "name": "JSON",
-                                                  "startPosition": "3313"
+                                                  "startPosition": "3454"
                                                 },
-                                                "endPosition": "3327",
+                                                "endPosition": "3468",
                                                 "kind": "MEMBER_SELECT",
-                                                "startPosition": "3313"
+                                                "startPosition": "3454"
                                               },
                                               "arguments": [
                                                 {
-                                                  "endPosition": "3354",
+                                                  "endPosition": "3495",
                                                   "kind": "FUNCTION_INVOCATION",
                                                   "functionSelect": {
                                                     "identifier": "convert",
                                                     "expression": {
-                                                      "endPosition": "3334",
+                                                      "endPosition": "3475",
                                                       "kind": "IDENTIFIER",
                                                       "name": "parser",
-                                                      "startPosition": "3328"
+                                                      "startPosition": "3469"
                                                     },
-                                                    "endPosition": "3342",
+                                                    "endPosition": "3483",
                                                     "kind": "MEMBER_SELECT",
-                                                    "startPosition": "3328"
+                                                    "startPosition": "3469"
                                                   },
                                                   "arguments": [
                                                     {
-                                                      "endPosition": "3353",
+                                                      "endPosition": "3494",
                                                       "kind": "IDENTIFIER",
                                                       "name": "diagnostic",
-                                                      "startPosition": "3343"
+                                                      "startPosition": "3484"
                                                     }
                                                   ],
-                                                  "startPosition": "3328"
+                                                  "startPosition": "3469"
                                                 },
                                                 {
-                                                  "endPosition": "3360",
+                                                  "endPosition": "3501",
                                                   "kind": "NULL_LITERAL",
-                                                  "startPosition": "3356"
+                                                  "startPosition": "3497"
                                                 },
                                                 {
-                                                  "endPosition": "3363",
+                                                  "endPosition": "3504",
                                                   "kind": "NUMBER_LITERAL",
                                                   "value": "2",
-                                                  "startPosition": "3362"
+                                                  "startPosition": "3503"
                                                 }
                                               ],
-                                              "startPosition": "3313"
+                                              "startPosition": "3454"
                                             },
-                                            "endPosition": "3372",
+                                            "endPosition": "3513",
                                             "kind": "MEMBER_SELECT",
-                                            "startPosition": "3313"
+                                            "startPosition": "3454"
                                           },
                                           "arguments": [
                                             {
-                                              "endPosition": "3379",
+                                              "endPosition": "3520",
                                               "kind": "REGEXP_LITERAL",
                                               "options": "g",
                                               "pattern": "\\\\r",
-                                              "startPosition": "3373"
+                                              "startPosition": "3514"
                                             },
                                             {
-                                              "endPosition": "3382",
+                                              "endPosition": "3523",
                                               "kind": "STRING_LITERAL",
                                               "value": "",
-                                              "startPosition": "3382"
+                                              "startPosition": "3523"
                                             }
                                           ],
-                                          "startPosition": "3372"
+                                          "startPosition": "3513"
                                         }
                                       ],
-                                      "startPosition": "3307"
+                                      "startPosition": "3448"
                                     },
-                                    "endPosition": "3385",
+                                    "endPosition": "3526",
                                     "kind": "EXPRESSION_STATEMENT",
-                                    "startPosition": "3307"
+                                    "startPosition": "3448"
                                   },
                                   {
                                     "expression": {
-                                      "endPosition": "3416",
+                                      "endPosition": "3558",
                                       "kind": "FUNCTION_INVOCATION",
                                       "functionSelect": {
-                                        "endPosition": "3411",
+                                        "endPosition": "3553",
                                         "kind": "IDENTIFIER",
                                         "name": "print",
-                                        "startPosition": "3406"
+                                        "startPosition": "3548"
                                       },
                                       "arguments": [
                                         {
-                                          "endPosition": "3414",
+                                          "endPosition": "3556",
                                           "kind": "STRING_LITERAL",
                                           "value": ",",
-                                          "startPosition": "3413"
+                                          "startPosition": "3555"
                                         }
                                       ],
-                                      "startPosition": "3406"
+                                      "startPosition": "3548"
                                     },
-                                    "endPosition": "3416",
+                                    "endPosition": "3558",
                                     "kind": "EXPRESSION_STATEMENT",
-                                    "startPosition": "3406"
+                                    "startPosition": "3548"
                                   }
                                 ],
-                                "startPosition": "3286"
+                                "startPosition": "3426"
                               },
                               "strict": "false",
-                              "startPosition": "3286",
+                              "startPosition": "3426",
                               "parameters": [
                                 {
-                                  "endPosition": "3284",
+                                  "endPosition": "3424",
                                   "kind": "IDENTIFIER",
                                   "name": "diagnostic",
-                                  "startPosition": "3274"
+                                  "startPosition": "3414"
                                 }
                               ]
                             }
                           ],
-                          "startPosition": "3203"
+                          "startPosition": "3342"
                         }
                       },
                       {
                         "condition": {
                           "leftOperand": {
-                            "endPosition": "3457",
+                            "endPosition": "3601",
                             "kind": "IDENTIFIER",
                             "name": "tree",
-                            "startPosition": "3453"
+                            "startPosition": "3597"
                           },
-                          "endPosition": "3465",
+                          "endPosition": "3609",
                           "kind": "NOT_EQUAL_TO",
                           "rightOperand": {
-                            "endPosition": "3465",
+                            "endPosition": "3609",
                             "kind": "NULL_LITERAL",
-                            "startPosition": "3461"
+                            "startPosition": "3605"
                           },
-                          "startPosition": "3453"
+                          "startPosition": "3597"
                         },
-                        "endPosition": "3561",
+                        "endPosition": "3708",
                         "kind": "IF",
-                        "startPosition": "3449",
+                        "startPosition": "3593",
                         "thenStatement": {
-                          "endPosition": "3561",
+                          "endPosition": "3708",
                           "kind": "BLOCK",
                           "statements": [
                             {
                               "expression": {
-                                "endPosition": "3520",
+                                "endPosition": "3665",
                                 "kind": "FUNCTION_INVOCATION",
                                 "functionSelect": {
-                                  "endPosition": "3489",
+                                  "endPosition": "3634",
                                   "kind": "IDENTIFIER",
                                   "name": "print",
-                                  "startPosition": "3484"
+                                  "startPosition": "3629"
                                 },
                                 "arguments": [
                                   {
-                                    "endPosition": "3519",
+                                    "endPosition": "3664",
                                     "kind": "FUNCTION_INVOCATION",
                                     "functionSelect": {
                                       "identifier": "stringify",
                                       "expression": {
-                                        "endPosition": "3494",
+                                        "endPosition": "3639",
                                         "kind": "IDENTIFIER",
                                         "name": "JSON",
-                                        "startPosition": "3490"
+                                        "startPosition": "3635"
                                       },
-                                      "endPosition": "3504",
+                                      "endPosition": "3649",
                                       "kind": "MEMBER_SELECT",
-                                      "startPosition": "3490"
+                                      "startPosition": "3635"
                                     },
                                     "arguments": [
                                       {
-                                        "endPosition": "3509",
+                                        "endPosition": "3654",
                                         "kind": "IDENTIFIER",
                                         "name": "tree",
-                                        "startPosition": "3505"
+                                        "startPosition": "3650"
                                       },
                                       {
-                                        "endPosition": "3515",
+                                        "endPosition": "3660",
                                         "kind": "NULL_LITERAL",
-                                        "startPosition": "3511"
+                                        "startPosition": "3656"
                                       },
                                       {
-                                        "endPosition": "3518",
+                                        "endPosition": "3663",
                                         "kind": "NUMBER_LITERAL",
                                         "value": "2",
-                                        "startPosition": "3517"
+                                        "startPosition": "3662"
                                       }
                                     ],
-                                    "startPosition": "3490"
+                                    "startPosition": "3635"
                                   }
                                 ],
-                                "startPosition": "3484"
+                                "startPosition": "3629"
                               },
-                              "endPosition": "3520",
+                              "endPosition": "3665",
                               "kind": "EXPRESSION_STATEMENT",
-                              "startPosition": "3484"
+                              "startPosition": "3629"
                             },
                             {
                               "expression": {
-                                "endPosition": "3547",
+                                "endPosition": "3693",
                                 "kind": "FUNCTION_INVOCATION",
                                 "functionSelect": {
-                                  "endPosition": "3542",
+                                  "endPosition": "3688",
                                   "kind": "IDENTIFIER",
                                   "name": "print",
-                                  "startPosition": "3537"
+                                  "startPosition": "3683"
                                 },
                                 "arguments": [
                                   {
-                                    "endPosition": "3545",
+                                    "endPosition": "3691",
                                     "kind": "STRING_LITERAL",
                                     "value": ",",
-                                    "startPosition": "3544"
+                                    "startPosition": "3690"
                                   }
                                 ],
-                                "startPosition": "3537"
+                                "startPosition": "3683"
                               },
-                              "endPosition": "3547",
+                              "endPosition": "3693",
                               "kind": "EXPRESSION_STATEMENT",
-                              "startPosition": "3537"
+                              "startPosition": "3683"
                             }
                           ],
-                          "startPosition": "3467"
+                          "startPosition": "3611"
                         }
                       }
                     ],
-                    "startPosition": "3100"
+                    "startPosition": "3236"
                   }
                 }
               ],
-              "startPosition": "3060"
+              "startPosition": "3195"
             },
-            "startPosition": "3031"
+            "startPosition": "3166"
           }
         ],
-        "startPosition": "2897"
+        "startPosition": "3028"
       },
       "strict": "false",
-      "startPosition": "2867",
+      "startPosition": "2998",
       "parameters": [
         {
-          "endPosition": "2895",
+          "endPosition": "3026",
           "kind": "IDENTIFIER",
           "name": "subdir",
-          "startPosition": "2889"
+          "startPosition": "3020"
         }
       ]
     },
     {
-      "endPosition": "3921",
+      "endPosition": "4070",
       "kind": "FUNCTION",
       "name": "main",
       "body": {
-        "endPosition": "3919",
+        "endPosition": "4068",
         "kind": "BLOCK",
         "statements": [
           {
             "expression": {
-              "endPosition": "3651",
+              "endPosition": "3800",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3646",
+                "endPosition": "3795",
                 "kind": "IDENTIFIER",
                 "name": "print",
-                "startPosition": "3641"
+                "startPosition": "3790"
               },
               "arguments": [
                 {
-                  "endPosition": "3649",
+                  "endPosition": "3798",
                   "kind": "STRING_LITERAL",
                   "value": "[",
-                  "startPosition": "3648"
+                  "startPosition": "3797"
                 }
               ],
-              "startPosition": "3641"
+              "startPosition": "3790"
             },
-            "endPosition": "3651",
+            "endPosition": "3800",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3641"
+            "startPosition": "3790"
           },
           {
             "expression": {
-              "endPosition": "3685",
+              "endPosition": "3834",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3670",
+                "endPosition": "3819",
                 "kind": "IDENTIFIER",
                 "name": "processFiles",
-                "startPosition": "3658"
+                "startPosition": "3807"
               },
               "arguments": [
                 {
-                  "endPosition": "3683",
+                  "endPosition": "3832",
                   "kind": "STRING_LITERAL",
                   "value": "parsertests",
-                  "startPosition": "3672"
+                  "startPosition": "3821"
                 }
               ],
-              "startPosition": "3658"
+              "startPosition": "3807"
             },
-            "endPosition": "3685",
+            "endPosition": "3834",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3658"
+            "startPosition": "3807"
           },
           {
             "expression": {
-              "endPosition": "3726",
+              "endPosition": "3875",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3703",
+                "endPosition": "3852",
                 "kind": "IDENTIFIER",
                 "name": "processFiles",
-                "startPosition": "3691"
+                "startPosition": "3840"
               },
               "arguments": [
                 {
-                  "endPosition": "3724",
+                  "endPosition": "3873",
                   "kind": "STRING_LITERAL",
                   "value": "parsernegativetests",
-                  "startPosition": "3705"
+                  "startPosition": "3854"
                 }
               ],
-              "startPosition": "3691"
+              "startPosition": "3840"
             },
-            "endPosition": "3726",
+            "endPosition": "3875",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3691"
+            "startPosition": "3840"
           },
           {
-            "endPosition": "3795",
+            "endPosition": "3944",
             "kind": "VARIABLE",
             "name": "script",
-            "startPosition": "3767",
+            "startPosition": "3916",
             "initializer": {
-              "endPosition": "3795",
+              "endPosition": "3944",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3785",
+                "endPosition": "3934",
                 "kind": "IDENTIFIER",
                 "name": "readFully",
-                "startPosition": "3776"
+                "startPosition": "3925"
               },
               "arguments": [
                 {
-                  "endPosition": "3794",
+                  "endPosition": "3943",
                   "kind": "IDENTIFIER",
                   "name": "__FILE__",
-                  "startPosition": "3786"
+                  "startPosition": "3935"
                 }
               ],
-              "startPosition": "3776"
+              "startPosition": "3925"
             }
           },
           {
-            "endPosition": "3860",
+            "endPosition": "4009",
             "kind": "VARIABLE",
             "name": "tree",
-            "startPosition": "3805",
+            "startPosition": "3954",
             "initializer": {
-              "endPosition": "3860",
+              "endPosition": "4009",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
                 "identifier": "parse",
                 "expression": {
                   "constructorExpression": {
-                    "endPosition": "3824",
+                    "endPosition": "3973",
                     "kind": "FUNCTION_INVOCATION",
                     "functionSelect": {
-                      "endPosition": "3822",
+                      "endPosition": "3971",
                       "kind": "IDENTIFIER",
                       "name": "Parser",
-                      "startPosition": "3816"
+                      "startPosition": "3965"
                     },
                     "arguments": [],
-                    "startPosition": "3816"
+                    "startPosition": "3965"
                   },
-                  "endPosition": "3824",
+                  "endPosition": "3973",
                   "kind": "NEW",
-                  "startPosition": "3812"
+                  "startPosition": "3961"
                 },
-                "endPosition": "3830",
+                "endPosition": "3979",
                 "kind": "MEMBER_SELECT",
-                "startPosition": "3812"
+                "startPosition": "3961"
               },
               "arguments": [
                 {
-                  "endPosition": "3844",
+                  "endPosition": "3993",
                   "kind": "STRING_LITERAL",
                   "value": "parserapi.js",
-                  "startPosition": "3832"
+                  "startPosition": "3981"
                 },
                 {
-                  "endPosition": "3853",
+                  "endPosition": "4002",
                   "kind": "IDENTIFIER",
                   "name": "script",
-                  "startPosition": "3847"
+                  "startPosition": "3996"
                 },
                 {
-                  "endPosition": "3859",
+                  "endPosition": "4008",
                   "kind": "NULL_LITERAL",
-                  "startPosition": "3855"
+                  "startPosition": "4004"
                 }
               ],
-              "startPosition": "3812"
+              "startPosition": "3961"
             }
           },
           {
             "expression": {
-              "endPosition": "3902",
+              "endPosition": "4051",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3871",
+                "endPosition": "4020",
                 "kind": "IDENTIFIER",
                 "name": "print",
-                "startPosition": "3866"
+                "startPosition": "4015"
               },
               "arguments": [
                 {
-                  "endPosition": "3901",
+                  "endPosition": "4050",
                   "kind": "FUNCTION_INVOCATION",
                   "functionSelect": {
                     "identifier": "stringify",
                     "expression": {
-                      "endPosition": "3876",
+                      "endPosition": "4025",
                       "kind": "IDENTIFIER",
                       "name": "JSON",
-                      "startPosition": "3872"
+                      "startPosition": "4021"
                     },
-                    "endPosition": "3886",
+                    "endPosition": "4035",
                     "kind": "MEMBER_SELECT",
-                    "startPosition": "3872"
+                    "startPosition": "4021"
                   },
                   "arguments": [
                     {
-                      "endPosition": "3891",
+                      "endPosition": "4040",
                       "kind": "IDENTIFIER",
                       "name": "tree",
-                      "startPosition": "3887"
+                      "startPosition": "4036"
                     },
                     {
-                      "endPosition": "3897",
+                      "endPosition": "4046",
                       "kind": "NULL_LITERAL",
-                      "startPosition": "3893"
+                      "startPosition": "4042"
                     },
                     {
-                      "endPosition": "3900",
+                      "endPosition": "4049",
                       "kind": "NUMBER_LITERAL",
                       "value": "2",
-                      "startPosition": "3899"
+                      "startPosition": "4048"
                     }
                   ],
-                  "startPosition": "3872"
+                  "startPosition": "4021"
                 }
               ],
-              "startPosition": "3866"
+              "startPosition": "4015"
             },
-            "endPosition": "3902",
+            "endPosition": "4051",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3866"
+            "startPosition": "4015"
           },
           {
             "expression": {
-              "endPosition": "3918",
+              "endPosition": "4067",
               "kind": "FUNCTION_INVOCATION",
               "functionSelect": {
-                "endPosition": "3913",
+                "endPosition": "4062",
                 "kind": "IDENTIFIER",
                 "name": "print",
-                "startPosition": "3908"
+                "startPosition": "4057"
               },
               "arguments": [
                 {
-                  "endPosition": "3916",
+                  "endPosition": "4065",
                   "kind": "STRING_LITERAL",
                   "value": "]",
-                  "startPosition": "3915"
+                  "startPosition": "4064"
                 }
               ],
-              "startPosition": "3908"
+              "startPosition": "4057"
             },
-            "endPosition": "3918",
+            "endPosition": "4067",
             "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3908"
+            "startPosition": "4057"
           }
         ],
-        "startPosition": "3635"
+        "startPosition": "3784"
       },
       "strict": "false",
-      "startPosition": "3619",
+      "startPosition": "3768",
       "parameters": []
     },
     {
       "expression": {
-        "endPosition": "3929",
+        "endPosition": "4078",
         "kind": "FUNCTION_INVOCATION",
         "functionSelect": {
-          "endPosition": "3927",
+          "endPosition": "4076",
           "kind": "IDENTIFIER",
           "name": "main",
-          "startPosition": "3923"
+          "startPosition": "4072"
         },
         "arguments": [],
-        "startPosition": "3923"
-      },
-      "endPosition": "3929",
+        "startPosition": "4072"
+      },
+      "endPosition": "4078",
       "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "3923"
+      "startPosition": "4072"
     }
   ],
   "sourceName": "parserapi.js",
   "strict": "false",
   "startPosition": "1136"
-}
-]
+}
+]
--- a/nashorn/test/script/nosecurity/treeapi/for.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/for.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
@@ -47,4 +47,4 @@
     visitForLoop : function (node, obj) {
         obj.push(convert(node))
     }
-})))
\ No newline at end of file
+})))
--- a/nashorn/test/script/nosecurity/treeapi/forin.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/forin.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
@@ -45,4 +45,4 @@
     visitForInLoop : function (node, obj) {
         obj.push(convert(node))
     }
-})))
\ No newline at end of file
+})))
--- a/nashorn/test/script/nosecurity/treeapi/functionCall.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/functionCall.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
@@ -51,4 +51,4 @@
     visitFunctionCall : function (node, obj) {
         obj.push(convert(node))
     }
-})))
\ No newline at end of file
+})))
--- a/nashorn/test/script/nosecurity/treeapi/functionDeclaration.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/functionDeclaration.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
--- a/nashorn/test/script/nosecurity/treeapi/functionExpr.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/functionExpr.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
--- a/nashorn/test/script/nosecurity/treeapi/identifier.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/identifier.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
--- a/nashorn/test/script/nosecurity/treeapi/if.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/if.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
--- a/nashorn/test/script/nosecurity/treeapi/instanceof.js	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/script/nosecurity/treeapi/instanceof.js	Thu Jan 21 14:49:02 2016 -0800
@@ -1,23 +1,23 @@
 /*
- * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
- * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ * 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 softw1re; you c1n redistri2ute it 1nd/or modify it
- * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
- * pu2lished 2y the Free Softw1re Found1tion.
+ * This code is free software; you can redistribute 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 distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
- * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
- * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
- * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
- * 1ccomp1nied 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 h1ve received 1 copy of the GNU Gener1l Pu2lic License version
- * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
- * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
- * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
--- a/nashorn/test/src/jdk/dynalink/beans/test/BeanLinkerTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/beans/test/BeanLinkerTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -24,7 +24,17 @@
  */
 package jdk.dynalink.beans.test;
 
+import static jdk.dynalink.StandardOperation.CALL;
+import static jdk.dynalink.StandardOperation.CALL_METHOD;
+import static jdk.dynalink.StandardOperation.GET_ELEMENT;
+import static jdk.dynalink.StandardOperation.GET_LENGTH;
+import static jdk.dynalink.StandardOperation.GET_METHOD;
+import static jdk.dynalink.StandardOperation.GET_PROPERTY;
+import static jdk.dynalink.StandardOperation.NEW;
+import static jdk.dynalink.StandardOperation.SET_ELEMENT;
+
 import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.security.AccessControlException;
@@ -38,7 +48,6 @@
 import jdk.dynalink.NamedOperation;
 import jdk.dynalink.NoSuchDynamicMethodException;
 import jdk.dynalink.Operation;
-import jdk.dynalink.StandardOperation;
 import jdk.dynalink.beans.BeansLinker;
 import jdk.dynalink.beans.StaticClass;
 import jdk.dynalink.support.SimpleRelinkableCallSite;
@@ -72,9 +81,80 @@
         return createCallSite(publicLookup, new NamedOperation(op, name), mt);
     }
 
+    private static final MethodHandle throwArrayIndexOutOfBounds = findThrower("throwArrayIndexOutOfBounds");
+    private static final MethodHandle throwIndexOutOfBounds = findThrower("throwIndexOutOfBounds");
+
+    private static final MethodHandle findThrower(final String name) {
+        try {
+            return MethodHandles.lookup().findStatic(BeanLinkerTest.class, name,
+                    MethodType.methodType(Object.class, Object.class, Object.class));
+        } catch (NoSuchMethodException | IllegalAccessException e) {
+            Assert.fail("Unexpected exception", e);
+            return null;
+        }
+    }
+
+    private static Object throwArrayIndexOutOfBounds(final Object receiver, final Object index) {
+        throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
+    }
+
+    private static Object throwIndexOutOfBounds(final Object receiver, final Object index) {
+        throw new IndexOutOfBoundsException(String.valueOf(index));
+    }
+
     @BeforeTest
     public void initLinker() {
         final DynamicLinkerFactory factory = new DynamicLinkerFactory();
+        factory.setFallbackLinkers(new BeansLinker((req, services) -> {
+            // This is a MissingMemberHandlerFactory that creates a missing
+            // member handler for element getters and setters that throw an
+            // ArrayIndexOutOfBoundsException when applied to an array and an
+            // IndexOutOfBoundsException when applied to a list.
+
+            final CallSiteDescriptor desc = req.getCallSiteDescriptor();
+            final Operation op = desc.getOperation();
+            final Operation baseOp = NamedOperation.getBaseOperation(op);
+            if (baseOp != GET_ELEMENT && baseOp != SET_ELEMENT) {
+                // We only handle GET_ELEMENT and SET_ELEMENT.
+                return null;
+            }
+
+            final Object receiver = req.getReceiver();
+            Assert.assertNotNull(receiver);
+
+            final Class<?> clazz = receiver.getClass();
+            final MethodHandle throwerHandle;
+            if (clazz.isArray()) {
+                throwerHandle = throwArrayIndexOutOfBounds;
+            } else if (List.class.isAssignableFrom(clazz)) {
+                throwerHandle = throwIndexOutOfBounds;
+            } else {
+                Assert.fail("Unexpected receiver type " + clazz.getName());
+                return null;
+            }
+
+            final Object name = NamedOperation.getName(op);
+            final MethodHandle nameBoundHandle;
+            if (name == null) {
+                nameBoundHandle = throwerHandle;
+            } else {
+                // If the operation is for a fixed index, bind it
+                nameBoundHandle = MethodHandles.insertArguments(throwerHandle, 1, name);
+            }
+
+            final MethodType callSiteType = desc.getMethodType();
+            final MethodHandle arityMatchedHandle;
+            if (baseOp == SET_ELEMENT) {
+                // Drop "value" parameter for a setter
+                final int handleArity = nameBoundHandle.type().parameterCount();
+                arityMatchedHandle = MethodHandles.dropArguments(nameBoundHandle,
+                        handleArity, callSiteType.parameterType(handleArity));
+            } else {
+                arityMatchedHandle = nameBoundHandle;
+            }
+
+            return arityMatchedHandle.asType(callSiteType);
+        }));
         this.linker = factory.createLinker();
     }
 
@@ -86,7 +166,7 @@
     @Test(dataProvider = "flags")
     public void getPropertyTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(Object.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, mt);
         Assert.assertEquals(cs.getTarget().invoke(new Object(), "class"), Object.class);
         Assert.assertEquals(cs.getTarget().invoke(new Date(), "class"), Date.class);
     }
@@ -94,14 +174,14 @@
     @Test(dataProvider = "flags")
     public void getPropertyNegativeTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(Object.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, mt);
         Assert.assertNull(cs.getTarget().invoke(new Object(), "DOES_NOT_EXIST"));
     }
 
     @Test(dataProvider = "flags")
     public void getPropertyTest2(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(Object.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, "class", mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, "class", mt);
         Assert.assertEquals(cs.getTarget().invoke(new Object()), Object.class);
         Assert.assertEquals(cs.getTarget().invoke(new Date()), Date.class);
     }
@@ -109,12 +189,12 @@
     @Test(dataProvider = "flags")
     public void getPropertyNegativeTest2(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(Object.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, "DOES_NOT_EXIST", mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, "DOES_NOT_EXIST", mt);
 
         try {
             cs.getTarget().invoke(new Object());
             throw new RuntimeException("Expected NoSuchDynamicMethodException");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             Assert.assertTrue(th instanceof NoSuchDynamicMethodException);
         }
     }
@@ -122,7 +202,7 @@
     @Test(dataProvider = "flags")
     public void getLengthPropertyTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(int.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, mt);
 
         Assert.assertEquals((int) cs.getTarget().invoke(new int[10], "length"), 10);
         Assert.assertEquals((int) cs.getTarget().invoke(new String[33], "length"), 33);
@@ -131,7 +211,7 @@
     @Test(dataProvider = "flags")
     public void getlengthTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(int.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_LENGTH, mt);
+        final CallSite cs = createCallSite(publicLookup, GET_LENGTH, mt);
 
         final int[] arr = {23, 42};
         Assert.assertEquals((int) cs.getTarget().invoke((Object) arr), 2);
@@ -151,21 +231,21 @@
     @Test(dataProvider = "flags")
     public void getElementTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(int.class, Object.class, int.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_ELEMENT, mt);
+        final CallSite cs = createCallSite(publicLookup, GET_ELEMENT, mt);
 
         final int[] arr = {23, 42};
         Assert.assertEquals((int) cs.getTarget().invoke(arr, 0), 23);
         Assert.assertEquals((int) cs.getTarget().invoke(arr, 1), 42);
         try {
-            int x = (int) cs.getTarget().invoke(arr, -1);
+            final int x = (int) cs.getTarget().invoke(arr, -1);
             throw new RuntimeException("expected ArrayIndexOutOfBoundsException");
-        } catch (ArrayIndexOutOfBoundsException ex) {
+        } catch (final ArrayIndexOutOfBoundsException ex) {
         }
 
         try {
-            int x = (int) cs.getTarget().invoke(arr, arr.length);
+            final int x = (int) cs.getTarget().invoke(arr, arr.length);
             throw new RuntimeException("expected ArrayIndexOutOfBoundsException");
-        } catch (ArrayIndexOutOfBoundsException ex) {
+        } catch (final ArrayIndexOutOfBoundsException ex) {
         }
 
         final List<Integer> list = new ArrayList<>();
@@ -176,22 +256,22 @@
         Assert.assertEquals((int) cs.getTarget().invoke(list, 1), (int) list.get(1));
         Assert.assertEquals((int) cs.getTarget().invoke(list, 2), (int) list.get(2));
         try {
-            int x = (int) cs.getTarget().invoke(list, -1);
+            final int x = (int) cs.getTarget().invoke(list, -1);
             throw new RuntimeException("expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
         }
 
         try {
-            int x = (int) cs.getTarget().invoke(list, list.size());
+            final int x = (int) cs.getTarget().invoke(list, list.size());
             throw new RuntimeException("expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
         }
     }
 
     @Test(dataProvider = "flags")
     public void setElementTest(final boolean publicLookup) throws Throwable {
         final MethodType mt = MethodType.methodType(void.class, Object.class, int.class, int.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.SET_ELEMENT, mt);
+        final CallSite cs = createCallSite(publicLookup, SET_ELEMENT, mt);
 
         final int[] arr = {23, 42};
         cs.getTarget().invoke(arr, 0, 0);
@@ -202,13 +282,13 @@
         try {
             cs.getTarget().invoke(arr, -1, 12);
             throw new RuntimeException("expected ArrayIndexOutOfBoundsException");
-        } catch (ArrayIndexOutOfBoundsException ex) {
+        } catch (final ArrayIndexOutOfBoundsException ex) {
         }
 
         try {
             cs.getTarget().invoke(arr, arr.length, 20);
             throw new RuntimeException("expected ArrayIndexOutOfBoundsException");
-        } catch (ArrayIndexOutOfBoundsException ex) {
+        } catch (final ArrayIndexOutOfBoundsException ex) {
         }
 
         final List<Integer> list = new ArrayList<>();
@@ -223,25 +303,25 @@
         try {
             cs.getTarget().invoke(list, -1, 343);
             throw new RuntimeException("expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
         }
 
         try {
             cs.getTarget().invoke(list, list.size(), 43543);
             throw new RuntimeException("expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
+        } catch (final IndexOutOfBoundsException ex) {
         }
     }
 
     @Test(dataProvider = "flags")
     public void newObjectTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Object.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.NEW, mt);
+        final CallSite cs = createCallSite(publicLookup, NEW, mt);
 
         Object obj = null;
         try {
             obj = cs.getTarget().invoke(StaticClass.forClass(Date.class));
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -251,12 +331,12 @@
     @Test(dataProvider = "flags")
     public void staticPropertyTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Object.class, Class.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_PROPERTY, "static", mt);
+        final CallSite cs = createCallSite(publicLookup, GET_PROPERTY, "static", mt);
 
         Object obj = null;
         try {
             obj = cs.getTarget().invoke(Object.class);
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -265,7 +345,7 @@
 
         try {
             obj = cs.getTarget().invoke(Date.class);
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -274,7 +354,7 @@
 
         try {
             obj = cs.getTarget().invoke(Object[].class);
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -285,14 +365,14 @@
     @Test(dataProvider = "flags")
     public void instanceMethodCallTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Object.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_METHOD, "getClass", mt);
+        final CallSite cs = createCallSite(publicLookup, GET_METHOD, "getClass", mt);
         final MethodType mt2 = MethodType.methodType(Class.class, Object.class, Object.class);
-        final CallSite cs2 = createCallSite(publicLookup, StandardOperation.CALL, mt2);
+        final CallSite cs2 = createCallSite(publicLookup, CALL, mt2);
 
         Object method = null;
         try {
             method = cs.getTarget().invoke(new Date());
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -301,7 +381,7 @@
         Class clz = null;
         try {
             clz = (Class) cs2.getTarget().invoke(method, new Date());
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -311,11 +391,11 @@
     @Test(dataProvider = "flags")
     public void instanceMethodCallTest2(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Class.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.CALL_METHOD, "getClass", mt);
+        final CallSite cs = createCallSite(publicLookup, CALL_METHOD, "getClass", mt);
         Class clz = null;
         try {
             clz = (Class) cs.getTarget().invoke(new Date());
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -325,14 +405,14 @@
     @Test(dataProvider = "flags")
     public void staticMethodCallTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Object.class, StaticClass.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.GET_METHOD, "getProperty", mt);
+        final CallSite cs = createCallSite(publicLookup, GET_METHOD, "getProperty", mt);
         final MethodType mt2 = MethodType.methodType(String.class, Object.class, Object.class, String.class);
-        final CallSite cs2 = createCallSite(publicLookup, StandardOperation.CALL, mt2);
+        final CallSite cs2 = createCallSite(publicLookup, CALL, mt2);
 
         Object method = null;
         try {
             method = cs.getTarget().invoke(StaticClass.forClass(System.class));
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
 
@@ -342,7 +422,7 @@
         String str = null;
         try {
             str = (String) cs2.getTarget().invoke(method, null, "os.name");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
         Assert.assertEquals(str, System.getProperty("os.name"));
@@ -351,12 +431,12 @@
     @Test(dataProvider = "flags")
     public void staticMethodCallTest2(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(String.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.CALL_METHOD, "getProperty", mt);
+        final CallSite cs = createCallSite(publicLookup, CALL_METHOD, "getProperty", mt);
 
         String str = null;
         try {
             str = (String) cs.getTarget().invoke(StaticClass.forClass(System.class), "os.name");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             throw new RuntimeException(th);
         }
         Assert.assertEquals(str, System.getProperty("os.name"));
@@ -366,12 +446,12 @@
     @Test(dataProvider = "flags")
     public void systemGetenvTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(Object.class, Object.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.CALL_METHOD, "getenv", mt);
+        final CallSite cs = createCallSite(publicLookup, CALL_METHOD, "getenv", mt);
 
         try {
             cs.getTarget().invoke(StaticClass.forClass(System.class));
             throw new RuntimeException("should not reach here in any case!");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             Assert.assertTrue(th instanceof SecurityException);
         }
     }
@@ -380,12 +460,12 @@
     @Test(dataProvider = "flags")
     public void systemGetPropertyTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(String.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.CALL_METHOD, "getProperty", mt);
+        final CallSite cs = createCallSite(publicLookup, CALL_METHOD, "getProperty", mt);
 
         try {
             cs.getTarget().invoke(StaticClass.forClass(System.class), "java.home");
             throw new RuntimeException("should not reach here in any case!");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             Assert.assertTrue(th instanceof SecurityException);
         }
     }
@@ -394,12 +474,12 @@
     @Test(dataProvider = "flags")
     public void systemLoadLibraryTest(final boolean publicLookup) {
         final MethodType mt = MethodType.methodType(void.class, Object.class, String.class);
-        final CallSite cs = createCallSite(publicLookup, StandardOperation.CALL_METHOD, "loadLibrary", mt);
+        final CallSite cs = createCallSite(publicLookup, CALL_METHOD, "loadLibrary", mt);
 
         try {
             cs.getTarget().invoke(StaticClass.forClass(System.class), "foo");
             throw new RuntimeException("should not reach here in any case!");
-        } catch (Throwable th) {
+        } catch (final Throwable th) {
             if (publicLookup) {
                 Assert.assertTrue(th instanceof IllegalAccessError);
             } else {
--- a/nashorn/test/src/jdk/dynalink/beans/test/BeansLinkerTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/beans/test/BeansLinkerTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -33,6 +33,7 @@
 
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -44,6 +45,7 @@
 import jdk.dynalink.CompositeOperation;
 import jdk.dynalink.DynamicLinkerFactory;
 import jdk.dynalink.NamedOperation;
+import jdk.dynalink.NoSuchDynamicMethodException;
 import jdk.dynalink.Operation;
 import jdk.dynalink.StandardOperation;
 import jdk.dynalink.support.SimpleRelinkableCallSite;
@@ -207,6 +209,30 @@
         Assert.assertEquals("element2", map.get("name"));
     }
 
+    @Test
+    public static void testMissingMembersAtLinkTime() {
+        testPermutations(GETTER_PERMUTATIONS, (op) -> expectNoSuchDynamicMethodException(()-> call(named("foo", op), new Object())));
+        testPermutations(SETTER_PERMUTATIONS, (op) -> expectNoSuchDynamicMethodException(()-> call(named("foo", op), new Object(), "newValue")));
+    }
+
+    @Test
+    public static void testMissingMembersAtRunTime() {
+        call(GET_ELEMENT, new ArrayList<>(), "foo");
+        Stream.of(new HashMap(), new ArrayList(), new Object[0]).forEach((receiver) -> {
+            testPermutations(GETTER_PERMUTATIONS, (op) -> { System.err.println(op + " " + receiver.getClass().getName()); Assert.assertNull(call(op, receiver, "foo"));});
+            // No assertion for the setter; we just expect it to silently succeed
+            testPermutations(SETTER_PERMUTATIONS, (op) -> call(op, receiver, "foo", "newValue"));
+        });
+    }
+
+    private static void expectNoSuchDynamicMethodException(final Runnable r) {
+        try {
+            r.run();
+            Assert.fail("Should've thrown NoSuchDynamicMethodException");
+        } catch(final NoSuchDynamicMethodException e) {
+        }
+    }
+
     private static Operation[] GETTER_PERMUTATIONS = new Operation[] {
         GET_PROPERTY,
         GET_METHOD,
@@ -240,6 +266,10 @@
         testPermutationsWithFilter(ops, (op)->regex.matcher(op.toString()).matches(), expectedCount, test);
     }
 
+    private static void testPermutations(final Operation[] ops, final Consumer<Operation> test) {
+        testPermutationsWithFilter(ops, (op)->true, ops.length, test);
+    }
+
     private static void testPermutationsWithFilter(final Operation[] ops, final Predicate<Operation> filter, final int expectedCount, final Consumer<Operation> test) {
         final int[] counter = new int[1];
         Stream.of(ops).filter(filter).forEach((op)-> { counter[0]++; test.accept(op); });
--- a/nashorn/test/src/jdk/dynalink/beans/test/CallerSensitiveTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/beans/test/CallerSensitiveTest.java	Thu Jan 21 14:49:02 2016 -0800
@@ -33,6 +33,6 @@
 public class CallerSensitiveTest {
     @Test
     public void testCallerSensitive() {
-        BeansLinker.getLinkerForClass(ClassLoaderAware.class);
+        new BeansLinker().getLinkerForClass(ClassLoaderAware.class);
     }
 }
--- a/nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java	Thu Jan 21 13:41:02 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.internal.dynalink.beans.test;
-
-import jdk.dynalink.beans.BeansLinker;
-import jdk.nashorn.test.models.ClassLoaderAware;
-import org.testng.annotations.Test;
-
-@SuppressWarnings("javadoc")
-public class CallerSensitiveTest {
-    @Test
-    public void testCallerSensitive() {
-        BeansLinker.getLinkerForClass(ClassLoaderAware.class);
-    }
-}
--- a/test/make/TestJavaCompilation.gmk	Thu Jan 21 13:41:02 2016 +0530
+++ b/test/make/TestJavaCompilation.gmk	Thu Jan 21 14:49:02 2016 -0800
@@ -239,6 +239,7 @@
 
 $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
     JAVAC := $(JAVAC), \
+    DISABLE_SJAVAC := true, \
 ))
 
 JAVA_SRC_ROOT1 := $(OUTPUT_DIR)/javaroot1