Merge
authordlong
Mon, 03 Oct 2016 12:35:51 -0400
changeset 41700 ba9120f9206b
parent 41699 fcefeb90b468 (current diff)
parent 41667 4a349512fde1 (diff)
child 41702 fa592dd9dcd9
Merge
hotspot/src/share/vm/utilities/chunkedList.cpp
hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java
jdk/test/java/net/URLPermission/nstest/LookupTestHosts
test/lib/jdk/test/lib/unsafe/UnsafeHelper.java
--- a/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 a71210c0d9800eb6925b61ecd6198abd554f90ee jdk-9+134
 e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135
 1b4b5d01aa11edf24b6fadbe3d2f3e411e3b02cd jdk-9+136
+9cb87c88ed851c0575b8ead753ea238ed5b544e9 jdk-9+137
--- a/.hgtags-top-repo	Wed Sep 28 11:17:51 2016 +0200
+++ b/.hgtags-top-repo	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 065724348690eda41fc69112278d8da6dcde548c jdk-9+134
 82b94cb5f342319d2cda77f9fa59703ad7fde576 jdk-9+135
 3ec350f5f32af249b59620d7e37b54bdcd77b233 jdk-9+136
+d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
--- a/Makefile	Wed Sep 28 11:17:51 2016 +0200
+++ b/Makefile	Mon Oct 03 12:35:51 2016 -0400
@@ -28,8 +28,8 @@
 ### It also performs some sanity checks on make.
 ###
 
-# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU Make.
-# /usr/ccs/bin/make lacks basically every other flow control mechanism.
+# The shell code below will be executed on /usr/bin/make on Solaris, but not in GNU Make.
+# /usr/bin/make lacks basically every other flow control mechanism.
 .TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
 
 # The .FEATURES variable is likely to be unique for GNU Make.
--- a/README-builds.html	Wed Sep 28 11:17:51 2016 +0200
+++ b/README-builds.html	Mon Oct 03 12:35:51 2016 -0400
@@ -626,8 +626,7 @@
 
 <p>The Common UNIX Printing System (CUPS) Headers are required for building the
    OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
-   installing the package <strong>SFWcups</strong> from the Solaris Software Companion
-   CD/DVD, these often will be installed into the directory <code>/opt/sfw/cups</code>.</p>
+   installing the package <strong>print/cups</strong>.</p>
 
 <p>The CUPS header files can always be downloaded from
    <a href="http://www.cups.org">www.cups.org</a>.</p>
@@ -1111,8 +1110,7 @@
 <li>Place the location of the GNU make binary in the <code>PATH</code>.</li>
 <li><strong>Solaris:</strong> Do NOT use <code>/usr/bin/make</code> on Solaris. If your Solaris system
 has the software from the Solaris Developer Companion CD installed, you
-should try and use <code>gmake</code> which will be located in either the <code>/usr/bin</code>,
-<code>/opt/sfw/bin</code> or <code>/usr/sfw/bin</code> directory.</li>
+should try and use <code>/usr/bin/gmake</code> or <code>/usr/gnu/bin/make</code>.</li>
 <li><strong>Windows:</strong> Make sure you start your build inside a bash shell.</li>
 <li><strong>Mac OS X:</strong> The XCode "command line tools" must be installed on your Mac.</li>
 </ul>
--- a/README-builds.md	Wed Sep 28 11:17:51 2016 +0200
+++ b/README-builds.md	Mon Oct 03 12:35:51 2016 -0400
@@ -560,8 +560,7 @@
 
 >  The Common UNIX Printing System (CUPS) Headers are required for building the
    OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
-   installing the package **SFWcups** from the Solaris Software Companion
-   CD/DVD, these often will be installed into the directory `/opt/sfw/cups`.
+   installing the package **print/cups**.
 
 >  The CUPS header files can always be downloaded from
    [www.cups.org](http://www.cups.org).
@@ -1017,8 +1016,7 @@
  * Place the location of the GNU make binary in the `PATH`.
  * **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system
    has the software from the Solaris Developer Companion CD installed, you
-   should try and use `gmake` which will be located in either the `/usr/bin`,
-   `/opt/sfw/bin` or `/usr/sfw/bin` directory.
+   should try and use `/usr/bin/gmake` or `/usr/gnu/bin/make`.
  * **Windows:** Make sure you start your build inside a bash shell.
  * **Mac OS X:** The XCode "command line tools" must be installed on your Mac.
 
--- a/common/autoconf/basics.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/basics.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -750,11 +750,6 @@
   # Prepend the extra path to the global path
   BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
 
-  if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
-    # Add extra search paths on solaris for utilities like ar, as, dtrace etc...
-    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/usr/sbin"
-  fi
-
   AC_MSG_CHECKING([for sysroot])
   AC_MSG_RESULT([$SYSROOT])
   AC_MSG_CHECKING([for toolchain path])
--- a/common/autoconf/flags.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/flags.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -88,8 +88,7 @@
         # inlining of system functions and intrinsics.
         $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
         $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
+            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
--- a/common/autoconf/generated-configure.sh	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/generated-configure.sh	Mon Oct 03 12:35:51 2016 -0400
@@ -926,9 +926,7 @@
 INCLUDE_SA
 UNLIMITED_CRYPTO
 CACERTS_FILE
-BUILD_HEADLESS
-SUPPORT_HEADFUL
-SUPPORT_HEADLESS
+ENABLE_HEADLESS_ONLY
 DEFAULT_MAKE_TARGET
 OS_VERSION_MICRO
 OS_VERSION_MINOR
@@ -1153,7 +1151,7 @@
 with_conf_name
 with_output_sync
 with_default_make_target
-enable_headful
+enable_headless_only
 with_cacerts_file
 enable_unlimited_crypto
 with_copyright_year
@@ -1976,8 +1974,7 @@
                           [disabled]
   --enable-debug          set the debug level to fastdebug (shorthand for
                           --with-debug-level=fastdebug) [disabled]
-  --disable-headful       disable building headful support (graphical UI
-                          support) [enabled]
+  --enable-headless-only  only build headless (no GUI) support [disabled]
   --enable-unlimited-crypto
                           Enable unlimited crypto policy [disabled]
   --disable-keep-packaged-modules
@@ -5095,7 +5092,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1472718471
+DATE_WHEN_GENERATED=1474894604
 
 ###############################################################################
 #
@@ -17213,11 +17210,6 @@
   fi
 
 
-  if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
-    # Add extra search paths on solaris for utilities like ar, as, dtrace etc...
-    PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/usr/sbin"
-  fi
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
 $as_echo_n "checking for sysroot... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5
@@ -24197,36 +24189,30 @@
 
 # We need build & target for this.
 
-  # Should we build a JDK/JVM with headful support (ie a graphical ui)?
-  # We always build headless support.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking headful support" >&5
-$as_echo_n "checking headful support... " >&6; }
-  # Check whether --enable-headful was given.
-if test "${enable_headful+set}" = set; then :
-  enableval=$enable_headful; SUPPORT_HEADFUL=${enable_headful}
-else
-  SUPPORT_HEADFUL=yes
-fi
-
-
-  SUPPORT_HEADLESS=yes
-  BUILD_HEADLESS="BUILD_HEADLESS:=true"
-
-  if test "x$SUPPORT_HEADFUL" = xyes; then
-    # We are building both headful and headless.
-    headful_msg="include support for both headful and headless"
-  fi
-
-  if test "x$SUPPORT_HEADFUL" = xno; then
-    # Thus we are building headless only.
-    BUILD_HEADLESS="BUILD_HEADLESS:=true"
-    headful_msg="headless only"
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $headful_msg" >&5
-$as_echo "$headful_msg" >&6; }
-
-
+  # Should we build a JDK without a graphical UI?
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking headless only" >&5
+$as_echo_n "checking headless only... " >&6; }
+  # Check whether --enable-headless-only was given.
+if test "${enable_headless_only+set}" = set; then :
+  enableval=$enable_headless_only;
+fi
+
+
+  if test "x$enable_headless_only" = "xyes"; then
+    ENABLE_HEADLESS_ONLY="true"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  elif test "x$enable_headless_only" = "xno"; then
+    ENABLE_HEADLESS_ONLY="false"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  elif test "x$enable_headless_only" = "x"; then
+    ENABLE_HEADLESS_ONLY="false"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  else
+    as_fn_error $? "--enable-headless-only can only take yes or no" "$LINENO" 5
+  fi
 
 
 
@@ -31475,8 +31461,7 @@
         # inlining of system functions and intrinsics.
         SYSROOT_CFLAGS="-I-xbuiltin -I$SYSROOT/usr/include"
         SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
+            -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       SYSROOT_CFLAGS="--sysroot=$SYSROOT"
@@ -32992,14 +32977,6 @@
   fi
 
 
-  # For solaris we really need solaris tools, and not the GNU equivalent.
-  # The build tools on Solaris reside in /usr/ccs (C Compilation System),
-  # so add that to path before starting to probe.
-  # FIXME: This was originally only done for AS,NM,GNM,STRIP,OBJCOPY,OBJDUMP.
-  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
-    PATH="/usr/ccs/bin:$PATH"
-  fi
-
   # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
   # override all other locations.
   if test "x$TOOLCHAIN_PATH" != x; then
@@ -44000,8 +43977,7 @@
         # inlining of system functions and intrinsics.
         BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include"
         BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-            -L$BUILD_SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
+            -L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       BUILD_SYSROOT_CFLAGS="--sysroot=$BUILD_SYSROOT"
@@ -53060,13 +53036,9 @@
     # No X11 support on windows or macosx
     NEEDS_LIB_X11=false
   else
-    if test "x$SUPPORT_HEADFUL" = xno; then
-      # No X11 support if building headless-only
-      NEEDS_LIB_X11=false
-    else
-      # All other instances need X11
-      NEEDS_LIB_X11=true
-    fi
+    # All other instances need X11, even if building headless only, libawt still
+    # needs X11 headers.
+    NEEDS_LIB_X11=true
   fi
 
   # Check if cups is needed
@@ -56730,9 +56702,7 @@
     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
       OPENWIN_HOME="/usr/openwin"
       X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
-      X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-          -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-          -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+      X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
           -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
     fi
 
@@ -56911,23 +56881,6 @@
 
     fi
     if test "x$CUPS_FOUND" = xno; then
-      # Getting nervous now? Lets poke around for standard Solaris third-party
-      # package installation locations.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5
-$as_echo_n "checking for cups headers... " >&6; }
-      if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
-        # An SFW package seems to be installed!
-        CUPS_FOUND=yes
-        CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
-      elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
-        # A CSW package seems to be installed!
-        CUPS_FOUND=yes
-        CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
-      fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5
-$as_echo "$CUPS_FOUND" >&6; }
-    fi
-    if test "x$CUPS_FOUND" = xno; then
 
   # Print a helpful message on how to acquire the necessary build dependency.
   # cups is the help tag: freetype, cups, alsa etc
@@ -61167,346 +61120,6 @@
           fi
 
           if test "x$FOUND_FREETYPE" != xyes; then
-            FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
-
-  POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
-  POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
-  METHOD="well-known location"
-
-  # Let's start with an optimistic view of the world :-)
-  FOUND_FREETYPE=yes
-
-  # First look for the canonical freetype main include file ft2build.h.
-  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
-    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
-    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
-      # Fail.
-      FOUND_FREETYPE=no
-    fi
-  fi
-
-  if test "x$FOUND_FREETYPE" = xyes; then
-    # Include file found, let's continue the sanity check.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
-$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
-
-    # Reset to default value
-    FREETYPE_BASE_NAME=freetype
-    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
-    if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
-      if test "x$OPENJDK_TARGET_OS" = xmacosx \
-          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
-        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
-        # for the .6 version explicitly.
-        FREETYPE_BASE_NAME=freetype.6
-        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
-$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
-        FOUND_FREETYPE=no
-      fi
-    else
-      if test "x$OPENJDK_TARGET_OS" = xwindows; then
-        # On Windows, we will need both .lib and .dll file.
-        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
-$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
-          FOUND_FREETYPE=no
-        fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
-          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
-        # Found lib in isa dir, use that instead.
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
-$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
-      fi
-    fi
-  fi
-
-  if test "x$FOUND_FREETYPE" = xyes; then
-
-  # Only process if variable expands to non-empty
-
-  if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then
-    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
-  # Input might be given as Windows format, start by converting to
-  # unix format.
-  path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
-  new_path=`$CYGPATH -u "$path"`
-
-  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
-  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
-  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
-  # "foo.exe" is OK but "foo" is an error.
-  #
-  # This test is therefore slightly more accurate than "test -f" to check for file precense.
-  # It is also a way to make sure we got the proper file name for the real test later on.
-  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
-  if test "x$test_shortpath" = x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
-    as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
-  fi
-
-  # Call helper function which possibly converts this using DOS-style short mode.
-  # If so, the updated path is stored in $new_path.
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
-    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
-    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
-      # Going to short mode and back again did indeed matter. Since short mode is
-      # case insensitive, let's make it lowercase to improve readability.
-      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-      # Now convert it back to Unix-style (cygpath)
-      input_path=`$CYGPATH -u "$shortmode_path"`
-      new_path="$input_path"
-    fi
-  fi
-
-  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
-  if test "x$test_cygdrive_prefix" = x; then
-    # As a simple fix, exclude /usr/bin since it's not a real path.
-    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
-      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
-      # a path prefixed by /cygdrive for fixpath to work.
-      new_path="$CYGWIN_ROOT_PATH$input_path"
-    fi
-  fi
-
-
-  if test "x$path" != "x$new_path"; then
-    POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
-  fi
-
-    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
-  path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
-  has_colon=`$ECHO $path | $GREP ^.:`
-  new_path="$path"
-  if test "x$has_colon" = x; then
-    # Not in mixed or Windows style, start by that.
-    new_path=`cmd //c echo $path`
-  fi
-
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-  fi
-
-
-  windows_path="$new_path"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    new_path="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    new_path="$unix_path"
-  fi
-
-  if test "x$path" != "x$new_path"; then
-    POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
-  fi
-
-  # Save the first 10 bytes of this path to the storage, so fixpath can work.
-  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
-    else
-      # We're on a unix platform. Hooray! :)
-      path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
-      has_space=`$ECHO "$path" | $GREP " "`
-      if test "x$has_space" != x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
-        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
-      fi
-
-      # Use eval to expand a potential ~
-      eval path="$path"
-      if test ! -f "$path" && test ! -d "$path"; then
-        as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
-      fi
-
-      if test -d "$path"; then
-        POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
-      else
-        dir="`$DIRNAME "$path"`"
-        base="`$BASENAME "$path"`"
-        POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
-      fi
-    fi
-  fi
-
-
-  # Only process if variable expands to non-empty
-
-  if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
-    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
-  # Input might be given as Windows format, start by converting to
-  # unix format.
-  path="$POTENTIAL_FREETYPE_LIB_PATH"
-  new_path=`$CYGPATH -u "$path"`
-
-  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
-  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
-  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
-  # "foo.exe" is OK but "foo" is an error.
-  #
-  # This test is therefore slightly more accurate than "test -f" to check for file precense.
-  # It is also a way to make sure we got the proper file name for the real test later on.
-  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
-  if test "x$test_shortpath" = x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
-    as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
-  fi
-
-  # Call helper function which possibly converts this using DOS-style short mode.
-  # If so, the updated path is stored in $new_path.
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
-    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
-    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
-      # Going to short mode and back again did indeed matter. Since short mode is
-      # case insensitive, let's make it lowercase to improve readability.
-      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-      # Now convert it back to Unix-style (cygpath)
-      input_path=`$CYGPATH -u "$shortmode_path"`
-      new_path="$input_path"
-    fi
-  fi
-
-  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
-  if test "x$test_cygdrive_prefix" = x; then
-    # As a simple fix, exclude /usr/bin since it's not a real path.
-    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
-      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
-      # a path prefixed by /cygdrive for fixpath to work.
-      new_path="$CYGWIN_ROOT_PATH$input_path"
-    fi
-  fi
-
-
-  if test "x$path" != "x$new_path"; then
-    POTENTIAL_FREETYPE_LIB_PATH="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
-  fi
-
-    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
-  path="$POTENTIAL_FREETYPE_LIB_PATH"
-  has_colon=`$ECHO $path | $GREP ^.:`
-  new_path="$path"
-  if test "x$has_colon" = x; then
-    # Not in mixed or Windows style, start by that.
-    new_path=`cmd //c echo $path`
-  fi
-
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-  fi
-
-
-  windows_path="$new_path"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    new_path="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    new_path="$unix_path"
-  fi
-
-  if test "x$path" != "x$new_path"; then
-    POTENTIAL_FREETYPE_LIB_PATH="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
-  fi
-
-  # Save the first 10 bytes of this path to the storage, so fixpath can work.
-  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
-    else
-      # We're on a unix platform. Hooray! :)
-      path="$POTENTIAL_FREETYPE_LIB_PATH"
-      has_space=`$ECHO "$path" | $GREP " "`
-      if test "x$has_space" != x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
-        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
-      fi
-
-      # Use eval to expand a potential ~
-      eval path="$path"
-      if test ! -f "$path" && test ! -d "$path"; then
-        as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
-      fi
-
-      if test -d "$path"; then
-        POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
-      else
-        dir="`$DIRNAME "$path"`"
-        base="`$BASENAME "$path"`"
-        POTENTIAL_FREETYPE_LIB_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
-      fi
-    fi
-  fi
-
-
-    FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
-$as_echo_n "checking for freetype includes... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
-$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
-    FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
-$as_echo_n "checking for freetype libraries... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
-$as_echo "$FREETYPE_LIB_PATH" >&6; }
-  fi
-
-          fi
-
-          if test "x$FOUND_FREETYPE" != xyes; then
             FREETYPE_BASE_DIR="$SYSROOT/usr"
             if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 
--- a/common/autoconf/jdk-options.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/jdk-options.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -134,32 +134,25 @@
 
 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
 [
-  # Should we build a JDK/JVM with headful support (ie a graphical ui)?
-  # We always build headless support.
-  AC_MSG_CHECKING([headful support])
-  AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
-      [disable building headful support (graphical UI support) @<:@enabled@:>@])],
-      [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
+  # Should we build a JDK without a graphical UI?
+  AC_MSG_CHECKING([headless only])
+  AC_ARG_ENABLE([headless-only], [AS_HELP_STRING([--enable-headless-only],
+      [only build headless (no GUI) support @<:@disabled@:>@])])
 
-  SUPPORT_HEADLESS=yes
-  BUILD_HEADLESS="BUILD_HEADLESS:=true"
-
-  if test "x$SUPPORT_HEADFUL" = xyes; then
-    # We are building both headful and headless.
-    headful_msg="include support for both headful and headless"
+  if test "x$enable_headless_only" = "xyes"; then
+    ENABLE_HEADLESS_ONLY="true"
+    AC_MSG_RESULT([yes])
+  elif test "x$enable_headless_only" = "xno"; then
+    ENABLE_HEADLESS_ONLY="false"
+    AC_MSG_RESULT([no])
+  elif test "x$enable_headless_only" = "x"; then
+    ENABLE_HEADLESS_ONLY="false"
+    AC_MSG_RESULT([no])
+  else
+    AC_MSG_ERROR([--enable-headless-only can only take yes or no])
   fi
 
-  if test "x$SUPPORT_HEADFUL" = xno; then
-    # Thus we are building headless only.
-    BUILD_HEADLESS="BUILD_HEADLESS:=true"
-    headful_msg="headless only"
-  fi
-
-  AC_MSG_RESULT([$headful_msg])
-
-  AC_SUBST(SUPPORT_HEADLESS)
-  AC_SUBST(SUPPORT_HEADFUL)
-  AC_SUBST(BUILD_HEADLESS)
+  AC_SUBST(ENABLE_HEADLESS_ONLY)
 
   # Choose cacerts source file
   AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
--- a/common/autoconf/lib-cups.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/lib-cups.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -76,21 +76,6 @@
       ])
     fi
     if test "x$CUPS_FOUND" = xno; then
-      # Getting nervous now? Lets poke around for standard Solaris third-party
-      # package installation locations.
-      AC_MSG_CHECKING([for cups headers])
-      if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
-        # An SFW package seems to be installed!
-        CUPS_FOUND=yes
-        CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
-      elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
-        # A CSW package seems to be installed!
-        CUPS_FOUND=yes
-        CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
-      fi
-      AC_MSG_RESULT([$CUPS_FOUND])
-    fi
-    if test "x$CUPS_FOUND" = xno; then
       HELP_MSG_MISSING_DEPENDENCY([cups])
       AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
     fi
--- a/common/autoconf/lib-freetype.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/lib-freetype.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -358,11 +358,6 @@
           fi
 
           if test "x$FOUND_FREETYPE" != xyes; then
-            FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
-            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
-          fi
-
-          if test "x$FOUND_FREETYPE" != xyes; then
             FREETYPE_BASE_DIR="$SYSROOT/usr"
             if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
               LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
--- a/common/autoconf/lib-x11.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/lib-x11.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -91,9 +91,7 @@
     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
       OPENWIN_HOME="/usr/openwin"
       X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
-      X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-          -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-          -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
+      X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
           -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
     fi
 
--- a/common/autoconf/libraries.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/libraries.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -42,13 +42,9 @@
     # No X11 support on windows or macosx
     NEEDS_LIB_X11=false
   else
-    if test "x$SUPPORT_HEADFUL" = xno; then
-      # No X11 support if building headless-only
-      NEEDS_LIB_X11=false
-    else
-      # All other instances need X11
-      NEEDS_LIB_X11=true
-    fi
+    # All other instances need X11, even if building headless only, libawt still
+    # needs X11 headers.
+    NEEDS_LIB_X11=true
   fi
 
   # Check if cups is needed
--- a/common/autoconf/spec.gmk.in	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/spec.gmk.in	Mon Oct 03 12:35:51 2016 -0400
@@ -241,12 +241,8 @@
 # Control use of precompiled header in hotspot libjvm build
 USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
 
-# Should we compile support for running with a graphical UI? (ie headful)
-# Should we compile support for running without? (ie headless)
-SUPPORT_HEADFUL:=@SUPPORT_HEADFUL@
-SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@
-# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
-@BUILD_HEADLESS@
+# Only build headless support or not
+ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@
 
 # Legacy support
 USE_NEW_HOTSPOT_BUILD:=@USE_NEW_HOTSPOT_BUILD@
--- a/common/autoconf/toolchain.m4	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/autoconf/toolchain.m4	Mon Oct 03 12:35:51 2016 -0400
@@ -294,14 +294,6 @@
   fi
   AC_SUBST(TOOLCHAIN_VERSION)
 
-  # For solaris we really need solaris tools, and not the GNU equivalent.
-  # The build tools on Solaris reside in /usr/ccs (C Compilation System),
-  # so add that to path before starting to probe.
-  # FIXME: This was originally only done for AS,NM,GNM,STRIP,OBJCOPY,OBJDUMP.
-  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
-    PATH="/usr/ccs/bin:$PATH"
-  fi
-
   # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
   # override all other locations.
   if test "x$TOOLCHAIN_PATH" != x; then
--- a/common/conf/jib-profiles.js	Wed Sep 28 11:17:51 2016 +0200
+++ b/common/conf/jib-profiles.js	Mon Oct 03 12:35:51 2016 -0400
@@ -224,6 +224,23 @@
     common.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
     common.organization = "jpg.infra.builddeps"
 
+    var boot_jdk_revision = "8";
+    var boot_jdk_subdirpart = "1.8.0";
+    // JDK 8 does not work on sparc M7 cpus, need a newer update when building
+    // on such hardware.
+    if (input.build_cpu == "sparcv9") {
+       var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
+       if (cpu_brand.trim() == 'SPARC-M7') {
+           boot_jdk_revision = "8u20";
+           boot_jdk_subdirpart = "1.8.0_20";
+       }
+    }
+    common.boot_jdk_revision = boot_jdk_revision;
+    common.boot_jdk_subdirpart = boot_jdk_subdirpart;
+    common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk"
+        + common.boot_jdk_subdirpart
+        + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
+
     return common;
 };
 
@@ -333,8 +350,11 @@
         "run-test": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
-            dependencies: [ "jtreg", "gnumake" ],
-            labels: "test"
+            dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
+            labels: "test",
+            environment: {
+                "JT_JAVA": common.boot_jdk_home
+            }
         }
     };
     profiles = concatObjects(profiles, testOnlyProfiles);
@@ -357,18 +377,6 @@
     var boot_jdk_platform = input.build_os + "-"
         + (input.build_cpu == "x86" ? "i586" : input.build_cpu);
 
-    var boot_jdk_revision = "8";
-    var boot_jdk_subdirpart = "1.8.0";
-    // JDK 8 does not work on sparc M7 cpus, need a newer update when building
-    // on such hardware.
-    if (input.build_cpu == "sparcv9") {
-       var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
-       if (cpu_brand.trim() == 'SPARC-M7') {
-           boot_jdk_revision = "8u20";
-           boot_jdk_subdirpart = "1.8.0_20";
-       }
-    }
-
     var devkit_platform_revisions = {
         linux_x64: "gcc4.9.2-OEL6.4+1.0",
         macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
@@ -386,12 +394,12 @@
         boot_jdk: {
             server: "javare",
             module: "jdk",
-            revision: boot_jdk_revision,
+            revision: common.boot_jdk_revision,
             checksum_file: boot_jdk_platform + "/MD5_VALUES",
-            file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz",
-            configure_args: (input.build_os == "macosx"
-                ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home"
-                : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart)
+            file: boot_jdk_platform + "/jdk-" + common.boot_jdk_revision
+                + "-" + boot_jdk_platform + ".tar.gz",
+            configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
+            environment_path: common.boot_jdk_home
         },
 
         devkit: {
@@ -420,7 +428,8 @@
             build_number: "b03",
             checksum_file: "MD5_VALUES",
             file: "jtreg_bin-4.2.zip",
-            environment_name: "JT_HOME"
+            environment_name: "JT_HOME",
+            environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
         },
 
         gnumake: {
--- a/corba/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/corba/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 1a497f5ca0cfd88115cc7daa8af8a62b8741caf2 jdk-9+134
 094d0db606db976045f594dba47d4593b715cc81 jdk-9+135
 aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
+258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137
--- a/hotspot/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -539,3 +539,5 @@
 b8b694c6b4d2ab0939aed7adaf0eec1ac321a085 jdk-9+134
 3b1c4562953db47e36b237a500f368d5c9746d47 jdk-9+135
 a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136
+dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
+fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -1575,6 +1575,9 @@
   inline void stdu( Register d, int si16,    Register s1);
   inline void stdux(Register s, Register a,  Register b);
 
+  inline void st_ptr(Register d, int si16,    Register s1);
+  DEBUG_ONLY(inline void st_ptr(Register d, ByteSize b, Register s1);)
+
   // PPC 1, section 3.3.13 Move To/From System Register Instructions
   inline void mtlr( Register s1);
   inline void mflr( Register d);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -349,6 +349,9 @@
 inline void Assembler::stdu( Register d, int si16,    Register s1) { emit_int32(STDU_OPCODE | rs(d) | ds(si16)   | rta0mem(s1));}
 inline void Assembler::stdux(Register s, Register a,  Register b)  { emit_int32(STDUX_OPCODE| rs(s) | rta0mem(a) | rb(b));}
 
+inline void Assembler::st_ptr(Register d, int b, Register s1) { std(d, b, s1); }
+DEBUG_ONLY(inline void Assembler::st_ptr(Register d, ByteSize b, Register s1) { std(d, in_bytes(b), s1); })
+
 // PPC 1, section 3.3.13 Move To/From System Register Instructions
 inline void Assembler::mtlr( Register s1)         { emit_int32(MTLR_OPCODE  | rs(s1)); }
 inline void Assembler::mflr( Register d )         { emit_int32(MFLR_OPCODE  | rt(d)); }
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -261,6 +261,9 @@
 }
 
 void InterpreterMacroAssembler::push_l(Register r) {
+  // Clear unused slot.
+  load_const_optimized(R0, 0L);
+  std(R0, 0, R15_esp);
   std(r, - Interpreter::stackElementSize, R15_esp);
   addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize );
 }
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -2489,6 +2489,11 @@
     __ verify_oop(R3_RET);
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
 
   // Reset handle block.
   // --------------------------------------------------------------------------
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -1544,6 +1544,12 @@
     __ fence();
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
+
   __ reset_last_Java_frame();
 
   // Jvmdi/jvmpi support. Whether we've got an exception pending or
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -2366,7 +2366,9 @@
   if (Interpreter::contains(pc)) {
     *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -2383,7 +2385,7 @@
       // has been pushed on the stack
       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -378,7 +378,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -395,7 +397,7 @@
       // has been pushed on the stack
       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -191,7 +191,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -209,8 +211,8 @@
       intptr_t* sp = os::Linux::ucontext_get_sp(uc);
       *fr = frame(sp + 1, fp, (address)*sp);
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
         assert(!fr->is_first_frame(), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -255,7 +255,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -273,7 +275,7 @@
       intptr_t* sp = os::Solaris::ucontext_get_sp(uc);
       *fr = frame(sp + 1, fp, (address)*sp);
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -81,7 +81,6 @@
 typedef void (JNICALL *ZipClose_t)(jzfile *zip);
 typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen);
 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
-typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
 typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
 typedef jint     (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
@@ -91,7 +90,6 @@
 static ZipClose_t        ZipClose           = NULL;
 static FindEntry_t       FindEntry          = NULL;
 static ReadEntry_t       ReadEntry          = NULL;
-static ReadMappedEntry_t ReadMappedEntry    = NULL;
 static GetNextEntry_t    GetNextEntry       = NULL;
 static canonicalize_fn_t CanonicalizeEntry  = NULL;
 static ZipInflateFully_t ZipInflateFully    = NULL;
@@ -353,15 +351,10 @@
     filename = NEW_RESOURCE_ARRAY(char, name_len + 1);
   }
 
-  // file found, get pointer to the entry in mmapped jar file.
-  if (ReadMappedEntry == NULL ||
-      !(*ReadMappedEntry)(_zip, entry, &buffer, filename)) {
-      // mmapped access not available, perhaps due to compression,
-      // read contents into resource array
-      int size = (*filesize) + ((nul_terminate) ? 1 : 0);
-      buffer = NEW_RESOURCE_ARRAY(u1, size);
-      if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
-  }
+  // read contents into resource array
+  int size = (*filesize) + ((nul_terminate) ? 1 : 0);
+  buffer = NEW_RESOURCE_ARRAY(u1, size);
+  if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
 
   // return result
   if (nul_terminate) {
@@ -1079,7 +1072,6 @@
   ZipClose     = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close"));
   FindEntry    = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry"));
   ReadEntry    = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
-  ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
   GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
   ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
   Crc32        = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -540,7 +540,7 @@
 
   // Overflow list of grey objects, threaded through mark-word
   // Manipulated with CAS in the parallel/multi-threaded case.
-  oop _overflow_list;
+  oopDesc* volatile _overflow_list;
   // The following array-pair keeps track of mark words
   // displaced for accommodating overflow list above.
   // This code will likely be revisited under RFE#4922830.
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -323,7 +323,7 @@
   // A list of from-space images of to-be-scanned objects, threaded through
   // klass-pointers (klass information already copied to the forwarded
   // image.)  Manipulated with CAS.
-  oop _overflow_list;
+  oopDesc* volatile _overflow_list;
   NOT_PRODUCT(ssize_t _num_par_pushes;)
 
   // This closure is used by the reference processor to filter out
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -81,47 +81,6 @@
   _last_marking_length_s(0.0) {
 }
 
-#ifndef PRODUCT
-static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
-  for (int i = 0; i < 100; i++) {
-    ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
-    ctrl->update_marking_length(mark_time);
-  }
-}
-
-void G1StaticIHOPControl::test() {
-  size_t const initial_ihop = 45;
-
-  G1StaticIHOPControl ctrl(initial_ihop);
-  ctrl.update_target_occupancy(100);
-
-  size_t threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  ctrl.update_allocation_info(100.0, 100, 100);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  ctrl.update_marking_length(1000.0);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  // Whatever we pass, the IHOP value must stay the same.
-  test_update(&ctrl, 2, 10, 10, 3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  test_update(&ctrl, 12, 10, 10, 3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-}
-#endif
-
 G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
                                              G1Predictions const* predictor,
                                              size_t heap_reserve_percent,
@@ -224,79 +183,3 @@
                                           _predictor->get_new_prediction(&_marking_times_s),
                                           have_enough_data_for_prediction());
 }
-
-#ifndef PRODUCT
-void G1AdaptiveIHOPControl::test() {
-  size_t const initial_threshold = 45;
-  size_t const young_size = 10;
-  size_t const target_size = 100;
-
-  // The final IHOP value is always
-  // target_size - (young_size + alloc_amount/alloc_time * marking_time)
-
-  G1Predictions pred(0.95);
-  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
-  ctrl.update_target_occupancy(target_size);
-
-  // First "load".
-  size_t const alloc_time1 = 2;
-  size_t const alloc_amount1 = 10;
-  size_t const marking_time1 = 2;
-  size_t const settled_ihop1 = target_size - (young_size + alloc_amount1/alloc_time1 * marking_time1);
-
-  size_t threshold;
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_threshold,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
-  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
-    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
-    ctrl.update_marking_length(marking_time1);
-    // Not enough data yet.
-    threshold = ctrl.get_conc_mark_start_threshold();
-    assert(threshold == initial_threshold,
-           "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
-  }
-
-  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == settled_ihop1,
-         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
-
-  // Second "load". A bit higher allocation rate.
-  size_t const alloc_time2 = 2;
-  size_t const alloc_amount2 = 30;
-  size_t const marking_time2 = 2;
-  size_t const settled_ihop2 = target_size - (young_size + alloc_amount2/alloc_time2 * marking_time2);
-
-  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold < settled_ihop1,
-         "Expected IHOP threshold to settle at a value lower than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
-
-  // Third "load". Very high (impossible) allocation rate.
-  size_t const alloc_time3 = 1;
-  size_t const alloc_amount3 = 50;
-  size_t const marking_time3 = 2;
-  size_t const settled_ihop3 = 0;
-
-  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-
-  assert(threshold == settled_ihop3,
-         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
-
-  // And back to some arbitrary value.
-  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold > settled_ihop3,
-         "Expected IHOP threshold to settle at value larger than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
-}
-
-void IHOP_test() {
-  G1StaticIHOPControl::test();
-  G1AdaptiveIHOPControl::test();
-}
-#endif
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -99,10 +99,6 @@
    assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
     _last_marking_length_s = marking_length_s;
   }
-
-#ifndef PRODUCT
-  static void test();
-#endif
 };
 
 // This algorithm tries to return a concurrent mark starting occupancy value that
@@ -148,9 +144,6 @@
 
   virtual void print();
   virtual void send_trace_event(G1NewTracer* tracer);
-#ifndef PRODUCT
-  static void test();
-#endif
 };
 
 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -668,20 +668,18 @@
   // fail arbitrarily). We tell the iteration code to perform this
   // filtering when it has been determined that there has been an actual
   // allocation in this region and making it safe to check the young type.
-  bool filter_young = true;
 
-  HeapWord* stop_point =
+  bool card_processed =
     r->oops_on_card_seq_iterate_careful(dirtyRegion,
                                         &filter_then_update_rs_oop_cl,
-                                        filter_young,
                                         card_ptr);
 
-  // If stop_point is non-null, then we encountered an unallocated region
-  // (perhaps the unfilled portion of a TLAB.)  For now, we'll dirty the
-  // card and re-enqueue: if we put off the card until a GC pause, then the
-  // unallocated portion will be filled in.  Alternatively, we might try
-  // the full complexity of the technique used in "regular" precleaning.
-  if (stop_point != NULL) {
+  // If unable to process the card then we encountered an unparsable
+  // part of the heap (e.g. a partially allocated object).  Redirty
+  // and re-enqueue: if we put off the card until a GC pause, then the
+  // allocation will have completed.
+  if (!card_processed) {
+    assert(!_g1->is_gc_active(), "Unparsable heap during GC");
     // The card might have gotten re-dirtied and re-enqueued while we
     // worked.  (In fact, it's pretty likely.)
     if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -352,19 +352,10 @@
   _prev_marked_bytes = marked_bytes;
 }
 
-HeapWord*
-HeapRegion::
-oops_on_card_seq_iterate_careful(MemRegion mr,
-                                 FilterOutOfRegionClosure* cl,
-                                 bool filter_young,
-                                 jbyte* card_ptr) {
-  // Currently, we should only have to clean the card if filter_young
-  // is true and vice versa.
-  if (filter_young) {
-    assert(card_ptr != NULL, "pre-condition");
-  } else {
-    assert(card_ptr == NULL, "pre-condition");
-  }
+bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr,
+                                                  FilterOutOfRegionClosure* cl,
+                                                  jbyte* card_ptr) {
+  assert(card_ptr != NULL, "pre-condition");
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   // If we're within a stop-world GC, then we might look at a card in a
@@ -375,7 +366,9 @@
   } else {
     mr = mr.intersection(used_region());
   }
-  if (mr.is_empty()) return NULL;
+  if (mr.is_empty()) {
+    return true;
+  }
   // Otherwise, find the obj that extends onto mr.start().
 
   // The intersection of the incoming mr (for the card) and the
@@ -384,27 +377,21 @@
   // G1CollectedHeap.cpp that allocates a new region sets the
   // is_young tag on the region before allocating. Thus we
   // safely know if this region is young.
-  if (is_young() && filter_young) {
-    return NULL;
+  if (is_young()) {
+    return true;
   }
 
-  assert(!is_young(), "check value of filter_young");
-
   // We can only clean the card here, after we make the decision that
-  // the card is not young. And we only clean the card if we have been
-  // asked to (i.e., card_ptr != NULL).
-  if (card_ptr != NULL) {
-    *card_ptr = CardTableModRefBS::clean_card_val();
-    // We must complete this write before we do any of the reads below.
-    OrderAccess::storeload();
-  }
+  // the card is not young.
+  *card_ptr = CardTableModRefBS::clean_card_val();
+  // We must complete this write before we do any of the reads below.
+  OrderAccess::storeload();
 
   // Cache the boundaries of the memory region in some const locals
   HeapWord* const start = mr.start();
   HeapWord* const end = mr.end();
 
-  // We used to use "block_start_careful" here.  But we're actually happy
-  // to update the BOT while we do this...
+  // Update BOT as needed while finding start of (potential) object.
   HeapWord* cur = block_start(start);
   assert(cur <= start, "Postcondition");
 
@@ -416,7 +403,9 @@
     obj = oop(cur);
     if (obj->klass_or_null() == NULL) {
       // Ran into an unparseable point.
-      return cur;
+      assert(!g1h->is_gc_active(),
+             "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
+      return false;
     }
     // Otherwise...
     next = cur + block_size(cur);
@@ -433,7 +422,9 @@
     assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant");
     if (obj->klass_or_null() == NULL) {
       // Ran into an unparseable point.
-      return cur;
+      assert(!g1h->is_gc_active(),
+             "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
+      return false;
     }
 
     // Advance the current pointer. "obj" still points to the object to iterate.
@@ -452,7 +443,7 @@
     }
   } while (cur < end);
 
-  return NULL;
+  return true;
 }
 
 // Code roots support
--- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -653,16 +653,17 @@
     }
   }
 
-  // filter_young: if true and the region is a young region then we
-  // skip the iteration.
-  // card_ptr: if not NULL, and we decide that the card is not young
-  // and we iterate over it, we'll clean the card before we start the
-  // iteration.
-  HeapWord*
-  oops_on_card_seq_iterate_careful(MemRegion mr,
-                                   FilterOutOfRegionClosure* cl,
-                                   bool filter_young,
-                                   jbyte* card_ptr);
+  // Iterate over the card in the card designated by card_ptr,
+  // applying cl to all references in the region.
+  // mr: the memory region covered by the card.
+  // card_ptr: if we decide that the card is not young and we iterate
+  // over it, we'll clean the card before we start the iteration.
+  // Returns true if card was successfully processed, false if an
+  // unparsable part of the heap was encountered, which should only
+  // happen when invoked concurrently with the mutator.
+  bool oops_on_card_seq_iterate_careful(MemRegion mr,
+                                        FilterOutOfRegionClosure* cl,
+                                        jbyte* card_ptr);
 
   size_t recorded_rs_length() const        { return _recorded_rs_length; }
   double predicted_elapsed_time_ms() const { return _predicted_elapsed_time_ms; }
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -482,8 +482,9 @@
 HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
     _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._allocated_heapregions_length), _claims(NULL) {
   assert(n_workers > 0, "Need at least one worker.");
-  _claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
-  memset(_claims, Unclaimed, sizeof(*_claims) * _n_regions);
+  uint* new_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
+  memset(new_claims, Unclaimed, sizeof(*_claims) * _n_regions);
+  _claims = new_claims;
 }
 
 HeapRegionClaimer::~HeapRegionClaimer() {
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -259,9 +259,9 @@
 // The HeapRegionClaimer is used during parallel iteration over heap regions,
 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
 class HeapRegionClaimer : public StackObj {
-  uint  _n_workers;
-  uint  _n_regions;
-  uint* _claims;
+  uint           _n_workers;
+  uint           _n_regions;
+  volatile uint* _claims;
 
   static const uint Unclaimed = 0;
   static const uint Claimed   = 1;
@@ -285,4 +285,3 @@
   bool claim_region(uint region_index);
 };
 #endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
-
--- a/hotspot/src/share/vm/logging/logFileOutput.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/logging/logFileOutput.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -97,11 +97,7 @@
   if (ret != 0) {
     return false;
   }
-#ifdef _WINDOWS
-  return (st.st_mode & S_IFMT) == _S_IFREG;
-#else
-  return S_ISREG(st.st_mode);
-#endif
+  return (st.st_mode & S_IFMT) == S_IFREG;
 }
 
 // Try to find the next number that should be used for file rotation.
--- a/hotspot/src/share/vm/logging/logTag.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -105,6 +105,7 @@
   LOG_TAG(scavenge) \
   LOG_TAG(scrub) \
   LOG_TAG(stacktrace) \
+  LOG_TAG(stackwalk) \
   LOG_TAG(start) \
   LOG_TAG(startuptime) \
   LOG_TAG(state) \
--- a/hotspot/src/share/vm/memory/filemap.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -263,7 +263,7 @@
         } else {
           struct stat st;
           if (os::stat(name, &st) == 0) {
-            if ((st.st_mode & S_IFDIR) == S_IFDIR) {
+            if ((st.st_mode & S_IFMT) == S_IFDIR) {
               if (!os::dir_is_empty(name)) {
                 ClassLoader::exit_with_path_failure(
                   "Cannot have non-empty directory in archived classpaths", name);
--- a/hotspot/src/share/vm/oops/oop.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/oops/oop.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -83,6 +83,7 @@
 
   inline Klass* klass() const;
   inline Klass* klass_or_null() const volatile;
+  inline Klass* klass_or_null_acquire() const volatile;
   inline Klass** klass_addr();
   inline narrowKlass* compressed_klass_addr();
 
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -109,7 +109,6 @@
 }
 
 Klass* oopDesc::klass_or_null() const volatile {
-  // can be NULL in CMS
   if (UseCompressedClassPointers) {
     return Klass::decode_klass(_metadata._compressed_klass);
   } else {
@@ -117,6 +116,17 @@
   }
 }
 
+Klass* oopDesc::klass_or_null_acquire() const volatile {
+  if (UseCompressedClassPointers) {
+    // Workaround for non-const load_acquire parameter.
+    const volatile narrowKlass* addr = &_metadata._compressed_klass;
+    volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr);
+    return Klass::decode_klass(OrderAccess::load_acquire(xaddr));
+  } else {
+    return (Klass*)OrderAccess::load_ptr_acquire(&_metadata._klass);
+  }
+}
+
 Klass** oopDesc::klass_addr() {
   // Only used internally and with CMS and will not work with
   // UseCompressedOops
--- a/hotspot/src/share/vm/prims/stackwalk.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -26,6 +26,7 @@
 #include "classfile/javaClasses.hpp"
 #include "classfile/javaClasses.inline.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/oopFactory.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/objArrayOop.inline.hpp"
@@ -105,10 +106,8 @@
                               int max_nframes, int start_index,
                               objArrayHandle  frames_array,
                               int& end_index, TRAPS) {
-  if (TraceStackWalk) {
-    tty->print_cr("fill_in_frames limit=%d start=%d frames length=%d",
-                  max_nframes, start_index, frames_array->length());
-  }
+  log_debug(stackwalk)("fill_in_frames limit=%d start=%d frames length=%d",
+                       max_nframes, start_index, frames_array->length());
   assert(max_nframes > 0, "invalid max_nframes");
   assert(start_index + max_nframes <= frames_array->length(), "oob");
 
@@ -122,18 +121,24 @@
     // not set) and when StackWalker::getCallerClass is called
     if (!ShowHiddenFrames && (skip_hidden_frames(mode) || get_caller_class(mode))) {
       if (method->is_hidden()) {
-        if (TraceStackWalk) {
-          tty->print("  hidden method: "); method->print_short_name();
-          tty->print("\n");
+        if (log_is_enabled(Debug, stackwalk)) {
+          ResourceMark rm(THREAD);
+          outputStream* st = Log(stackwalk)::debug_stream();
+          st->print("  hidden method: ");
+          method->print_short_name(st);
+          st->cr();
         }
         continue;
       }
     }
 
     int index = end_index++;
-    if (TraceStackWalk) {
-      tty->print("  %d: frame method: ", index); method->print_short_name();
-      tty->print_cr(" bci=%d", stream.bci());
+    if (log_is_enabled(Debug, stackwalk)) {
+      ResourceMark rm(THREAD);
+      outputStream* st = Log(stackwalk)::debug_stream();
+      st->print("  %d: frame method: ", index);
+      method->print_short_name(st);
+      st->print_cr(" bci=%d", stream.bci());
     }
 
     if (!need_method_info(mode) && get_caller_class(mode) &&
@@ -317,10 +322,8 @@
                     TRAPS) {
   ResourceMark rm(THREAD);
   JavaThread* jt = (JavaThread*)THREAD;
-  if (TraceStackWalk) {
-    tty->print_cr("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
-                  mode, skip_frames, frame_count);
-  }
+  log_debug(stackwalk)("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
+                       mode, skip_frames, frame_count);
 
   if (frames_array.is_null()) {
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
@@ -355,8 +358,12 @@
         break;
       }
 
-      if (TraceStackWalk) {
-        tty->print("  skip "); stream.method()->print_short_name(); tty->print("\n");
+      if (log_is_enabled(Debug, stackwalk)) {
+        ResourceMark rm(THREAD);
+        outputStream* st = Log(stackwalk)::debug_stream();
+        st->print("  skip ");
+        stream.method()->print_short_name(st);
+        st->cr();
       }
       stream.next();
     }
@@ -364,8 +371,12 @@
     // stack frame has been traversed individually and resume stack walk
     // from the stack frame at depth == skip_frames.
     for (int n=0; n < skip_frames && !stream.at_end(); stream.next(), n++) {
-      if (TraceStackWalk) {
-        tty->print("  skip "); stream.method()->print_short_name(); tty->cr();
+      if (log_is_enabled(Debug, stackwalk)) {
+        ResourceMark rm(THREAD);
+        outputStream* st = Log(stackwalk)::debug_stream();
+        st->print("  skip ");
+        stream.method()->print_short_name(st);
+        st->cr();
       }
     }
   }
@@ -438,10 +449,9 @@
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", 0L);
   }
 
-  if (TraceStackWalk) {
-    tty->print_cr("StackWalk::fetchNextBatch frame_count %d existing_stream " PTR_FORMAT " start %d frames %d",
-                  frame_count, p2i(existing_stream), start_index, frames_array->length());
-  }
+  log_debug(stackwalk)("StackWalk::fetchNextBatch frame_count %d existing_stream "
+                       PTR_FORMAT " start %d frames %d",
+                       frame_count, p2i(existing_stream), start_index, frames_array->length());
   int end_index = start_index;
   if (frame_count <= 0) {
     return end_index;        // No operation.
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Oct 03 12:35:51 2016 -0400
@@ -2887,9 +2887,6 @@
           "exceptions (0 means all)")                                       \
           range(0, max_jint/2)                                              \
                                                                             \
-  develop(bool, TraceStackWalk, false,                                      \
-          "Trace stack walking")                                            \
-                                                                            \
   /* notice: the max range value here is max_jint, not max_intx  */         \
   /* because of overflow issue                                   */         \
   diagnostic(intx, GuaranteedSafepointInterval, 1000,                       \
--- a/hotspot/src/share/vm/utilities/chunkedList.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "utilities/chunkedList.hpp"
-#include "utilities/debug.hpp"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-template <typename T>
-class TestChunkedList {
-  typedef ChunkedList<T, mtOther> ChunkedListT;
-
- public:
-  static void testEmpty() {
-    ChunkedListT buffer;
-    assert(buffer.size() == 0, "assert");
-  }
-
-  static void testFull() {
-    ChunkedListT buffer;
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-    }
-    assert(buffer.size() == ChunkedListT::BufferSize, "assert");
-    assert(buffer.is_full(), "assert");
-  }
-
-  static void testSize() {
-    ChunkedListT buffer;
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      assert(buffer.size() == i, "assert");
-      buffer.push((T)i);
-      assert(buffer.size() == i + 1, "assert");
-    }
-  }
-
-  static void testClear() {
-    ChunkedListT buffer;
-
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) {
-      buffer.push((T)i);
-    }
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-    }
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-  }
-
-  static void testAt() {
-    ChunkedListT buffer;
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-      assert(buffer.at(i) == (T)i, "assert");
-    }
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      assert(buffer.at(i) == (T)i, "assert");
-    }
-  }
-
-  static void test() {
-    testEmpty();
-    testFull();
-    testSize();
-    testClear();
-    testAt();
-  }
-};
-
-class Metadata;
-
-void TestChunkedList_test() {
-  TestChunkedList<Metadata*>::test();
-  TestChunkedList<size_t>::test();
-}
-
-#endif
--- a/hotspot/src/share/vm/utilities/internalVMTests.cpp	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/src/share/vm/utilities/internalVMTests.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -60,7 +60,6 @@
   run_unit_test(TestBitMap_test);
   run_unit_test(TestResourcehash_test);
   run_unit_test(ObjectMonitor_test);
-  run_unit_test(TestChunkedList_test);
   run_unit_test(Test_log_tag_combinations_limit);
   run_unit_test(Test_logtarget);
   run_unit_test(Test_logstream);
@@ -86,7 +85,6 @@
   run_unit_test(TestBufferingOopClosure_test);
   if (UseG1GC) {
     run_unit_test(FreeRegionList_test);
-    run_unit_test(IHOP_test);
   }
   run_unit_test(WorkerDataArray_test);
   run_unit_test(ParallelCompact_test);
--- a/hotspot/test/jprt.config	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/test/jprt.config	Mon Oct 03 12:35:51 2016 -0400
@@ -86,12 +86,12 @@
     fi
 
     # Add basic solaris system paths
-    path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
+    path4sdk=/usr/bin
 
     # Find GNU make
-    make=/usr/sfw/bin/gmake
+    make=/usr/bin/gmake
     if [ ! -f ${make} ] ; then
-	make=/opt/sfw/bin/gmake
+	make=/usr/gnu/bin/make
 	if [ ! -f ${make} ] ; then
 	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
         fi 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/gc/g1/test_g1IHOPControl.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1IHOPControl.hpp"
+#include "gc/g1/g1Predictions.hpp"
+#include "unittest.hpp"
+
+static void test_update(G1IHOPControl* ctrl, double alloc_time,
+                        size_t alloc_amount, size_t young_size,
+                        double mark_time) {
+  for (int i = 0; i < 100; i++) {
+    ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
+    ctrl->update_marking_length(mark_time);
+  }
+}
+
+// @requires UseG1GC
+TEST_VM(G1StaticIHOPControl, simple) {
+  // Test requires G1
+  if (!UseG1GC) {
+    return;
+  }
+
+  const size_t initial_ihop = 45;
+
+  G1StaticIHOPControl ctrl(initial_ihop);
+  ctrl.update_target_occupancy(100);
+
+  size_t threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  ctrl.update_allocation_info(100.0, 100, 100);
+  threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  ctrl.update_marking_length(1000.0);
+  threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  // Whatever we pass, the IHOP value must stay the same.
+  test_update(&ctrl, 2, 10, 10, 3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_ihop, threshold);
+
+  test_update(&ctrl, 12, 10, 10, 3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_ihop, threshold);
+}
+
+// @requires UseG1GC
+TEST_VM(G1AdaptiveIHOPControl, simple) {
+  // Test requires G1
+  if (!UseG1GC) {
+    return;
+  }
+
+  const size_t initial_threshold = 45;
+  const size_t young_size = 10;
+  const size_t target_size = 100;
+
+  // The final IHOP value is always
+  // target_size - (young_size + alloc_amount/alloc_time * marking_time)
+
+  G1Predictions pred(0.95);
+  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
+  ctrl.update_target_occupancy(target_size);
+
+  // First "load".
+  const size_t alloc_time1 = 2;
+  const size_t alloc_amount1 = 10;
+  const size_t marking_time1 = 2;
+  const size_t settled_ihop1 = target_size
+          - (young_size + alloc_amount1 / alloc_time1 * marking_time1);
+
+  size_t threshold;
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_threshold, threshold);
+
+  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
+    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
+    ctrl.update_marking_length(marking_time1);
+    // Not enough data yet.
+    threshold = ctrl.get_conc_mark_start_threshold();
+
+    ASSERT_EQ(initial_threshold, threshold) << "on step " << i;
+  }
+
+  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(settled_ihop1, threshold);
+
+  // Second "load". A bit higher allocation rate.
+  const size_t alloc_time2 = 2;
+  const size_t alloc_amount2 = 30;
+  const size_t marking_time2 = 2;
+  const size_t settled_ihop2 = target_size
+          - (young_size + alloc_amount2 / alloc_time2 * marking_time2);
+
+  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_LT(threshold, settled_ihop1);
+
+  // Third "load". Very high (impossible) allocation rate.
+  const size_t alloc_time3 = 1;
+  const size_t alloc_amount3 = 50;
+  const size_t marking_time3 = 2;
+  const size_t settled_ihop3 = 0;
+
+  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(settled_ihop3, threshold);
+
+  // And back to some arbitrary value.
+  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_GT(threshold, settled_ihop3);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/utilities/test_chunkedList.cpp	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "unittest.hpp"
+#include "utilities/chunkedList.hpp"
+
+class Metadata;
+
+template <typename T>
+class TestChunkedList {
+  typedef ChunkedList<T, mtOther> ChunkedListT;
+
+ public:
+
+  static void testEmpty() {
+    ChunkedListT buffer;
+    ASSERT_EQ((size_t) 0, buffer.size());
+  }
+
+  static void testFull() {
+    ChunkedListT buffer;
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+    }
+    ASSERT_EQ((size_t) ChunkedListT::BufferSize, buffer.size());
+    ASSERT_TRUE(buffer.is_full());
+  }
+
+  static void testSize() {
+    ChunkedListT buffer;
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      ASSERT_EQ((size_t) i, buffer.size());
+      buffer.push((T) i);
+      ASSERT_EQ((size_t) (i + 1), buffer.size());
+    }
+  }
+
+  static void testClear() {
+    ChunkedListT buffer;
+
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) {
+      buffer.push((T) i);
+    }
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+    }
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+  }
+
+  static void testAt() {
+    ChunkedListT buffer;
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+      ASSERT_EQ((T) i, buffer.at(i));
+    }
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      ASSERT_EQ((T) i, buffer.at(i));
+    }
+  }
+};
+
+TEST(ChunkedList, metadata_empty) {
+  TestChunkedList<Metadata*>::testEmpty();
+}
+
+TEST(ChunkedList, metadata_full) {
+  TestChunkedList<Metadata*>::testFull();
+}
+
+TEST(ChunkedList, metadata_size) {
+  TestChunkedList<Metadata*>::testSize();
+}
+
+TEST(ChunkedList, metadata_clear) {
+  TestChunkedList<Metadata*>::testSize();
+}
+
+TEST(ChunkedList, metadata_at) {
+  TestChunkedList<Metadata*>::testAt();
+}
+
+TEST(ChunkedList, size_t_empty) {
+  TestChunkedList<size_t>::testEmpty();
+}
+
+TEST(ChunkedList, size_t_full) {
+  TestChunkedList<size_t>::testFull();
+}
+
+TEST(ChunkedList, size_t_size) {
+  TestChunkedList<size_t>::testSize();
+}
+
+TEST(ChunkedList, size_t_clear) {
+  TestChunkedList<size_t>::testSize();
+}
+
+TEST(ChunkedList, size_t_at) {
+  TestChunkedList<size_t>::testAt();
+}
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -34,14 +34,17 @@
  *          jdk.hotspot.agent/sun.jvm.hotspot.runtime
  *          jdk.hotspot.agent/sun.jvm.hotspot.tools
  *          java.management
- * @build SASymbolTableTestAgent SASymbolTableTestAttachee
+ * @build SASymbolTableTestAgent
  * @run main SASymbolTableTest
  */
 
+import java.util.Arrays;
+import java.util.List;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Platform;
+import jdk.test.lib.apps.LingeredApp;
 
 /*
  * The purpose of this test is to validate that we can use SA to
@@ -53,6 +56,7 @@
  */
 public class SASymbolTableTest {
     static String jsaName = "./SASymbolTableTest.jsa";
+    private static LingeredApp theApp = null;
 
     public static void main(String[] args) throws Exception {
         if (!Platform.shouldSAAttach()) {
@@ -78,50 +82,44 @@
     private static void run(boolean useArchive) throws Exception {
         String flag = useArchive ? "auto" : "off";
 
-        // (1) Launch the attachee process
-        ProcessBuilder attachee = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + jsaName,
-            "-Xshare:" + flag,
-            "-showversion",                // so we can see "sharing" in the output
-            "SASymbolTableTestAttachee");
+        try {
+            // (1) Launch the attachee process
+            System.out.println("Starting LingeredApp");
+            List<String> vmOpts = Arrays.asList(
+                    "-XX:+UnlockDiagnosticVMOptions",
+                    "-XX:SharedArchiveFile=" + jsaName,
+                    "-Xshare:" + flag,
+                    "-showversion");                // so we can see "sharing" in the output
 
-        final Process p = attachee.start();
+            theApp = LingeredApp.startApp(vmOpts);
 
-        // (2) Launch the agent process
-        long pid = p.getPid();
-        System.out.println("Attaching agent " + pid);
-        ProcessBuilder tool = ProcessTools.createJavaProcessBuilder(
-            "--add-modules=jdk.hotspot.agent",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
-            "SASymbolTableTestAgent",
-            Long.toString(pid));
-        OutputAnalyzer output = ProcessTools.executeProcess(tool);
-        System.out.println(output.getOutput());
-        output.shouldHaveExitValue(0);
-
-        Thread t = new Thread() {
-                public void run() {
-                    try {
-                        OutputAnalyzer output = new OutputAnalyzer(p);
-                        System.out.println("STDOUT[");
-                        System.out.print(output.getStdout());
-                        System.out.println("]");
-                        System.out.println("STDERR[");
-                        System.out.print(output.getStderr());
-                        System.out.println("]");
-                    } catch (Throwable t) {
-                        t.printStackTrace();
-                    }
-                }
-            };
-        t.start();
-
-        Thread.sleep(2 * 1000);
-        p.destroy();
-        t.join();
+            // (2) Launch the agent process
+            long pid = theApp.getPid();
+            System.out.println("Attaching agent to " + pid );
+            ProcessBuilder tool = ProcessTools.createJavaProcessBuilder(
+                    "--add-modules=jdk.hotspot.agent",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
+                    "SASymbolTableTestAgent",
+                    Long.toString(pid));
+            OutputAnalyzer output = ProcessTools.executeProcess(tool);
+            System.out.println("STDOUT[");
+            System.out.println(output.getOutput());
+            if (output.getStdout().contains("connected too early")) {
+                System.out.println("SymbolTable not created by VM - test skipped");
+                return;
+            }
+            System.out.println("]");
+            System.out.println("STDERR[");
+            System.out.print(output.getStderr());
+            System.out.println("]");
+            output.shouldHaveExitValue(0);
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java	Mon Oct 03 12:35:51 2016 -0400
@@ -112,31 +112,35 @@
 
     public void run() {
         System.out.println("SASymbolTableTestAgent: starting");
-        VM vm = VM.getVM();
-        SymbolTable table = vm.getSymbolTable();
+        try {
+            VM vm = VM.getVM();
+            SymbolTable table = vm.getSymbolTable();
 
-        // (a) These are names that are likely to exist in the symbol table
-        //     of a JVM after start-up. They were taken from vmSymbols.hpp
-        //     during the middle of JDK9 development.
-        //
-        //     The purpose is not to check that each name must exist (a future
-        //     version of JDK may not preload some of the classes).
-        //
-        //     The purpose of this loops is to ensure that we check a lot of symbols,
-        //     so we will (most likely) hit on both VALUE_ONLY_BUCKET_TYPE and normal bucket type
-        //     in CompactHashTable.probe().
-        for (String n : commonNames) {
-            Symbol s = table.probe(n);
-            System.out.format("%-40s = %s\n", n, s);
-        }
+            // (a) These are names that are likely to exist in the symbol table
+            //     of a JVM after start-up. They were taken from vmSymbols.hpp
+            //     during the middle of JDK9 development.
+            //
+            //     The purpose is not to check that each name must exist (a future
+            //     version of JDK may not preload some of the classes).
+            //
+            //     The purpose of this loops is to ensure that we check a lot of symbols,
+            //     so we will (most likely) hit on both VALUE_ONLY_BUCKET_TYPE and normal bucket type
+            //     in CompactHashTable.probe().
+            for (String n : commonNames) {
+                Symbol s = table.probe(n);
+                System.out.format("%-40s = %s\n", n, s);
+            }
 
-        System.out.println("======================================================================");
+            System.out.println("======================================================================");
 
-        // (b) Also test a few strings that are known to not exist in the table. This will
-        //     both the compact table (if it exists) and the regular table to be walked.
-        for (String n : badNames) {
-            Symbol s = table.probe(n);
-            System.out.format("%-40s = %s\n", n, s);
+            // (b) Also test a few strings that are known to not exist in the table. This will
+            //     both the compact table (if it exists) and the regular table to be walked.
+            for (String n : badNames) {
+                Symbol s = table.probe(n);
+                System.out.format("%-40s = %s\n", n, s);
+            }
+        } catch (NullPointerException e) {
+            System.out.println("connected too early -- please try again");
         }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java	Wed Sep 28 11:17:51 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * This class is launched in a sub-process by the main test,
- * SASymbolTableTest.java.
- *
- * This class does nothing in particular. It just sleeps for 120
- * seconds so SASymbolTableTestAgent can have a chance to examine its
- * SymbolTable. This process should be killed by the parent process
- * after SASymbolTableTestAgent has completed testing.
- */
-public class SASymbolTableTestAttachee {
-    public static void main(String args[]) throws Throwable {
-        System.out.println("SASymbolTableTestAttachee: sleeping to wait for SA tool to attach ...");
-        Thread.sleep(120 * 1000);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/StackWalkTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,67 @@
+/*
+ * 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 StackWalkTest
+ * @bug 8160064
+ * @summary -Xlog:stackwalk should produce logging from the source code
+ * @library /test/lib
+ * @run driver StackWalkTest
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class StackWalkTest {
+    static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Start walking");
+        output.shouldContain("fill_in_frames");
+        output.shouldHaveExitValue(0);
+    }
+
+    static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("[stackwalk]");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void main(String... args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=debug",
+                                                                  InnerClass.class.getName());
+        analyzeOutputOn(pb);
+
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=off",
+                                                   InnerClass.class.getName());
+        analyzeOutputOff(pb);
+    }
+
+    public static class InnerClass {
+        public static void main(String[] args) throws Exception {
+            System.out.println("Testing stackwalk.");
+            StackWalker sw = StackWalker.getInstance();
+            sw.forEach(System.out::println);
+        }
+    }
+}
--- a/jaxp/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 1c6c21d87aa459d82425e1fddc9ce8647aebde34 jdk-9+134
 f695240370c77a25fed88225a392e7d530cb4d78 jdk-9+135
 f1eafcb0eb7182b937bc93f214d8cabd01ec4d59 jdk-9+136
+a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1033,12 +1033,12 @@
             staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
         }
 
-        if (staxInputSource == null) {
+        if (staxInputSource == null && fUseCatalog) {
             if (fCatalogFeatures == null) {
                 fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
             }
             fCatalogFile = fCatalogFeatures.get(Feature.FILES);
-            if (fUseCatalog && fCatalogFile != null) {
+            if (fCatalogFile != null) {
                 try {
                     if (fCatalogResolver == null) {
                         fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
@@ -1133,12 +1133,12 @@
             xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
         }
 
-        if (xmlInputSource == null) {
+        if (xmlInputSource == null && fUseCatalog) {
             if (fCatalogFeatures == null) {
                 fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
             }
             fCatalogFile = fCatalogFeatures.get(Feature.FILES);
-            if (fUseCatalog && fCatalogFile != null) {
+            if (fCatalogFile != null) {
                 /*
                  since the method can be called from various processors, both
                  EntityResolver and URIResolver are used to attempt to find
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Mon Oct 03 12:35:51 2016 -0400
@@ -34,6 +34,8 @@
 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
 import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException;
 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
+import com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration;
+import com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration;
 import com.sun.org.apache.xerces.internal.util.AugmentationsImpl;
 import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
 import com.sun.org.apache.xerces.internal.util.IntStack;
@@ -129,8 +131,6 @@
 public class XIncludeHandler
     implements XMLComponent, XMLDocumentFilter, XMLDTDFilter {
 
-    public final static String XINCLUDE_DEFAULT_CONFIGURATION =
-        "com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration";
     public final static String HTTP_ACCEPT = "Accept";
     public final static String HTTP_ACCEPT_LANGUAGE = "Accept-Language";
     public final static String XPOINTER = "xpointer";
@@ -1624,12 +1624,12 @@
                 includedSource =
                     fEntityResolver.resolveEntity(resourceIdentifier);
 
-                if (includedSource == null) {
+                if (includedSource == null && fUseCatalog) {
                     if (fCatalogFeatures == null) {
                         fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
                     }
                     fCatalogFile = fCatalogFeatures.get(CatalogFeatures.Feature.FILES);
-                    if (fUseCatalog && fCatalogFile != null) {
+                    if (fCatalogFile != null) {
                         /*
                            Although URI entry is preferred for resolving XInclude, system entry
                            is allowed as well.
@@ -1690,14 +1690,11 @@
             if ((xpointer != null && fXPointerChildConfig == null)
                         || (xpointer == null && fXIncludeChildConfig == null) ) {
 
-                String parserName = XINCLUDE_DEFAULT_CONFIGURATION;
-                if (xpointer != null)
-                        parserName = "com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration";
-
-                fChildConfig =
-                    (XMLParserConfiguration)ObjectFactory.newInstance(
-                        parserName,
-                        true);
+                if (xpointer == null) {
+                    fChildConfig = new XIncludeParserConfiguration();
+                } else {
+                    fChildConfig = new XPointerParserConfiguration();
+                }
 
                 // use the same symbol table, error reporter, entity resolver, security manager and buffer size.
                 if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable);
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java	Mon Oct 03 12:35:51 2016 -0400
@@ -32,7 +32,6 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
-
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Listeners;
@@ -42,7 +41,7 @@
 
 /**
  * @test
- * @bug 8158084 8162438 8162442 8166220
+ * @bug 8158084 8162438 8162442 8166220 8166398
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport
  * @run testng/othervm catalog.CatalogSupport
@@ -51,7 +50,7 @@
  * A custom resolver is used whether or not there's a Catalog;
  * A Catalog is used when there's no custom resolver, and the USE_CATALOG
  * is true (which is the case by default).
- */
+*/
 
 /**
  * Support Catalog:
@@ -177,13 +176,13 @@
      */
     @DataProvider(name = "data_SAXA")
     public Object[][] getDataSAX() {
-        String[] systemIds = {"system.xsd"};
-        InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
-        MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
+        String[] systemIds = {"system.dtd"};
         return new Object[][]{
             {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
-            {false, true, xml_catalog, xml_system, entityHandler, expectedWResolver},
-            {true, true, xml_catalog, xml_system, entityHandler, expectedWResolver}
+            {false, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
+                    new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver},
+            {true, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
+                    new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver}
         };
     }
 
@@ -209,7 +208,7 @@
      */
     @DataProvider(name = "data_DOMA")
     public Object[][] getDataDOM() {
-        String[] systemIds = {"system.xsd"};
+        String[] systemIds = {"system.dtd"};
         InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
         MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
         return new Object[][]{
@@ -230,8 +229,8 @@
 
         return new Object[][]{
             {false, true, xml_catalog, xml_system, null, expectedWCatalog},
-            {false, true, xml_catalog, xml_system, null, expectedWResolver},
-            {true, true, xml_catalog, xml_system, null, expectedWResolver}
+            {false, true, xml_catalog, xml_system, new MyStaxEntityResolver(), expectedWResolver},
+            {true, true, xml_catalog, xml_system, new MyStaxEntityResolver(), expectedWResolver}
         };
     }
 
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml	Mon Oct 03 12:35:51 2016 -0400
@@ -15,6 +15,7 @@
     <system systemId="XI_utf8.xml" uri="XI_utf8.xml"/>
     <system systemId="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
     <system systemId="XI_test2.xml" uri="XI_test2.xml"/>
+    <system systemId="XI_test2Catalog.xml" uri="XI_test2Catalog.xml"/>
     <system systemId="XI_red.dtd" uri="XI_red.dtd"/>
 
     <!-- xsd import can be mapped using the namespace or systemId -->
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java	Mon Oct 03 12:35:51 2016 -0400
@@ -276,7 +276,7 @@
         SAXParser parser = getSAXParser(setUseCatalog, useCatalog, catalog);
 
         parser.parse(xml, handler);
-        assertEquals(expected, handler.getResult().trim(), "");
+        Assert.assertEquals(handler.getResult().trim(), expected);
     }
 
     /*
@@ -287,8 +287,9 @@
         XMLReader reader = getXMLReader(setUseCatalog, useCatalog, catalog);
 
         reader.setContentHandler(handler);
+        reader.setEntityResolver(handler);
         reader.parse(xml);
-        assertEquals(expected, handler.getResult().trim(), "");
+        Assert.assertEquals(handler.getResult().trim(), expected);
     }
 
     /*
@@ -300,7 +301,7 @@
 
         parser.parse(new InputSource(new StringReader(xml)), handler);
         debugPrint("handler.result:" + handler.getResult());
-        assertEquals(expected, handler.getResult(), "Catalog support for XInclude");
+        Assert.assertEquals(handler.getResult().trim(), expected);
     }
 
     /*
@@ -314,8 +315,7 @@
 
         Node node = doc.getElementsByTagName(elementInSystem).item(0);
         String result = node.getFirstChild().getTextContent();
-
-        assertEquals(expected, result.trim(), "Catalog support for DOM");
+        Assert.assertEquals(result.trim(), expected);
     }
 
     /*
@@ -327,7 +327,7 @@
             XMLStreamReader streamReader = getStreamReader(
                     setUseCatalog, useCatalog, catalog, xml, resolver);
             String text = getText(streamReader, XMLStreamConstants.CHARACTERS);
-            assertEquals(expected, text.trim(), "Catalog support for StAX");
+            Assert.assertEquals(text.trim(), expected);
     }
 
     /*
@@ -340,7 +340,7 @@
             XMLStreamReader streamReader = getStreamReader(
                     setUseCatalog, useCatalog, catalog, xml, resolver);
             String text = getText(streamReader, XMLStreamConstants.ENTITY_REFERENCE);
-            assertEquals(expected, text.trim(), "Catalog support for StAX");
+            Assert.assertEquals(text.trim(), expected);
     }
 
     /*
@@ -601,9 +601,11 @@
     }
 
     /**
-     * Returns the text of the first element found by the reader.
+     * Returns the accumulated text of an event type.
+     *
      * @param streamReader the XMLStreamReader
-     * @return the text of the first element
+     * @param type the type of event requested
+     * @return the text of the accumulated text for the request type
      * @throws XMLStreamException
      */
     String getText(XMLStreamReader streamReader, int type) throws XMLStreamException {
@@ -662,24 +664,6 @@
         return factory;
     }
 
-    void assertNotNull(Object obj, String msg) {
-        if (obj == null) {
-            debugPrint("Test failed: " + msg);
-        } else {
-            debugPrint("Test passed: " + obj + " is not null");
-        }
-    }
-
-    void assertEquals(String expected, String actual, String msg) {
-        if (!expected.equals(actual)) {
-            debugPrint("Test failed: " + msg);
-        } else {
-            debugPrint("Test passed: ");
-        }
-        debugPrint("Expected: " + expected);
-        debugPrint("Actual: " + actual);
-    }
-
     void fail(String msg) {
         System.out.println("Test failed:");
         System.out.println(msg);
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_simple4Catalog.xml	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_simple4Catalog.xml	Mon Oct 03 12:35:51 2016 -0400
@@ -9,7 +9,7 @@
     </another>
   </latin1>
   <test2>
-    <xinclude:include href="XI_test2.xml"/>
+    <xinclude:include href="XI_test2Catalog.xml"/>
   </test2>
   <test3>
    <!-- <xinclude:include href="XI_roottest.xml"/> -->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_test2Catalog.xml	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- comment before root -->
+<!DOCTYPE red SYSTEM "XI_red.dtd">
+<red xmlns:xinclude="http://www.w3.org/2001/XInclude">
+  <blue>
+    <xinclude:include href="XI_utf8Catalog.xml" parse="text"/>
+  </blue>
+</red>
+<!-- comment after root -->
+
--- a/jaxws/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/jaxws/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -382,3 +382,4 @@
 ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134
 22631824f55128a7ab6605493b3001a37af6a168 jdk-9+135
 09ec13a99f50a4a346180d1e3b0fd8bc1ee399ce jdk-9+136
+297c16d401c534cb879809d2a746d21ca99d2954 jdk-9+137
--- a/jdk/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134
 021369229cfd0b5feb76834b2ea498f47f43c0f3 jdk-9+135
 54c5931849a33a363e03fdffa141503f5cc4779d jdk-9+136
+e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
--- a/jdk/make/launcher/Launcher-java.desktop.gmk	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/make/launcher/Launcher-java.desktop.gmk	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -28,7 +28,7 @@
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
 
-ifndef BUILD_HEADLESS_ONLY
+ifeq ($(ENABLE_HEADLESS_ONLY), false)
   $(eval $(call SetupBuildLauncher, appletviewer, \
       MAIN_CLASS := sun.applet.Main, \
       JAVA_ARGS := --add-modules ALL-DEFAULT, \
--- a/jdk/make/launcher/Launcher-jdk.policytool.gmk	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-ifndef BUILD_HEADLESS_ONLY
+ifeq ($(ENABLE_HEADLESS_ONLY), false)
   $(eval $(call SetupBuildLauncher, policytool, \
       MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
       LIBS_unix := $(X_LIBS), \
--- a/jdk/make/lib/Awt2dLibraries.gmk	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Mon Oct 03 12:35:51 2016 -0400
@@ -280,7 +280,7 @@
 ################################################################################
 
 ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
-  ifndef BUILD_HEADLESS_ONLY
+  ifeq ($(ENABLE_HEADLESS_ONLY), false)
 
     LIBAWT_XAWT_DIRS := \
         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
@@ -511,77 +511,75 @@
 
 ################################################################################
 
-ifeq ($(BUILD_HEADLESS), true)
-  # Mac and Windows only use the native AWT lib, do not build libawt_headless
-  ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
+# Mac and Windows only use the native AWT lib, do not build libawt_headless
+ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 
-    LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
-        $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-        #
+  LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
+      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
+      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
+      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
+      $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
+      $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
+      #
 
-    LIBAWT_HEADLESS_EXCLUDES := medialib
-    LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-        $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
-        $(LIBJAVA_HEADER_FLAGS) \
-        #
+  LIBAWT_HEADLESS_EXCLUDES := medialib
+  LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+      $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
+      $(LIBJAVA_HEADER_FLAGS) \
+      #
 
-    LIBAWT_HEADLESS_REORDER :=
-    ifeq ($(OPENJDK_TARGET_OS), solaris)
-      ifneq ($(OPENJDK_TARGET_CPU), x86_64)
-        LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
-      endif
+  LIBAWT_HEADLESS_REORDER :=
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
+    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+      LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
     endif
+  endif
 
-    $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
-        LIBRARY := awt_headless, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-        SRC := $(LIBAWT_HEADLESS_DIRS), \
-        EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
-        OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            -DHEADLESS=true \
-            -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-            $(CUPS_CFLAGS) \
-            $(X_CFLAGS) \
-            $(LIBAWT_HEADLESS_CFLAGS), \
-        DISABLED_WARNINGS_xlc := 1506-356, \
-        DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
-        MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
-        LDFLAGS := $(LDFLAGS_JDKLIB) \
-            $(call SET_SHARED_LIBRARY_ORIGIN), \
-        LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
-        LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
-        LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
-        REORDER := $(LIBAWT_HEADLESS_REORDER), \
-        LIBS_unix := -lawt -ljvm -ljava, \
-        LIBS_linux := $(LIBM) $(LIBDL), \
-        LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
-    ))
+  $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
+      LIBRARY := awt_headless, \
+      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+      SRC := $(LIBAWT_HEADLESS_DIRS), \
+      EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
+      OPTIMIZATION := LOW, \
+      CFLAGS := $(CFLAGS_JDKLIB) \
+          -DHEADLESS=true \
+          -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
+          $(CUPS_CFLAGS) \
+          $(X_CFLAGS) \
+          $(LIBAWT_HEADLESS_CFLAGS), \
+      DISABLED_WARNINGS_xlc := 1506-356, \
+      DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
+      MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
+          $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
+      LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+      LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+      REORDER := $(LIBAWT_HEADLESS_REORDER), \
+      LIBS_unix := -lawt -ljvm -ljava, \
+      LIBS_linux := $(LIBM) $(LIBDL), \
+      LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
+  ))
 
-    # AIX warning explanation:
-    # 1506-356 : (W) Compilation unit is empty.
-    #            This happens during the headless build
+  # AIX warning explanation:
+  # 1506-356 : (W) Compilation unit is empty.
+  #            This happens during the headless build
 
-    $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
+  $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 
-    TARGETS += $(BUILD_LIBAWT_HEADLESS)
+  TARGETS += $(BUILD_LIBAWT_HEADLESS)
 
-  endif
 endif
 
 ################################################################################
@@ -780,7 +778,7 @@
     ifneq ($(OPENJDK_TARGET_OS), solaris)
       JAWT_LIBS += -lawt
     endif
-    ifndef BUILD_HEADLESS_ONLY
+    ifeq ($(ENABLE_HEADLESS_ONLY), false)
       JAWT_LIBS += -lawt_xawt
     else
       JAWT_LIBS += -lawt_headless
@@ -809,7 +807,7 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
   ))
 
-  ifndef BUILD_HEADLESS_ONLY
+  ifeq ($(ENABLE_HEADLESS_ONLY), false)
     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
   else
     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
@@ -825,7 +823,7 @@
 
 ################################################################################
 
-ifndef BUILD_HEADLESS_ONLY
+ifeq ($(ENABLE_HEADLESS_ONLY), false)
 
   LIBSPLASHSCREEN_DIRS := \
       $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/aix/native/libjli/java_md_aix.c	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2016 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+#include <stdio.h>
+#include <sys/ldr.h>
+
+#include "java_md_aix.h"
+
+static unsigned char dladdr_buffer[0x4000];
+
+static int fill_dll_info(void) {
+    return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
+}
+
+static int dladdr_dont_reload(void *addr, Dl_info *info) {
+    const struct ld_info *p = (struct ld_info *)dladdr_buffer;
+    memset((void *)info, 0, sizeof(Dl_info));
+    for (;;) {
+        if (addr >= p->ldinfo_textorg &&
+            addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
+        {
+            info->dli_fname = p->ldinfo_filename;
+            return 1;
+        }
+        if (!p->ldinfo_next) {
+            break;
+        }
+        p = (struct ld_info *)(((char *)p) + p->ldinfo_next);
+    }
+    return 0;
+}
+
+int dladdr(void *addr, Dl_info *info) {
+    static int loaded = 0;
+    int rc = 0;
+    void *addr0;
+    if (!addr) {
+        return rc;
+    }
+    if (!loaded) {
+        if (fill_dll_info() == -1)
+            return rc;
+        loaded = 1;
+    }
+
+    // first try with addr on cached data
+    rc = dladdr_dont_reload(addr, info);
+
+    // addr could be an AIX function descriptor, so try dereferenced version
+    if (rc == 0) {
+        addr0 = *((void **)addr);
+        rc = dladdr_dont_reload(addr0, info);
+    }
+
+    // if we had no success until now, maybe loadquery info is outdated.
+    // refresh and retry
+    if (rc == 0) {
+        if (fill_dll_info() == -1)
+            return rc;
+        rc = dladdr_dont_reload(addr, info);
+        if (rc == 0) {
+            rc = dladdr_dont_reload(addr0, info);
+        }
+    }
+    return rc;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/aix/native/libjli/java_md_aix.h	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+#ifndef JAVA_MD_AIX_H
+#define JAVA_MD_AIX_H
+
+/*
+ * Very limited AIX port of dladdr() for libjli.so.
+ *
+ * We try to mimick dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr)
+ * dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
+ *
+ * We only support Dl_info.dli_fname here as this is the only thing that is
+ * used of it by libjli.so. A more comprehensive port of dladdr can be found
+ * in the hotspot implementation which is not available at this place, though.
+ */
+
+typedef struct {
+  const char *dli_fname; /* file path of loaded library */
+  void *dli_fbase;       /* unsupported */
+  const char *dli_sname; /* unsupported */
+  void *dli_saddr;       /* unsupported */
+} Dl_info;
+
+int dladdr(void *addr, Dl_info *info);
+
+#endif /* JAVA_MD_AIX_H */
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Mon Oct 03 12:35:51 2016 -0400
@@ -71,6 +71,7 @@
     // These flags must match the values maintained in the VM
     @Native private static final int DEFAULT_MODE              = 0x0;
     @Native private static final int FILL_CLASS_REFS_ONLY      = 0x2;
+    @Native private static final int GET_CALLER_CLASS          = 0x4;
     @Native private static final int SHOW_HIDDEN_FRAMES        = 0x20;  // LambdaForms are hidden by the VM
     @Native private static final int FILL_LIVE_STACK_FRAMES    = 0x100;
     /*
@@ -614,9 +615,7 @@
         private Class<?> caller;
 
         CallerClassFinder(StackWalker walker) {
-            super(walker, FILL_CLASS_REFS_ONLY);
-            assert (mode & FILL_CLASS_REFS_ONLY) == FILL_CLASS_REFS_ONLY
-                   : "mode should contain FILL_CLASS_REFS_ONLY";
+            super(walker, FILL_CLASS_REFS_ONLY|GET_CALLER_CLASS);
         }
 
         final class ClassBuffer extends FrameBuffer<Class<?>> {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Mon Oct 03 12:35:51 2016 -0400
@@ -869,5 +869,4 @@
     static SpeciesData speciesData_LLL()    { return checkCache(3, "LLL"); }
     static SpeciesData speciesData_LLLL()   { return checkCache(4, "LLLL"); }
     static SpeciesData speciesData_LLLLL()  { return checkCache(5, "LLLLL"); }
-    static SpeciesData speciesData_LLLLLL() { return checkCache(6, "LLLLLL"); }
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -39,14 +39,14 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.stream.Stream;
 
-import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType;
 import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.LambdaForm.Kind.*;
+import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 
@@ -65,6 +65,9 @@
     private static final String OBJ     = "java/lang/Object";
     private static final String OBJARY  = "[Ljava/lang/Object;";
 
+    private static final String LOOP_CLAUSES = MHI + "$LoopClauses";
+    private static final String MHARY2       = "[[L" + MH + ";";
+
     private static final String LF_SIG  = "L" + LF + ";";
     private static final String LFN_SIG = "L" + LFN + ";";
     private static final String LL_SIG  = "(L" + OBJ + ";)L" + OBJ + ";";
@@ -1319,38 +1322,43 @@
      * The pattern looks like (Cf. MethodHandleImpl.loop):
      * <blockquote><pre>{@code
      * // a0: BMH
-     * // a1: inits, a2: steps, a3: preds, a4: finis
-     * // a5: box, a6: unbox
-     * // a7 (and following): arguments
-     * loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L)=>{
-     *   t8:L=MethodHandle.invokeBasic(a5:L,a7:L);                  // box the arguments into an Object[]
-     *   t9:L=MethodHandleImpl.loop(bt:L,a1:L,a2:L,a3:L,a4:L,t8:L); // call the loop executor (with supplied types in bt)
-     *   t10:L=MethodHandle.invokeBasic(a6:L,t9:L);t10:L}           // unbox the result; return the result
+     * // a1: LoopClauses (containing an array of arrays: inits, steps, preds, finis)
+     * // a2: box, a3: unbox
+     * // a4 (and following): arguments
+     * loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{
+     *   t5:L=MethodHandle.invokeBasic(a2:L,a4:L);          // box the arguments into an Object[]
+     *   t6:L=MethodHandleImpl.loop(bt:L,a1:L,t5:L);        // call the loop executor (with supplied types in bt)
+     *   t7:L=MethodHandle.invokeBasic(a3:L,t6:L);t7:L}     // unbox the result; return the result
      * }</pre></blockquote>
      * <p>
      * It is compiled into bytecode equivalent to the code seen in {@link MethodHandleImpl#loop(BasicType[],
-     * MethodHandle[], MethodHandle[], MethodHandle[], MethodHandle[], Object...)}, with the difference that no arrays
+     * MethodHandleImpl.LoopClauses, Object...)}, with the difference that no arrays
      * will be used for local state storage. Instead, the local state will be mapped to actual stack slots.
      * <p>
      * Bytecode generation applies an unrolling scheme to enable better bytecode generation regarding local state type
      * handling. The generated bytecode will have the following form ({@code void} types are ignored for convenience).
      * Assume there are {@code C} clauses in the loop.
      * <blockquote><pre>{@code
-     * INIT: (INIT_SEQ for clause 1)
-     *       ...
-     *       (INIT_SEQ for clause C)
-     * LOOP: (LOOP_SEQ for clause 1)
-     *       ...
-     *       (LOOP_SEQ for clause C)
-     *       GOTO LOOP
-     * DONE: ...
+     * PREINIT: ALOAD_1
+     *          CHECKCAST LoopClauses
+     *          GETFIELD LoopClauses.clauses
+     *          ASTORE clauseDataIndex          // place the clauses 2-dimensional array on the stack
+     * INIT:    (INIT_SEQ for clause 1)
+     *          ...
+     *          (INIT_SEQ for clause C)
+     * LOOP:    (LOOP_SEQ for clause 1)
+     *          ...
+     *          (LOOP_SEQ for clause C)
+     *          GOTO LOOP
+     * DONE:    ...
      * }</pre></blockquote>
      * <p>
      * The {@code INIT_SEQ_x} sequence for clause {@code x} (with {@code x} ranging from {@code 0} to {@code C-1}) has
      * the following shape. Assume slot {@code vx} is used to hold the state for clause {@code x}.
      * <blockquote><pre>{@code
-     * INIT_SEQ_x:  ALOAD inits
-     *              CHECKCAST MethodHandle[]
+     * INIT_SEQ_x:  ALOAD clauseDataIndex
+     *              ICONST_0
+     *              AALOAD      // load the inits array
      *              ICONST x
      *              AALOAD      // load the init handle for clause x
      *              load args
@@ -1361,24 +1369,27 @@
      * The {@code LOOP_SEQ_x} sequence for clause {@code x} (with {@code x} ranging from {@code 0} to {@code C-1}) has
      * the following shape. Again, assume slot {@code vx} is used to hold the state for clause {@code x}.
      * <blockquote><pre>{@code
-     * LOOP_SEQ_x:  ALOAD steps
-     *              CHECKCAST MethodHandle[]
+     * LOOP_SEQ_x:  ALOAD clauseDataIndex
+     *              ICONST_1
+     *              AALOAD              // load the steps array
      *              ICONST x
      *              AALOAD              // load the step handle for clause x
      *              load locals
      *              load args
      *              INVOKEVIRTUAL MethodHandle.invokeBasic
      *              store vx
-     *              ALOAD preds
-     *              CHECKCAST MethodHandle[]
+     *              ALOAD clauseDataIndex
+     *              ICONST_2
+     *              AALOAD              // load the preds array
      *              ICONST x
      *              AALOAD              // load the pred handle for clause x
      *              load locals
      *              load args
      *              INVOKEVIRTUAL MethodHandle.invokeBasic
      *              IFNE LOOP_SEQ_x+1   // predicate returned false -> jump to next clause
-     *              ALOAD finis
-     *              CHECKCAST MethodHandle[]
+     *              ALOAD clauseDataIndex
+     *              ICONST_3
+     *              AALOAD              // load the finis array
      *              ICONST x
      *              AALOAD              // load the fini handle for clause x
      *              load locals
@@ -1397,8 +1408,12 @@
         BasicType[] loopClauseTypes = (BasicType[]) invoker.arguments[0];
         Class<?>[] loopLocalStateTypes = Stream.of(loopClauseTypes).
                 filter(bt -> bt != BasicType.V_TYPE).map(BasicType::basicTypeClass).toArray(Class<?>[]::new);
+        Class<?>[] localTypes = new Class<?>[loopLocalStateTypes.length + 1];
+        localTypes[0] = MethodHandleImpl.LoopClauses.class;
+        System.arraycopy(loopLocalStateTypes, 0, localTypes, 1, loopLocalStateTypes.length);
 
-        final int firstLoopStateIndex = extendLocalsMap(loopLocalStateTypes);
+        final int clauseDataIndex = extendLocalsMap(localTypes);
+        final int firstLoopStateIndex = clauseDataIndex + 1;
 
         Class<?> returnType = result.function.resolvedHandle().type().returnType();
         MethodType loopType = args.function.resolvedHandle().type()
@@ -1420,10 +1435,16 @@
         Label lDone = new Label();
         Label lNext;
 
+        // PREINIT:
+        emitPushArgument(MethodHandleImpl.LoopClauses.class, invoker.arguments[1]);
+        mv.visitFieldInsn(Opcodes.GETFIELD, LOOP_CLAUSES, "clauses", MHARY2);
+        emitAstoreInsn(clauseDataIndex);
+
         // INIT:
         for (int c = 0, state = 0; c < nClauses; ++c) {
             MethodType cInitType = loopType.changeReturnType(loopClauseTypes[c].basicTypeClass());
-            emitLoopHandleInvoke(invoker, inits, c, args, false, cInitType, loopLocalStateTypes, firstLoopStateIndex);
+            emitLoopHandleInvoke(invoker, inits, c, args, false, cInitType, loopLocalStateTypes, clauseDataIndex,
+                    firstLoopStateIndex);
             if (cInitType.returnType() != void.class) {
                 emitStoreInsn(BasicType.basicType(cInitType.returnType()), firstLoopStateIndex + state);
                 ++state;
@@ -1440,18 +1461,21 @@
             boolean isVoid = stepType.returnType() == void.class;
 
             // invoke loop step
-            emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, firstLoopStateIndex);
+            emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, clauseDataIndex,
+                    firstLoopStateIndex);
             if (!isVoid) {
                 emitStoreInsn(BasicType.basicType(stepType.returnType()), firstLoopStateIndex + state);
                 ++state;
             }
 
             // invoke loop predicate
-            emitLoopHandleInvoke(invoker, preds, c, args, true, predType, loopLocalStateTypes, firstLoopStateIndex);
+            emitLoopHandleInvoke(invoker, preds, c, args, true, predType, loopLocalStateTypes, clauseDataIndex,
+                    firstLoopStateIndex);
             mv.visitJumpInsn(Opcodes.IFNE, lNext);
 
             // invoke fini
-            emitLoopHandleInvoke(invoker, finis, c, args, true, finiType, loopLocalStateTypes, firstLoopStateIndex);
+            emitLoopHandleInvoke(invoker, finis, c, args, true, finiType, loopLocalStateTypes, clauseDataIndex,
+                    firstLoopStateIndex);
             mv.visitJumpInsn(Opcodes.GOTO, lDone);
 
             // this is the beginning of the next loop clause
@@ -1483,9 +1507,10 @@
     }
 
     private void emitLoopHandleInvoke(Name holder, int handles, int clause, Name args, boolean pushLocalState,
-                                      MethodType type, Class<?>[] loopLocalStateTypes, int firstLoopStateSlot) {
+                                      MethodType type, Class<?>[] loopLocalStateTypes, int clauseDataSlot,
+                                      int firstLoopStateSlot) {
         // load handle for clause
-        emitPushArgument(holder, handles);
+        emitPushClauseArray(clauseDataSlot, handles);
         emitIconstInsn(clause);
         mv.visitInsn(Opcodes.AALOAD);
         // load loop state (preceding the other arguments)
@@ -1499,6 +1524,12 @@
         mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.toMethodDescriptorString(), false);
     }
 
+    private void emitPushClauseArray(int clauseDataSlot, int which) {
+        emitAloadInsn(clauseDataSlot);
+        emitIconstInsn(which - 1);
+        mv.visitInsn(Opcodes.AALOAD);
+    }
+
     private void emitZero(BasicType type) {
         switch (type) {
             case I_TYPE: mv.visitInsn(Opcodes.ICONST_0); break;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Mon Oct 03 12:35:51 2016 -0400
@@ -41,7 +41,6 @@
 import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
 import static java.lang.invoke.MethodHandleStatics.*;
-import java.util.Objects;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
@@ -732,9 +731,9 @@
     boolean isLoop(int pos) {
         // loop idiom:
         //   t_{n}:L=MethodHandle.invokeBasic(...)
-        //   t_{n+1}:L=MethodHandleImpl.loop(types, *, *, *, *, t_{n})
+        //   t_{n+1}:L=MethodHandleImpl.loop(types, *, t_{n})
         //   t_{n+2}:?=MethodHandle.invokeBasic(*, t_{n+1})
-        return isMatchingIdiom(pos, "loop", 5);
+        return isMatchingIdiom(pos, "loop", 2);
     }
 
     /*
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1689,8 +1689,7 @@
             NF_tryFinally = new NamedFunction(MethodHandleImpl.class
                     .getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class));
             NF_loop = new NamedFunction(MethodHandleImpl.class
-                    .getDeclaredMethod("loop", BasicType[].class, MethodHandle[].class, MethodHandle[].class,
-                            MethodHandle[].class, MethodHandle[].class, Object[].class));
+                    .getDeclaredMethod("loop", BasicType[].class, LoopClauses.class, Object[].class));
             NF_throwException = new NamedFunction(MethodHandleImpl.class
                     .getDeclaredMethod("throwException", Throwable.class));
             NF_profileBoolean = new NamedFunction(MethodHandleImpl.class
@@ -1794,12 +1793,13 @@
         MethodHandle collectArgs = varargsArray(type.parameterCount()).asType(varargsType);
         MethodHandle unboxResult = unboxResultHandle(tloop);
 
-        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLLL();
+        LoopClauses clauseData =
+                new LoopClauses(new MethodHandle[][]{toArray(init), toArray(step), toArray(pred), toArray(fini)});
+        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
         BoundMethodHandle mh;
         try {
-            mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) toArray(init),
-                    (Object) toArray(step), (Object) toArray(pred), (Object) toArray(fini), (Object) collectArgs,
-                    (Object) unboxResult);
+            mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) clauseData,
+                    (Object) collectArgs, (Object) unboxResult);
         } catch (Throwable ex) {
             throw uncaughtException(ex);
         }
@@ -1818,23 +1818,20 @@
      * {@code t12}):
      * <blockquote><pre>{@code
      *  loop=Lambda(a0:L,a1:L)=>{
-     *    t2:L=BoundMethodHandle$Species_L6.argL0(a0:L);             // array of init method handles
-     *    t3:L=BoundMethodHandle$Species_L6.argL1(a0:L);             // array of step method handles
-     *    t4:L=BoundMethodHandle$Species_L6.argL2(a0:L);             // array of pred method handles
-     *    t5:L=BoundMethodHandle$Species_L6.argL3(a0:L);             // array of fini method handles
-     *    t6:L=BoundMethodHandle$Species_L6.argL4(a0:L);             // helper handle to box the arguments into an Object[]
-     *    t7:L=BoundMethodHandle$Species_L6.argL5(a0:L);             // helper handle to unbox the result
-     *    t8:L=MethodHandle.invokeBasic(t6:L,a1:L);                  // box the arguments into an Object[]
-     *    t9:L=MethodHandleImpl.loop(null,t2:L,t3:L,t4:L,t5:L,t6:L); // call the loop executor
-     *    t10:L=MethodHandle.invokeBasic(t7:L,t9:L);t10:L}           // unbox the result; return the result
+     *    t2:L=BoundMethodHandle$Species_L3.argL0(a0:L);    // LoopClauses holding init, step, pred, fini handles
+     *    t3:L=BoundMethodHandle$Species_L3.argL1(a0:L);    // helper handle to box the arguments into an Object[]
+     *    t4:L=BoundMethodHandle$Species_L3.argL2(a0:L);    // helper handle to unbox the result
+     *    t5:L=MethodHandle.invokeBasic(t3:L,a1:L);         // box the arguments into an Object[]
+     *    t6:L=MethodHandleImpl.loop(null,t2:L,t3:L);       // call the loop executor
+     *    t7:L=MethodHandle.invokeBasic(t4:L,t6:L);t7:L}    // unbox the result; return the result
      * }</pre></blockquote>
      * <p>
-     * {@code argL0} through {@code argL3} are the arrays of init, step, pred, and fini method handles.
-     * {@code argL4} and {@code argL5} are auxiliary method handles: {@code argL2} boxes arguments and wraps them into
-     * {@code Object[]} ({@code ValueConversions.array()}), and {@code argL3} unboxes the result if necessary
+     * {@code argL0} is a LoopClauses instance holding, in a 2-dimensional array, the init, step, pred, and fini method
+     * handles. {@code argL1} and {@code argL2} are auxiliary method handles: {@code argL1} boxes arguments and wraps
+     * them into {@code Object[]} ({@code ValueConversions.array()}), and {@code argL2} unboxes the result if necessary
      * ({@code ValueConversions.unbox()}).
      * <p>
-     * Having {@code t6} and {@code t7} passed in via a BMH and not hardcoded in the lambda form allows to share lambda
+     * Having {@code t3} and {@code t4} passed in via a BMH and not hardcoded in the lambda form allows to share lambda
      * forms among loop combinators with the same basic type.
      * <p>
      * The above template is instantiated by using the {@link LambdaFormEditor} to replace the {@code null} argument to
@@ -1845,15 +1842,12 @@
     private static LambdaForm makeLoopForm(MethodType basicType, BasicType[] localVarTypes) {
         MethodType lambdaType = basicType.invokerType();
 
-        final int THIS_MH = 0;  // the BMH_LLLLLL
+        final int THIS_MH = 0;  // the BMH_LLL
         final int ARG_BASE = 1; // start of incoming arguments
         final int ARG_LIMIT = ARG_BASE + basicType.parameterCount();
 
         int nameCursor = ARG_LIMIT;
-        final int GET_INITS = nameCursor++;
-        final int GET_STEPS = nameCursor++;
-        final int GET_PREDS = nameCursor++;
-        final int GET_FINIS = nameCursor++;
+        final int GET_CLAUSE_DATA = nameCursor++;
         final int GET_COLLECT_ARGS = nameCursor++;
         final int GET_UNBOX_RESULT = nameCursor++;
         final int BOXED_ARGS = nameCursor++;
@@ -1864,14 +1858,11 @@
         if (lform == null) {
             Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
 
-            BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLLL();
+            BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
             names[THIS_MH] = names[THIS_MH].withConstraint(data);
-            names[GET_INITS] = new Name(data.getterFunction(0), names[THIS_MH]);
-            names[GET_STEPS] = new Name(data.getterFunction(1), names[THIS_MH]);
-            names[GET_PREDS] = new Name(data.getterFunction(2), names[THIS_MH]);
-            names[GET_FINIS] = new Name(data.getterFunction(3), names[THIS_MH]);
-            names[GET_COLLECT_ARGS] = new Name(data.getterFunction(4), names[THIS_MH]);
-            names[GET_UNBOX_RESULT] = new Name(data.getterFunction(5), names[THIS_MH]);
+            names[GET_CLAUSE_DATA] = new Name(data.getterFunction(0), names[THIS_MH]);
+            names[GET_COLLECT_ARGS] = new Name(data.getterFunction(1), names[THIS_MH]);
+            names[GET_UNBOX_RESULT] = new Name(data.getterFunction(2), names[THIS_MH]);
 
             // t_{i}:L=MethodHandle.invokeBasic(collectArgs:L,a1:L,...);
             MethodType collectArgsType = basicType.changeReturnType(Object.class);
@@ -1881,10 +1872,10 @@
             System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT - ARG_BASE);
             names[BOXED_ARGS] = new Name(makeIntrinsic(invokeBasic, Intrinsic.LOOP), args);
 
-            // t_{i+1}:L=MethodHandleImpl.loop(localTypes:L,inits:L,steps:L,preds:L,finis:L,t_{i}:L);
+            // t_{i+1}:L=MethodHandleImpl.loop(localTypes:L,clauses:L,t_{i}:L);
             Object[] lArgs =
                     new Object[]{null, // placeholder for BasicType[] localTypes - will be added by LambdaFormEditor
-                            names[GET_INITS], names[GET_STEPS], names[GET_PREDS], names[GET_FINIS], names[BOXED_ARGS]};
+                            names[GET_CLAUSE_DATA], names[BOXED_ARGS]};
             names[LOOP] = new Name(NF_loop, lArgs);
 
             // t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
@@ -1900,22 +1891,52 @@
         return lform.editor().noteLoopLocalTypesForm(BOXED_ARGS, localVarTypes);
     }
 
+    static class LoopClauses {
+        @Stable final MethodHandle[][] clauses;
+        LoopClauses(MethodHandle[][] clauses) {
+            assert clauses.length == 4;
+            this.clauses = clauses;
+        }
+        @Override
+        public String toString() {
+            StringBuffer sb = new StringBuffer("LoopClauses -- ");
+            for (int i = 0; i < 4; ++i) {
+                if (i > 0) {
+                    sb.append("       ");
+                }
+                sb.append('<').append(i).append(">: ");
+                MethodHandle[] hs = clauses[i];
+                for (int j = 0; j < hs.length; ++j) {
+                    if (j > 0) {
+                        sb.append("          ");
+                    }
+                    sb.append('*').append(j).append(": ").append(hs[j]).append('\n');
+                }
+            }
+            sb.append(" --\n");
+            return sb.toString();
+        }
+    }
 
     /**
      * Intrinsified during LambdaForm compilation
      * (see {@link InvokerBytecodeGenerator#emitLoop(int)}).
      */
     @LambdaForm.Hidden
-    static Object loop(BasicType[] localTypes, MethodHandle[] init, MethodHandle[] step, MethodHandle[] pred,
-                       MethodHandle[] fini, Object... av) throws Throwable {
+    static Object loop(BasicType[] localTypes, LoopClauses clauseData, Object... av) throws Throwable {
+        final MethodHandle[] init = clauseData.clauses[0];
+        final MethodHandle[] step = clauseData.clauses[1];
+        final MethodHandle[] pred = clauseData.clauses[2];
+        final MethodHandle[] fini = clauseData.clauses[3];
         int varSize = (int) Stream.of(init).filter(h -> h.type().returnType() != void.class).count();
         int nArgs = init[0].type().parameterCount();
         Object[] varsAndArgs = new Object[varSize + nArgs];
         for (int i = 0, v = 0; i < init.length; ++i) {
-            if (init[i].type().returnType() == void.class) {
-                init[i].asFixedArity().invokeWithArguments(av);
+            MethodHandle ih = init[i];
+            if (ih.type().returnType() == void.class) {
+                ih.invokeWithArguments(av);
             } else {
-                varsAndArgs[v++] = init[i].asFixedArity().invokeWithArguments(av);
+                varsAndArgs[v++] = ih.invokeWithArguments(av);
             }
         }
         System.arraycopy(av, 0, varsAndArgs, varSize, nArgs);
@@ -1926,12 +1947,12 @@
                 MethodHandle s = step[i];
                 MethodHandle f = fini[i];
                 if (s.type().returnType() == void.class) {
-                    s.asFixedArity().invokeWithArguments(varsAndArgs);
+                    s.invokeWithArguments(varsAndArgs);
                 } else {
-                    varsAndArgs[v++] = s.asFixedArity().invokeWithArguments(varsAndArgs);
+                    varsAndArgs[v++] = s.invokeWithArguments(varsAndArgs);
                 }
-                if (!(boolean) p.asFixedArity().invokeWithArguments(varsAndArgs)) {
-                    return f.asFixedArity().invokeWithArguments(varsAndArgs);
+                if (!(boolean) p.invokeWithArguments(varsAndArgs)) {
+                    return f.invokeWithArguments(varsAndArgs);
                 }
             }
         }
@@ -2122,14 +2143,13 @@
         Throwable t = null;
         Object r = null;
         try {
-            // Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
-            r = target.asFixedArity().invokeWithArguments(av);
+            r = target.invokeWithArguments(av);
         } catch (Throwable thrown) {
             t = thrown;
             throw t;
         } finally {
             Object[] args = target.type().returnType() == void.class ? prepend(av, t) : prepend(av, t, r);
-            r = cleanup.asFixedArity().invokeWithArguments(args);
+            r = cleanup.invokeWithArguments(args);
         }
         return r;
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Oct 03 12:35:51 2016 -0400
@@ -4368,10 +4368,11 @@
         }
 
         // Step 4: fill in missing parameter types.
-        List<MethodHandle> finit = fillParameterTypes(init, commonSuffix);
-        List<MethodHandle> fstep = fillParameterTypes(step, commonParameterSequence);
-        List<MethodHandle> fpred = fillParameterTypes(pred, commonParameterSequence);
-        List<MethodHandle> ffini = fillParameterTypes(fini, commonParameterSequence);
+        // Also convert all handles to fixed-arity handles.
+        List<MethodHandle> finit = fixArities(fillParameterTypes(init, commonSuffix));
+        List<MethodHandle> fstep = fixArities(fillParameterTypes(step, commonParameterSequence));
+        List<MethodHandle> fpred = fixArities(fillParameterTypes(pred, commonParameterSequence));
+        List<MethodHandle> ffini = fixArities(fillParameterTypes(fini, commonParameterSequence));
 
         assert finit.stream().map(MethodHandle::type).map(MethodType::parameterList).
                 allMatch(pl -> pl.equals(commonSuffix));
@@ -4389,6 +4390,10 @@
         }).collect(Collectors.toList());
     }
 
+    private static List<MethodHandle> fixArities(List<MethodHandle> hs) {
+        return hs.stream().map(MethodHandle::asFixedArity).collect(Collectors.toList());
+    }
+
     /**
      * Constructs a {@code while} loop from an initializer, a body, and a predicate. This is a convenience wrapper for
      * the {@linkplain #loop(MethodHandle[][]) generic loop combinator}.
@@ -4887,7 +4892,8 @@
         // target parameter list.
         cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0);
 
-        return MethodHandleImpl.makeTryFinally(target, cleanup, rtype, targetParamTypes);
+        // Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
+        return MethodHandleImpl.makeTryFinally(target.asFixedArity(), cleanup.asFixedArity(), rtype, targetParamTypes);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java	Mon Oct 03 12:35:51 2016 -0400
@@ -664,7 +664,7 @@
             try {
                 bb.get(b, off, len);
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -681,7 +681,7 @@
                 int ch = bb.get();
                 return (ch != 0);
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -690,7 +690,7 @@
             try {
                 return bb.get();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -699,7 +699,7 @@
             try {
                 return ((int) bb.get()) & 0xff;
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -708,7 +708,7 @@
             try {
                 return bb.getShort();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -717,7 +717,7 @@
             try {
                 return ((int) bb.getShort()) & 0xffff;
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -726,7 +726,7 @@
             try {
                 return bb.getChar();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -735,7 +735,7 @@
             try {
                 return bb.getInt();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -744,7 +744,7 @@
             try {
                 return bb.getLong();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -753,7 +753,7 @@
             try {
                 return bb.getFloat();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
@@ -762,7 +762,7 @@
             try {
                 return bb.getDouble();
             } catch (BufferUnderflowException e) {
-                throw new EOFException();
+                throw new EOFException(e.getMessage());
             }
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Mon Oct 03 12:35:51 2016 -0400
@@ -597,10 +597,10 @@
         private final Module module;
         ProxyBuilder(ClassLoader loader, List<Class<?>> interfaces) {
             if (!VM.isModuleSystemInited()) {
-                throw new InternalError("Proxy is not supported until module system is fully initialzed");
+                throw new InternalError("Proxy is not supported until module system is fully initialized");
             }
             if (interfaces.size() > 65535) {
-                throw new IllegalArgumentException("interface limit exceeded");
+                throw new IllegalArgumentException("interface limit exceeded: " + interfaces.size());
             }
 
             Set<Class<?>> refTypes = referencedTypes(loader, interfaces);
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Mon Oct 03 12:35:51 2016 -0400
@@ -2559,6 +2559,13 @@
      * exceptionally with a CompletionException with this exception as
      * cause.
      *
+     * <p>Unless overridden by a subclass, a new non-minimal
+     * CompletableFuture with all methods available can be obtained from
+     * a minimal CompletionStage via {@link #toCompletableFuture()}.
+     * For example, completion of a minimal stage can be awaited by
+     *
+     * <pre> {@code minimalStage.toCompletableFuture().join(); }</pre>
+     *
      * @return the new CompletionStage
      * @since 9
      */
@@ -2853,6 +2860,16 @@
         @Override public CompletableFuture<T> completeOnTimeout
             (T value, long timeout, TimeUnit unit) {
             throw new UnsupportedOperationException(); }
+        @Override public CompletableFuture<T> toCompletableFuture() {
+            Object r;
+            if ((r = result) != null)
+                return new CompletableFuture<T>(encodeRelay(r));
+            else {
+                CompletableFuture<T> d = new CompletableFuture<>();
+                unipush(new UniRelay<T,T>(d, this));
+                return d;
+            }
+        }
     }
 
     // VarHandle mechanics
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1191,7 +1191,7 @@
      * Default idle timeout value (in milliseconds) for the thread
      * triggering quiescence to park waiting for new work
      */
-    private static final long DEFAULT_KEEPALIVE = 60000L;
+    private static final long DEFAULT_KEEPALIVE = 60_000L;
 
     /**
      * Undershoot tolerance for idle timeouts
@@ -2303,7 +2303,6 @@
             throw new NullPointerException();
         long ms = Math.max(unit.toMillis(keepAliveTime), TIMEOUT_SLOP);
 
-        String prefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
         int corep = Math.min(Math.max(corePoolSize, parallelism), MAX_CAP);
         long c = ((((long)(-corep)       << TC_SHIFT) & TC_MASK) |
                   (((long)(-parallelism) << RC_SHIFT) & RC_MASK));
@@ -2315,8 +2314,8 @@
         n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
         n = (n + 1) << 1; // power of two, including space for submission queues
 
+        this.workerNamePrefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
         this.workQueues = new WorkQueue[n];
-        this.workerNamePrefix = prefix;
         this.factory = factory;
         this.ueh = handler;
         this.saturate = saturate;
@@ -2327,11 +2326,19 @@
         checkPermission();
     }
 
+    private Object newInstanceFromSystemProperty(String property)
+        throws ReflectiveOperationException {
+        String className = System.getProperty(property);
+        return (className == null)
+            ? null
+            : ClassLoader.getSystemClassLoader().loadClass(className)
+            .getConstructor().newInstance();
+    }
+
     /**
      * Constructor for common pool using parameters possibly
      * overridden by system properties
      */
-    @SuppressWarnings("deprecation") // Class.newInstance
     private ForkJoinPool(byte forCommonPoolOnly) {
         int parallelism = -1;
         ForkJoinWorkerThreadFactory fac = null;
@@ -2339,18 +2346,12 @@
         try {  // ignore exceptions in accessing/parsing properties
             String pp = System.getProperty
                 ("java.util.concurrent.ForkJoinPool.common.parallelism");
-            String fp = System.getProperty
-                ("java.util.concurrent.ForkJoinPool.common.threadFactory");
-            String hp = System.getProperty
-                ("java.util.concurrent.ForkJoinPool.common.exceptionHandler");
             if (pp != null)
                 parallelism = Integer.parseInt(pp);
-            if (fp != null)
-                fac = ((ForkJoinWorkerThreadFactory)ClassLoader.
-                           getSystemClassLoader().loadClass(fp).newInstance());
-            if (hp != null)
-                handler = ((UncaughtExceptionHandler)ClassLoader.
-                           getSystemClassLoader().loadClass(hp).newInstance());
+            fac = (ForkJoinWorkerThreadFactory) newInstanceFromSystemProperty(
+                "java.util.concurrent.ForkJoinPool.common.threadFactory");
+            handler = (UncaughtExceptionHandler) newInstanceFromSystemProperty(
+                "java.util.concurrent.ForkJoinPool.common.exceptionHandler");
         } catch (Exception ignore) {
         }
 
@@ -2373,8 +2374,8 @@
         n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
         n = (n + 1) << 1;
 
+        this.workerNamePrefix = "ForkJoinPool.commonPool-worker-";
         this.workQueues = new WorkQueue[n];
-        this.workerNamePrefix = "ForkJoinPool.commonPool-worker-";
         this.factory = fac;
         this.ueh = handler;
         this.saturate = null;
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -35,6 +35,9 @@
 
 package java.util.concurrent.atomic;
 
+import static java.lang.Double.doubleToRawLongBits;
+import static java.lang.Double.longBitsToDouble;
+
 import java.io.Serializable;
 import java.util.function.DoubleBinaryOperator;
 
@@ -91,7 +94,7 @@
     public DoubleAccumulator(DoubleBinaryOperator accumulatorFunction,
                              double identity) {
         this.function = accumulatorFunction;
-        base = this.identity = Double.doubleToRawLongBits(identity);
+        base = this.identity = doubleToRawLongBits(identity);
     }
 
     /**
@@ -101,18 +104,19 @@
      */
     public void accumulate(double x) {
         Cell[] as; long b, v, r; int m; Cell a;
-        if ((as = cells) != null ||
-            (r = Double.doubleToRawLongBits
-             (function.applyAsDouble
-              (Double.longBitsToDouble(b = base), x))) != b  && !casBase(b, r)) {
+        if ((as = cells) != null
+            || ((r = doubleToRawLongBits
+                (function.applyAsDouble(longBitsToDouble(b = base), x))) != b
+                && !casBase(b, r))) {
             boolean uncontended = true;
-            if (as == null || (m = as.length - 1) < 0 ||
-                (a = as[getProbe() & m]) == null ||
-                !(uncontended =
-                  (r = Double.doubleToRawLongBits
-                   (function.applyAsDouble
-                    (Double.longBitsToDouble(v = a.value), x))) == v ||
-                  a.cas(v, r)))
+            if (as == null
+                || (m = as.length - 1) < 0
+                || (a = as[getProbe() & m]) == null
+                || !(uncontended =
+                     ((r = doubleToRawLongBits
+                       (function.applyAsDouble
+                        (longBitsToDouble(v = a.value), x))) == v)
+                     || a.cas(v, r)))
                 doubleAccumulate(x, function, uncontended);
         }
     }
@@ -128,12 +132,12 @@
      */
     public double get() {
         Cell[] as = cells;
-        double result = Double.longBitsToDouble(base);
+        double result = longBitsToDouble(base);
         if (as != null) {
             for (Cell a : as)
                 if (a != null)
                     result = function.applyAsDouble
-                        (result, Double.longBitsToDouble(a.value));
+                        (result, longBitsToDouble(a.value));
         }
         return result;
     }
@@ -168,12 +172,12 @@
      */
     public double getThenReset() {
         Cell[] as = cells;
-        double result = Double.longBitsToDouble(base);
+        double result = longBitsToDouble(base);
         base = identity;
         if (as != null) {
             for (Cell a : as) {
                 if (a != null) {
-                    double v = Double.longBitsToDouble(a.value);
+                    double v = longBitsToDouble(a.value);
                     a.reset(identity);
                     result = function.applyAsDouble(result, v);
                 }
@@ -267,9 +271,9 @@
          * held by this proxy
          */
         private Object readResolve() {
-            double d = Double.longBitsToDouble(identity);
+            double d = longBitsToDouble(identity);
             DoubleAccumulator a = new DoubleAccumulator(function, d);
-            a.base = Double.doubleToRawLongBits(value);
+            a.base = doubleToRawLongBits(value);
             return a;
         }
     }
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -103,14 +103,16 @@
      */
     public void accumulate(long x) {
         Cell[] as; long b, v, r; int m; Cell a;
-        if ((as = cells) != null ||
-            (r = function.applyAsLong(b = base, x)) != b && !casBase(b, r)) {
+        if ((as = cells) != null
+            || ((r = function.applyAsLong(b = base, x)) != b
+                && !casBase(b, r))) {
             boolean uncontended = true;
-            if (as == null || (m = as.length - 1) < 0 ||
-                (a = as[getProbe() & m]) == null ||
-                !(uncontended =
-                  (r = function.applyAsLong(v = a.value, x)) == v ||
-                  a.cas(v, r)))
+            if (as == null
+                || (m = as.length - 1) < 0
+                || (a = as[getProbe() & m]) == null
+                || !(uncontended =
+                     (r = function.applyAsLong(v = a.value, x)) == v
+                     || a.cas(v, r)))
                 longAccumulate(x, function, uncontended);
         }
     }
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Mon Oct 03 12:35:51 2016 -0400
@@ -186,7 +186,9 @@
 
         if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION ||
             result.getMinorVersion() != ImageHeader.MINOR_VERSION) {
-            throw new IOException("The image file \"" + name + "\" is not the correct version");
+            throw new IOException("The image file \"" + name + "\" is not " +
+                "the correct version. Major: " + result.getMajorVersion() +
+                ". Minor: " + result.getMinorVersion());
         }
 
         return result;
@@ -318,11 +320,11 @@
 
     private ByteBuffer readBuffer(long offset, long size) {
         if (offset < 0 || Integer.MAX_VALUE <= offset) {
-            throw new IndexOutOfBoundsException("offset");
+            throw new IndexOutOfBoundsException("Bad offset: " + offset);
         }
 
         if (size < 0 || Integer.MAX_VALUE <= size) {
-            throw new IndexOutOfBoundsException("size");
+            throw new IndexOutOfBoundsException("Bad size: " + size);
         }
 
         if (MAP_ALL) {
@@ -382,11 +384,13 @@
         long uncompressedSize = loc.getUncompressedSize();
 
         if (compressedSize < 0 || Integer.MAX_VALUE < compressedSize) {
-            throw new IndexOutOfBoundsException("Compressed size");
+            throw new IndexOutOfBoundsException(
+                "Bad compressed size: " + compressedSize);
         }
 
         if (uncompressedSize < 0 || Integer.MAX_VALUE < uncompressedSize) {
-            throw new IndexOutOfBoundsException("Uncompressed size");
+            throw new IndexOutOfBoundsException(
+                "Bad uncompressed size: " + uncompressedSize);
         }
 
         if (compressedSize == 0) {
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java	Mon Oct 03 12:35:51 2016 -0400
@@ -79,7 +79,8 @@
         Objects.requireNonNull(buffer);
 
         if (buffer.capacity() != HEADER_SLOTS) {
-            throw new InternalError("jimage header not the correct size");
+            throw new InternalError(
+                "jimage header not the correct size: " + buffer.capacity());
         }
 
         int magic = buffer.get(0);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java	Mon Oct 03 12:35:51 2016 -0400
@@ -81,7 +81,8 @@
                 }
 
                 if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
-                    throw new InternalError("Invalid jimage attribute kind");
+                    throw new InternalError(
+                        "Invalid jimage attribute kind: " + kind);
                 }
 
                 int length = attributeLength(data);
@@ -91,7 +92,7 @@
                     value <<= 8;
 
                     if (!bytes.hasRemaining()) {
-                        throw new InternalError("\"Missing jimage attribute datad");
+                        throw new InternalError("Missing jimage attribute data");
                     }
 
                     value |= bytes.get() & 0xFF;
@@ -134,7 +135,8 @@
 
     long getAttribute(int kind) {
         if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
-            throw new InternalError("Invalid jimage attribute kind");
+            throw new InternalError(
+                "Invalid jimage attribute kind: " + kind);
         }
 
         return attributes[kind];
@@ -142,7 +144,8 @@
 
     String getAttributeString(int kind) {
         if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
-            throw new InternalError("Invalid jimage attribute kind");
+            throw new InternalError(
+                "Invalid jimage attribute kind: " + kind);
         }
 
         return getStrings().get((int)attributes[kind]);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java	Mon Oct 03 12:35:51 2016 -0400
@@ -82,7 +82,7 @@
 
     public void ensure(int needs) {
         if (needs < 0) {
-            throw new IndexOutOfBoundsException("needs");
+            throw new IndexOutOfBoundsException("Bad value: " + needs);
         }
 
         if (needs > buffer.remaining()) {
@@ -106,7 +106,7 @@
 
     public void skip(int n) {
         if (n < 0) {
-            throw new IndexOutOfBoundsException("n");
+            throw new IndexOutOfBoundsException("skip value = " + n);
         }
 
         buffer.position(buffer.position() + n);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java	Mon Oct 03 12:35:51 2016 -0400
@@ -151,7 +151,7 @@
         try {
             charsFromMUTF8(chars, bytes, offset, count);
         } catch (UTFDataFormatException ex) {
-            throw new InternalError("Attempt to convert non modified UTF-8 byte sequence");
+            throw new InternalError("Attempt to convert non modified UTF-8 byte sequence", ex);
         }
 
         return new String(chars);
@@ -199,7 +199,8 @@
                     ch = buffer.get();
 
                     if ((ch & 0xC0) != 0x80) {
-                        throw new InternalError("Bad continuation in modified UTF-8 byte sequence");
+                        throw new InternalError("Bad continuation in " +
+                            "modified UTF-8 byte sequence: " + ch);
                     }
 
                     uch = ((uch & ~mask) << 6) | (ch & 0x3F);
@@ -208,7 +209,8 @@
             }
 
             if ((uch & 0xFFFF) != uch) {
-                throw new InternalError("UTF-32 char in modified UTF-8 byte sequence");
+                throw new InternalError("UTF-32 char in modified UTF-8 " +
+                    "byte sequence: " + uch);
             }
 
             chars[j++] = (char)uch;
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Mon Oct 03 12:35:51 2016 -0400
@@ -183,7 +183,7 @@
     public PathMatcher getPathMatcher(String syntaxAndInput) {
         int pos = syntaxAndInput.indexOf(':');
         if (pos <= 0 || pos == syntaxAndInput.length()) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("pos is " + pos);
         }
         String syntax = syntaxAndInput.substring(0, pos);
         String input = syntaxAndInput.substring(pos + 1);
@@ -285,7 +285,8 @@
         for (OpenOption option : options) {
             Objects.requireNonNull(option);
             if (!(option instanceof StandardOpenOption)) {
-                throw new IllegalArgumentException();
+                throw new IllegalArgumentException(
+                    "option class: " + option.getClass());
             }
         }
         if (options.contains(StandardOpenOption.WRITE) ||
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java	Mon Oct 03 12:35:51 2016 -0400
@@ -122,7 +122,8 @@
     public final JrtPath getName(int index) {
         initOffsets();
         if (index < 0 || index >= offsets.length) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("index: " +
+                index + ", offsets length: " + offsets.length);
         }
         int begin = offsets[index];
         int end;
@@ -139,7 +140,9 @@
         initOffsets();
         if (beginIndex < 0 || endIndex > offsets.length ||
             beginIndex >= endIndex) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException(
+                "beginIndex: " + beginIndex + ", endIndex: " + endIndex +
+                ", offsets length: " + offsets.length);
         }
         // starting/ending offsets
         int begin = offsets[beginIndex];
@@ -211,7 +214,8 @@
             return o;
         }
         if (jrtfs != o.jrtfs || isAbsolute() != o.isAbsolute()) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException(
+                "Incorrect filesystem or path: " + other);
         }
         final String tp = this.path;
         final String op = o.path;
@@ -366,7 +370,8 @@
     private JrtPath checkPath(Path path) {
         Objects.requireNonNull(path);
         if (!(path instanceof JrtPath))
-            throw new ProviderMismatchException();
+            throw new ProviderMismatchException("path class: " +
+                path.getClass());
         return (JrtPath) path;
     }
 
@@ -459,7 +464,7 @@
             }
             if (c == '\u0000') {
                 throw new InvalidPathException(path,
-                        "Path: nul character not allowed");
+                        "Path: NUL character not allowed");
             }
             to.append(c);
             prevC = c;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1603,11 +1603,50 @@
         return weakCompareAndSwapShort(o, offset, c2s(expected), c2s(x));
     }
 
+    /**
+     * The JVM converts integral values to boolean values using two
+     * different conventions, byte testing against zero and truncation
+     * to least-significant bit.
+     *
+     * <p>The JNI documents specify that, at least for returning
+     * values from native methods, a Java boolean value is converted
+     * to the value-set 0..1 by first truncating to a byte (0..255 or
+     * maybe -128..127) and then testing against zero. Thus, Java
+     * booleans in non-Java data structures are by convention
+     * represented as 8-bit containers containing either zero (for
+     * false) or any non-zero value (for true).
+     *
+     * <p>Java booleans in the heap are also stored in bytes, but are
+     * strongly normalized to the value-set 0..1 (i.e., they are
+     * truncated to the least-significant bit).
+     *
+     * <p>The main reason for having different conventions for
+     * conversion is performance: Truncation to the least-significant
+     * bit can be usually implemented with fewer (machine)
+     * instructions than byte testing against zero.
+     *
+     * <p>A number of Unsafe methods load boolean values from the heap
+     * as bytes. Unsafe converts those values according to the JNI
+     * rules (i.e, using the "testing against zero" convention). The
+     * method {@code byte2bool} implements that conversion.
+     *
+     * @param b the byte to be converted to boolean
+     * @return the result of the conversion
+     */
     @ForceInline
     private boolean byte2bool(byte b) {
-        return b > 0;
-    }
-
+        return b != 0;
+    }
+
+    /**
+     * Convert a boolean value to a byte. The return value is strongly
+     * normalized to the value-set 0..1 (i.e., the value is truncated
+     * to the least-significant bit). See {@link #byte2bool(byte)} for
+     * more details on conversion conventions.
+     *
+     * @param b the boolean to be converted to byte (and then normalized)
+     * @return the result of the conversion
+     */
     @ForceInline
     private byte bool2byte(boolean b) {
         return b ? (byte)1 : (byte)0;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Mon Oct 03 12:35:51 2016 -0400
@@ -50,7 +50,7 @@
     public static void initLevel(int value) {
         synchronized (lock) {
             if (value <= initLevel || value > SYSTEM_BOOTED)
-                throw new InternalError();
+                throw new InternalError("Bad level: " + value);
             initLevel = value;
             lock.notifyAll();
         }
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Mon Oct 03 12:35:51 2016 -0400
@@ -153,27 +153,24 @@
         boolean addAllDefaultModules = false;
         boolean addAllSystemModules = false;
         boolean addAllApplicationModules = false;
-        String propValue = getAndRemoveProperty("jdk.module.addmods");
-        if (propValue != null) {
-            for (String mod: propValue.split(",")) {
-                switch (mod) {
-                    case ALL_DEFAULT:
-                        addAllDefaultModules = true;
-                        break;
-                    case ALL_SYSTEM:
-                        addAllSystemModules = true;
-                        break;
-                    case ALL_MODULE_PATH:
-                        addAllApplicationModules = true;
-                        break;
-                    default :
-                        roots.add(mod);
-                }
+        for (String mod: getExtraAddModules()) {
+            switch (mod) {
+                case ALL_DEFAULT:
+                    addAllDefaultModules = true;
+                    break;
+                case ALL_SYSTEM:
+                    addAllSystemModules = true;
+                    break;
+                case ALL_MODULE_PATH:
+                    addAllApplicationModules = true;
+                    break;
+                default :
+                    roots.add(mod);
             }
         }
 
         // --limit-modules
-        propValue = getAndRemoveProperty("jdk.module.limitmods");
+        String propValue = getAndRemoveProperty("jdk.module.limitmods");
         if (propValue != null) {
             Set<String> mods = new HashSet<>();
             for (String mod: propValue.split(",")) {
@@ -392,6 +389,32 @@
         }
     }
 
+    /**
+     * Returns the set of module names specified via --add-modules options
+     * on the command line
+     */
+    private static Set<String> getExtraAddModules() {
+        String prefix = "jdk.module.addmods.";
+        int index = 0;
+
+        // the system property is removed after decoding
+        String value = getAndRemoveProperty(prefix + index);
+        if (value == null) {
+            return Collections.emptySet();
+        }
+
+        Set<String> modules = new HashSet<>();
+        while (value != null) {
+            for (String s : value.split(",")) {
+                if (s.length() > 0) modules.add(s);
+            }
+
+            index++;
+            value = getAndRemoveProperty(prefix + index);
+        }
+
+        return modules;
+    }
 
     /**
      * Process the --add-reads options to add any additional read edges that
@@ -514,7 +537,7 @@
 
             // value is <module>(,<module>)*
             if (map.containsKey(key))
-                fail(key + " specified more than once");
+                 fail(key + " specified more than once");
 
             Set<String> values = new HashSet<>();
             map.put(key, values);
--- a/jdk/src/java.base/share/classes/module-info.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/module-info.java	Mon Oct 03 12:35:51 2016 -0400
@@ -166,6 +166,7 @@
         jdk.charsets,
         jdk.compiler,
         jdk.jartool,
+        jdk.jdeps,
         jdk.jlink,
         jdk.net,
         jdk.scripting.nashorn,
@@ -189,7 +190,8 @@
         jdk.unsupported,
         jdk.vm.ci;
     exports jdk.internal.util.jar to
-        jdk.jartool;
+        jdk.jartool,
+        jdk.jdeps;
     exports jdk.internal.vm to
         java.management,
         jdk.jvmstat;
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -328,8 +328,6 @@
     public SocketAddress receive(ByteBuffer dst) throws IOException {
         if (dst.isReadOnly())
             throw new IllegalArgumentException("Read-only buffer");
-        if (dst == null)
-            throw new NullPointerException();
         synchronized (readLock) {
             ensureOpen();
             // Socket was not bound before attempting receive
@@ -716,8 +714,6 @@
 
     @Override
     public DatagramChannel connect(SocketAddress sa) throws IOException {
-        int localPort = 0;
-
         synchronized(readLock) {
             synchronized(writeLock) {
                 synchronized (stateLock) {
--- a/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -616,8 +616,6 @@
     }
 
     public boolean connect(SocketAddress sa) throws IOException {
-        int localPort = 0;
-
         synchronized (readLock) {
             synchronized (writeLock) {
                 ensureOpenAndUnconnected();
--- a/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -344,7 +344,8 @@
                         try {
                             BogusThread bt = new BogusThread();
                             Thread t = new Thread
-                                (seedGroup, bt, "SeedGenerator Thread", 0, false);
+                                (seedGroup, bt, "SeedGenerator Thread", 0,
+                                        false);
                             t.start();
                         } catch (Exception e) {
                             throw new InternalError("internal error: " +
@@ -357,7 +358,8 @@
                         long startTime = System.nanoTime();
                         while (System.nanoTime() - startTime < 250000000) {
                             synchronized(this){};
-                            latch++;
+                            // Mask the sign bit and keep latch non-negative
+                            latch = (latch + 1) & 0x1FFFFFFF;
                         }
 
                         // Translate the value using the permutation, and xor
@@ -431,7 +433,7 @@
         // data and using it to mix the trivial permutation.
         // It should be evenly distributed. The specific values
         // are not crucial to the security of this class.
-        private static byte[] rndTab = {
+        private static final byte[] rndTab = {
             56, 30, -107, -6, -86, 25, -83, 75, -12, -64,
             5, -128, 78, 21, 16, 32, 70, -81, 37, -51,
             -43, -46, -108, 87, 29, 17, -55, 22, -11, -111,
--- a/jdk/src/java.base/share/native/include/jvm.h	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/share/native/include/jvm.h	Mon Oct 03 12:35:51 2016 -0400
@@ -179,6 +179,7 @@
  */
 enum {
   JVM_STACKWALK_FILL_CLASS_REFS_ONLY       = 0x2,
+  JVM_STACKWALK_GET_CALLER_CLASS           = 0x04,
   JVM_STACKWALK_SHOW_HIDDEN_FRAMES         = 0x20,
   JVM_STACKWALK_FILL_LIVE_STACK_FRAMES     = 0x100
 };
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Mon Oct 03 12:35:51 2016 -0400
@@ -152,8 +152,8 @@
 #ifdef __solaris__
     /* These really are the Solaris defaults! */
     return (geteuid() == 0 || getuid() == 0) ?
-        "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
-        "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:";
+        "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
+        "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:";
 #else
     return ":/bin:/usr/bin";    /* glibc */
 #endif
--- a/jdk/src/java.base/unix/native/libjli/java_md.h	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,12 +35,12 @@
 #include "manifest_info.h"
 #include "jli_util.h"
 
-#define PATH_SEPARATOR          ':'
-#define FILESEP                 "/"
-#define FILE_SEPARATOR          '/'
+#define PATH_SEPARATOR       ':'
+#define FILESEP              "/"
+#define FILE_SEPARATOR       '/'
 #define IS_FILE_SEPARATOR(c) ((c) == '/')
 #ifndef MAXNAMELEN
-#define MAXNAMELEN              PATH_MAX
+#define MAXNAMELEN           PATH_MAX
 #endif
 
 #ifdef _LP64
@@ -59,10 +59,13 @@
 static jboolean GetJREPath(char *path, jint pathsize, const char * arch,
                            jboolean speculative);
 
+#if defined(_AIX)
+#include "java_md_aix.h"
+#endif
+
 #ifdef MACOSX
 #include "java_md_macosx.h"
 #else  /* !MACOSX */
 #include "java_md_solinux.h"
 #endif /* MACOSX */
-
 #endif /* JAVA_MD_H */
--- a/jdk/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Mon Oct 03 12:35:51 2016 -0400
@@ -33,6 +33,7 @@
 #include <process.h>
 #include <iphlpapi.h>
 #include <icmpapi.h>
+#include <WinError.h>
 
 #include "java_net_InetAddress.h"
 #include "java_net_Inet4AddressImpl.h"
@@ -442,7 +443,15 @@
     DWORD ReplySize = 0;
     jboolean ret = JNI_FALSE;
 
-    ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData);
+    // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366051%28v=vs.85%29.aspx
+    ReplySize = sizeof(ICMP_ECHO_REPLY)   // The buffer should be large enough
+                                          // to hold at least one ICMP_ECHO_REPLY
+                                          // structure
+                + sizeof(SendData)        // plus RequestSize bytes of data.
+                + 8;                      // This buffer should also be large enough
+                                          // to also hold 8 more bytes of data
+                                          // (the size of an ICMP error message)
+
     ReplyBuffer = (VOID*) malloc(ReplySize);
     if (ReplyBuffer == NULL) {
         IcmpCloseHandle(hIcmpFile);
@@ -478,10 +487,47 @@
                                    (timeout < 1000) ? 1000 : timeout);   // DWORD Timeout
     }
 
-    if (dwRetVal != 0) {
+    if (dwRetVal == 0) { // if the call failed
+        TCHAR *buf;
+        DWORD err = WSAGetLastError();
+        switch (err) {
+            case ERROR_NO_NETWORK:
+            case ERROR_NETWORK_UNREACHABLE:
+            case ERROR_HOST_UNREACHABLE:
+            case ERROR_PROTOCOL_UNREACHABLE:
+            case ERROR_PORT_UNREACHABLE:
+            case ERROR_REQUEST_ABORTED:
+            case ERROR_INCORRECT_ADDRESS:
+            case ERROR_HOST_DOWN:
+            case ERROR_INVALID_COMPUTERNAME:
+            case ERROR_INVALID_NETNAME:
+            case WSAEHOSTUNREACH:   /* Host Unreachable */
+            case WSAENETUNREACH:    /* Network Unreachable */
+            case WSAENETDOWN:       /* Network is down */
+            case WSAEPFNOSUPPORT:   /* Protocol Family unsupported */
+            case IP_REQ_TIMED_OUT:
+                break;
+            default:
+                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+                        NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                        (LPTSTR)&buf, 0, NULL);
+                NET_ThrowNew(env, err, buf);
+                LocalFree(buf);
+                break;
+        }
+    } else {
         PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
-        if ((int)pEchoReply->RoundTripTime <= timeout)
+
+        // This is to take into account the undocumented minimum
+        // timeout mentioned in the IcmpSendEcho call above.
+        // We perform an extra check to make sure that our
+        // roundtrip time was less than our desired timeout
+        // for cases where that timeout is < 1000ms.
+        if (pEchoReply->Status == IP_SUCCESS
+                && (int)pEchoReply->RoundTripTime <= timeout)
+        {
             ret = JNI_TRUE;
+        }
     }
 
     free(ReplyBuffer);
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/finder/ConstructorFinder.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/finder/ConstructorFinder.java	Mon Oct 03 12:35:51 2016 -0400
@@ -67,19 +67,22 @@
      */
     public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) throws NoSuchMethodException {
         if (type.isPrimitive()) {
-            throw new NoSuchMethodException("Primitive wrapper does not contain constructors");
+            throw new NoSuchMethodException("Primitive wrapper does not contain constructors: "
+                + type.getName());
         }
         if (type.isInterface()) {
-            throw new NoSuchMethodException("Interface does not contain constructors");
+            throw new NoSuchMethodException("Interface does not contain constructors: "
+                + type.getName());
         }
         if (!FinderUtils.isExported(type)) {
-            throw new NoSuchMethodException("Class is not accessible");
+            throw new NoSuchMethodException("Class is not accessible: " + type.getName());
         }
         if (Modifier.isAbstract(type.getModifiers())) {
-            throw new NoSuchMethodException("Abstract class cannot be instantiated");
+            throw new NoSuchMethodException("Abstract class cannot be instantiated: "
+                + type.getName());
         }
         if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) {
-            throw new NoSuchMethodException("Class is not accessible");
+            throw new NoSuchMethodException("Class is not accessible: " + type.getName());
         }
         PrimitiveWrapperMap.replacePrimitivesWithWrappers(args);
         Signature signature = new Signature(type, args);
--- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageReader.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageReader.java	Mon Oct 03 12:35:51 2016 -0400
@@ -2461,16 +2461,16 @@
             try {
                 bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
             } catch (MissingResourceException mre) {
-                throw new IllegalArgumentException("Bundle not found!");
+                throw new IllegalArgumentException("Bundle not found!", mre);
             }
 
             String warning = null;
             try {
                 warning = bundle.getString(keyword);
             } catch (ClassCastException cce) {
-                throw new IllegalArgumentException("Resource is not a String!");
+                throw new IllegalArgumentException("Resource is not a String!", cce);
             } catch (MissingResourceException mre) {
-                throw new IllegalArgumentException("Resource is missing!");
+                throw new IllegalArgumentException("Resource is missing!", mre);
             }
 
             listener.warningOccurred(this, warning);
--- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1963,16 +1963,16 @@
             try {
                 bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
             } catch (MissingResourceException mre) {
-                throw new IllegalArgumentException("Bundle not found!");
+                throw new IllegalArgumentException("Bundle not found!", mre);
             }
 
             String warning = null;
             try {
                 warning = bundle.getString(keyword);
             } catch (ClassCastException cce) {
-                throw new IllegalArgumentException("Resource is not a String!");
+                throw new IllegalArgumentException("Resource is not a String!", cce);
             } catch (MissingResourceException mre) {
-                throw new IllegalArgumentException("Resource is missing!");
+                throw new IllegalArgumentException("Resource is missing!", mre);
             }
 
             listener.warningOccurred(this, imageIndex, warning);
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Mon Oct 03 12:35:51 2016 -0400
@@ -442,7 +442,7 @@
 
 #ifndef __linux__ /* SOLARIS */
         if (xrenderLibHandle == NULL) {
-            xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
+            xrenderLibHandle = dlopen("/usr/lib/libXrender.so.1",
                                       RTLD_LAZY | RTLD_GLOBAL);
         }
 #endif
--- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c	Mon Oct 03 12:35:51 2016 -0400
@@ -39,6 +39,10 @@
  */
 JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
 {
+#if defined(HEADLESS)
+    /* there are no AWT libs available at all */
+    return JNI_FALSE;
+#else
     if (awt == NULL) {
         return JNI_FALSE;
     }
@@ -64,4 +68,5 @@
     }
 
     return JNI_TRUE;
+#endif
 }
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, 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
@@ -68,8 +68,8 @@
     // master secret as a P11Key
     private P11Key p11Key;
 
-    // version, e.g. 0x0301
-    private int version;
+    // whether SSLv3 is supported
+    private final boolean supportSSLv3;
 
     P11TlsKeyMaterialGenerator(Token token, String algorithm, long mechanism)
             throws PKCS11Exception {
@@ -77,6 +77,11 @@
         this.token = token;
         this.algorithm = algorithm;
         this.mechanism = mechanism;
+
+        // Given the current lookup order specified in SunPKCS11.java,
+        // if CKM_SSL3_KEY_AND_MAC_DERIVE is not used to construct this object,
+        // it means that this mech is disabled or unsupported.
+        this.supportSSLv3 = (mechanism == CKM_SSL3_KEY_AND_MAC_DERIVE);
     }
 
     protected void engineInit(SecureRandom random) {
@@ -89,20 +94,26 @@
         if (params instanceof TlsKeyMaterialParameterSpec == false) {
             throw new InvalidAlgorithmParameterException(MSG);
         }
-        this.spec = (TlsKeyMaterialParameterSpec)params;
+
+        TlsKeyMaterialParameterSpec spec = (TlsKeyMaterialParameterSpec)params;
+        int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
+
+        if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
+            (version > 0x0302)) {
+             throw new InvalidAlgorithmParameterException
+                    ("Only" + (supportSSLv3? " SSL 3.0,": "") +
+                     " TLS 1.0, and TLS 1.1 are supported (0x" +
+                     Integer.toHexString(version) + ")");
+        }
         try {
             p11Key = P11SecretKeyFactory.convertKey
                             (token, spec.getMasterSecret(), "TlsMasterSecret");
         } catch (InvalidKeyException e) {
             throw new InvalidAlgorithmParameterException("init() failed", e);
         }
-        version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
-        if ((version < 0x0300) && (version > 0x0302)) {
-            throw new InvalidAlgorithmParameterException
-                    ("Only SSL 3.0, TLS 1.0, and TLS 1.1 are supported");
-        }
-        // we assume the token supports both the CKM_SSL3_* and the CKM_TLS_*
-        // mechanisms
+        this.spec = spec;
+        this.mechanism = (version == 0x0300)?
+            CKM_SSL3_KEY_AND_MAC_DERIVE : CKM_TLS_KEY_AND_MAC_DERIVE;
     }
 
     protected void engineInit(int keysize, SecureRandom random) {
@@ -115,8 +126,6 @@
             throw new IllegalStateException
                 ("TlsKeyMaterialGenerator must be initialized");
         }
-        mechanism = (version == 0x0300) ? CKM_SSL3_KEY_AND_MAC_DERIVE
-                                         : CKM_TLS_KEY_AND_MAC_DERIVE;
         int macBits = spec.getMacKeyLength() << 3;
         int ivBits = spec.getIvLength() << 3;
 
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, 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
@@ -61,7 +61,10 @@
     private TlsMasterSecretParameterSpec spec;
     private P11Key p11Key;
 
-    int version;
+    CK_VERSION ckVersion;
+
+    // whether SSLv3 is supported
+    private final boolean supportSSLv3;
 
     P11TlsMasterSecretGenerator(Token token, String algorithm, long mechanism)
             throws PKCS11Exception {
@@ -69,6 +72,11 @@
         this.token = token;
         this.algorithm = algorithm;
         this.mechanism = mechanism;
+
+        // Given the current lookup order specified in SunPKCS11.java, if
+        // CKM_SSL3_MASTER_KEY_DERIVE is not used to construct this object,
+        // it means that this mech is disabled or unsupported.
+        supportSSLv3 = (mechanism == CKM_SSL3_MASTER_KEY_DERIVE);
     }
 
     protected void engineInit(SecureRandom random) {
@@ -81,7 +89,17 @@
         if (params instanceof TlsMasterSecretParameterSpec == false) {
             throw new InvalidAlgorithmParameterException(MSG);
         }
-        this.spec = (TlsMasterSecretParameterSpec)params;
+
+        TlsMasterSecretParameterSpec spec = (TlsMasterSecretParameterSpec)params;
+        int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
+        if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
+            (version > 0x0302)) {
+             throw new InvalidAlgorithmParameterException
+                    ("Only" + (supportSSLv3? " SSL 3.0,": "") +
+                     " TLS 1.0, and TLS 1.1 are supported (0x" +
+                     Integer.toHexString(version) + ")");
+        }
+
         SecretKey key = spec.getPremasterSecret();
         // algorithm should be either TlsRsaPremasterSecret or TlsPremasterSecret,
         // but we omit the check
@@ -90,25 +108,7 @@
         } catch (InvalidKeyException e) {
             throw new InvalidAlgorithmParameterException("init() failed", e);
         }
-        version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
-        if ((version < 0x0300) || (version > 0x0302)) {
-            throw new InvalidAlgorithmParameterException
-                ("Only SSL 3.0, TLS 1.0, and TLS 1.1 supported");
-        }
-        // We assume the token supports the required mechanism. If it does not,
-        // generateKey() will fail and the failover should take care of us.
-    }
-
-    protected void engineInit(int keysize, SecureRandom random) {
-        throw new InvalidParameterException(MSG);
-    }
-
-    protected SecretKey engineGenerateKey() {
-        if (spec == null) {
-            throw new IllegalStateException
-                ("TlsMasterSecretGenerator must be initialized");
-        }
-        CK_VERSION ckVersion;
+        this.spec = spec;
         if (p11Key.getAlgorithm().equals("TlsRsaPremasterSecret")) {
             mechanism = (version == 0x0300) ? CKM_SSL3_MASTER_KEY_DERIVE
                                              : CKM_TLS_MASTER_KEY_DERIVE;
@@ -124,6 +124,17 @@
                                              : CKM_TLS_MASTER_KEY_DERIVE_DH;
             ckVersion = null;
         }
+    }
+
+    protected void engineInit(int keysize, SecureRandom random) {
+        throw new InvalidParameterException(MSG);
+    }
+
+    protected SecretKey engineGenerateKey() {
+        if (spec == null) {
+            throw new IllegalStateException
+                ("TlsMasterSecretGenerator must be initialized");
+        }
         byte[] clientRandom = spec.getClientRandom();
         byte[] serverRandom = spec.getServerRandom();
         CK_SSL3_RANDOM_DATA random =
@@ -139,13 +150,12 @@
             long keyID = token.p11.C_DeriveKey(session.id(),
                 new CK_MECHANISM(mechanism, params), p11Key.keyID, attributes);
             int major, minor;
-            ckVersion = params.pVersion;
-            if (ckVersion == null) {
+            if (params.pVersion == null) {
                 major = -1;
                 minor = -1;
             } else {
-                major = ckVersion.major;
-                minor = ckVersion.minor;
+                major = params.pVersion.major;
+                minor = params.pVersion.minor;
             }
             SecretKey key = P11Key.masterSecretKey(session, keyID,
                 "TlsMasterSecret", 48 << 3, attributes, major, minor);
@@ -156,5 +166,4 @@
             token.releaseSession(session);
         }
     }
-
 }
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, 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
@@ -60,12 +60,20 @@
     @SuppressWarnings("deprecation")
     private TlsRsaPremasterSecretParameterSpec spec;
 
+    // whether SSLv3 is supported
+    private final boolean supportSSLv3;
+
     P11TlsRsaPremasterSecretGenerator(Token token, String algorithm, long mechanism)
             throws PKCS11Exception {
         super();
         this.token = token;
         this.algorithm = algorithm;
         this.mechanism = mechanism;
+
+        // Given the current lookup order specified in SunPKCS11.java,
+        // if CKM_SSL3_PRE_MASTER_KEY_GEN is not used to construct this object,
+        // it means that this mech is disabled or unsupported.
+        this.supportSSLv3 = (mechanism == CKM_SSL3_PRE_MASTER_KEY_GEN);
     }
 
     protected void engineInit(SecureRandom random) {
@@ -78,7 +86,20 @@
         if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) {
             throw new InvalidAlgorithmParameterException(MSG);
         }
-        this.spec = (TlsRsaPremasterSecretParameterSpec)params;
+
+        TlsRsaPremasterSecretParameterSpec spec =
+            (TlsRsaPremasterSecretParameterSpec) params;
+
+        int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
+
+        if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
+            (version > 0x0302)) {
+             throw new InvalidAlgorithmParameterException
+                    ("Only" + (supportSSLv3? " SSL 3.0,": "") +
+                     " TLS 1.0, and TLS 1.1 are supported (0x" +
+                     Integer.toHexString(version) + ")");
+        }
+        this.spec = spec;
     }
 
     protected void engineInit(int keysize, SecureRandom random) {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java	Mon Oct 03 12:35:51 2016 -0400
@@ -45,7 +45,7 @@
  * <pre>
  *   Secmod secmod = Secmod.getInstance();
  *   if (secmod.isInitialized() == false) {
- *       secmod.initialize("/home/myself/.mozilla", "/usr/sfw/lib/mozilla");
+ *       secmod.initialize("/home/myself/.mozilla");
  *   }
  *
  *   Provider p = secmod.getModule(ModuleType.KEYSTORE).getProvider();
--- a/jdk/test/com/sun/net/httpserver/Test5.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/com/sun/net/httpserver/Test5.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -145,6 +145,7 @@
         socket.close();
         s = new String (b,0,count, "ISO8859_1");
         if (!compare (s, result)) {
+            System.err.println(" Expected [" + result + "]\n actual [" + s + "]");
             throw new RuntimeException ("wrong string result");
         }
     }
--- a/jdk/test/java/io/PrintStream/FormatLocale.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/io/PrintStream/FormatLocale.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8146156
  * @summary test whether conversion follows Locale.Category.FORMAT locale.
+ * @modules jdk.localedata
  * @run main/othervm FormatLocale
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/Main.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,35 @@
+/*
+ * 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 8157464
+ * @summary Basic test for StackWalker.getCallerClass()
+ * @library src
+ * @build java.base/java.util.CSM csm/*
+ * @run main/othervm csm/jdk.test.CallerSensitiveTest
+ * @run main/othervm csm/jdk.test.CallerSensitiveTest sm
+ */
+public class Main {
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/csm/jdk/test/CallerSensitiveTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,159 @@
+/*
+ * 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 jdk.test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.CSM.Result;
+import java.util.function.Supplier;
+
+/**
+ * This test invokes StackWalker::getCallerClass via static reference,
+ * reflection, MethodHandle, lambda.  Also verify that
+ * StackWalker::getCallerClass can't be called from @CallerSensitive method.
+ */
+public class CallerSensitiveTest {
+    private static final String NON_CSM_CALLER_METHOD = "getCallerClass";
+    private static final String CSM_CALLER_METHOD = "caller";
+
+    public static void main(String... args) throws Throwable {
+        boolean sm = false;
+        if (args.length > 0 && args[0].equals("sm")) {
+            sm = true;
+            PermissionCollection perms = new Permissions();
+            perms.add(new StackFramePermission("retainClassReference"));
+            Policy.setPolicy(new Policy() {
+                @Override
+                public boolean implies(ProtectionDomain domain, Permission p) {
+                    return perms.implies(p);
+                }
+            });
+            System.setSecurityManager(new SecurityManager());
+        }
+
+        System.err.format("Test %s security manager.%n",
+                          sm ? "with" : "without");
+
+        CallerSensitiveTest cstest = new CallerSensitiveTest();
+        // test static call to java.util.CSM::caller and CSM::getCallerClass
+        cstest.staticMethodCall();
+        // test java.lang.reflect.Method call
+        cstest.reflectMethodCall();
+        // test java.lang.invoke.MethodHandle
+        cstest.invokeMethodHandle(Lookup1.lookup);
+        cstest.invokeMethodHandle(Lookup2.lookup);
+        // test method ref
+        cstest.lambda();
+
+        LambdaTest.lambda();
+
+        if (failed > 0) {
+            throw new RuntimeException(failed + " test cases failed.");
+        }
+    }
+
+    void staticMethodCall() {
+        java.util.CSM.caller();
+
+        Result result = java.util.CSM.getCallerClass();
+        checkNonCSMCaller(CallerSensitiveTest.class, result);
+    }
+
+    void reflectMethodCall() throws Throwable {
+        Method method1 = java.util.CSM.class.getMethod(CSM_CALLER_METHOD);
+        method1.invoke(null);
+
+        Method method2 = java.util.CSM.class.getMethod(NON_CSM_CALLER_METHOD);
+        Result result = (Result) method2.invoke(null);
+        checkNonCSMCaller(CallerSensitiveTest.class, result);
+    }
+
+    void invokeMethodHandle(Lookup lookup) throws Throwable {
+        MethodHandle mh1 = lookup.findStatic(java.util.CSM.class, CSM_CALLER_METHOD,
+            MethodType.methodType(Class.class));
+        Class<?> c = (Class<?>)mh1.invokeExact();
+
+        MethodHandle mh2 = lookup.findStatic(java.util.CSM.class, NON_CSM_CALLER_METHOD,
+            MethodType.methodType(Result.class));
+        Result result = (Result)mh2.invokeExact();
+        checkNonCSMCaller(CallerSensitiveTest.class, result);
+    }
+
+    void lambda() {
+        Result result = LambdaTest.getCallerClass.get();
+        checkNonCSMCaller(CallerSensitiveTest.class, result);
+
+        LambdaTest.caller.get();
+    }
+
+    static int failed = 0;
+
+    static void checkNonCSMCaller(Class<?> expected, Result result) {
+        if (result.callers.size() != 1) {
+            throw new RuntimeException("Expected result.callers contain one element");
+        }
+        if (expected != result.callers.get(0)) {
+            System.err.format("ERROR: Expected %s but got %s%n", expected,
+                result.callers);
+            result.frames.stream()
+                .forEach(f -> System.err.println("   " + f));
+            failed++;
+        }
+    }
+
+    static class Lookup1 {
+        static Lookup lookup = MethodHandles.lookup();
+    }
+
+    static class Lookup2 {
+        static Lookup lookup = MethodHandles.lookup();
+    }
+
+    static class LambdaTest {
+        static Supplier<Class<?>> caller = java.util.CSM::caller;
+        static Supplier<Result> getCallerClass = java.util.CSM::getCallerClass;
+
+        static void caller() {
+            caller.get();
+        }
+        static Result getCallerClass() {
+            return getCallerClass.get();
+        }
+
+        static void lambda() {
+            Result result = LambdaTest.getCallerClass();
+            checkNonCSMCaller(LambdaTest.class, result);
+
+            LambdaTest.caller();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/csm/module-info.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module csm {
+    exports jdk.test;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StackWalker/CallerSensitiveMethod/src/java.base/java/util/CSM.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,77 @@
+/*
+ * 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 java.util;
+
+import static java.lang.StackWalker.Option.*;
+import java.lang.StackWalker.StackFrame;
+import java.util.stream.Collectors;
+
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+
+public class CSM {
+    private static StackWalker walker =
+        StackWalker.getInstance(EnumSet.of(RETAIN_CLASS_REFERENCE,
+                                           SHOW_HIDDEN_FRAMES,
+                                           SHOW_REFLECT_FRAMES));
+
+    public static class Result {
+        public final List<Class<?>> callers;
+        public final List<StackWalker.StackFrame> frames;
+        Result(List<Class<?>> callers,
+               List<StackFrame> frames) {
+            this.callers = callers;
+            this.frames = frames;
+        }
+    }
+
+    /**
+     * Returns the caller of this caller-sensitive method returned by
+     * by Reflection::getCallerClass.
+     *
+     * StackWalker::getCallerClass is expected to throw UOE
+     */
+    @CallerSensitive
+    public static Class<?> caller() {
+        Class<?> c1 = Reflection.getCallerClass();
+
+        try {
+            Class<?> c2 = walker.getCallerClass();
+            throw new RuntimeException("Exception not thrown by StackWalker::getCallerClass");
+        } catch (UnsupportedOperationException e) {}
+        return c1;
+    }
+
+    /**
+     * Returns the caller of this non-caller-sensitive method.
+     */
+    public static Result getCallerClass() {
+        Class<?> caller = walker.getCallerClass();
+        return new Result(List.of(caller), dump());
+    }
+
+    static List<StackFrame> dump() {
+        return walker.walk(s -> s.collect(Collectors.toList()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/SimpleAgent.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.instrument.Instrumentation;
+
+class SimpleAgent {
+
+    public static void premain(String args, Instrumentation inst) {
+        System.out.println("in premain");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/TestAgentWithLimitMods.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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
+ * @summary Tests that the -javaagent option adds the java.instrument into
+ * the module graph
+ * @modules java.instrument
+ * @run shell MakeJAR3.sh SimpleAgent
+ * @run main/othervm -javaagent:SimpleAgent.jar -limitmods java.base TestAgentWithLimitMods
+ *
+ */
+public class TestAgentWithLimitMods {
+
+    public static void main(String[] args) {
+        System.out.println("Test passed");
+    }
+
+}
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -632,6 +632,7 @@
     }
 
     public void testFindVirtualClone0() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
         // test some ad hoc system methods
         testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone");
 
@@ -2798,11 +2799,17 @@
             toClauseMajor(postClauses, inits, steps, usePreds, finis);
             MethodHandle pre = MethodHandles.loop(preClauses);
             MethodHandle post = MethodHandles.loop(postClauses);
+            if (verbosity >= 6) {
+                System.out.println("pre-handle: " + pre);
+            }
             Object[] preResults = (Object[]) pre.invokeWithArguments(args);
             if (verbosity >= 4) {
                 System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " +
                         Arrays.asList(preResults));
             }
+            if (verbosity >= 6) {
+                System.out.println("post-handle: " + post);
+            }
             Object[] postResults = (Object[]) post.invokeWithArguments(args);
             if (verbosity >= 4) {
                 System.out.println("post-checked: expected " + Arrays.asList(postCheckedResults[i]) + ", actual " +
--- a/jdk/test/java/net/MulticastSocket/TimeToLive.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/MulticastSocket/TimeToLive.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,26 +37,27 @@
     static int[] bad_ttls = { -1, 256 };
 
     public static void main(String[] args) throws Exception {
-        MulticastSocket socket = new MulticastSocket(6789);
-        int ttl = socket.getTimeToLive();
-        System.out.println("default ttl: " + ttl);
-        for (int i = 0; i < new_ttls.length; i++) {
-            socket.setTimeToLive(new_ttls[i]);
-            if (!(new_ttls[i] == socket.getTimeToLive())) {
-                throw new RuntimeException("test failure, set/get differ: " +
-                                           new_ttls[i] + " /  " +
-                                           socket.getTimeToLive());
+        try (MulticastSocket socket = new MulticastSocket()) {
+            int ttl = socket.getTimeToLive();
+            System.out.println("default ttl: " + ttl);
+            for (int i = 0; i < new_ttls.length; i++) {
+                socket.setTimeToLive(new_ttls[i]);
+                if (!(new_ttls[i] == socket.getTimeToLive())) {
+                    throw new RuntimeException("test failure, set/get differ: " +
+                            new_ttls[i] + " /  " +
+                            socket.getTimeToLive());
+                }
             }
-        }
-        for (int j = 0; j < bad_ttls.length; j++) {
-            boolean exception = false;
-            try {
-                socket.setTimeToLive(bad_ttls[j]);
-            } catch (IllegalArgumentException e) {
-                exception = true;
-            }
-            if (!exception) {
-                throw new RuntimeException("bad argument accepted: " + bad_ttls[j]);
+            for (int j = 0; j < bad_ttls.length; j++) {
+                boolean exception = false;
+                try {
+                    socket.setTimeToLive(bad_ttls[j]);
+                } catch (IllegalArgumentException e) {
+                    exception = true;
+                }
+                if (!exception) {
+                    throw new RuntimeException("bad argument accepted: " + bad_ttls[j]);
+                }
             }
         }
     }
--- a/jdk/test/java/net/ServerSocket/ThreadStop.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/ServerSocket/ThreadStop.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,23 +68,23 @@
         thr.start();
 
         // give server time to block in ServerSocket.accept()
-        Thread.currentThread().sleep(2000);
+        Thread.sleep(2000);
 
         // "stop" the thread
         thr.stop();
 
         // give thread time to stop
-        Thread.currentThread().sleep(2000);
+        Thread.sleep(2000);
 
         // it's platform specific if Thread.stop interrupts the
         // thread - on Linux/Windows most likely that thread is
         // still in accept() so we connect to server which causes
         // it to unblock and do JNI-stuff with a pending exception
 
-        try {
-            Socket s = new Socket("localhost", svr.localPort());
-        } catch (IOException ioe) { }
-
+        try (Socket s = new Socket("localhost", svr.localPort())) {
+        } catch (IOException ioe) {
+        }
+        thr.join();
     }
 
 }
--- a/jdk/test/java/net/Socket/InheritHandle.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/Socket/InheritHandle.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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,6 +27,7 @@
    @author Chris Hegarty
  */
 
+import java.net.BindException;
 import java.net.ServerSocket;
 import java.io.File;
 import java.io.IOException;
@@ -74,6 +75,11 @@
         } catch (IOException ioe) {
             System.out.println("Cannot create process");
             ioe.printStackTrace();
+            try {
+                ss.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
             return;
         }
 
@@ -85,9 +91,18 @@
             System.out.println("Now close the socket and try to create another" +
                                " one listening on the same port");
             ss.close();
-            ss = new ServerSocket(port);
-            System.out.println("Second ServerSocket created successfully");
-            ss.close();
+            int retries = 0;
+            while (retries < 5) {
+                try (ServerSocket s = new ServerSocket(port);) {
+                    System.out.println("Second ServerSocket created successfully");
+                    break;
+                } catch (BindException e) {
+                    System.out.println("BindException \"" + e.getMessage() + "\", retrying...");
+                    Thread.sleep(100L);
+                    retries ++;
+                    continue;
+                }
+            }
 
         } catch (InterruptedException ie) {
         } catch (IOException ioe) {
--- a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java	Mon Oct 03 12:35:51 2016 -0400
@@ -27,6 +27,7 @@
  * @summary Test two URLClassLoader define Package object of the same name
  * @library /lib/testlibrary
  * @build CompilerUtils
+ * @modules jdk.compiler
  * @run testng SplitPackage
  */
 
--- a/jdk/test/java/net/URLPermission/nstest/LookupTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/URLPermission/nstest/LookupTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -37,6 +37,7 @@
         String url, boolean throwsSecException, boolean throwsIOException)
     {
         try {
+            ProxySelector.setDefault(null);
             URL u = new URL(url);
             System.err.println ("Connecting to " + u);
             URLConnection urlc = u.openConnection();
@@ -71,7 +72,7 @@
             System.out.print(port);
         } else if (cmd.equals("-runtest")) {
             port = Integer.parseInt(args[1]);
-            String hostsFileName = System.getProperty("test.src", ".") + "/LookupTestHosts";
+            String hostsFileName = System.getProperty("user.dir", ".") + "/LookupTestHosts";
             System.setProperty("jdk.net.hosts.file", hostsFileName);
             addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
             addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true);
--- a/jdk/test/java/net/URLPermission/nstest/LookupTestHosts	Wed Sep 28 11:17:51 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-127.0.0.1 allowedAndFound.com
-99.99.99.99 notAllowedButFound.com
--- a/jdk/test/java/net/URLPermission/nstest/lookup.sh	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/URLPermission/nstest/lookup.sh	Mon Oct 03 12:35:51 2016 -0400
@@ -48,6 +48,7 @@
 grant {
     permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
     permission java.net.URLPermission "http://allowedButNotfound.com:${port}/-", "*:*";
+    permission java.net.NetPermission "setProxySelector";
     permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
     permission java.util.PropertyPermission "java.io.tmpdir", "read";
 
--- a/jdk/test/java/net/httpclient/HeadersTest1.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/httpclient/HeadersTest1.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,9 +23,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8153142
+ * @modules java.httpclient
+ *          jdk.httpserver
  * @run main/othervm HeadersTest1
  * @summary HeadersTest1
  */
@@ -39,9 +41,11 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetSocketAddress;
-import java.net.PasswordAuthentication;
 import java.net.URI;
-import java.net.http.*;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpResponse;
+import java.net.http.HttpRequest;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.List;
--- a/jdk/test/java/net/httpclient/ProxyAuthTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/httpclient/ProxyAuthTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -26,6 +26,7 @@
  * @test
  * @bug 8163561
  * @modules java.base/sun.net.www
+ *          java.httpclient
  * @summary Verify that Proxy-Authenticate header is correctly handled
  *
  * @run main/othervm ProxyAuthTest
--- a/jdk/test/java/net/httpclient/whitebox/Driver.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/net/httpclient/whitebox/Driver.java	Mon Oct 03 12:35:51 2016 -0400
@@ -24,5 +24,6 @@
 /*
  * @test
  * @bug 8151299
+ * @modules java.httpclient
  * @run testng java.httpclient/java.net.http.SelectorTest
  */
--- a/jdk/test/java/util/Collections/EmptyNavigableMap.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/Collections/EmptyNavigableMap.java	Mon Oct 03 12:35:51 2016 -0400
@@ -33,7 +33,6 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
-import java.util.NoSuchElementException;
 import java.util.NavigableMap;
 import java.util.SortedMap;
 import java.util.TreeMap;
@@ -41,10 +40,8 @@
 import org.testng.annotations.DataProvider;
 
 import static org.testng.Assert.fail;
-import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertSame;
 
 public class EmptyNavigableMap {
 
--- a/jdk/test/java/util/Collections/EmptyNavigableSet.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/Collections/EmptyNavigableSet.java	Mon Oct 03 12:35:51 2016 -0400
@@ -41,10 +41,9 @@
 import org.testng.annotations.DataProvider;
 
 import static org.testng.Assert.fail;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
 
 public class EmptyNavigableSet {
 
--- a/jdk/test/java/util/Deque/ChorusLine.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/Deque/ChorusLine.java	Mon Oct 03 12:35:51 2016 -0400
@@ -28,8 +28,14 @@
  * @author Martin Buchholz
  */
 
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.LinkedBlockingDeque;
 
 public class ChorusLine {
     private interface Tweaker {
--- a/jdk/test/java/util/PriorityQueue/ForgetMeNot.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/PriorityQueue/ForgetMeNot.java	Mon Oct 03 12:35:51 2016 -0400
@@ -28,7 +28,11 @@
  * @author Martin Buchholz
  */
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.PriorityQueue;
+import java.util.Queue;
 
 public class ForgetMeNot {
     private static void checkQ(PriorityQueue<Integer> q, Integer...elts) {
--- a/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Mon Oct 03 12:35:51 2016 -0400
@@ -37,7 +37,13 @@
  * @summary Checks that a priority queue returns elements in sorted order across various operations
  */
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Queue;
+import java.util.PriorityQueue;
 
 public class PriorityQueueSort {
 
--- a/jdk/test/java/util/PriorityQueue/RemoveContains.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/PriorityQueue/RemoveContains.java	Mon Oct 03 12:35:51 2016 -0400
@@ -28,8 +28,17 @@
  * @author  Martin Buchholz
  */
 
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Queue;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.PriorityBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
 
 public class RemoveContains {
     static volatile int passed = 0, failed = 0;
--- a/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Mon Oct 03 12:35:51 2016 -0400
@@ -31,8 +31,6 @@
  */
 
 import static java.util.concurrent.Executors.defaultThreadFactory;
-import static java.util.concurrent.Executors.newFixedThreadPool;
-import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Mon Oct 03 12:35:51 2016 -0400
@@ -83,15 +83,18 @@
         tpe.allowCoreThreadTimeOut(true);
         check(tpe.allowsCoreThreadTimeOut());
         equal(countExecutorThreads(), 0);
-        long t0 = System.nanoTime();
-        for (int i = 0; i < threadCount; i++)
-            tpe.submit(new Runnable() { public void run() {}});
-        int count = countExecutorThreads();
-        if (millisElapsedSince(t0) < timeoutMillis)
-            equal(count, threadCount);
+        long startTime = System.nanoTime();
+        for (int i = 0; i < threadCount; i++) {
+            tpe.submit(() -> {});
+            int count = countExecutorThreads();
+            if (millisElapsedSince(startTime) < timeoutMillis)
+                equal(count, i + 1);
+        }
         while (countExecutorThreads() > 0 &&
-               millisElapsedSince(t0) < 10 * 1000);
+               millisElapsedSince(startTime) < LONG_DELAY_MS)
+            Thread.yield();
         equal(countExecutorThreads(), 0);
+        check(millisElapsedSince(startTime) >= timeoutMillis);
         tpe.shutdown();
         check(tpe.allowsCoreThreadTimeOut());
         check(tpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
--- a/jdk/test/java/util/concurrent/tck/AtomicIntegerArrayTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/AtomicIntegerArrayTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -303,7 +303,7 @@
 
     class Counter extends CheckedRunnable {
         final AtomicIntegerArray aa;
-        volatile int counts;
+        int decs;
         Counter(AtomicIntegerArray a) { aa = a; }
         public void realRun() {
             for (;;) {
@@ -314,7 +314,7 @@
                     if (v != 0) {
                         done = false;
                         if (aa.compareAndSet(i, v, v - 1))
-                            ++counts;
+                            decs++;
                     }
                 }
                 if (done)
@@ -334,13 +334,11 @@
             aa.set(i, countdown);
         Counter c1 = new Counter(aa);
         Counter c2 = new Counter(aa);
-        Thread t1 = new Thread(c1);
-        Thread t2 = new Thread(c2);
-        t1.start();
-        t2.start();
+        Thread t1 = newStartedThread(c1);
+        Thread t2 = newStartedThread(c2);
         t1.join();
         t2.join();
-        assertEquals(c1.counts+c2.counts, SIZE * countdown);
+        assertEquals(c1.decs + c2.decs, SIZE * countdown);
     }
 
     /**
--- a/jdk/test/java/util/concurrent/tck/AtomicLongArrayTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/AtomicLongArrayTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -302,7 +302,7 @@
 
     class Counter extends CheckedRunnable {
         final AtomicLongArray aa;
-        volatile long counts;
+        int decs;
         Counter(AtomicLongArray a) { aa = a; }
         public void realRun() {
             for (;;) {
@@ -313,7 +313,7 @@
                     if (v != 0) {
                         done = false;
                         if (aa.compareAndSet(i, v, v - 1))
-                            ++counts;
+                            decs++;
                     }
                 }
                 if (done)
@@ -333,13 +333,11 @@
             aa.set(i, countdown);
         Counter c1 = new Counter(aa);
         Counter c2 = new Counter(aa);
-        Thread t1 = new Thread(c1);
-        Thread t2 = new Thread(c2);
-        t1.start();
-        t2.start();
+        Thread t1 = newStartedThread(c1);
+        Thread t2 = newStartedThread(c2);
         t1.join();
         t2.join();
-        assertEquals(c1.counts+c2.counts, SIZE * countdown);
+        assertEquals(c1.decs + c2.decs, SIZE * countdown);
     }
 
     /**
--- a/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -388,7 +388,7 @@
         checkCompletedNormally(f, "test");
     }
 
-    abstract class CheckedAction {
+    abstract static class CheckedAction {
         int invocationCount = 0;
         final ExecutionMode m;
         CheckedAction(ExecutionMode m) { this.m = m; }
@@ -400,7 +400,7 @@
         void assertInvoked() { assertEquals(1, invocationCount); }
     }
 
-    abstract class CheckedIntegerAction extends CheckedAction {
+    abstract static class CheckedIntegerAction extends CheckedAction {
         Integer value;
         CheckedIntegerAction(ExecutionMode m) { super(m); }
         void assertValue(Integer expected) {
@@ -409,7 +409,7 @@
         }
     }
 
-    class IntegerSupplier extends CheckedAction
+    static class IntegerSupplier extends CheckedAction
         implements Supplier<Integer>
     {
         final Integer value;
@@ -428,7 +428,7 @@
         return (x == null) ? null : x + 1;
     }
 
-    class NoopConsumer extends CheckedIntegerAction
+    static class NoopConsumer extends CheckedIntegerAction
         implements Consumer<Integer>
     {
         NoopConsumer(ExecutionMode m) { super(m); }
@@ -438,7 +438,7 @@
         }
     }
 
-    class IncFunction extends CheckedIntegerAction
+    static class IncFunction extends CheckedIntegerAction
         implements Function<Integer,Integer>
     {
         IncFunction(ExecutionMode m) { super(m); }
@@ -456,7 +456,7 @@
             - ((y == null) ? 99 : y.intValue());
     }
 
-    class SubtractAction extends CheckedIntegerAction
+    static class SubtractAction extends CheckedIntegerAction
         implements BiConsumer<Integer, Integer>
     {
         SubtractAction(ExecutionMode m) { super(m); }
@@ -466,7 +466,7 @@
         }
     }
 
-    class SubtractFunction extends CheckedIntegerAction
+    static class SubtractFunction extends CheckedIntegerAction
         implements BiFunction<Integer, Integer, Integer>
     {
         SubtractFunction(ExecutionMode m) { super(m); }
@@ -476,14 +476,14 @@
         }
     }
 
-    class Noop extends CheckedAction implements Runnable {
+    static class Noop extends CheckedAction implements Runnable {
         Noop(ExecutionMode m) { super(m); }
         public void run() {
             invoked();
         }
     }
 
-    class FailingSupplier extends CheckedAction
+    static class FailingSupplier extends CheckedAction
         implements Supplier<Integer>
     {
         final CFException ex;
@@ -494,7 +494,7 @@
         }
     }
 
-    class FailingConsumer extends CheckedIntegerAction
+    static class FailingConsumer extends CheckedIntegerAction
         implements Consumer<Integer>
     {
         final CFException ex;
@@ -506,7 +506,7 @@
         }
     }
 
-    class FailingBiConsumer extends CheckedIntegerAction
+    static class FailingBiConsumer extends CheckedIntegerAction
         implements BiConsumer<Integer, Integer>
     {
         final CFException ex;
@@ -518,7 +518,7 @@
         }
     }
 
-    class FailingFunction extends CheckedIntegerAction
+    static class FailingFunction extends CheckedIntegerAction
         implements Function<Integer, Integer>
     {
         final CFException ex;
@@ -530,7 +530,7 @@
         }
     }
 
-    class FailingBiFunction extends CheckedIntegerAction
+    static class FailingBiFunction extends CheckedIntegerAction
         implements BiFunction<Integer, Integer, Integer>
     {
         final CFException ex;
@@ -542,7 +542,7 @@
         }
     }
 
-    class FailingRunnable extends CheckedAction implements Runnable {
+    static class FailingRunnable extends CheckedAction implements Runnable {
         final CFException ex;
         FailingRunnable(ExecutionMode m) { super(m); ex = new CFException(); }
         public void run() {
@@ -551,7 +551,7 @@
         }
     }
 
-    class CompletableFutureInc extends CheckedIntegerAction
+    static class CompletableFutureInc extends CheckedIntegerAction
         implements Function<Integer, CompletableFuture<Integer>>
     {
         CompletableFutureInc(ExecutionMode m) { super(m); }
@@ -564,7 +564,7 @@
         }
     }
 
-    class FailingCompletableFutureFunction extends CheckedIntegerAction
+    static class FailingCompletableFutureFunction extends CheckedIntegerAction
         implements Function<Integer, CompletableFuture<Integer>>
     {
         final CFException ex;
@@ -3604,29 +3604,53 @@
      * copy returns a CompletableFuture that is completed normally,
      * with the same value, when source is.
      */
-    public void testCopy() {
+    public void testCopy_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
         CompletableFuture<Integer> f = new CompletableFuture<>();
+        if (!createIncomplete) assertTrue(f.complete(v1));
         CompletableFuture<Integer> g = f.copy();
-        checkIncomplete(f);
-        checkIncomplete(g);
-        f.complete(1);
-        checkCompletedNormally(f, 1);
-        checkCompletedNormally(g, 1);
-    }
+        if (createIncomplete) {
+            checkIncomplete(f);
+            checkIncomplete(g);
+            assertTrue(f.complete(v1));
+        }
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g, v1);
+    }}
 
     /**
      * copy returns a CompletableFuture that is completed exceptionally
      * when source is.
      */
-    public void testCopy2() {
+    public void testCopy_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        CFException ex = new CFException();
         CompletableFuture<Integer> f = new CompletableFuture<>();
+        if (!createIncomplete) f.completeExceptionally(ex);
         CompletableFuture<Integer> g = f.copy();
-        checkIncomplete(f);
-        checkIncomplete(g);
-        CFException ex = new CFException();
-        f.completeExceptionally(ex);
+        if (createIncomplete) {
+            checkIncomplete(f);
+            checkIncomplete(g);
+            f.completeExceptionally(ex);
+        }
         checkCompletedExceptionally(f, ex);
         checkCompletedWithWrappedException(g, ex);
+    }}
+
+    /**
+     * Completion of a copy does not complete its source.
+     */
+    public void testCopy_oneWayPropagation() {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        assertTrue(f.copy().complete(1));
+        assertTrue(f.copy().complete(null));
+        assertTrue(f.copy().cancel(true));
+        assertTrue(f.copy().cancel(false));
+        assertTrue(f.copy().completeExceptionally(new CFException()));
+        checkIncomplete(f);
     }
 
     /**
@@ -3991,7 +4015,10 @@
             .collect(Collectors.toList());
 
         List<CompletionStage<Integer>> stages = new ArrayList<>();
-        stages.add(new CompletableFuture<Integer>().minimalCompletionStage());
+        CompletionStage<Integer> min =
+            new CompletableFuture<Integer>().minimalCompletionStage();
+        stages.add(min);
+        stages.add(min.thenApply(x -> x));
         stages.add(CompletableFuture.completedStage(1));
         stages.add(CompletableFuture.failedStage(new CFException()));
 
@@ -4027,6 +4054,131 @@
             throw new Error("Methods did not throw UOE: " + bugs);
     }
 
+    /**
+     * minimalStage.toCompletableFuture() returns a CompletableFuture that
+     * is completed normally, with the same value, when source is.
+     */
+    public void testMinimalCompletionStage_toCompletableFuture_normalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        CompletionStage<Integer> minimal = f.minimalCompletionStage();
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        CompletableFuture<Integer> g = minimal.toCompletableFuture();
+        if (createIncomplete) {
+            checkIncomplete(f);
+            checkIncomplete(g);
+            assertTrue(f.complete(v1));
+        }
+        checkCompletedNormally(f, v1);
+        checkCompletedNormally(g, v1);
+    }}
+
+    /**
+     * minimalStage.toCompletableFuture() returns a CompletableFuture that
+     * is completed exceptionally when source is.
+     */
+    public void testMinimalCompletionStage_toCompletableFuture_exceptionalCompletion() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+    {
+        CFException ex = new CFException();
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        CompletionStage<Integer> minimal = f.minimalCompletionStage();
+        if (!createIncomplete) f.completeExceptionally(ex);
+        CompletableFuture<Integer> g = minimal.toCompletableFuture();
+        if (createIncomplete) {
+            checkIncomplete(f);
+            checkIncomplete(g);
+            f.completeExceptionally(ex);
+        }
+        checkCompletedExceptionally(f, ex);
+        checkCompletedWithWrappedException(g, ex);
+    }}
+
+    /**
+     * minimalStage.toCompletableFuture() gives mutable CompletableFuture
+     */
+    public void testMinimalCompletionStage_toCompletableFuture_mutable() {
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        CompletionStage minimal = f.minimalCompletionStage();
+        CompletableFuture<Integer> g = minimal.toCompletableFuture();
+        assertTrue(g.complete(v1));
+        checkCompletedNormally(g, v1);
+        checkIncomplete(f);
+        checkIncomplete(minimal.toCompletableFuture());
+    }}
+
+    /**
+     * minimalStage.toCompletableFuture().join() awaits completion
+     */
+    public void testMinimalCompletionStage_toCompletableFuture_join() throws Exception {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        CompletionStage<Integer> minimal = f.minimalCompletionStage();
+        if (createIncomplete) assertTrue(f.complete(v1));
+        assertEquals(v1, minimal.toCompletableFuture().join());
+        assertEquals(v1, minimal.toCompletableFuture().get());
+        checkCompletedNormally(minimal.toCompletableFuture(), v1);
+    }}
+
+    /**
+     * Completion of a toCompletableFuture copy of a minimal stage
+     * does not complete its source.
+     */
+    public void testMinimalCompletionStage_toCompletableFuture_oneWayPropagation() {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        CompletionStage<Integer> g = f.minimalCompletionStage();
+        assertTrue(g.toCompletableFuture().complete(1));
+        assertTrue(g.toCompletableFuture().complete(null));
+        assertTrue(g.toCompletableFuture().cancel(true));
+        assertTrue(g.toCompletableFuture().cancel(false));
+        assertTrue(g.toCompletableFuture().completeExceptionally(new CFException()));
+        checkIncomplete(g.toCompletableFuture());
+        f.complete(1);
+        checkCompletedNormally(g.toCompletableFuture(), 1);
+    }
+
+    /** Demo utility method for external reliable toCompletableFuture */
+    static <T> CompletableFuture<T> toCompletableFuture(CompletionStage<T> stage) {
+        CompletableFuture<T> f = new CompletableFuture<>();
+        stage.handle((T t, Throwable ex) -> {
+                         if (ex != null) f.completeExceptionally(ex);
+                         else f.complete(t);
+                         return null;
+                     });
+        return f;
+    }
+
+    /** Demo utility method to join a CompletionStage */
+    static <T> T join(CompletionStage<T> stage) {
+        return toCompletableFuture(stage).join();
+    }
+
+    /**
+     * Joining a minimal stage "by hand" works
+     */
+    public void testMinimalCompletionStage_join_by_hand() {
+        for (boolean createIncomplete : new boolean[] { true, false })
+        for (Integer v1 : new Integer[] { 1, null })
+    {
+        CompletableFuture<Integer> f = new CompletableFuture<>();
+        CompletionStage<Integer> minimal = f.minimalCompletionStage();
+        CompletableFuture<Integer> g = new CompletableFuture<>();
+        if (!createIncomplete) assertTrue(f.complete(v1));
+        minimal.thenAccept((x) -> g.complete(x));
+        if (createIncomplete) assertTrue(f.complete(v1));
+        g.join();
+        checkCompletedNormally(g, v1);
+        checkCompletedNormally(f, v1);
+        assertEquals(v1, join(minimal));
+    }}
+
     static class Monad {
         static class ZeroException extends RuntimeException {
             public ZeroException() { super("monadic zero"); }
@@ -4317,6 +4469,22 @@
             assertTrue(neverCompleted.thenRun(() -> {}).cancel(true));
     }
 
+    /**
+     * Checks for garbage retention when MinimalStage.toCompletableFuture()
+     * is invoked many times.
+     * 8161600: Garbage retention when source CompletableFutures are never completed
+     *
+     * As of 2016-07, fails with OOME:
+     * ant -Dvmoptions=-Xmx8m -Djsr166.expensiveTests=true -Djsr166.tckTestClass=CompletableFutureTest -Djsr166.methodFilter=testToCompletableFutureGarbageRetention tck
+     */
+    public void testToCompletableFutureGarbageRetention() throws Throwable {
+        final int n = expensiveTests ? 900_000 : 10;
+        CompletableFuture<Integer> neverCompleted = new CompletableFuture<>();
+        CompletionStage minimal = neverCompleted.minimalCompletionStage();
+        for (int i = 0; i < n; i++)
+            assertTrue(minimal.toCompletableFuture().cancel(true));
+    }
+
 //     static <U> U join(CompletionStage<U> stage) {
 //         CompletableFuture<U> f = new CompletableFuture<>();
 //         stage.whenComplete((v, ex) -> {
--- a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1024,7 +1024,7 @@
 
     static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
         NavigableMap<Integer, Integer> result =
-            (NavigableMap<Integer, Integer>) cl.newInstance();
+            (NavigableMap<Integer, Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.keySet().iterator().hasNext());
         return result;
--- a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -725,7 +725,8 @@
     }
 
     static NavigableSet<Integer> newSet(Class cl) throws Exception {
-        NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance();
+        NavigableSet<Integer> result =
+            (NavigableSet<Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.iterator().hasNext());
         return result;
--- a/jdk/test/java/util/concurrent/tck/CyclicBarrierTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/CyclicBarrierTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -40,6 +40,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -52,11 +53,6 @@
         return new TestSuite(CyclicBarrierTest.class);
     }
 
-    private volatile int countAction;
-    private class MyAction implements Runnable {
-        public void run() { ++countAction; }
-    }
-
     /**
      * Spin-waits till the number of waiters == numberOfWaiters.
      */
@@ -114,14 +110,16 @@
      * The supplied barrier action is run at barrier
      */
     public void testBarrierAction() throws Exception {
-        countAction = 0;
-        CyclicBarrier b = new CyclicBarrier(1, new MyAction());
+        final AtomicInteger count = new AtomicInteger(0);
+        final Runnable incCount = new Runnable() { public void run() {
+            count.getAndIncrement(); }};
+        CyclicBarrier b = new CyclicBarrier(1, incCount);
         assertEquals(1, b.getParties());
         assertEquals(0, b.getNumberWaiting());
         b.await();
         b.await();
         assertEquals(0, b.getNumberWaiting());
-        assertEquals(2, countAction);
+        assertEquals(2, count.get());
     }
 
     /**
--- a/jdk/test/java/util/concurrent/tck/DelayQueueTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/DelayQueueTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -121,10 +121,8 @@
         }
 
         public boolean equals(Object other) {
-            return equals((NanoDelay)other);
-        }
-        public boolean equals(NanoDelay other) {
-            return other.trigger == trigger;
+            return (other instanceof NanoDelay) &&
+                this.trigger == ((NanoDelay)other).trigger;
         }
 
         // suppress [overrides] javac warning
--- a/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -51,6 +51,7 @@
 import java.util.concurrent.RecursiveTask;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.ReentrantLock;
 
 import junit.framework.AssertionFailedError;
@@ -84,13 +85,6 @@
 
     // Some classes to test extension and factory methods
 
-    static class MyHandler implements Thread.UncaughtExceptionHandler {
-        volatile int catches = 0;
-        public void uncaughtException(Thread t, Throwable e) {
-            ++catches;
-        }
-    }
-
     static class MyError extends Error {}
 
     // to test handlers
@@ -101,9 +95,9 @@
 
     static class FailingThreadFactory
             implements ForkJoinPool.ForkJoinWorkerThreadFactory {
-        volatile int calls = 0;
+        final AtomicInteger calls = new AtomicInteger(0);
         public ForkJoinWorkerThread newThread(ForkJoinPool p) {
-            if (++calls > 1) return null;
+            if (calls.incrementAndGet() > 1) return null;
             return new FailingFJWSubclass(p);
         }
     }
--- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1032,14 +1032,17 @@
         ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
         System.err.println("------ stacktrace dump start ------");
         for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
-            String name = info.getThreadName();
+            final String name = info.getThreadName();
+            String lockName;
             if ("Signal Dispatcher".equals(name))
                 continue;
             if ("Reference Handler".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.Reference$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.Reference$Lock"))
                 continue;
             if ("Finalizer".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
                 continue;
             if ("checkForWedgedTest".equals(name))
                 continue;
@@ -1783,7 +1786,7 @@
      * A CyclicBarrier that uses timed await and fails with
      * AssertionFailedErrors instead of throwing checked exceptions.
      */
-    public class CheckedBarrier extends CyclicBarrier {
+    public static class CheckedBarrier extends CyclicBarrier {
         public CheckedBarrier(int parties) { super(parties); }
 
         public int await() {
--- a/jdk/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -537,15 +537,14 @@
      * isShutdown is false before shutdown, true after
      */
     public void testIsShutdown() {
-
         final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
-        try {
-            assertFalse(p.isShutdown());
+        assertFalse(p.isShutdown());
+        try (PoolCleaner cleaner = cleaner(p)) {
+            try {
+                p.shutdown();
+                assertTrue(p.isShutdown());
+            } catch (SecurityException ok) {}
         }
-        finally {
-            try { p.shutdown(); } catch (SecurityException ok) { return; }
-        }
-        assertTrue(p.isShutdown());
     }
 
     /**
--- a/jdk/test/java/util/concurrent/tck/TreeMapTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/TreeMapTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -829,7 +829,7 @@
 
     static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
         NavigableMap<Integer, Integer> result
-            = (NavigableMap<Integer, Integer>) cl.newInstance();
+            = (NavigableMap<Integer, Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.keySet().iterator().hasNext());
         return result;
--- a/jdk/test/java/util/concurrent/tck/TreeSetTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/java/util/concurrent/tck/TreeSetTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -722,7 +722,8 @@
     }
 
     static NavigableSet<Integer> newSet(Class cl) throws Exception {
-        NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance();
+        NavigableSet<Integer> result =
+            (NavigableSet<Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.iterator().hasNext());
         return result;
--- a/jdk/test/jdk/internal/misc/Unsafe/TestBadHostClass.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/jdk/internal/misc/Unsafe/TestBadHostClass.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,7 +25,6 @@
  * @test
  * @bug 8058575
  * @summary Test that bad host classes cause exceptions to get thrown.
- * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.base/jdk.internal.org.objectweb.asm
  * @run main TestBadHostClass
@@ -35,7 +34,6 @@
 import java.lang.*;
 import java.lang.reflect.Field;
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
--- a/jdk/test/jprt.config	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/jprt.config	Mon Oct 03 12:35:51 2016 -0400
@@ -82,15 +82,12 @@
     fi
 
     # Add basic solaris system paths
-    path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
+    path4sdk=/usr/bin:/usr/gnu/bin
 
     # Find GNU make
-    make=/usr/sfw/bin/gmake
+    make=/usr/bin/gmake
     if [ ! -f ${make} ] ; then
-	make=/opt/sfw/bin/gmake
-	if [ ! -f ${make} ] ; then
-	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-        fi 
+	make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
     fi
     fileMustExist "${make}" make
 
--- a/jdk/test/start-Xvfb.sh	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/start-Xvfb.sh	Mon Oct 03 12:35:51 2016 -0400
@@ -59,9 +59,6 @@
   /usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
 fi
 WM="/usr/bin/X11/fvwm2"
-if [ ! -x ${WM} ] ; then
-  WM="/opt/sfw/bin/fvwm2"
-fi
 #
 # Wait for Xvfb to initialize:
 sleep 5
--- a/jdk/test/sun/nio/cs/TestUnmappable.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/nio/cs/TestUnmappable.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 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
@@ -28,11 +28,11 @@
  * @bug 8008386
  * @summary (cs) Unmappable leading should be decoded to replacement.
  *          Tests for Shift_JIS and MS932 decoding
+ * @modules jdk.charsets
  * @run main TestUnmappable
  */
 
-import java.nio.*;
-import java.nio.charset.*;
+import java.nio.charset.Charset;
 
 public class TestUnmappable {
     public static void main(String args[]) throws Exception {
--- a/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6316539
+ * @bug 6316539 8136355
  * @summary Known-answer-test for TlsKeyMaterial generator
  * @author Andreas Sterbenz
  * @library ..
@@ -37,6 +37,7 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.security.Provider;
+import java.security.InvalidAlgorithmParameterException;
 import java.util.Arrays;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
@@ -139,21 +140,28 @@
                         keyLength, expandedKeyLength, ivLength, macLength,
                         null, -1, -1);
 
-                    kg.init(spec);
-                    TlsKeyMaterialSpec result =
-                        (TlsKeyMaterialSpec)kg.generateKey();
-                    match(lineNumber, clientCipherBytes,
-                        result.getClientCipherKey(), cipherAlgorithm);
-                    match(lineNumber, serverCipherBytes,
-                        result.getServerCipherKey(), cipherAlgorithm);
-                    match(lineNumber, clientIv, result.getClientIv(), "");
-                    match(lineNumber, serverIv, result.getServerIv(), "");
-                    match(lineNumber, clientMacBytes, result.getClientMacKey(), "");
-                    match(lineNumber, serverMacBytes, result.getServerMacKey(), "");
-
-                } else {
+                    try {
+                        kg.init(spec);
+                        TlsKeyMaterialSpec result =
+                            (TlsKeyMaterialSpec)kg.generateKey();
+                        match(lineNumber, clientCipherBytes,
+                            result.getClientCipherKey(), cipherAlgorithm);
+                        match(lineNumber, serverCipherBytes,
+                            result.getServerCipherKey(), cipherAlgorithm);
+                        match(lineNumber, clientIv, result.getClientIv(), "");
+                        match(lineNumber, serverIv, result.getServerIv(), "");
+                        match(lineNumber, clientMacBytes, result.getClientMacKey(), "");
+                        match(lineNumber, serverMacBytes, result.getServerMacKey(), "");
+                    } catch (InvalidAlgorithmParameterException iape) {
+                        // SSLv3 support is removed in S12
+                        if (major == 3 && minor == 0) {
+                            System.out.println("Skip testing SSLv3");
+                            continue;
+                        }
+                    }
+               } else {
                     throw new Exception("Unknown line: " + line);
-                }
+               }
             }
             if (n == 0) {
                 throw new Exception("no tests");
--- a/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6316539
+ * @bug 6316539 8136355
  * @summary Known-answer-test for TlsMasterSecret generator
  * @author Andreas Sterbenz
  * @library ..
@@ -38,6 +38,7 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.security.Provider;
+import java.security.InvalidAlgorithmParameterException;
 import java.util.Arrays;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
@@ -116,15 +117,24 @@
                         new TlsMasterSecretParameterSpec(premasterKey,
                             protoMajor, protoMinor, clientRandom, serverRandom,
                             null, -1, -1);
-                    kg.init(spec);
-                    TlsMasterSecret key = (TlsMasterSecret)kg.generateKey();
-                    byte[] enc = key.getEncoded();
-                    if (Arrays.equals(master, enc) == false) {
-                        throw new Exception("mismatch line: " + lineNumber);
-                    }
-                    if ((preMajor != key.getMajorVersion()) ||
-                            (preMinor != key.getMinorVersion())) {
-                        throw new Exception("version mismatch line: " + lineNumber);
+
+                    try {
+                        kg.init(spec);
+                        TlsMasterSecret key = (TlsMasterSecret)kg.generateKey();
+                        byte[] enc = key.getEncoded();
+                        if (Arrays.equals(master, enc) == false) {
+                            throw new Exception("mismatch line: " + lineNumber);
+                        }
+                        if ((preMajor != key.getMajorVersion()) ||
+                                (preMinor != key.getMinorVersion())) {
+                           throw new Exception("version mismatch line: " + lineNumber);
+                        }
+                    } catch (InvalidAlgorithmParameterException iape) {
+                        // SSLv3 support is removed in S12
+                        if (preMajor == 3 && preMinor == 0) {
+                            System.out.println("Skip testing SSLv3");
+                            continue;
+                        }
                     }
                 } else {
                     throw new Exception("Unknown line: " + line);
--- a/jdk/test/sun/security/pkcs11/tls/TestPremaster.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/pkcs11/tls/TestPremaster.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6316539
+ * @bug 6316539 8136355
  * @summary Basic tests for TlsRsaPremasterSecret generator
  * @author Andreas Sterbenz
  * @library ..
@@ -34,6 +34,7 @@
  */
 
 import java.security.Provider;
+import java.security.InvalidAlgorithmParameterException;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
@@ -61,7 +62,7 @@
             System.out.println("OK: " + e);
         }
 
-        int[] protocolVersions = {0x0300, 0x0301, 0x0302, 0x0400};
+        int[] protocolVersions = {0x0300, 0x0301, 0x0302};
         for (int clientVersion : protocolVersions) {
             for (int serverVersion : protocolVersions) {
                 test(kg, clientVersion, serverVersion);
@@ -81,8 +82,18 @@
                 "Testing RSA pre-master secret key generation between " +
                 "client (0x%04X) and server(0x%04X)%n",
                 clientVersion, serverVersion);
-        kg.init(new TlsRsaPremasterSecretParameterSpec(
+        try {
+            kg.init(new TlsRsaPremasterSecretParameterSpec(
                                     clientVersion, serverVersion));
+        } catch (InvalidAlgorithmParameterException iape) {
+            // S12 removed support for SSL v3.0
+            if (clientVersion == 0x300 || serverVersion == 0x300) {
+                System.out.println("Skip testing SSLv3 due to no support");
+                return;
+            }
+            // unexpected, pass it up
+            throw iape;
+        }
         SecretKey key = kg.generateKey();
         byte[] encoded = key.getEncoded();
         if (encoded != null) {  // raw key material may be not extractable
--- a/jdk/test/sun/security/smartcardio/README.txt	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/README.txt	Mon Oct 03 12:35:51 2016 -0400
@@ -1,17 +1,17 @@
 
 Rough hints for setting up MUSCLE on Solaris:
 
-Make sure you have libusb, usually in /usr/sfw:
+Make sure you have libusb, usually in /usr/lib:
 
-ls -l /usr/sfw/lib/libusb.so
-lrwxrwxrwx   1 root     other         11 Jan 12 16:02 /usr/sfw/lib/libusb.so -> libusb.so.1
+ls -l /usr/lib/libusb.so
+lrwxrwxrwx   1 root     other         11 Jan 12 16:02 /usr/lib/libusb.so -> libusb.so.1
 
 Get PCSC and CCID.
 -rwx------   1 user staff     529540 Jun 16 18:24 ccid-1.0.1.tar.gz
 -rwx------   1 user staff     842654 Jun 16 18:24 pcsc-lite-1.3.1.tar.gz
 
 Unpack pcsc
-Run ./configure --enable-libusb=/usr/sfw (??)
+Run ./configure --enable-libusb (??)
 gnumake
 Make /usr/local writeable for user
 gnumake install
--- a/jdk/test/sun/security/smartcardio/TestChannel.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestChannel.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary test logical channels work
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestChannel
  */
 
--- a/jdk/test/sun/security/smartcardio/TestConnect.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestConnect.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527 6309280
  * @summary test connect() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestConnect
  */
 
--- a/jdk/test/sun/security/smartcardio/TestConnectAgain.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestConnectAgain.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary test connect works correctly if called multiple times/card removed
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestConnectAgain
  */
 
--- a/jdk/test/sun/security/smartcardio/TestControl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestControl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117 6470320
  * @summary test if transmitControlCommand() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestControl
  */
 
--- a/jdk/test/sun/security/smartcardio/TestDefault.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestDefault.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6327047
  * @summary verify that TerminalFactory.getDefault() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestDefault
  */
 
--- a/jdk/test/sun/security/smartcardio/TestDirect.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestDirect.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8046343
  * @summary Make sure that direct protocol is available
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestDirect
  */
 
--- a/jdk/test/sun/security/smartcardio/TestExclusive.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestExclusive.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary verify that beginExclusive()/endExclusive() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestExclusive
  */
 
--- a/jdk/test/sun/security/smartcardio/TestMultiplePresent.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestMultiplePresent.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117 6445367
  * @summary test that CardTerminals.waitForCard() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestMultiplePresent
  */
 
--- a/jdk/test/sun/security/smartcardio/TestPresent.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestPresent.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527
  * @summary test that the isCardPresent()/waitForX() APIs work correctly
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestPresent
  */
 
--- a/jdk/test/sun/security/smartcardio/TestTransmit.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/smartcardio/TestTransmit.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527
  * @summary test transmit() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestTransmit
  */
 
--- a/jdk/test/sun/security/ssl/SocketCreation/SocketCreation.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/ssl/SocketCreation/SocketCreation.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -139,7 +139,7 @@
             (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
 
         System.out.println("Server: Will call createServerSocket(int)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort);
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0);
         serverPort = sslServerSocket.getLocalPort();
 
         System.out.println("Server: Will accept on SSL server socket...");
@@ -157,7 +157,7 @@
             (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
 
         System.out.println("Server: Will call createServerSocket(int, int)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0,
                                                                  1);
         serverPort = sslServerSocket.getLocalPort();
 
@@ -177,7 +177,7 @@
 
         System.out.println("Server: Will call createServerSocket(int, " +
                            " int, InetAddress)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0,
                                          1,
                                          InetAddress.getByName("localhost"));
         serverPort = sslServerSocket.getLocalPort();
@@ -203,14 +203,15 @@
         if (sslServerSocket.isBound())
             throw new Exception("Server socket is already bound!");
 
-        System.out.println("Server: Will bind SSL server socket to port " +
-                           serverPort + "...");
-
-        sslServerSocket.bind(new java.net.InetSocketAddress(serverPort));
+        sslServerSocket.bind(new java.net.InetSocketAddress(0));
 
         if (!sslServerSocket.isBound())
             throw new Exception("Server socket is not bound!");
 
+        serverPort = sslServerSocket.getLocalPort();
+        System.out.println("Server: Bound SSL server socket to port " +
+                serverPort + "...");
+
         serverReady = true;
 
         System.out.println("Server: Will accept on SSL server socket...");
@@ -224,11 +225,10 @@
         SSLSocketFactory sslsf =
             (SSLSocketFactory) SSLSocketFactory.getDefault();
 
-        System.out.println("Server: Will create normal server socket bound"
-                           + " to port " + serverPort + "...");
-
-        ServerSocket ss = new ServerSocket(serverPort);
+        ServerSocket ss = new ServerSocket(0);
         serverPort = ss.getLocalPort();
+        System.out.println("Server: Created normal server socket bound"
+                + " to port " + serverPort + "...");
         System.out.println("Server: Will accept on server socket...");
         serverReady = true;
         Socket s = ss.accept();
--- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1761,7 +1761,7 @@
         //PKCS#11 tests
 
         //   1. sccs edit cert8.db key3.db
-        //Runtime.getRuntime().exec("/usr/ccs/bin/sccs edit cert8.db key3.db");
+        //Runtime.getRuntime().exec("/usr/bin/sccs edit cert8.db key3.db");
         testOK("", p11Arg + ("-storepass test12 -genkey -alias genkey" +
                 " -dname cn=genkey -keysize 512 -keyalg rsa"));
         testOK("", p11Arg + "-storepass test12 -list");
@@ -1781,7 +1781,7 @@
         testOK("", p11Arg + "-storepass test12 -list");
         assertTrue(out.indexOf("Your keystore contains 0 entries") != -1);
         //(check for empty database listing)
-        //Runtime.getRuntime().exec("/usr/ccs/bin/sccs unedit cert8.db key3.db");
+        //Runtime.getRuntime().exec("/usr/bin/sccs unedit cert8.db key3.db");
         remove("genkey.cert");
         remove("genkey.certreq");
         //  12. sccs unedit cert8.db key3.db
--- a/jdk/test/tools/launcher/RunpathTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/tools/launcher/RunpathTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -40,7 +40,7 @@
     }
 
     final String findElfReader() {
-        String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
+        String[] paths = {"/usr/sbin", "/usr/bin"};
         final String cmd = isSolaris ? "elfdump" : "readelf";
         for (String x : paths) {
             File p = new File(x);
--- a/jdk/test/tools/launcher/TooSmallStackSize.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,11 @@
  * stack size for the platform (as provided by the JVM error message when a very
  * small stack is used), and then verify that the JVM can be launched with that stack
  * size without a crash or any error messages.
+ *
+ * Note: The '-Xss<size>' and '-XX:ThreadStackSize=<k-bytes>' options
+ * both control Java thread stack size. This repo's version of the test
+ * exercises the '-Xss' option. The hotspot repo's version of the test
+ * exercises the '-XX:ThreadStackSize' VM option.
  */
 
 public class TooSmallStackSize extends TestHelper {
@@ -59,7 +64,7 @@
     static String getMinStackAllowed(TestResult tr) {
         /*
          * The JVM output will contain in one of the lines:
-         *   "The stack size specified is too small, Specify at least 100k"
+         *   "The Java thread stack size specified is too small. Specify at least 100k"
          * Although the actual size will vary. We need to extract this size
          * string from the output and return it.
          */
@@ -73,6 +78,9 @@
             }
         }
 
+        System.out.println("Expect='" + matchStr + "'");
+        System.out.println("Actual:");
+        printTestOutput(tr);
         System.out.println("FAILED: Could not get the stack size from the output");
         throw new RuntimeException("test fails");
     }
@@ -96,11 +104,15 @@
             System.out.println("PASSED: got no error message with stack size of " + stackSize);
             min_stack_allowed = stackSize;
         } else {
-            if (tr.contains("The stack size specified is too small")) {
+            String matchStr = "The Java thread stack size specified is too small";
+            if (tr.contains(matchStr)) {
                 System.out.println("PASSED: got expected error message with stack size of " + stackSize);
                 min_stack_allowed = getMinStackAllowed(tr);
             } else {
                 // Likely a crash
+                System.out.println("Expect='" + matchStr + "'");
+                System.out.println("Actual:");
+                printTestOutput(tr);
                 System.out.println("FAILED: Did not get expected error message with stack size of " + stackSize);
                 throw new RuntimeException("test fails");
             }
@@ -123,6 +135,8 @@
             System.out.println("PASSED: VM launched with minimum allowed stack size of " + stackSize);
         } else {
             // Likely a crash
+            System.out.println("Test output:");
+            printTestOutput(tr);
             System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize);
             throw new RuntimeException("test fails");
         }
--- a/jdk/test/tools/launcher/modules/addmods/AddModsTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/tools/launcher/modules/addmods/AddModsTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -31,6 +31,7 @@
  * @summary Basic test for java --add-modules
  */
 
+import java.io.File;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
@@ -224,6 +225,27 @@
 
 
     /**
+     * Tests {@code --add-modules} be specified more than once.
+     */
+    public void testWithMultipleAddModules() throws Exception {
+
+        String modulepath = MODS1_DIR.toString() + File.pathSeparator +
+                                MODS2_DIR.toString();
+        int exitValue
+            = executeTestJava("--module-path", modulepath,
+            "--add-modules", LOGGER_MODULE,
+            "--add-modules", TEST_MODULE,
+            "-m", TEST_MID,
+            "logger.Logger")
+            .outputTo(System.out)
+            .errorTo(System.out)
+            .getExitValue();
+
+        assertTrue(exitValue == 0);
+    }
+
+
+    /**
      * Attempt to run with a bad module name specified to --add-modules
      */
     public void testRunWithBadAddMods() throws Exception {
--- a/jdk/test/tools/pack200/Pack200Test.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/jdk/test/tools/pack200/Pack200Test.java	Mon Oct 03 12:35:51 2016 -0400
@@ -24,6 +24,7 @@
  /*
   * @test
   * @bug 6521334 6712743 8007902 8151901
+  * @requires (sun.arch.data.model == "64" & os.maxMemory >= 4g)
   * @summary test general packer/unpacker functionality
   *          using native and java unpackers
   * @compile -XDignore.symbol.file Utils.java Pack200Test.java
--- a/langtools/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -379,3 +379,4 @@
 f08683786207a48b652266b3b7b908e6c863c3fc jdk-9+134
 af5eb8f3ffd21288305a54ea177ffad75021a741 jdk-9+135
 c8f02f0ecbd7cd6700f47416e4b7e9d5ec20ad77 jdk-9+136
+dd56c243c199a540c9f1fbff4855f0934b32a9d0 jdk-9+137
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Mon Oct 03 12:35:51 2016 -0400
@@ -383,18 +383,16 @@
         JCTree tree = (JCTree) path.getLeaf();
         Symbol sym = TreeInfo.symbolFor(tree);
         if (sym == null) {
-            if (TreeInfo.isDeclaration(tree)) {
-                for (TreePath p = path; p != null; p = p.getParentPath()) {
-                    JCTree t = (JCTree) p.getLeaf();
-                    if (t.hasTag(JCTree.Tag.CLASSDEF)) {
-                        JCClassDecl ct = (JCClassDecl) t;
-                        if (ct.sym != null) {
-                            if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
-                                attr.attribClass(ct.pos(), ct.sym);
-                                sym = TreeInfo.symbolFor(tree);
-                            }
-                            break;
+            for (TreePath p = path; p != null; p = p.getParentPath()) {
+                JCTree t = (JCTree) p.getLeaf();
+                if (t.hasTag(JCTree.Tag.CLASSDEF)) {
+                    JCClassDecl ct = (JCClassDecl) t;
+                    if (ct.sym != null) {
+                        if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
+                            attr.attribClass(ct.pos(), ct.sym);
+                            sym = TreeInfo.symbolFor(tree);
                         }
+                        break;
                     }
                 }
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Mon Oct 03 12:35:51 2016 -0400
@@ -134,7 +134,7 @@
     /** Flag is set for nested classes that do not access instance members
      *  or `this' of an outer class and therefore don't need to be passed
      *  a this$n reference.  This value is currently set only for anonymous
-     *  classes in superclass constructor calls and only for pre 1.4 targets.
+     *  classes in superclass constructor calls.
      *  todo: use this value for optimizing away this$n parameters in
      *  other cases.
      */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Mon Oct 03 12:35:51 2016 -0400
@@ -789,7 +789,7 @@
         classExtends(final List<TypePathEntry> location,
                      final JCLambda onLambda,
                      final int pos) {
-        return classExtends(location, onLambda, -1, pos);
+        return classExtends(location, onLambda, 65535, pos);
     }
 
     /**
@@ -821,7 +821,7 @@
      * @param pos The position from the associated tree node.
      */
     public static TypeAnnotationPosition classExtends(final int pos) {
-        return classExtends(-1, pos);
+        return classExtends(65535, pos);
     }
 
     /**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Oct 03 12:35:51 2016 -0400
@@ -921,13 +921,11 @@
                 c.complete();
 
                 // If this class appears as an anonymous class
-                // in a superclass constructor call where
-                // no explicit outer instance is given,
+                // in a superclass constructor call
                 // disable implicit outer instance from being passed.
                 // (This would be an illegal access to "this before super").
                 if (env.info.isSelfCall &&
-                        env.tree.hasTag(NEWCLASS) &&
-                        ((JCNewClass)env.tree).encl == null) {
+                        env.tree.hasTag(NEWCLASS)) {
                     c.flags_field |= NOOUTERTHIS;
                 }
                 attribClass(tree.pos(), c);
@@ -1453,7 +1451,7 @@
             try {
                 close = rs.resolveQualifiedMethod(pos,
                         env,
-                        resource,
+                        types.skipTypeVars(resource, false),
                         names.close,
                         List.<Type>nil(),
                         List.<Type>nil());
@@ -2329,6 +2327,9 @@
     /** Make an attributed null check tree.
      */
     public JCExpression makeNullCheck(JCExpression arg) {
+        // optimization: new Outer() can never be null; skip null check
+        if (arg.getTag() == NEWCLASS)
+            return arg;
         // optimization: X.this is never null; skip null check
         Name name = TreeInfo.name(arg);
         if (name == names._this || name == names._super) return arg;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1098,7 +1098,7 @@
                     if (types.asSuper(sup, syms.autoCloseableType.tsym) != null) {
                         Symbol closeMethod = rs.resolveQualifiedMethod(tree,
                                 attrEnv,
-                                sup,
+                                types.skipTypeVars(sup, false),
                                 names.close,
                                 List.<Type>nil(),
                                 List.<Type>nil());
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java	Mon Oct 03 12:35:51 2016 -0400
@@ -287,6 +287,7 @@
 
             case MULTIRELEASE:
                 multiReleaseValue = value;
+                locations.setMultiReleaseValue(value);
                 return true;
 
             default:
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Mon Oct 03 12:35:51 2016 -0400
@@ -130,6 +130,7 @@
 
     Map<Path, FileSystem> fileSystems = new LinkedHashMap<>();
     List<Closeable> closeables = new ArrayList<>();
+    private Map<String,String> fsEnv = Collections.emptyMap();
 
     Locations() {
         initHandlers();
@@ -207,6 +208,10 @@
         return entries;
     }
 
+    public void setMultiReleaseValue(String multiReleaseValue) {
+        fsEnv = Collections.singletonMap("multi-release", multiReleaseValue);
+    }
+
     /**
      * Utility class to help evaluate a path option. Duplicate entries are ignored, jar class paths
      * can be expanded.
@@ -1047,7 +1052,8 @@
                 }
 
                 if (p.getFileName().toString().endsWith(".jar") && fsInfo.exists(p)) {
-                    try (FileSystem fs = FileSystems.newFileSystem(p, null)) {
+                    URI uri = URI.create("jar:" + p.toUri());
+                    try (FileSystem fs = FileSystems.newFileSystem(uri, fsEnv, null)) {
                         Path moduleInfoClass = fs.getPath("module-info.class");
                         if (Files.exists(moduleInfoClass)) {
                             String moduleName = readModuleName(moduleInfoClass);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1503,13 +1503,35 @@
                 }
             }
             public void visitClassDef(JCClassDecl node) {
+                super.visitClassDef(node);
+                // remove generated constructor that may have been added during attribution:
+                List<JCTree> beforeConstructor = List.nil();
+                List<JCTree> defs = node.defs;
+                while (defs.nonEmpty() && !defs.head.hasTag(Tag.METHODDEF)) {
+                    beforeConstructor = beforeConstructor.prepend(defs.head);
+                    defs = defs.tail;
+                }
+                if (defs.nonEmpty() &&
+                    (((JCMethodDecl) defs.head).mods.flags & Flags.GENERATEDCONSTR) != 0) {
+                    defs = defs.tail;
+                    while (beforeConstructor.nonEmpty()) {
+                        defs = defs.prepend(beforeConstructor.head);
+                        beforeConstructor = beforeConstructor.tail;
+                    }
+                    node.defs = defs;
+                }
                 if (node.sym != null) {
                     node.sym.completer = new ImplicitCompleter(topLevel);
                 }
                 node.sym = null;
-                super.visitClassDef(node);
             }
             public void visitMethodDef(JCMethodDecl node) {
+                // remove super constructor call that may have been added during attribution:
+                if (TreeInfo.isConstructor(node) && node.sym != null && node.sym.owner.isEnum() &&
+                    node.body.stats.nonEmpty() && TreeInfo.isSuperCall(node.body.stats.head) &&
+                    node.body.stats.head.pos == node.body.pos) {
+                    node.body.stats = node.body.stats.tail;
+                }
                 node.sym = null;
                 super.visitMethodDef(node);
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -424,12 +424,15 @@
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             boolean altColor = true;
             for (Element member : deprmembers) {
-                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
+                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getDeprecatedLink(member));
+                HtmlTree tr = HtmlTree.TR(thRow);
+                HtmlTree td = new HtmlTree(HtmlTag.TD);
+                td.addStyle(HtmlStyle.colLast);
                 List<? extends DocTree> deprTrees = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
                 if (!deprTrees.isEmpty()) {
                     writer.addInlineDeprecatedComment(member, deprTrees.get(0), td);
                 }
-                HtmlTree tr = HtmlTree.TR(td);
+                tr.addContent(td);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                 altColor = !altColor;
                 tbody.addContent(tr);
@@ -477,8 +480,9 @@
                 tdFirst.addStyle(HtmlStyle.colFirst);
                 writer.addSummaryType(this, element, tdFirst);
                 tr.addContent(tdFirst);
-                HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
-                tdLast.addStyle(HtmlStyle.colLast);
+                HtmlTree thType = new HtmlTree(HtmlTag.TH);
+                thType.addStyle(HtmlStyle.colSecond);
+                thType.addAttr(HtmlAttr.SCOPE, "row");
                 if (te != null
                         && !utils.isConstructor(element)
                         && !utils.isClass(element)
@@ -487,14 +491,17 @@
                     HtmlTree name = new HtmlTree(HtmlTag.SPAN);
                     name.addStyle(HtmlStyle.typeNameLabel);
                     name.addContent(name(te) + ".");
-                    tdLast.addContent(name);
+                    thType.addContent(name);
                 }
                 addSummaryLink(utils.isClass(element) || utils.isInterface(element)
                         ? LinkInfoImpl.Kind.CLASS_USE
                         : LinkInfoImpl.Kind.MEMBER,
-                    te, element, tdLast);
-                writer.addSummaryLinkComment(this, element, tdLast);
-                tr.addContent(tdLast);
+                        te, element, thType);
+                tr.addContent(thType);
+                HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+                tdDesc.addStyle(HtmlStyle.colLast);
+                writer.addSummaryLinkComment(this, element, tdDesc);
+                tr.addContent(tdDesc);
                 tbody.addContent(tr);
             }
             table.addContent(tbody);
@@ -557,12 +564,15 @@
         HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
         tdSummaryType.addStyle(HtmlStyle.colFirst);
         writer.addSummaryType(this, member, tdSummaryType);
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-        setSummaryColumnStyle(tdSummary);
-        addSummaryLink(tElement, member, tdSummary);
-        writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
         HtmlTree tr = HtmlTree.TR(tdSummaryType);
-        tr.addContent(tdSummary);
+        HtmlTree thSummaryLink = new HtmlTree(HtmlTag.TH);
+        setSummaryColumnStyleAndScope(thSummaryLink);
+        addSummaryLink(tElement, member, thSummaryLink);
+        tr.addContent(thSummaryLink);
+        HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+        tdDesc.addStyle(HtmlStyle.colLast);
+        writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
+        tr.addContent(tdDesc);
         if (utils.isMethod(member) && !utils.isAnnotationType(member)) {
             int methodType = utils.isStatic(member) ? MethodTypes.STATIC.value() :
                     MethodTypes.INSTANCE.value();
@@ -612,12 +622,13 @@
     }
 
     /**
-     * Set the style for the summary column.
+     * Set the style and scope attribute for the summary column.
      *
-     * @param tdTree the column for which the style will be set
+     * @param thTree the column for which the style and scope attribute will be set
      */
-    public void setSummaryColumnStyle(HtmlTree tdTree) {
-        tdTree.addStyle(HtmlStyle.colLast);
+    public void setSummaryColumnStyleAndScope(HtmlTree thTree) {
+        thTree.addStyle(HtmlStyle.colSecond);
+        thTree.addAttr(HtmlAttr.SCOPE, "row");
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 
@@ -222,9 +220,7 @@
      */
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-                configuration.getText("doclet.0_and_1",
-                        configuration.getText("doclet.Fields"),
-                        configuration.getText("doclet.Description")));
+                resources.getText("doclet.Fields"), resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -133,9 +133,8 @@
      */
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-                configuration.getText("doclet.0_and_1",
-                        configuration.getText("doclet.Annotation_Type_Optional_Member"),
-                        configuration.getText("doclet.Description")));
+                resources.getText("doclet.Annotation_Type_Optional_Member"),
+                resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.Arrays;
 import java.util.List;
 
@@ -223,9 +222,7 @@
      */
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-                configuration.getText("doclet.0_and_1",
-                        configuration.getText("doclet.Annotation_Type_Required_Member"),
-                        configuration.getText("doclet.Description")));
+                resources.getText("doclet.Annotation_Type_Required_Member"), resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -330,8 +330,8 @@
             HtmlTree tr = new HtmlTree(HtmlTag.TR);
             tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
             altColor = !altColor;
-            Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst, getPackageLink(pkg));
-            tr.addContent(tdFirst);
+            Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getPackageLink(pkg));
+            tr.addContent(thFirst);
             HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
             tdLast.addStyle(HtmlStyle.colLast);
             addSummaryComment(pkg, tdLast);
@@ -380,9 +380,9 @@
      * @param contentTree the content tree to which the package use information will be added
      */
     protected void addPackageUse(PackageElement pkg, Content contentTree) {
-        Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
+        Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
                 getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))));
-        contentTree.addContent(tdFirst);
+        contentTree.addContent(thFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
         addSummaryComment(pkg, tdLast);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.Modifier;
@@ -332,7 +331,7 @@
         Content nameContent = getDocLink(LinkInfoImpl.Kind.CONSTANT_SUMMARY,
                 member, member.getSimpleName(), false);
         Content code = HtmlTree.CODE(nameContent);
-        return HtmlTree.TD(code);
+        return HtmlTree.TH_ROW_SCOPE(HtmlStyle.colSecond, code);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,13 +25,13 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.*;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -168,11 +168,13 @@
      * {@inheritDoc}
      */
     @Override
-    public void setSummaryColumnStyle(HtmlTree tdTree) {
-        if (foundNonPubConstructor)
-            tdTree.addStyle(HtmlStyle.colLast);
-        else
-            tdTree.addStyle(HtmlStyle.colOne);
+    public void setSummaryColumnStyleAndScope(HtmlTree thTree) {
+        if (foundNonPubConstructor) {
+            thTree.addStyle(HtmlStyle.colSecond);
+        } else {
+            thTree.addStyle(HtmlStyle.colFirst);
+        }
+        thTree.addAttr(HtmlAttr.SCOPE, "row");
     }
 
     /**
@@ -267,9 +269,8 @@
         if (foundNonPubConstructor) {
             header.add(resources.getText("doclet.Modifier"));
         }
-        header.add(resources.getText("doclet.0_and_1",
-                resources.getText("doclet.Constructor"),
-                resources.getText("doclet.Description")));
+        header.add(resources.getText("doclet.Constructor"));
+        header.add(resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -261,14 +261,13 @@
         for (DeprElementKind kind : DeprElementKind.values()) {
             if (deprapi.hasDocumentation(kind)) {
                 addAnchor(deprapi, kind, div);
-                memberTableSummary =
-                        configuration.getText("doclet.Member_Table_Summary",
-                        configuration.getText(getHeadingKey(kind)),
-                        configuration.getText(getSummaryKey(kind)));
+                memberTableSummary
+                        = resources.getText("doclet.Member_Table_Summary",
+                                resources.getText(getHeadingKey(kind)),
+                                resources.getText(getSummaryKey(kind)));
                 List<String> memberTableHeader = new ArrayList<>();
-                memberTableHeader.add(configuration.getText("doclet.0_and_1",
-                        configuration.getText(getHeaderKey(kind)),
-                        configuration.getText("doclet.Description")));
+                memberTableHeader.add(resources.getText(getHeaderKey(kind)));
+                memberTableHeader.add(resources.getText("doclet.Description"));
                 if (kind == DeprElementKind.PACKAGE)
                     addPackageDeprecatedAPI(deprapi.getSet(kind),
                             getHeadingKey(kind), memberTableSummary, memberTableHeader, div);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,8 +25,7 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -34,6 +33,7 @@
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -214,9 +214,8 @@
      */
     @Override
     public List<String> getSummaryTableHeader(Element member) {
-        List<String> header = Arrays.asList(configuration.getText("doclet.0_and_1",
-                configuration.getText("doclet.Enum_Constant"),
-                configuration.getText("doclet.Description")));
+        List<String> header = Arrays.asList(resources.getText("doclet.Enum_Constant"),
+                resources.getText("doclet.Description"));
         return header;
     }
 
@@ -259,8 +258,9 @@
      * {@inheritDoc}
      */
     @Override
-    public void setSummaryColumnStyle(HtmlTree tdTree) {
-        tdTree.addStyle(HtmlStyle.colOne);
+    public void setSummaryColumnStyleAndScope(HtmlTree thTree) {
+        thTree.addStyle(HtmlStyle.colFirst);
+        thTree.addAttr(HtmlAttr.SCOPE, "row");
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,7 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
 import java.util.Arrays;
 import java.util.List;
 
@@ -215,9 +214,7 @@
     @Override
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-            resources.getText("doclet.0_and_1",
-                    resources.getText("doclet.Field"),
-                    resources.getText("doclet.Description")));
+                resources.getText("doclet.Field"), resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -405,7 +405,7 @@
                 }
                 Content classContent = getLink(new LinkInfoImpl(
                         configuration, LinkInfoImpl.Kind.PACKAGE, te));
-                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
+                Content tdClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
                 HtmlTree tr = HtmlTree.TR(tdClass);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                 altColor = !altColor;
@@ -942,16 +942,20 @@
         Content tr = new HtmlTree(HtmlTag.TR);
         final int size = header.size();
         Content tableHeader;
-        if (size == 1) {
+        if (size == 2) {
             tableHeader = new StringContent(header.get(0));
-            tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
+            tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
+            tableHeader = new StringContent(header.get(1));
+            tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
             return tr;
         }
         for (int i = 0; i < size; i++) {
             tableHeader = new StringContent(header.get(i));
-            if(i == 0)
+            if (i == 0)
                 tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
-            else if(i == (size - 1))
+            else if (i == 1)
+                tr.addContent(HtmlTree.TH(HtmlStyle.colSecond, scope, tableHeader));
+            else if (i == (size - 1))
                 tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
             else
                 tr.addContent(HtmlTree.TH(scope, tableHeader));
@@ -1062,13 +1066,16 @@
             boolean altColor = true;
             for (Element e : deprPkgs) {
                 PackageElement pkg = (PackageElement) e;
-                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
+                HtmlTree thRow = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
                         getPackageLink(pkg, getPackageName(pkg)));
+                HtmlTree tr = HtmlTree.TR(thRow);
+                HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+                tdDesc.addStyle(HtmlStyle.colLast);
                 List<? extends DocTree> tags = utils.getDeprecatedTrees(pkg);
                 if (!tags.isEmpty()) {
-                    addInlineDeprecatedComment(pkg, tags.get(0), td);
+                    addInlineDeprecatedComment(pkg, tags.get(0), tdDesc);
                 }
-                HtmlTree tr = HtmlTree.TR(td);
+                tr.addContent(tdDesc);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                 altColor = !altColor;
                 tbody.addContent(tr);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -261,9 +261,7 @@
     @Override
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-                resources.getText("doclet.0_and_1",
-                        resources.getText("doclet.Method"),
-                        resources.getText("doclet.Description")));
+                resources.getText("doclet.Method"), resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -159,11 +159,11 @@
         for (ModuleElement mdle : modules) {
             if (!mdle.isUnnamed()) {
                 Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
-                Content tdModule = HtmlTree.TD(HtmlStyle.colFirst, moduleLinkContent);
+                Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
                 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
                 tdSummary.addStyle(HtmlStyle.colLast);
                 addSummaryComment(mdle, tdSummary);
-                HtmlTree tr = HtmlTree.TR(tdModule);
+                HtmlTree tr = HtmlTree.TR(thModule);
                 tr.addContent(tdSummary);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                 tbody.addContent(tr);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -294,11 +294,11 @@
     public void addRequiresList(ModuleElement.RequiresDirective direct, Content tbody, boolean altColor) {
         ModuleElement m = direct.getDependency();
         Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName().toString()));
-        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, moduleLinkContent);
+        Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
         tdSummary.addStyle(HtmlStyle.colLast);
         addSummaryComment(m, tdSummary);
-        HtmlTree tr = HtmlTree.TR(tdPackage);
+        HtmlTree tr = HtmlTree.TR(thPackage);
         tr.addContent(tdSummary);
         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
         tbody.addContent(tr);
@@ -347,27 +347,27 @@
     public void addExportedPackagesList(ModuleElement.ExportsDirective direct, Content tbody, boolean altColor) {
         PackageElement pkg = direct.getPackage();
         Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
-        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, pkgLinkContent);
-        HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
-        tdModules.addStyle(HtmlStyle.colSecond);
+        Content tdPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
+        HtmlTree thModules = new HtmlTree(HtmlTag.TD);
+        thModules.addStyle(HtmlStyle.colSecond);
         List<? extends ModuleElement> targetModules = direct.getTargetModules();
         if (targetModules != null) {
             List<? extends ModuleElement> mElements = direct.getTargetModules();
             for (int i = 0; i < mElements.size(); i++) {
                 if (i > 0) {
-                    tdModules.addContent(new HtmlTree(HtmlTag.BR));
+                    thModules.addContent(new HtmlTree(HtmlTag.BR));
                 }
                 ModuleElement m = mElements.get(i);
-                tdModules.addContent(new StringContent(m.getQualifiedName().toString()));
+                thModules.addContent(new StringContent(m.getQualifiedName().toString()));
             }
         } else {
-            tdModules.addContent(configuration.getText("doclet.All_Modules"));
+            thModules.addContent(configuration.getText("doclet.All_Modules"));
         }
         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
         tdSummary.addStyle(HtmlStyle.colLast);
         addSummaryComment(pkg, tdSummary);
         HtmlTree tr = HtmlTree.TR(tdPackage);
-        tr.addContent(tdModules);
+        tr.addContent(thModules);
         tr.addContent(tdSummary);
         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
         tbody.addContent(tr);
@@ -428,11 +428,11 @@
     public void addUsesList(ModuleElement.UsesDirective direct, Content tbody, boolean altColor) {
         TypeElement type = direct.getService();
         Content typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, type));
-        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, typeLinkContent);
+        Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
         tdSummary.addStyle(HtmlStyle.colLast);
         addSummaryComment(type, tdSummary);
-        HtmlTree tr = HtmlTree.TR(tdPackage);
+        HtmlTree tr = HtmlTree.TR(thPackage);
         tr.addContent(tdSummary);
         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
         tbody.addContent(tr);
@@ -463,18 +463,18 @@
         TypeElement srv = direct.getService();
         Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
         Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
-        HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent);
-        tdType.addContent(new HtmlTree(HtmlTag.BR));
-        tdType.addContent("(");
+        HtmlTree thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, srvLinkContent);
+        thType.addContent(new HtmlTree(HtmlTag.BR));
+        thType.addContent("(");
         HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
-        tdType.addContent(implSpan);
-        tdType.addContent(Contents.SPACE);
-        tdType.addContent(implLinkContent);
-        tdType.addContent(")");
+        thType.addContent(implSpan);
+        thType.addContent(Contents.SPACE);
+        thType.addContent(implLinkContent);
+        thType.addContent(")");
         HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
         tdDesc.addStyle(HtmlStyle.colLast);
         addSummaryComment(srv, tdDesc);
-        HtmlTree tr = HtmlTree.TR(tdType);
+        HtmlTree tr = HtmlTree.TR(thType);
         tr.addContent(tdDesc);
         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
         tbody.addContent(tr);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 
@@ -118,15 +116,11 @@
     public List<String> getSummaryTableHeader(Element member) {
         if (utils.isInterface(member)) {
             return Arrays.asList(writer.getModifierTypeHeader(),
-                configuration.getText("doclet.0_and_1",
-                    configuration.getText("doclet.Interface"),
-                    configuration.getText("doclet.Description")));
+                    resources.getText("doclet.Interface"), resources.getText("doclet.Description"));
 
         } else {
             return Arrays.asList(writer.getModifierTypeHeader(),
-                configuration.getText("doclet.0_and_1",
-                    configuration.getText("doclet.Class"),
-                    configuration.getText("doclet.Description")));
+                    resources.getText("doclet.Class"), resources.getText("doclet.Description"));
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -151,11 +151,11 @@
             if (!pkg.isUnnamed()) {
                 if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                     Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
-                    Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
+                    Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, packageLinkContent);
                     HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
                     tdSummary.addStyle(HtmlStyle.colLast);
                     addSummaryComment(pkg, tdSummary);
-                    HtmlTree tr = HtmlTree.TR(tdPackage);
+                    HtmlTree tr = HtmlTree.TR(thPackage);
                     tr.addContent(tdSummary);
                     tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
                     tbody.addContent(tr);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Mon Oct 03 12:35:51 2016 -0400
@@ -187,9 +187,7 @@
      */
     protected void addClassList(Content contentTree) {
         List<String> classTableHeader = Arrays.asList(
-            configuration.getText("doclet.0_and_1",
-                    configuration.getText("doclet.Class"),
-                    configuration.getText("doclet.Description")));
+                resources.getText("doclet.Class"), resources.getText("doclet.Description"));
         for (String packageName : usingPackageToUsedClasses.keySet()) {
             PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
             HtmlTree li = new HtmlTree(HtmlTag.LI);
@@ -234,10 +232,13 @@
         DocPath dp = pathString(usedClass,
                 DocPaths.CLASS_USE.resolve(DocPath.forName(utils, usedClass)));
         StringContent stringContent = new StringContent(utils.getSimpleName(usedClass));
-        Content td = HtmlTree.TD(HtmlStyle.colOne,
+        Content thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
                 getHyperLink(dp.fragment(getPackageAnchorName(pkg)), stringContent));
-        addIndexComment(usedClass, td);
-        contentTree.addContent(td);
+        contentTree.addContent(thType);
+        HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+        tdDesc.addStyle(HtmlStyle.colLast);
+        addIndexComment(usedClass, tdDesc);
+        contentTree.addContent(tdDesc);
     }
 
     /**
@@ -247,10 +248,10 @@
      * @param contentTree the content tree to which the information will be added
      */
     protected void addPackageUse(PackageElement pkg, Content contentTree) {
-        Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
+        Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
                 getHyperLink(utils.getPackageName(pkg),
                 new StringContent(utils.getPackageName(pkg))));
-        contentTree.addContent(tdFirst);
+        contentTree.addContent(thFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
         if (pkg != null && !pkg.isUnnamed()) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -229,8 +229,8 @@
                 }
                 Content classContent = getLink(new LinkInfoImpl(
                         configuration, LinkInfoImpl.Kind.PACKAGE, klass));
-                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
-                HtmlTree tr = HtmlTree.TR(tdClass);
+                Content thClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
+                HtmlTree tr = HtmlTree.TR(thClass);
                 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
 
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 
@@ -235,10 +233,8 @@
      */
     @Override
     public List<String> getSummaryTableHeader(Element member) {
-        List<String> header = Arrays.asList(configuration.getText("doclet.Type"),
-                configuration.getText("doclet.0_and_1",
-                        configuration.getText("doclet.Property"),
-                        configuration.getText("doclet.Description")));
+        List<String> header = Arrays.asList(resources.getText("doclet.Type"),
+                resources.getText("doclet.Property"), resources.getText("doclet.Description"));
         return header;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Oct 03 12:35:51 2016 -0400
@@ -48,7 +48,6 @@
     classUseContainer,
     colFirst,
     colLast,
-    colOne,
     colSecond,
     constantsSummary,
     constantValuesContainer,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java	Mon Oct 03 12:35:51 2016 -0400
@@ -808,6 +808,17 @@
     }
 
     /**
+     * Generates a TH tag with style class, scope attribute and some content.
+     *
+     * @param styleClass style for the tag
+     * @param body content for the tag
+     * @return an HtmlTree object for the TH tag
+     */
+    public static HtmlTree TH_ROW_SCOPE(HtmlStyle styleClass, Content body) {
+        return TH(styleClass, "row", body);
+    }
+
+    /**
      * Generates a TITLE tag with some content.
      *
      * @param body content for the tag
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Oct 03 12:35:51 2016 -0400
@@ -528,20 +528,23 @@
     float:left;
 
 }
+.rowColor th, .altColor th {
+    font-weight:normal;
+}
 .overviewSummary td, .memberSummary td, .typeSummary td,
 .useSummary td, .constantsSummary td, .deprecatedSummary td,
 .requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {
     text-align:left;
     padding:0px 0px 12px 10px;
 }
-th.colOne, th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th,
-td.colOne, td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
+th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th,
+td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
     vertical-align:top;
     padding-right:0px;
     padding-top:8px;
     padding-bottom:3px;
 }
-th.colFirst, th.colSecond, th.colLast, th.colOne, .constantsSummary th, .packagesSummary th {
+th.colFirst, th.colSecond, th.colLast, .constantsSummary th, .packagesSummary th {
     background:#dee3e9;
     text-align:left;
     padding:8px 3px 3px 7px;
@@ -550,10 +553,10 @@
     white-space:nowrap;
     font-size:13px;
 }
-td.colLast, th.colLast {
+td.colSecond, th.colSecond, td.colLast, th.colLast {
     font-size:13px;
 }
-td.colOne, th.colOne, .constantsSummary th, .packagesSummary th {
+.constantsSummary th, .packagesSummary th {
     font-size:13px;
 }
 .providesSummary th.colFirst, .providesSummary th.colLast, .providesSummary td.colFirst,
@@ -567,23 +570,22 @@
 .packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,
 .usesSummary td.colFirst, .usesSummary th.colFirst,
 .useSummary td.colFirst, .useSummary th.colFirst,
-.overviewSummary td.colOne, .overviewSummary th.colOne,
 .memberSummary td.colFirst, .memberSummary th.colFirst,
-.memberSummary td.colOne, .memberSummary th.colOne,
+.memberSummary td.colSecond, .memberSummary th.colSecond,
 .typeSummary td.colFirst{
     width:25%;
     vertical-align:top;
 }
-td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover, th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
     font-weight:bold;
 }
 .tableSubHeadingColor {
     background-color:#EEEEFF;
 }
-.altColor {
+.altColor, .altColor th {
     background-color:#FFFFFF;
 }
-.rowColor {
+.rowColor, .rowColor th {
     background-color:#EEEEEF;
 }
 /*
@@ -774,4 +776,4 @@
 .searchTagHolderResult {
     font-style:italic;
     font-size:12px;
-}
+}
\ No newline at end of file
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Mon Oct 03 12:35:51 2016 -0400
@@ -130,10 +130,7 @@
             break;
         // class extends or implements clause
         case CLASS_EXTENDS:
-            int in = cr.readUnsignedShort();
-            if (in == 0xFFFF)
-                in = -1;
-            position.type_index = in;
+            position.type_index = cr.readUnsignedShort();;
             break;
         // throws
         case THROWS:
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java	Mon Oct 03 12:35:51 2016 -0400
@@ -256,7 +256,7 @@
         // return classname or package name depending on the level
         private String getLocationName(Location o) {
             if (level == Type.CLASS || level == Type.VERBOSE) {
-                return o.getClassName();
+                return VersionHelper.get(o.getClassName());
             } else {
                 String pkg = o.getPackageName();
                 return pkg.isEmpty() ? "<unnamed>" : pkg;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Archive.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Archive.java	Mon Oct 03 12:35:51 2016 -0400
@@ -45,9 +45,9 @@
  * Represents the source of the class files.
  */
 public class Archive implements Closeable {
-    public static Archive getInstance(Path p) {
+    public static Archive getInstance(Path p, Runtime.Version version) {
         try {
-            return new Archive(p, ClassFileReader.newInstance(p));
+            return new Archive(p, ClassFileReader.newInstance(p, version));
         } catch (IOException e) {
             throw new UncheckedIOException(e);
         }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Mon Oct 03 12:35:51 2016 -0400
@@ -29,6 +29,8 @@
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 
+import jdk.internal.util.jar.VersionedStream;
+
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -50,6 +52,7 @@
 import java.util.jar.JarFile;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import java.util.zip.ZipFile;
 
 /**
  * ClassFileReader reads ClassFile(s) of a given path that can be
@@ -60,6 +63,13 @@
      * Returns a ClassFileReader instance of a given path.
      */
     public static ClassFileReader newInstance(Path path) throws IOException {
+        return newInstance(path, JarFile.baseVersion());
+    }
+
+    /**
+     * Returns a ClassFileReader instance of a given path.
+     */
+    public static ClassFileReader newInstance(Path path, Runtime.Version version) throws IOException {
         if (Files.notExists(path)) {
             throw new FileNotFoundException(path.toString());
         }
@@ -67,20 +77,13 @@
         if (Files.isDirectory(path)) {
             return new DirectoryReader(path);
         } else if (path.getFileName().toString().endsWith(".jar")) {
-            return new JarFileReader(path);
+            return new JarFileReader(path, version);
         } else {
             return new ClassFileReader(path);
         }
     }
 
     /**
-     * Returns a ClassFileReader instance of a given JarFile.
-     */
-    public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
-        return new JarFileReader(path, jf);
-    }
-
-    /**
      * Returns a ClassFileReader instance of a given FileSystem and path.
      *
      * This method is used for reading classes from jrtfs.
@@ -302,13 +305,16 @@
 
     static class JarFileReader extends ClassFileReader {
         private final JarFile jarfile;
-        JarFileReader(Path path) throws IOException {
-            this(path, new JarFile(path.toFile(), false));
+        private final Runtime.Version version;
+
+        JarFileReader(Path path, Runtime.Version version) throws IOException {
+            this(path, openJarFile(path.toFile(), version), version);
         }
 
-        JarFileReader(Path path, JarFile jf) throws IOException {
+        JarFileReader(Path path, JarFile jf, Runtime.Version version) throws IOException {
             super(path);
             this.jarfile = jf;
+            this.version = version;
         }
 
         @Override
@@ -316,9 +322,26 @@
             jarfile.close();
         }
 
+        private static JarFile openJarFile(File f, Runtime.Version version)
+                throws IOException {
+            JarFile jf;
+            if (version == null) {
+                jf = new JarFile(f, false);
+                if (jf.isMultiRelease()) {
+                    throw new MultiReleaseException("err.multirelease.option.notfound", f.getName());
+                }
+            } else {
+                jf = new JarFile(f, false, ZipFile.OPEN_READ, version);
+                if (!jf.isMultiRelease()) {
+                    throw new MultiReleaseException("err.multirelease.option.exists", f.getName());
+                }
+            }
+            return jf;
+        }
+
         protected Set<String> scan() {
-            try (JarFile jf = new JarFile(path.toFile())) {
-                return jf.stream().map(JarEntry::getName)
+            try (JarFile jf = openJarFile(path.toFile(), version)) {
+                return VersionedStream.stream(jf).map(JarEntry::getName)
                          .filter(n -> n.endsWith(".class"))
                          .collect(Collectors.toSet());
             } catch (IOException e) {
@@ -348,15 +371,14 @@
         }
 
         protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
-            InputStream is = null;
-            try {
-                is = jarfile.getInputStream(e);
-                return ClassFile.read(is);
+            try (InputStream is = jarfile.getInputStream(e)) {
+                ClassFile cf = ClassFile.read(is);
+                if (jarfile.isMultiRelease()) {
+                    VersionHelper.add(jarfile, e, cf);
+                }
+                return cf;
             } catch (ConstantPoolException ex) {
                 throw new ClassFileError(ex);
-            } finally {
-                if (is != null)
-                    is.close();
             }
         }
 
@@ -370,6 +392,21 @@
         }
     }
 
+    Enumeration<JarEntry> versionedEntries(JarFile jf) {
+        Iterator<JarEntry> it = VersionedStream.stream(jf).iterator();
+        return new Enumeration<>() {
+            @Override
+            public boolean hasMoreElements() {
+                return it.hasNext();
+            }
+
+            @Override
+            public JarEntry nextElement() {
+                return it.next();
+            }
+        };
+    }
+
     class JarFileIterator implements Iterator<ClassFile> {
         protected final JarFileReader reader;
         protected Enumeration<JarEntry> entries;
@@ -388,7 +425,7 @@
             if (jarfile == null) return;
 
             this.jf = jarfile;
-            this.entries = jf.entries();
+            this.entries = versionedEntries(jf);
             this.nextEntry = nextEntry();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Mon Oct 03 12:35:51 2016 -0400
@@ -81,19 +81,22 @@
     private final List<Archive> initialArchives = new ArrayList<>();
     private final Set<Module> rootModules = new HashSet<>();
     private final Configuration configuration;
+    private final Runtime.Version version;
 
     private JdepsConfiguration(SystemModuleFinder systemModulePath,
                                ModuleFinder finder,
                                Set<String> roots,
                                List<Path> classpaths,
                                List<Archive> initialArchives,
-                               boolean allDefaultModules)
+                               boolean allDefaultModules,
+                               Runtime.Version version)
         throws IOException
     {
         trace("root: %s%n", roots);
 
         this.system = systemModulePath;
         this.finder = finder;
+        this.version = version;
 
         // build root set for resolution
         Set<String> mods = new HashSet<>(roots);
@@ -121,7 +124,7 @@
         // classpath archives
         for (Path p : classpaths) {
             if (Files.exists(p)) {
-                Archive archive = Archive.getInstance(p);
+                Archive archive = Archive.getInstance(p, version);
                 addPackagesInUnnamedModule(archive);
                 classpathArchives.add(archive);
             }
@@ -292,7 +295,7 @@
             if (location.getScheme().equals("jrt")) {
                 reader = system.getClassReader(mn);
             } else {
-                reader = ClassFileReader.newInstance(Paths.get(location));
+                reader = ClassFileReader.newInstance(Paths.get(location), version);
             }
 
             builder.classes(reader);
@@ -304,6 +307,10 @@
         }
     }
 
+    public Runtime.Version getVersion() {
+        return version;
+    }
+
     /*
      * Close all archives e.g. JarFile
      */
@@ -476,6 +483,7 @@
         ModuleFinder appModulePath;
         boolean addAllApplicationModules;
         boolean addAllDefaultModules;
+        Runtime.Version version;
 
         public Builder() {
             this.systemModulePath = new SystemModuleFinder();
@@ -526,8 +534,13 @@
             return this;
         }
 
+        public Builder multiRelease(Runtime.Version version) {
+            this.version = version;
+            return this;
+        }
+
         public Builder addRoot(Path path) {
-            Archive archive = Archive.getInstance(path);
+            Archive archive = Archive.getInstance(path, version);
             if (archive.contains(MODULE_INFO)) {
                 paths.add(path);
             } else {
@@ -569,7 +582,8 @@
                                           rootModules,
                                           classPaths,
                                           initialArchives,
-                                          addAllDefaultModules);
+                                          addAllDefaultModules,
+                                          version);
         }
 
         private static ModuleFinder createModulePathFinder(String mpaths) {
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Mon Oct 03 12:35:51 2016 -0400
@@ -36,6 +36,7 @@
 import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.*;
+import java.util.jar.JarFile;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -389,6 +390,23 @@
                 }
             }
         },
+        new Option(true, "--multi-release") {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                if (arg.equalsIgnoreCase("base")) {
+                    task.options.multiRelease = JarFile.baseVersion();
+                } else {
+                    try {
+                        int v = Integer.parseInt(arg);
+                        if (v < 9) {
+                            throw new BadArgs("err.invalid.arg.for.option", arg);
+                        }
+                    } catch (NumberFormatException x) {
+                        throw new BadArgs("err.invalid.arg.for.option", arg);
+                    }
+                    task.options.multiRelease = Runtime.Version.parse(arg);
+                }
+            }
+        },
     };
 
     private static final String PROGNAME = "jdeps";
@@ -481,6 +499,9 @@
         } catch (IOException e) {
             e.printStackTrace();
             return EXIT_CMDERR;
+        } catch (MultiReleaseException e) {
+            reportError(e.getKey(), (Object)e.getMsg());
+            return EXIT_CMDERR;  // could be EXIT_ABNORMAL sometimes
         } finally {
             log.flush();
         }
@@ -541,11 +562,16 @@
         if (options.classpath != null)
             builder.addClassPath(options.classpath);
 
+        if (options.multiRelease != null)
+            builder.multiRelease(options.multiRelease);
+
         // build the root set of archives to be analyzed
         for (String s : inputArgs) {
             Path p = Paths.get(s);
             if (Files.exists(p)) {
                 builder.addRoot(p);
+            } else {
+                warning("warn.invalid.arg", s);
             }
         }
 
@@ -839,6 +865,7 @@
         String modulePath;
         String rootModule;
         Set<String> addmods = new HashSet<>();
+        Runtime.Version multiRelease;
 
         boolean hasFilter() {
             return numFilters() > 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/MultiReleaseException.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,69 @@
+/*
+ * 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 com.sun.tools.jdeps;
+
+/**
+ * Signals that an exception of some sort has occurred while processing
+ * a multi-release jar file.
+ *
+ * @since   9
+ */
+class MultiReleaseException extends RuntimeException {
+    private static final long serialVersionUID = 4474870142461654108L;
+    private final String key;
+    private final String[] msg;
+
+    /**
+     * Constructs an {@code MultiReleaseException} with the specified detail
+     * error message array.
+     *
+     * @param key
+     *        The key that identifies the message in the jdeps.properties file
+     * @param msg
+     *        The detail message array
+     */
+    public MultiReleaseException(String key, String... msg) {
+        super();
+        this.key = key;
+        this.msg = msg;
+    }
+
+    /**
+     * Returns the resource message key
+     */
+    public String getKey() {
+        return key;
+    }
+
+    /**
+     * Returns the detailed error message array.
+     *
+     * @return the detailed error message array
+     */
+    public String[] getMsg() {
+        return msg;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,75 @@
+/*
+ * 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 com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import jdk.internal.misc.SharedSecrets;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class VersionHelper {
+    private static final String META_INF_VERSIONS = "META-INF/versions/";
+    private static final Map<String,String> nameToVersion = new ConcurrentHashMap<>();
+
+    public static String get(String classname) {
+        if (nameToVersion.containsKey(classname)) {
+            return nameToVersion.get(classname) + "/" + classname;
+        }
+        return classname;
+    }
+
+    public static void add(JarFile jarfile, JarEntry e, ClassFile cf)
+            throws ConstantPoolException
+    {
+        String realName = SharedSecrets.javaUtilJarAccess().getRealName(jarfile, e);
+        if (realName.startsWith(META_INF_VERSIONS)) {
+            int len = META_INF_VERSIONS.length();
+            int n = realName.indexOf('/', len);
+            if (n > 0) {
+                String version = realName.substring(len, n);
+                assert (Integer.parseInt(version) > 8);
+                String name = cf.getName().replace('/', '.');
+                if (nameToVersion.containsKey(name)) {
+                    if (!version.equals(nameToVersion.get(name))) {
+                        throw new MultiReleaseException(
+                                "err.multirelease.version.associated",
+                                name, nameToVersion.get(name), version
+                        );
+                    }
+                } else {
+                    nameToVersion.put(name, version);
+                }
+            } else {
+                throw new MultiReleaseException("err.multirelease.jar.malformed",
+                        jarfile.getName(), realName);
+            }
+        }
+    }
+}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Mon Oct 03 12:35:51 2016 -0400
@@ -150,6 +150,11 @@
 \  -q           -quiet               Do not show missing dependencies from \n\
 \                                    -genmoduleinfo output.
 
+main.opt.multi-release=\
+\  --multi-release <version>         Specifies the version when processing\n\
+\                                    multi-release jar files.  <version> should\n\
+\                                    be integer >= 9 or base.
+
 err.unknown.option=unknown option: {0}
 err.missing.arg=no value given for {0}
 err.invalid.arg.for.option=invalid argument for option: {0}
@@ -164,7 +169,11 @@
 err.root.module.not.set=root module set empty
 err.invalid.inverse.option={0} cannot be used with -inverse option
 err.inverse.filter.not.set={0} cannot be used with -inverse option
-warn.invalid.arg=Path not exist: {0}
+err.multirelease.option.exists={0} is not a multi-release jar file, but the --multi-release option is set
+err.multirelease.option.notfound={0} is a multi-release jar file, but the --multi-release option is not set
+err.multirelease.version.associated=class {0} already associated with version {1}, trying to add version {2}
+err.multirelease.jar.malformed=malformed multi-release jar, {0}, bad entry: {1}
+warn.invalid.arg=Path does not exist: {0}
 warn.split.package=package {0} defined in {1} {2}
 warn.replace.useJDKInternals=\
 JDK internal APIs are unsupported and private to JDK implementation that are\n\
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Mon Oct 03 12:35:51 2016 -0400
@@ -543,7 +543,6 @@
 \n\
 Where <mode> is the name of a previously defined feedback mode -- see '/help /set mode'.\n\
 Where <length> is an unsigned integer representing a maximum length.\n\
-Where <format> is a quoted string which will be the value of the field if one of\n\
 Where <selector> is only needed if you wish to fine-tune value truncation length\n\
 by context, <selector> is the context in which the truncation is applied.\n\
 The structure of selector is a hyphen separated list of selector kind lists.\n\
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DemultiplexInput.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DemultiplexInput.java	Mon Oct 03 12:35:51 2016 -0400
@@ -45,6 +45,7 @@
 
     DemultiplexInput(InputStream input, Map<String, OutputStream> io, Iterable<OutputStream> closeList) {
         super("output reader");
+        setDaemon(true);
         this.delegate = new DataInputStream(input);
         this.io = io;
         this.closeList = closeList;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Mon Oct 03 12:35:51 2016 -0400
@@ -24,6 +24,7 @@
  */
 package jdk.jshell.execution;
 
+import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -200,6 +201,21 @@
             return "\"" + (String) value + "\"";
         } else if (value instanceof Character) {
             return "'" + value + "'";
+        } else if (value.getClass().isArray()) {
+            String tn = value.getClass().getTypeName();
+            int len = Array.getLength(value);
+            StringBuilder sb = new StringBuilder();
+            sb.append(tn.substring(tn.lastIndexOf('.') + 1, tn.length() - 1));
+            sb.append(len);
+            sb.append("] { ");
+            for (int i = 0; i < len; ++i) {
+                sb.append(valueString(Array.get(value, i)));
+                if (i < len - 1) {
+                    sb.append(", ");
+                }
+            }
+            sb.append(" }");
+            return sb.toString();
         } else {
             return value.toString();
         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIEventHandler.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JDIEventHandler.java	Mon Oct 03 12:35:51 2016 -0400
@@ -53,6 +53,7 @@
         this.vm = vm;
         this.reportVMExit = reportVMExit;
         this.thread = new Thread(this, "event-handler");
+        this.thread.setDaemon(true);
     }
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/constantValues/TestConstantValuesDriver.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/constantValues/TestConstantValuesDriver.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4504730 4526070 5077317
+ * @bug 4504730 4526070 5077317 8162363
  * @summary Test the generation of constant-values.html.
  * @author jamieh
  * @library ../lib
@@ -53,29 +53,29 @@
                 "TEST4PASSES",
                 "<code>\"&lt;Hello World&gt;\"</code>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;byte</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#BYTE_MAX_VALUE\">" +
-                    "BYTE_MAX_VALUE</a></code></td>\n" +
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#BYTE_MAX_VALUE\">" +
+                    "BYTE_MAX_VALUE</a></code></th>\n" +
                     "<td class=\"colLast\"><code>127</code></td>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;byte</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#BYTE_MIN_VALUE\">" +
-                    "BYTE_MIN_VALUE</a></code></td>\n" +
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#BYTE_MIN_VALUE\">" +
+                    "BYTE_MIN_VALUE</a></code></th>\n" +
                     "<td class=\"colLast\"><code>-127</code></td>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;char</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#CHAR_MAX_VALUE\">" +
-                    "CHAR_MAX_VALUE</a></code></td>\n" +
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#CHAR_MAX_VALUE\">" +
+                    "CHAR_MAX_VALUE</a></code></th>\n" +
                     "<td class=\"colLast\"><code>65535</code></td>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;double</code></td>",
-                    "<td><code><a href=\"TestConstantValues.html#DOUBLE_MAX_VALUE\">" +
-                    "DOUBLE_MAX_VALUE</a></code></td>\n" +
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#DOUBLE_MAX_VALUE\">" +
+                    "DOUBLE_MAX_VALUE</a></code></th>\n" +
                     "<td class=\"colLast\"><code>1.7976931348623157E308</code></td>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;double</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#DOUBLE_MIN_VALUE\">" +
-                    "DOUBLE_MIN_VALUE</a></code></td>",
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#DOUBLE_MIN_VALUE\">" +
+                    "DOUBLE_MIN_VALUE</a></code></th>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;boolean</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#GOODBYE\">" +
-                    "GOODBYE</a></code></td>",
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#GOODBYE\">" +
+                    "GOODBYE</a></code></th>",
                 "</a><code>public&nbsp;static&nbsp;final&nbsp;boolean</code></td>\n" +
-                    "<td><code><a href=\"TestConstantValues.html#HELLO\">HELLO</a></code></td>\n" +
+                    "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#HELLO\">HELLO</a></code></th>\n" +
                     "<td class=\"colLast\"><code>true</code></td>"
         );
     }
--- a/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4973609 8015249 8025633 8026567 6469561 8071982
+ * @bug      4973609 8015249 8025633 8026567 6469561 8071982 8162363
  * @summary  Make sure that annotation types with 0 members does not have
  *           extra HR tags.
  * @author   jamieh
@@ -56,9 +56,9 @@
                 + "field.detail\">Field</a>&nbsp;|&nbsp;</li>",
                 "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
                 "<h3>Field Summary</h3>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../"
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../"
                 + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
-                + "</code>&nbsp;</td>",
+                + "</code></th>",
                 "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
                 "<h4>DEFAULT_NAME</h4>\n"
                 + "<pre>static final&nbsp;java."
--- a/langtools/test/jdk/javadoc/doclet/testHeadings/TestHeadings.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testHeadings/TestHeadings.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4905786 6259611
+ * @bug      4905786 6259611 8162363
  * @summary  Make sure that headings use the TH tag instead of the TD tag.
  * @author   jamieh
  * @library ../lib
@@ -76,7 +76,8 @@
         // Class documentation
         checkOutput("pkg1/C1.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<h3>Methods inherited from class&nbsp;java.lang.Object</h3>");
 
         // Class use documentation
@@ -84,17 +85,19 @@
                 "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Deprecated
         checkOutput("deprecated-list.html", true,
-                "<th class=\"colOne\" scope=\"col\">Method and Description</th>");
+                "<th class=\"colFirst\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Constant values
         checkOutput("constant-values.html", true,
                 "<th class=\"colFirst\" scope=\"col\">"
                 + "Modifier and Type</th>\n"
-                + "<th scope=\"col\">Constant Field</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Constant Field</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Value</th>");
 
         // Serialized Form
--- a/langtools/test/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      6786688 8008164
+ * @bug      6786688 8008164 8162363
  * @summary  HTML tables should have table summary, caption and table headers.
  * @author   Bhavesh Patel
  * @library  ../lib
@@ -282,25 +282,32 @@
         // Class documentation
         checkOutput("pkg1/C1.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/C2.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Class and Description</th>",
-                "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Class</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<th class=\"colFirst\" scope=\"col\">Constructor</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/C2.ModalExclusionType.html", true,
-                "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>");
+                "<th class=\"colFirst\" scope=\"col\">Enum Constant</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/C3.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Required Element</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/C4.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Optional Element</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Class use documentation
         checkOutput("pkg1/class-use/I1.html", true,
@@ -309,43 +316,52 @@
 
         checkOutput("pkg1/class-use/C1.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/class-use/C2.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>",
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Package use documentation
         checkOutput("pkg1/package-use.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>",
-                "<th class=\"colOne\" scope=\"col\">Class and Description</th>");
+                "<th class=\"colFirst\" scope=\"col\">Class</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         checkOutput("pkg2/package-use.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>",
-                "<th class=\"colOne\" scope=\"col\">Class and Description</th>");
+                "<th class=\"colFirst\" scope=\"col\">Class</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Deprecated
         checkOutput("deprecated-list.html", true,
-                "<th class=\"colOne\" scope=\"col\">Field and Description</th>",
-                "<th class=\"colOne\" scope=\"col\">Method and Description</th>");
+                "<th class=\"colFirst\" scope=\"col\">Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<th class=\"colFirst\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>");
 
         // Constant values
         checkOutput("constant-values.html", true,
                 "<th class=\"colFirst\" scope=\"col\">"
                 + "Modifier and Type</th>\n"
-                + "<th"
+                + "<th class=\"colSecond\""
                 + " scope=\"col\">Constant Field</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Value</th>");
 
--- a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130
+ * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
  * @summary Test of the JavaFX doclet features.
  * @author jvalenta
  * @library ../lib
@@ -61,19 +61,17 @@
                     + "<div class=\"block\">Gets the value of the property rate.</div>\n"
                     + "<dl>\n"
                     + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
-                    + "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code>\n"
-                    + "<div class=\"block\">Defines the direction/speed at which the "
-                    + "<code>Timeline</code> is expected to",
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                    + "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code>",
                 "<span class=\"simpleTagLabel\">Default value:</span>",
                 "<span class=\"simpleTagLabel\">Since:</span></dt>\n"
                     + "<dd>JavaFX 8.0</dd>",
                 "<p>Sets the value of the property <code>Property</code>",
                 "<p>Gets the value of the property <code>Property</code>",
                 "<span class=\"simpleTagLabel\">Property description:</span>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                     + "<a href=\"../pkg1/C.html#setTestMethodProperty--\">"
-                    + "setTestMethodProperty</a></span>()</code>&nbsp;</td>",
+                    + "setTestMethodProperty</a></span>()</code></th>",
                 "<h4>isPaused</h4>\n"
                     + "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
                     + "<div class=\"block\">Gets the value of the property paused.</div>");
@@ -152,34 +150,34 @@
         checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>");
         checkOutput("pkg2/Test.html", true,
                 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>\n"
                 + "<tr id=\"i0\" class=\"altColor\">\n"
                 + "<td class=\"colFirst\"><code>&lt;T&gt;&nbsp;java.lang.Object</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
-                + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">"
-                + "alphaProperty</a></span>(java.util.List&lt;T&gt;&nbsp;foo)</code>&nbsp;</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">alphaProperty</a>"
+                + "</span>(java.util.List&lt;T&gt;&nbsp;foo)</code></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
                 + "<tr id=\"i1\" class=\"rowColor\">\n"
                 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
-                + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code>"
-                + "&nbsp;</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
                 + "<tr id=\"i2\" class=\"altColor\">\n"
-                + "<td class=\"colFirst\"><code>"
-                + "java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
+                + "<td class=\"colFirst\"><code>java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
                 + "</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
-                + "<a href=\"../pkg2/Test.html#deltaProperty--\">"
-                + "deltaProperty</a></span>()</code>&nbsp;</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>()</code></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>\n"
                 + "<tr id=\"i3\" class=\"rowColor\">\n"
-                + "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;"
-                + "</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
-                + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a>"
-                + "</span>()</code>&nbsp;</td>"
+                + "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;</code></td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+                + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>()</code></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>"
         );
     }
 
--- a/langtools/test/jdk/javadoc/doclet/testMemberInheritence/TestMemberInheritence.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testMemberInheritence/TestMemberInheritence.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4638588 4635809 6256068 6270645 8025633 8026567
+ * @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363
  * @summary Test to make sure that members are inherited properly in the Javadoc.
  *          Verify that inheritence labels are correct.
  * @author jamieh
@@ -90,10 +90,10 @@
         checkOutput("pkg1/Implementer.html", true,
                 // ensure the method makes it
                 "<td class=\"colFirst\"><code>static java.time.Period</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../pkg1/Implementer.html#between-java.time.LocalDate-java.time.LocalDate-\">"
                 + "between</a></span>(java.time.LocalDate&nbsp;startDateInclusive,\n"
-                + "       java.time.LocalDate&nbsp;endDateExclusive)</code>&nbsp;</td>",
+                + "       java.time.LocalDate&nbsp;endDateExclusive)</code></th>",
                 // check the inherited from interfaces
                 "<h3>Methods inherited from interface&nbsp;pkg1.<a href=\"../pkg1/Interface.html\""
                 + " title=\"interface in pkg1\">Interface</a></h3>\n"
--- a/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4951228 6290760 8025633 8026567 8081854
+ * @bug      4951228 6290760 8025633 8026567 8081854 8162363
  * @summary  Test the case where the overriden method returns a different
  *           type than the method in the child class.  Make sure the
  *           documentation is inherited but the return type isn't.
@@ -51,7 +51,7 @@
         checkOutput("pkg/PublicChild.html", true,
                 // Check return type in member summary.
                 "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">"
                 + "returnTypeTest</a></span>()</code>",
                 // Check return type in member detail.
                 "<pre>public&nbsp;<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -397,7 +397,7 @@
                 + "</a>");
         checkOutput("module1-summary.html", true,
                 "<tr class=\"altColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"testpkgmdl1/package-summary.html\">testpkgmdl1</a></td>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl1/package-summary.html\">testpkgmdl1</a></th>\n"
                 + "<td class=\"colSecond\">All Modules</td>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>");
@@ -408,7 +408,7 @@
                 + "</a>");
         checkOutput("module1-summary.html", true,
                 "<tr class=\"rowColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"module2-summary.html\">module2</a></td>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"module2-summary.html\">module2</a></th>\n"
                 + "<td class=\"colLast\">\n"
                 + "<div class=\"block\">This is a test description for the module2 module.</div>\n"
                 + "</td>\n"
@@ -424,8 +424,8 @@
                 + "</a>");
         checkOutput("module2-summary.html", true,
                 "<tr class=\"rowColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"testpkg2mdl2/package-summary.html\">"
-                + "testpkg2mdl2</a></td>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/package-summary.html\">"
+                + "testpkg2mdl2</a></th>\n"
                 + "<td class=\"colSecond\">module1</td>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>");
@@ -436,7 +436,7 @@
                 + "</a>");
         checkOutput("module2-summary.html", true,
                 "<tr class=\"altColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"java.base-summary.html\">java.base</a></td>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"java.base-summary.html\">java.base</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>");
         checkOutput("module2-summary.html", true,
@@ -446,24 +446,24 @@
                 + "</a>");
         checkOutput("module2-summary.html", true,
                 "<tr class=\"altColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"testpkgmdl2/TestClassInModule2.html\" "
-                + "title=\"class in testpkgmdl2\">TestClassInModule2</a></td>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl2/TestClassInModule2.html\" "
+                + "title=\"class in testpkgmdl2\">TestClassInModule2</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr>");
         checkOutput("module2-summary.html", true,
                 "<tr class=\"altColor\">\n"
-                + "<td class=\"colFirst\"><a href=\"testpkg2mdl2/TestInterfaceInModule2.html\" "
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/TestInterfaceInModule2.html\" "
                 + "title=\"interface in testpkg2mdl2\">TestInterfaceInModule2</a><br>"
                 + "(<span class=\"implementationLabel\">Implementation:</span>&nbsp;"
                 + "<a href=\"testpkgmdl2/TestClassInModule2.html\" title=\"class in testpkgmdl2\">"
-                + "TestClassInModule2</a>)</td>\n"
+                + "TestClassInModule2</a>)</th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
                 + "</tr");
         checkOutput("module2-summary.html", true,
                 "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
-                + "<th scope=\"col\">Module</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>");
         checkOutput("module2-summary.html", true,
--- a/langtools/test/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567
+ * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363
  * @summary  Run Javadoc on a set of source files that demonstrate new
  *           language features.  Check the output to ensure that the new
  *           language features are properly documented.
@@ -134,7 +134,7 @@
                 // Method that returns TypeParameters
                 "<td class=\"colFirst\"><code><a href=\"../pkg/TypeParameters.html\" "
                 + "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../pkg/TypeParameters.html#methodThatReturnsTypeParameterA-E:A-\">"
                 + "methodThatReturnsTypeParameterA</a></span>(<a href=\"../pkg/TypeParameters.html\" "
                 + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</code>",
@@ -144,15 +144,15 @@
                 + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</pre>\n",
                 "<td class=\"colFirst\"><code>&lt;T extends java.lang.Object &amp; java.lang.Comparable&lt;? super T&gt;&gt;"
                 + "<br>T</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../pkg/TypeParameters.html#methodtThatReturnsTypeParametersB-java.util.Collection-\">"
-                + "methodtThatReturnsTypeParametersB</a></span>(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>\n"
-                + "<div class=\"block\">Returns TypeParameters</div>\n",
+                + "methodtThatReturnsTypeParametersB</a></span>(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>",
+                "<div class=\"block\">Returns TypeParameters</div>\n",
                 // Method takes a TypeVariable
                 "<td class=\"colFirst\"><code>&lt;X extends java.lang.Throwable&gt;<br>"
                 + "<a href=\"../pkg/TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>"
                 + "</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../pkg/TypeParameters.html#orElseThrow-java.util.function.Supplier-\">"
                 + "orElseThrow</a></span>(java.util.function.Supplier&lt;? extends X&gt;&nbsp;exceptionSupplier)</code>"
                 );
@@ -219,19 +219,19 @@
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
                 + "Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
                 + "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends "
                 + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
                 + "</a> &amp; <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
-                + "Foo2</a>&gt;</span></code>&nbsp;</td>",
+                + "Foo2</a>&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in "
                 + "pkg2\">Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest1."
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest1."
                 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
                 + "ClassUseTest1.html#method-T-\">method</a></span>"
-                + "(T&nbsp;t)</code>&nbsp;</td>",
+                + "(T&nbsp;t)</code></th>",
                 "<caption><span>Fields in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
@@ -259,20 +259,20 @@
                 + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
                 + "in pkg2\">Foo2</a></span><span class=\"tabEnd\">&nbsp;"
                 + "</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
                 + "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends "
                 + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
                 + "</a> &amp; <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
-                + "Foo2</a>&gt;</span></code>&nbsp;</td>",
+                + "Foo2</a>&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
                 + "in pkg2\">Foo2</a></span><span class=\"tabEnd\">&nbsp;"
                 + "</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">"
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">"
                 + "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../"
                 + "pkg2/ClassUseTest1.html#method-T-\">method</a></span>"
-                + "(T&nbsp;t)</code>&nbsp;</td>"
+                + "(T&nbsp;t)</code></th>"
         );
 
         // ClassUseTest2: <T extends ParamTest<Foo3>>
@@ -282,20 +282,20 @@
                 + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
                 + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
                 + "&nbsp;</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
                 + "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends "
                 + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
                 + "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
-                + "Foo3</a>&gt;&gt;</span></code>&nbsp;</td>",
+                + "Foo3</a>&gt;&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
                 + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
                 + "&nbsp;</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
                 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
                 + "ClassUseTest2.html#method-T-\">method</a></span>"
-                + "(T&nbsp;t)</code>&nbsp;</td>",
+                + "(T&nbsp;t)</code></th>",
                 "<caption><span>Fields in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> declared as <a href=\"../"
                 + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
@@ -323,20 +323,20 @@
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
                 + "Foo3</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
                 + "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends "
                 + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
                 + "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
-                + "Foo3</a>&gt;&gt;</span></code>&nbsp;</td>",
+                + "Foo3</a>&gt;&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in "
                 + "pkg2\">Foo3</a></span><span class=\"tabEnd\">&nbsp;"
                 + "</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
                 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
                 + "ClassUseTest2.html#method-T-\">method</a></span>"
-                + "(T&nbsp;t)</code>&nbsp;</td>",
+                + "(T&nbsp;t)</code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> that return types with "
                 + "arguments of type <a href=\"../../pkg2/Foo3.html\" title"
@@ -357,20 +357,20 @@
                 + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
                 + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
                 + "&nbsp;</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
                 + "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends "
                 + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
                 + "ParamTest2</a>&lt;java.util.List&lt;? extends "
                 + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
-                + "Foo4</a>&gt;&gt;&gt;</span></code>&nbsp;</td>",
+                + "Foo4</a>&gt;&gt;&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
                 + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
                 + "&nbsp;</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3"
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3"
                 + ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
-                + "html#method-T-\">method</a></span>(T&nbsp;t)</code>&nbsp;</td>",
+                + "html#method-T-\">method</a></span>(T&nbsp;t)</code></th>",
                 "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../"
                 + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
                 + "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".."
@@ -387,20 +387,20 @@
                 + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
                 + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;"
                 + "</span></caption>",
-                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
+                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
                 + "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends "
                 + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
                 + "ParamTest2</a>&lt;java.util.List&lt;? extends "
                 + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
-                + "Foo4</a>&gt;&gt;&gt;</span></code>&nbsp;</td>",
+                + "Foo4</a>&gt;&gt;&gt;</span></code></th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> with type parameters of "
                 + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
                 + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
-                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
+                "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
                 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
                 + "html#method-T-\">method</a></span>(T&nbsp;t)</code>"
-                + "&nbsp;</td>",
+                + "</th>",
                 "<caption><span>Methods in <a href=\"../../pkg2/"
                 + "package-summary.html\">pkg2</a> that return types with "
                 + "arguments of type <a href=\"../../pkg2/Foo4.html\" "
@@ -425,18 +425,17 @@
                 + "</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
-                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>\n"
                 + "<tbody>\n"
                 + "<tr class=\"altColor\">\n"
                 + "<td class=\"colFirst\"><code>void</code></td>\n"
-                + "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
+                + "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
                 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
                 + "html#method-java.util.Set-\">method</a></span>(java."
                 + "util.Set&lt;<a href=\"../../pkg2/Foo4.html\" title=\""
-                + "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code>&nbsp;</td>\n"
-                + "</tr>\n"
-                + "</tbody>",
+                + "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code></th>",
                 "<caption><span>Constructor parameters in <a href=\"../../"
                 + "pkg2/package-summary.html\">pkg2</a> with type arguments "
                 + "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
--- a/langtools/test/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      6492694 8026567 8048351
+ * @bug      6492694 8026567 8048351 8162363
  * @summary  Test package deprecation.
  * @author   bpatel
  * @library  ../lib/
@@ -72,7 +72,7 @@
         checkOutput("allclasses-frame.html", false,
                 "FooDepr");
         checkOutput("class-use/C2.ModalExclusionType.html", true,
-                "<td class=\"colFirst\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></td>");
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></th>");
 
         checkFiles(false,
                 "pkg1/package-summary.html",
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261
+ * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -139,9 +139,8 @@
                 + ".packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,\n"
                 + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
                 + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
-                + ".overviewSummary td.colOne, .overviewSummary th.colOne,\n"
                 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
-                + ".memberSummary td.colOne, .memberSummary th.colOne,\n"
+                + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
                 + ".typeSummary td.colFirst{\n"
                 + "    width:25%;\n"
                 + "    vertical-align:top;\n"
--- a/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8005091 8009686 8025633 8026567 6469562 8071982 8071984
+ * @bug      8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363
  * @summary  Make sure that type annotations are displayed correctly
  * @author   Bhavesh Patel
  * @library  ../lib
@@ -473,7 +473,7 @@
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> ...&nbsp;vararg)");
 
         checkOutput("typeannos/RepeatingOnField.html", true,
-                "<code>(package private) java.lang.Integer</code></td>\n<td class=\"colLast\">"
+                "<code>(package private) java.lang.Integer</code></td>\n<th class=\"colSecond\" scope=\"row\">"
                 + "<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnField.html#i1"
                 + "\">i1</a></span></code>",
 
@@ -483,7 +483,7 @@
                 + "@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html\" title="
                 + "\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html"
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.Integer</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href="
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href="
                 + "\"../typeannos/RepeatingOnField.html#i2\">i2</a></span></code>",
 
                 "<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" title="
@@ -492,7 +492,7 @@
                 + "\"../typeannos/RepTypeUseB.html\" title=\"annotation in typeannos\">"
                 + "@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" title="
                 + "\"annotation in typeannos\">@RepTypeUseB</a> java.lang.Integer</code>"
-                + "</td>\n<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../typeannos/RepeatingOnField.html#i3\">i3</a></span></code>",
 
                 "<code>(package private) <a href=\"../typeannos/RepAllContextsA.html\" title=\""
@@ -501,7 +501,7 @@
                 + "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">"
                 + "@RepAllContextsB</a> <a href=\"../typeannos/RepAllContextsB.html\" title="
                 + "\"annotation in typeannos\">@RepAllContextsB</a> java.lang.Integer</code>"
-                + "</td>\n<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../typeannos/RepeatingOnField.html#i4\">i4</a></span></code>",
 
                 "<code>(package private) java.lang.String <a href=\"../typeannos/RepTypeUseA.html"
@@ -515,7 +515,7 @@
                 + "\"annotation in typeannos\">@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html"
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> <a href="
                 + "\"../typeannos/RepTypeUseB.html\" title=\"annotation in typeannos\">"
-                + "@RepTypeUseB</a> []</code></td>\n<td class=\"colLast\"><code><span class="
+                + "@RepTypeUseB</a> []</code></td>\n<th class=\"colSecond\" scope=\"row\"><code><span class="
                 + "\"memberNameLink\"><a href=\"../typeannos/RepeatingOnField.html#sa"
                 + "\">sa</a></span></code>",
 
@@ -572,8 +572,8 @@
                 + "@RepTypeUseB</a> [] sa</pre>");
 
         checkOutput("typeannos/RepeatingOnMethod.html", true,
-                "<code>(package private) java.lang.String</code></td>\n<td class="
-                + "\"colLast\"><code><span class=\"memberNameLink\"><a href="
+                "<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">"
+                + "<code><span class=\"memberNameLink\"><a href="
                 + "\"../typeannos/RepeatingOnMethod.html#test1--\">test1</a></span>()</code>",
 
                 "<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" "
@@ -582,7 +582,7 @@
                 + "@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html\" title="
                 + "\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html"
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>"
-                + "</td>\n<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../typeannos/RepeatingOnMethod.html#test2--\">test2</a>"
                 + "</span>()</code>",
 
@@ -592,7 +592,7 @@
                 + "@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html\" title="
                 + "\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" "
                 + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>"
-                + "</td>\n<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+                + "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
                 + "<a href=\"../typeannos/RepeatingOnMethod.html#test3--\">test3</a>"
                 + "</span>()</code>",
 
@@ -602,7 +602,7 @@
                 + "@RepAllContextsA</a> <a href=\"../typeannos/RepAllContextsB.html\" "
                 + "title=\"annotation in typeannos\">@RepAllContextsB</a> <a href="
                 + "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">"
-                + "@RepAllContextsB</a> java.lang.String</code></td>\n<td class=\"colLast\">"
+                + "@RepAllContextsB</a> java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">"
                 + "<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnMethod.html"
                 + "#test4--\">test4</a></span>()</code>",
 
@@ -682,12 +682,12 @@
 
         checkOutput("typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html", true,
                 "<code>(package private) &lt;T&gt;&nbsp;java.lang.String</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href="
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href="
                 + "\"../typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html#"
                 + "genericMethod-T-\">genericMethod</a></span>(T&nbsp;t)</code>",
 
                 "<code>(package private) &lt;T&gt;&nbsp;java.lang.String</code></td>\n"
-                + "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href="
+                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href="
                 + "\"../typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html#"
                 + "genericMethod2-T-\">genericMethod2</a></span>(<a href=\"../typeannos/RepTypeUseA.html"
                 + "\" title=\"annotation in typeannos\">@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseA.html"
@@ -695,7 +695,7 @@
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html"
                 + "\" title=\"annotation in typeannos\">@RepTypeUseB</a> T&nbsp;t)</code>",
 
-                "<code>(package private) java.lang.String</code></td>\n<td class=\"colLast\"><code>"
+                "<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\"><code>"
                 + "<span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html#"
                 + "test--\">test</a></span>()</code>",
 
--- a/langtools/test/jdk/javadoc/doclet/testUseOption/TestUseOption.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testUseOption/TestUseOption.java	Mon Oct 03 12:35:51 2016 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982
+ * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363
  * @summary A simple test to ensure class-use files are correct.
  * @author jamieh
  * @library ../lib
@@ -124,17 +124,17 @@
         checkOutput("pkg1/class-use/UsedInterface.html", true,
             "Subinterfaces of <a href=\"../../pkg1/UsedInterface.html\" title=\"interface in pkg1\">"
             + "UsedInterface</a> in <a href=\"../../pkg1/package-summary.html\">pkg1",
-            "<td class=\"colFirst\"><code>interface&nbsp;</code></td>\n<td class=\"colLast\">"
+            "<td class=\"colFirst\"><code>interface&nbsp;</code></td>\n<th class=\"colSecond\" scope=\"row\">"
             + "<code><span class=\"memberNameLink\"><a href=\"../../pkg1/SubInterface.html\" "
-            + "title=\"interface in pkg1\">SubInterface</a>&lt;T&gt;</span></code>&nbsp;</td>"
+            + "title=\"interface in pkg1\">SubInterface</a>&lt;T&gt;</span></code></th>"
         );
         checkOutput("pkg1/class-use/UsedThrowable.html", true,
             "Methods in <a href=\"../../pkg1/package-summary.html\">pkg1</a> that throw "
             + "<a href=\"../../pkg1/UsedThrowable.html\" title=\"class in pkg1\">UsedThrowable</a>",
-            "<td class=\"colFirst\"><code>void</code></td>\n<td class=\"colLast\"><span class="
+            "<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class="
             + "\"typeNameLabel\">C1.</span><code><span class=\"memberNameLink\">"
             + "<a href=\"../../pkg1/C1.html#methodInC1ThrowsThrowable--\">methodInC1ThrowsThrowable"
-            + "</a></span>()</code>&nbsp;</td>"
+            + "</a></span>()</code></th>"
         );
     }
 
@@ -154,9 +154,9 @@
                 "<li class=\"blockList\"><a name=\"unnamed.package\">"
         );
         checkOutput("package-use.html", true,
-                "<td class=\"colOne\">"
-                + "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a>&nbsp;</td>",
-                "<td class=\"colFirst\"><a href=\"#-Unnamed-\">&lt;Unnamed&gt;</a></td>\n"
+                "<th class=\"colFirst\" scope=\"row\">"
+                + "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a></th>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"#-Unnamed-\">&lt;Unnamed&gt;</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>"
         );
     }
--- a/langtools/test/jdk/javadoc/tool/modules/ModuleTestBase.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/tool/modules/ModuleTestBase.java	Mon Oct 03 12:35:51 2016 -0400
@@ -252,10 +252,14 @@
     }
 
     void assertAbsent(String regex) throws Exception {
-        List<String> foundList = tb.grep(regex, currentTask.getOutputLines(STDOUT));
+        assertAbsent(regex, STDOUT);
+    }
+
+    void assertAbsent(String regex, Task.OutputKind kind) throws Exception {
+        List<String> foundList = tb.grep(regex, currentTask.getOutputLines(kind));
         if (!foundList.isEmpty()) {
             dumpDocletDiagnostics();
-            throw new Exception(regex + " found in: " + STDOUT);
+            throw new Exception(regex + " found in: " + kind);
         }
     }
 
--- a/langtools/test/jdk/javadoc/tool/modules/Modules.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java	Mon Oct 03 12:35:51 2016 -0400
@@ -21,9 +21,9 @@
  * questions.
  */
 
-/**
+/*
  * @test
- * @bug 8159305
+ * @bug 8159305 8166127
  * @summary Tests primarily the module graph computations.
  * @modules
  *      jdk.javadoc/jdk.javadoc.internal.api
@@ -40,6 +40,8 @@
 import java.nio.file.Path;
 
 import toolbox.*;
+import toolbox.Task.Expect;
+import toolbox.Task.OutputKind;
 
 public class Modules extends ModuleTestBase {
 
@@ -54,8 +56,8 @@
         ModuleBuilder mb = new ModuleBuilder(tb, "m1");
         mb.comment("The first module.")
                 .exports("pub")
-                .classes("package pub; /** Klass A */ public class A {}")
-                .classes("package pro; /** Klass B */ public class B {}")
+                .classes("package pub; /** Class A */ public class A {}")
+                .classes("package pro; /** Class B */ public class B {}")
                 .write(src);
         execTask("--module-source-path", src.toString(),
                  "--module", "m1");
@@ -72,15 +74,15 @@
         mb1.comment("The first module.")
                 .exports("m1pub")
                 .requires("m2")
-                .classes("package m1pub; /** Klass A */ public class A {}")
-                .classes("package m1pro; /** Klass B */ public class B {}")
+                .classes("package m1pub; /** Class A */ public class A {}")
+                .classes("package m1pro; /** Class B */ public class B {}")
                 .write(src);
 
         ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
         mb2.comment("The second module.")
                 .exports("m2pub")
-                .classes("package m2pub; /** Klass A */ public class A {}")
-                .classes("package m2pro; /** Klass B */ public class B {}")
+                .classes("package m2pub; /** Class A */ public class A {}")
+                .classes("package m2pro; /** Class B */ public class B {}")
                 .write(src);
         execTask("--module-source-path", src.toString(),
             "--module", "m1,m2");
@@ -98,15 +100,15 @@
         mb1.comment("The first module.")
                 .exports("m1pub")
                 .requires("m2")
-                .classes("package m1pub; /** Klass A */ public class A {}")
-                .classes("package m1pro; /** Klass B */ public class B {}")
+                .classes("package m1pub; /** Class A */ public class A {}")
+                .classes("package m1pro; /** Class B */ public class B {}")
                 .write(src);
 
         ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
         mb2.comment("The second module.")
                 .exports("m2pub")
-                .classes("package m2pub; /** Klass A */ public class A {}")
-                .classes("package m2pro; /** Klass B */ public class B {}")
+                .classes("package m2pub; /** Class A */ public class A {}")
+                .classes("package m2pro; /** Class B */ public class B {}")
                 .write(src);
         execTask("--module-source-path", src.toString(),
             "--module", "m1",
@@ -117,7 +119,268 @@
 
     }
 
-   /**
+    @Test
+    public void testModulePathOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .requires("m1")
+                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f; }")
+                .write(src);
+        execTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--module", "m2");
+        checkModulesSpecified("m2");
+        checkPackagesIncluded("pkg2");
+        checkMembersSelected("pkg2.B.f");
+
+        // module path option "-p"
+        execTask("--module-source-path", src.toString(),
+                "-p", modulePath.toString(),
+                "--module", "m2");
+        // no module path
+        execNegativeTask("--module-source-path", src.toString(),
+                "--module", "m2");
+        assertErrorPresent("error: module not found: m1");
+    }
+
+    @Test
+    public void testUpgradeModulePathOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+        Path upgradePath = base.resolve("upgrades");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder mbUpgrade = new ModuleBuilder(tb, "m1");
+        mbUpgrade.comment("Module on upgrade module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class C */ public class C { }")
+                .build(upgradePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .requires("m1")
+                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.C f; }")
+                .write(src);
+        execTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--upgrade-module-path", upgradePath.toString(),
+                "--module", "m2");
+        checkModulesSpecified("m2");
+        checkPackagesIncluded("pkg2");
+        checkMembersSelected("pkg2.B.f");
+
+        // no upgrade module path
+        execNegativeTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--module", "m2");
+        assertErrorPresent("error: cannot find symbol");
+
+        // dependency from module path
+        ModuleBuilder mb3 = new ModuleBuilder(tb, "m3");
+        mb3.comment("The third module.")
+                .exports("pkg3")
+                .requires("m1")
+                .classes("package pkg3; /** Class Z */ public class Z { /** Field f */ public pkg1.A f; }")
+                .write(src);
+        execNegativeTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--upgrade-module-path", upgradePath.toString(),
+                "--module", "m3");
+        assertErrorPresent("Z.java:1: error: cannot find symbol");
+    }
+
+    @Test
+    public void testAddModulesOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .classes("package pkg2; /** @see pkg1.A */ public class B { }")
+                .write(src);
+
+        String log = new JavadocTask(tb)
+                .options("--module-source-path", src.toString(),
+                        "--module-path", modulePath.toString(),
+                        "--module", "m2")
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutput(OutputKind.DIRECT);
+        if (!log.contains("B.java:1: error: reference not found")) {
+            throw new Exception("Error not found");
+        }
+
+        new JavadocTask(tb)
+                .options("--module-source-path", src.toString(),
+                        "--module-path", modulePath.toString(),
+                        "--add-modules", "m1",
+                        "--module", "m2")
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testLimitModulesOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .build(modulePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .requires("m1")
+                .classes("package pkg2; /** Class B */ public class B { }")
+                .write(src);
+
+        execNegativeTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--limit-modules", "java.base",
+                "--module", "m2");
+        assertErrorPresent("error: module not found: m1");
+    }
+
+    @Test
+    public void testAddExportsOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .requires("m1")
+                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f; }")
+                .write(src);
+        execTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--add-exports", "m1/pkg1=m2",
+                "--module", "m2");
+        checkModulesSpecified("m2");
+        checkPackagesIncluded("pkg2");
+        checkMembersSelected("pkg2.B.f");
+    }
+
+//    @Test @ignore JDK-8166379
+    public void testPatchModuleOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+        Path patchPath = base.resolve("patch");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A { }")
+                .build(modulePath);
+
+        tb.writeJavaFiles(patchPath, "package pkg1; /** Class A */ public class A { public static int k; }");
+        new JavacTask(tb)
+                .files(patchPath.resolve("pkg1/A.java"))
+                .run();
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .requires("m1")
+                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public int f = pkg1.A.k; }")
+                .write(src);
+        execTask("--module-source-path", src.toString(),
+                "--patch-module", "m1=" + patchPath.toString(),
+                "--module-path", modulePath.toString(),
+                "--module", "m2");
+        checkModulesSpecified("m2");
+        checkPackagesIncluded("pkg2");
+        checkMembersSelected("pkg2.B.f");
+    }
+
+    @Test
+    public void testAddReadsOption(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path modulePath = base.resolve("modules");
+
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
+        mb1.comment("Module on module path.")
+                .exports("pkg1")
+                .classes("package pkg1; /** Class A */ public class A {}")
+                .build(modulePath);
+
+        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
+        mb2.comment("The second module.")
+                .exports("pkg2")
+                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f;}")
+                .write(src);
+        execTask("--module-source-path", src.toString(),
+                "--module-path", modulePath.toString(),
+                "--add-modules", "m1",
+                "--add-reads", "m2=m1",
+                "--module", "m2");
+        checkModulesSpecified("m2");
+        checkPackagesIncluded("pkg2");
+        checkMembersSelected("pkg2.B.f");
+    }
+
+    @Test
+    public void testModuleOptionsWithLegacy(Path base) throws Exception {
+        Files.createDirectory(base);
+        Path src = base.resolve("src");
+        Path classpath = base.resolve("classpath");
+        Path modulePath = base.resolve("modules");
+
+        tb.writeJavaFiles(classpath, "package pkg1; /** Class C */ public class C { }");
+        new JavacTask(tb)
+                .files(classpath.resolve("pkg1/C.java"))
+                .run();
+
+        ModuleBuilder mb = new ModuleBuilder(tb, "m1");
+        mb.comment("The first module.")
+                .exports("pub")
+                .classes("package pub; /** Class M */ public class M { }")
+                .build(modulePath);
+
+        tb.writeJavaFiles(src, "package pkg; /** Class L */ public class L { public pkg1.C f1; public pub.M f2; }");
+
+        execTask("--source-path", src.toString(),
+                "--class-path", classpath.toString(),
+                "--module-path", modulePath.toString(),
+                "--add-modules", "m1",
+                "pkg");
+        checkPackagesIncluded("pkg");
+        checkTypesIncluded("pkg.L");
+        checkMembersSelected("pkg.L.f1");
+        checkMembersSelected("pkg.L.f2");
+        assertAbsent("error", OutputKind.DIRECT);
+    }
+
+    /**
      * Tests diamond graph, inspired by javac diamond tests.
      *
      *
@@ -262,48 +525,48 @@
         new ModuleBuilder(tb, "J")
                 .comment("The J module.")
                 .exports("openJ")
-                .classes("package openJ;  /** Klass J open. */ public class J { }")
-                .classes("package closedJ; /** Klass J closed. */ public class J  { }")
+                .classes("package openJ;  /** Class J open. */ public class J { }")
+                .classes("package closedJ; /** Class J closed. */ public class J  { }")
                 .write(src);
 
         new ModuleBuilder(tb, "L")
                 .comment("The L module.")
                 .exports("openL")
                 .requiresPublic("P")
-                .classes("package openL; /** Klass L open */ public class L { }")
-                .classes("package closedL;  /** Klass L closed */ public class L { }")
+                .classes("package openL; /** Class L open */ public class L { }")
+                .classes("package closedL;  /** Class L closed */ public class L { }")
                 .write(src);
 
         new ModuleBuilder(tb, "N")
                 .comment("The N module.")
                 .exports("openN")
                 .requiresPublic("O")
-                .classes("package openN; /** Klass N open */ public class N  { }")
-                .classes("package closedN; /** Klass N closed */ public class N { }")
+                .classes("package openN; /** Class N open */ public class N  { }")
+                .classes("package closedN; /** Class N closed */ public class N { }")
                 .write(src);
 
         new ModuleBuilder(tb, "O")
                 .comment("The O module.")
                 .exports("openO")
                 .requires("J")
-                .classes("package openO; /** Klass O open. */ public class O { openJ.J j; }")
-                .classes("package closedO;  /** Klass O closed. */ public class O { }")
+                .classes("package openO; /** Class O open. */ public class O { openJ.J j; }")
+                .classes("package closedO;  /** Class O closed. */ public class O { }")
                 .write(src);
 
         new ModuleBuilder(tb, "P")
                 .comment("The O module.")
                 .exports("openP")
                 .requires("J")
-                .classes("package openP; /** Klass O open. */ public class O { openJ.J j; }")
-                .classes("package closedP;  /** Klass O closed. */ public class O { }")
+                .classes("package openP; /** Class O open. */ public class O { openJ.J j; }")
+                .classes("package closedP;  /** Class O closed. */ public class O { }")
                 .write(src);
 
         new ModuleBuilder(tb, "Q")
                 .comment("The Q module.")
                 .exports("openQ")
                 .requires("J")
-                .classes("package openQ; /** Klass Q open. */ public class Q { openJ.J j; }")
-                .classes("package closedQ;  /** Klass Q closed. */ public class Q { }")
+                .classes("package openQ; /** Class Q open. */ public class Q { openJ.J j; }")
+                .classes("package closedQ;  /** Class Q closed. */ public class Q { }")
                 .write(src);
 
     }
--- a/langtools/test/jdk/jshell/SimpleRegressionTest.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/jdk/jshell/SimpleRegressionTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -22,7 +22,7 @@
  */
 
 /*
- * @test 8130450 8158906 8154374
+ * @test 8130450 8158906 8154374 8166400
  * @summary simple regression test
  * @build KullaTesting TestingInputStream
  * @run testng SimpleRegressionTest
@@ -149,4 +149,21 @@
         assertEval("class C {}");
         assertEval("C.class.getClassLoader() == Thread.currentThread().getContextClassLoader()", "true");
     }
+
+    public void testArayRepresentation() {
+        assertEval("new int[4]", "int[4] { 0, 0, 0, 0 }");
+        assertEval("new int[0]", "int[0] {  }");
+        assertEval("new byte[2]", "byte[2] { 0, 0 }");
+        assertEval("new short[] { 1234, 4321 }", "short[2] { 1234, 4321 }");
+        assertEval("new long[] { 123456789 }", "long[1] { 123456789 }");
+        assertEval("new float[] { -23.5645f, 1.0101f }", "float[2] { -23.5645, 1.0101 }");
+        assertEval("new double[] { 1/8, Math.PI }", "double[2] { 0.0, 3.141592653589793 }");
+        assertEval("new String[] { \"hi\", \"low\", null }", "String[3] { \"hi\", \"low\", null }");
+        assertEval("new char[] { 'a', 34, 77 }", "char[3] { 'a', '\"', 'M' }");
+        assertEval("new boolean[] { false, true }", "boolean[2] { false, true }");
+        assertEval("new int[][] { new int[] {44, 55}, new int[] {88,99}}",
+                "int[][2] { int[2] { 44, 55 }, int[2] { 88, 99 } }");
+        assertEval("new Object[] { \"howdy\", new int[] { 33, 44, 55 }, new String[] { \"up\", \"down\" }}",
+                "Object[3] { \"howdy\", int[3] { 33, 44, 55 }, String[2] { \"up\", \"down\" } }");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/AnonymousClass/AnonymousInSuperCallNegTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8166108
+ * @summary Verify that a program cannot access instance state before construction
+ * @compile/fail/ref=AnonymousInSuperCallNegTest.out -XDrawDiagnostics AnonymousInSuperCallNegTest.java
+ */
+
+public class AnonymousInSuperCallNegTest {
+
+    static class Base {
+        Base(Object o) {}
+    }
+
+    static class Outer {
+        class Inner {}
+    }
+
+    public static class JavacBug extends Base {
+        int x;
+        JavacBug() {
+            super(new Outer().new Inner() {
+                void foo() {
+                    System.out.println("x = " + x);
+                }
+            }); }
+    }
+
+    public static void main(String[] args) {
+        new JavacBug();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/AnonymousClass/AnonymousInSuperCallNegTest.out	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,2 @@
+AnonymousInSuperCallNegTest.java:23:49: compiler.err.cant.ref.before.ctor.called: x
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/AnonymousClass/AnonymousInSuperCallTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,48 @@
+/*
+ * 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 8166108
+ * @summary Verify that javac skips outer this to anonymous inner classes in super type constructor calls
+ *
+ */
+
+public class AnonymousInSuperCallTest {
+
+    static class Base {
+        Base(Object o) {}
+    }
+
+    static class Outer {
+        class Inner {}
+    }
+
+    public static class JavacBug extends Base {
+        JavacBug() { super(new Outer().new Inner() {}); }
+    }
+
+    public static void main(String[] args) {
+        new JavacBug();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/TwrAndTypeVariables2Test.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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 8163027
+ * @summary AssertionError while compiling program that uses try with resources
+ * @compile TwrAndTypeVariables2Test.java
+ */
+
+abstract class TwrAndTypeVariables2Test_01 implements AutoCloseable {
+    @Override
+    public void close() {
+    }
+    public boolean close(long timeout) {
+        return true;
+    }
+}
+
+public abstract class TwrAndTypeVariables2Test<C extends TwrAndTypeVariables2Test_01> {
+    abstract C newCloseable();
+
+    void m() throws Exception{
+        try(C p= newCloseable()){
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/AnnotatedExtendsTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,65 @@
+/*
+ * 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 8164519
+ * @summary Verify that javac emits proper super type index (65535) for an annotated extends
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox toolbox.JavapTask
+ * @run compile -g AnnotatedExtendsTest.java
+ * @run main AnnotatedExtendsTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class AnnotatedExtendsTest {
+
+    @Target(ElementType.TYPE_USE)
+    public @interface TA {
+    };
+
+    public class Inner extends @TA Object {}
+
+    public static strictfp void main(String args[]) throws Exception {
+        ToolBox tb = new ToolBox();
+        Path classPath = Paths.get(ToolBox.testClasses, "AnnotatedExtendsTest$Inner.class");
+        String javapOut = new JavapTask(tb)
+                .options("-v", "-p")
+                .classes(classPath.toString())
+                .run()
+                .getOutput(Task.OutputKind.DIRECT);
+        if (!javapOut.contains("0: #21(): CLASS_EXTENDS, type_index=65535"))
+            throw new AssertionError("Expected output missing: " + javapOut);
+    }
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 8042451
+ * @bug 8042451 8164519
  * @summary Test population of reference info for class extends clauses
  * @modules jdk.jdeps/com.sun.tools.classfile
  * @compile -g Driver.java ReferenceInfoUtil.java ClassExtends.java
@@ -33,21 +33,21 @@
  */
 public class ClassExtends {
 
-    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1)
+    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = 65535)
     @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
     public String regularClass() {
         return "class %TEST_CLASS_NAME% extends @TA Object implements Cloneable, @TB Runnable {"
                + "  public void run() { } }";
     }
 
-    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1)
+    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = 65535)
     @TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1)
     public String regularClassRepeatableAnnotation() {
         return "class %TEST_CLASS_NAME% extends @RTA @RTA Object implements Cloneable, @RTB @RTB Runnable {"
                 + "  public void run() { } }";
     }
 
-    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1,
+    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = 65535,
             genericLocation = { 3, 0 })
     @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1,
             genericLocation  = { 3, 1 })
@@ -55,7 +55,7 @@
         return "class %TEST_CLASS_NAME% extends HashMap<@TA String, String> implements Cloneable, Map<String, @TB String>{ } ";
     }
 
-    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1,
+    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = 65535,
             genericLocation = { 3, 0 })
     @TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1,
             genericLocation  = { 3, 1 })
@@ -63,21 +63,21 @@
         return "class %TEST_CLASS_NAME% extends HashMap<@RTA @RTA String, String> implements Cloneable, Map<String, @RTB @RTB String>{ } ";
     }
 
-    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1)
+    @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = 65535)
     @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
     public String abstractClass() {
         return "abstract class %TEST_CLASS_NAME% extends @TA Date implements Cloneable, @TB Runnable {"
                + "  public void run() { } }";
     }
 
-    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1)
+    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = 65535)
     @TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1)
     public String abstractClassRepeatableAnnotation() {
         return "abstract class %TEST_CLASS_NAME% extends @RTA @RTA Date implements Cloneable, @RTB @RTB Runnable {"
                 + "  public void run() { } }";
     }
 
-    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1,
+    @TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = 65535,
             genericLocation = { 3, 0 })
     @TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1,
             genericLocation  = { 3, 1 })
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/file/MultiReleaseJar/MutliReleaseModuleInfoTest.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,148 @@
+/*
+ * 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 8156568
+ * @summary Update javac to support compiling against a modular multi-release JAR
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @run main MutliReleaseModuleInfoTest
+ */
+
+import java.nio.file.Paths;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.ModuleElement.RequiresDirective;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.ElementFilter;
+
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+
+public class MutliReleaseModuleInfoTest {
+
+    private final String service_mi =
+            "module service {\n" +
+            "}\n";
+
+    private final String service =
+            "package service;\n" +
+            "public class Service {\n" +
+            "}\n";
+
+    private final String service_mi9 =
+            "module service {\n" +
+            "    requires java.desktop;\n" +
+            "}\n";
+
+    private final String service9 =
+            "package service;\n" +
+            "public class Service {\n" +
+            "}\n";
+
+    private final String client_mi =
+            "module client {\n" +
+            "    requires service;\n" +
+            "}\n";
+
+    private final String manifest =
+        "Manifest-Version: 1.0\n" +
+        "Multi-Release: true\n";
+
+    private final ToolBox tb = new ToolBox();
+
+    public static void main(String [] args) throws Exception {
+        new MutliReleaseModuleInfoTest().runTest();
+    }
+
+    private void runTest() throws Exception {
+        tb.createDirectories("classes", "classes/META-INF/versions/9");
+        new JavacTask(tb)
+                .outdir("classes")
+                .sources(service_mi, service)
+                .run();
+        new JavacTask(tb)
+                .outdir("classes/META-INF/versions/9")
+                .sources(service_mi9, service9)
+                .run();
+        new JarTask(tb, "multi-release.jar")
+                .manifest(manifest)
+                .baseDir("classes")
+                .files("module-info.class", "service/Service.class",
+                       "META-INF/versions/9/module-info.class",
+                       "META-INF/versions/9/service/Service.class")
+                .run();
+        tb.cleanDirectory(Paths.get("classes"));
+
+        tb.writeFile("module-info.java", client_mi);
+        Task.Result result = new JavacTask(tb)
+                .outdir("classes")
+                .options("-processor", VerifyRequires.class.getName(),
+                               "--module-path", "multi-release.jar")
+                .files("module-info.java")
+                .run();
+        result.writeAll();
+        tb.deleteFiles("module-info.java");
+
+        tb.deleteFiles(
+                "multi-release.jar",
+                "classes/module-info.class",
+                "classes"
+        );
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class VerifyRequires extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> u, RoundEnvironment r) {
+            ModuleElement sm = processingEnv.getElementUtils().getModuleElement("service");
+            if (sm == null) {
+                throw new AssertionError("Cannot find the service module!");
+            }
+            boolean foundjd = false;
+            for (RequiresDirective rd : ElementFilter.requiresIn(sm.getDirectives())) {
+                foundjd |= rd.getDependency().getSimpleName().contentEquals("java.desktop");
+            }
+            if (!foundjd) {
+                throw new AssertionError("Missing dependency on java desktop module!");
+            }
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/trees/BrokenEnumConstructor.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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 8047347
+ * @summary Verify that an explicit (incorrect) super constructor invocation in enums is not cleared
+ *          by JavacProcessingEnvironment
+ * @library /tools/javac/lib
+ * @modules jdk.compiler
+ * @build JavacTestingAbstractProcessor OnDemandAttribution
+ * @compile/process/fail/ref=BrokenEnumConstructor.out -XDrawDiagnostics -processor OnDemandAttribution BrokenEnumConstructor.java
+ */
+
+public enum BrokenEnumConstructor {
+
+    A;
+
+    BrokenEnumConstructor() {super(); /*illegal*/}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/trees/BrokenEnumConstructor.out	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,2 @@
+BrokenEnumConstructor.java:39:30: compiler.err.call.to.super.not.allowed.in.enum.ctor: BrokenEnumConstructor
+1 error
--- a/langtools/test/tools/javac/processing/model/trees/OnDemandAttribution.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/langtools/test/tools/javac/processing/model/trees/OnDemandAttribution.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,56 +23,88 @@
 
 /*
  * @test
- * @bug 8038455
+ * @bug 8038455 8047347
  * @summary Verify that in-method ClassSymbols from one round do not affect ClassSymbols in
  *          following rounds.
  * @library /tools/javac/lib
  * @modules jdk.compiler
  * @build JavacTestingAbstractProcessor OnDemandAttribution
- * @compile/process -processor OnDemandAttribution OnDemandAttribution.java
+ * @clean Gen
+ * @compile/process -processor OnDemandAttribution OnDemandAttributionData.java
  */
 
+import java.io.IOException;
+import java.io.Writer;
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
-import static javax.lang.model.util.ElementFilter.*;
+import static javax.lang.model.util.ElementFilter.constructorsIn;
 import com.sun.source.tree.*;
 import com.sun.source.util.*;
 
 public class OnDemandAttribution extends JavacTestingAbstractProcessor {
 
     public OnDemandAttribution() {
-        class Local { }
-        new Object() { };
     }
 
+    int round;
+    Set<String> roots = new HashSet<>();
+
     public boolean process(Set<? extends TypeElement> annos,RoundEnvironment rEnv) {
-        TypeElement currentClass = elements.getTypeElement("OnDemandAttribution");
-        ExecutableElement constr = constructorsIn(currentClass.getEnclosedElements()).get(0);
-        Trees trees = Trees.instance(processingEnv);
-        TreePath path = trees.getPath(constr);
+        for (Element root : rEnv.getRootElements()) {
+            while (root.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
+                root = root.getEnclosingElement();
+            }
+            roots.add(((TypeElement) root).getQualifiedName().toString());
+        }
+        for (String root : roots) {
+            TypeElement currentClass = elements.getTypeElement(root);
+            ExecutableElement constr = constructorsIn(currentClass.getEnclosedElements()).get(0);
+            Trees trees = Trees.instance(processingEnv);
+            TreePath path = trees.getPath(constr);
 
-        new TreePathScanner<Void, Void>() {
-            @Override public Void visitClass(ClassTree node, Void p) {
-                if (node.getSimpleName().contentEquals("Local")) {
-                     //will also attribute the body on demand:
+            new TreePathScanner<Void, Void>() {
+                @Override public Void visitClass(ClassTree node, Void p) {
+                    if (node.getSimpleName().contentEquals("Local")) {
+                         //will also attribute the body on demand:
+                        Element el = trees.getElement(getCurrentPath());
+                        Name binaryName = elements.getBinaryName((TypeElement) el);
+                        if (!binaryName.contentEquals("OnDemandAttributionData$1Local")) {
+                            throw new IllegalStateException("Incorrect binary name=" + binaryName);
+                        }
+                    }
+                    return super.visitClass(node, p);
+                }
+                @Override public Void visitNewClass(NewClassTree node, Void p) {
                     Element el = trees.getElement(getCurrentPath());
-                    Name binaryName = elements.getBinaryName((TypeElement) el);
-                    if (!binaryName.contentEquals("OnDemandAttribution$1Local")) {
+                    Name binaryName = elements.getBinaryName((TypeElement) el.getEnclosingElement());
+                    if (!binaryName.contentEquals("OnDemandAttributionData$1")) {
                         throw new IllegalStateException("Incorrect binary name=" + binaryName);
                     }
+                    return super.visitNewClass(node, p);
                 }
-                return super.visitClass(node, p);
+                @Override
+                public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
+                    if (trees.getElement(getCurrentPath()) == null)
+                        throw new IllegalStateException("No element for: " + node);
+                    return super.visitMethodInvocation(node, p);
+                }
+                @Override
+                public Void visitIdentifier(IdentifierTree node, Void p) {
+                    if (trees.getElement(getCurrentPath()) == null)
+                        throw new IllegalStateException("No element for: " + node);
+                    return super.visitIdentifier(node, p);
+                }
+            }.scan(path, null);
+        }
+
+        if (round++ == 0) {
+            try (Writer out = filer.createSourceFile("Gen").openWriter()) {
+                out.write("class Gen { public static long C = 1; }");
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
             }
-            @Override public Void visitNewClass(NewClassTree node, Void p) {
-                Element el = trees.getElement(getCurrentPath());
-                Name binaryName = elements.getBinaryName((TypeElement) el.getEnclosingElement());
-                if (!binaryName.contentEquals("OnDemandAttribution$1")) {
-                    throw new IllegalStateException("Incorrect binary name=" + binaryName);
-                }
-                return super.visitNewClass(node, p);
-            }
-        }.scan(path, null);
+        }
 
         return true;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/trees/OnDemandAttributionData.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+public class OnDemandAttributionData {
+
+    public OnDemandAttributionData(int i) {
+        class Local { }
+        new Aux(Gen.C) { };
+    }
+
+    class Aux {
+        Aux(String str) {}
+        Aux(int i) {}
+        Aux(long l) {}
+    }
+
+    private void methodAttributionTest() {
+        System.err.println("");
+    }
+
+    enum E {
+        A;
+
+        final int i;
+
+        E() {
+            i = Integer.parseInt("1");
+        }
+
+    }
+
+    enum E2 {
+        A;
+
+        {
+            int i = Integer.parseInt("1");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/MultiReleaseJar.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,274 @@
+/*
+ * 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 8153654
+ * @summary Tests for jdeps tool with multi-release jar files
+ * @modules jdk.jdeps/com.sun.tools.jdeps
+ * @library mrjar mrjar/base mrjar/9 mrjar/10 mrjar/v9 mrjar/v10
+ * @build test.* p.* q.*
+ * @run testng MultiReleaseJar
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.concurrent.TimeUnit;
+
+public class MultiReleaseJar {
+    Path mrjar;
+    String testJdk;
+    String fileSep;
+    Path cmdPath;
+
+    @BeforeClass
+    public void initialize() throws Exception {
+        mrjar = Paths.get(System.getProperty("test.classes", "."), "mrjar");
+        testJdk = System.getProperty("test.jdk");
+        fileSep = System.getProperty("file.separator");
+        cmdPath = Paths.get(testJdk, "bin");
+    }
+
+    @Test
+    public void basic() throws Exception {
+        // build the jar file
+        Result r = run("jar -cf Version.jar -C base test --release 9 -C 9 test --release 10 -C 10 test");
+        checkResult(r);
+
+        // try out a bunch of things
+        r = run("jdeps --multi-release 9  -v missing.jar");
+        checkResult(r, false, "Warning: Path does not exist: missing.jar");
+
+        r = run("jdeps -v Version.jar");
+        checkResult(r, false, "the --multi-release option is not set");
+
+        r = run("jdeps --multi-release base  -v Version.jar");
+        checkResult(r, true,
+                "Version.jar ->",
+                "test.Version",
+                "test.Version"
+        );
+
+        r = run("jdeps --multi-release 9  -v Version.jar");
+        checkResult(r, true,
+                "Version.jar ->",
+                "9/test.NonPublic",
+                "9/test.NonPublic",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version"
+        );
+
+        r = run("jdeps --multi-release 10  -v Version.jar");
+        checkResult(r, true,
+                "Version.jar ->",
+                "10/test.Version",
+                "10/test.Version",
+                "10/test.Version",
+                "10/test.Version",
+                "9/test.NonPublic",
+                "9/test.NonPublic"
+        );
+
+        r = run("jdeps --multi-release 8  -v Version.jar");
+        checkResult(r, false, "Error: invalid argument for option: 8");
+
+        r = run("jdeps --multi-release 9.1  -v Version.jar");
+        checkResult(r, false, "Error: invalid argument for option: 9.1");
+
+        r = run("jdeps -v -R -cp Version.jar test/Main.class");
+        checkResult(r, false, "the --multi-release option is not set");
+
+        r = run("jdeps -v -R -cp Version.jar -multi-release 9 test/Main.class");
+        checkResult(r, false,
+                "Error: unknown option: -multi-release",
+                "Usage: jdeps <options> <path",
+                "use -h, -?, -help, or --help"
+        );
+
+        r = run("jdeps -v -R -cp Version.jar --multi-release 9 test/Main.class");
+        checkResult(r, true,
+                "Main.class ->",
+                "Main.class ->",
+                "test.Main",
+                "test.Main",
+                "test.Main",
+                "Version.jar ->",
+                "9/test.NonPublic",
+                "9/test.NonPublic",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version"
+        );
+
+        r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class");
+        checkResult(r, true,
+                "Main.class ->",
+                "Main.class ->",
+                "test.Main",
+                "test.Main",
+                "test.Main",
+                "Version.jar ->",
+                "10/test.Version",
+                "10/test.Version",
+                "10/test.Version",
+                "10/test.Version",
+                "9/test.NonPublic",
+                "9/test.NonPublic"
+        );
+
+        r = run("jdeps -v -R -cp Version.jar --multi-release base test/Main.class");
+        checkResult(r, true,
+                "Main.class ->",
+                "Main.class ->",
+                "test.Main",
+                "test.Main",
+                "test.Main",
+                "Version.jar ->",
+                "test.Version",
+                "test.Version"
+        );
+
+        r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 test/Main.class");
+        checkResult(r, false, "Error: invalid argument for option: 9.1");
+
+        // Rebuild jar without version 10
+        r = run("jar -cf Version.jar -C base test --release 9 -C 9 test");
+        checkResult(r);
+
+        // but ask for version 10
+        r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class");
+        checkResult(r, true,
+                "Main.class ->",
+                "Main.class ->",
+                "test.Main",
+                "test.Main",
+                "test.Main",
+                "Version.jar ->",
+                "9/test.NonPublic",
+                "9/test.NonPublic",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version",
+                "9/test.Version"
+        );
+    }
+
+    @Test
+    public void ps_and_qs() throws Exception {
+        // build the jar file
+        Result r = run("jar -cf PQ.jar -C base p --release 9 -C v9 p -C v9 q --release 10 -C v10 q");
+        checkResult(r);
+
+        r = run("jdeps -v -R -cp PQ.jar --multi-release base PQ.jar");
+        checkResult(r, true,
+                "PQ.jar -> java.base",
+                "p.Foo"
+        );
+
+        r = run("jdeps -v -R -cp PQ.jar --multi-release 9 PQ.jar");
+        checkResult(r, true,
+                "PQ.jar -> java.base",
+                "9/p.Foo",
+                "9/p.Foo",
+                "9/q.Bar"
+        );
+
+
+        r = run("jdeps -v -R -cp PQ.jar --multi-release 10 PQ.jar");
+        checkResult(r, true,
+                "PQ.jar -> java.base",
+                "10/q.Bar",
+                "10/q.Bar",
+                "10/q.Gee",
+                "9/p.Foo",
+                "9/p.Foo"
+        );
+    }
+
+    static class Result {
+        final String cmd;
+        final int rc;
+        final String out;
+        final String err;
+        Result(String cmd, int rc, String out, String err) {
+            this.cmd = cmd;
+            this.rc = rc;
+            this.out = out;
+            this.err = err;
+        }
+    }
+
+    Result run(String cmd) throws Exception {
+        String[] cmds = cmd.split(" +");
+        cmds[0] = cmdPath.resolve(cmds[0]).toString();
+        ProcessBuilder pb = new ProcessBuilder(cmds);
+        pb.directory(mrjar.toFile());
+        Process p = pb.start();
+        p.waitFor(10, TimeUnit.SECONDS);
+        String out;
+        try (InputStream is = p.getInputStream()) {
+            out = new String(is.readAllBytes());
+        }
+        String err;
+        try (InputStream is = p.getErrorStream()) {
+            err = new String(is.readAllBytes());
+        }
+        return new Result(cmd, p.exitValue(), out, err);
+    }
+
+    void checkResult(Result r) throws Exception {
+        System.out.println(r.cmd);
+        System.out.println(r.out);
+        if (r.rc != 0) {
+            System.out.println(r.err);
+            throw new Exception("rc=" + r.rc);
+        }
+        System.out.println();
+    }
+
+    void checkResult(Result r, boolean checkrc, String... lines) throws Exception {
+        System.out.println(r.cmd);
+        System.out.println(r.out);
+        if (checkrc && r.rc != 0) {
+            System.out.println(r.err);
+            throw new Exception("rc=" + r.rc);
+        }
+        String[] out = r.out.split("\r?\n");
+        Assert.assertEquals(out.length, lines.length);
+        int n = 0;
+        for (String line : lines) {
+            Assert.assertTrue(out[n++].contains(line), "\"" + line + "\"");
+        }
+        System.out.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/10/test/Version.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,40 @@
+/*
+ * 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 test;
+
+public class Version {
+    public int getVersion() {
+        NonPublic np = new NonPublic();
+        String ignore = np.toString();
+        return 10;
+    }
+
+    private String getStringVersion() {
+        return "10";
+    }
+
+    private void foo() {
+        if (getStringVersion() == null) throw new NullPointerException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/9/test/NonPublic.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,30 @@
+/*
+ * 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 test;
+
+class NonPublic {
+    public String toString() {
+        return "NonPublic";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/9/test/Version.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,36 @@
+/*
+ * 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 test;
+
+public class Version {
+    public int getVersion() {
+        NonPublic np = new NonPublic();
+        String ignore = np.toString();
+        return 9;
+    }
+
+    private void foo() {
+        if (getVersion() != 9) throw new RuntimeException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/base/p/Foo.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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 p;
+
+// dependencies: Object
+public class Foo {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/base/test/Version.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test;
+
+public class Version {
+    public int getVersion() {
+        return 8;
+    }
+
+    private void foo() {
+        if (getVersion() != 8) throw new IllegalStateException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/test/Main.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,35 @@
+/*
+ * 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 test;
+
+public class Main {
+    public void run() {
+        Version v = new Version();
+        v.getVersion();
+    }
+
+    public static void main(String[] args) {
+        (new Main()).run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/v10/q/Bar.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,29 @@
+/*
+ * 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 q;
+
+// dependencies: Object, q.Gee
+class Bar {
+    Gee gee = new Gee();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/v10/q/Gee.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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 q;
+
+// dependencies: Object
+class Gee {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/v9/p/Foo.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,31 @@
+/*
+ * 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 p;
+
+// dependencies: Object, q.Bar
+public class Foo {
+    void crash() {
+        throw new RuntimeException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/mrjar/v9/q/Bar.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,28 @@
+/*
+ * 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 q;
+
+// dependecies: Object
+class Bar {
+}
--- a/make/MainSupport.gmk	Wed Sep 28 11:17:51 2016 +0200
+++ b/make/MainSupport.gmk	Mon Oct 03 12:35:51 2016 -0400
@@ -31,11 +31,13 @@
 _MAINSUPPORT_GMK := 1
 
 # Run the tests specified by $1, with PRODUCT_HOME specified by $2
+# JT_JAVA is picked up by the jtreg launcher and used to run Jtreg itself.
 define RunTests
 	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
 	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
 	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
 	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \
+	    JT_JAVA=$(BOOT_JDK) \
 	    JOBS=$(JOBS) $1) || true
 endef
 
--- a/nashorn/.hgtags	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/.hgtags	Mon Oct 03 12:35:51 2016 -0400
@@ -370,3 +370,4 @@
 e05400ba935753c77697af936db24657eb811022 jdk-9+134
 cb00d5ef023a18a66fcb4311ed4474d4145c66e9 jdk-9+135
 f11b8f5c4ccbf9c87d283815abac6c0117fba3c0 jdk-9+136
+17ed43add2f9e3528686cd786ae2ed49c8ed36e9 jdk-9+137
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon Oct 03 12:35:51 2016 -0400
@@ -2512,7 +2512,8 @@
         final List<PropertyNode> elements = objectNode.getElements();
 
         final List<MapTuple<Expression>> tuples = new ArrayList<>();
-        final List<PropertyNode> gettersSetters = new ArrayList<>();
+        // List below will contain getter/setter properties and properties with computed keys (ES6)
+        final List<PropertyNode> specialProperties = new ArrayList<>();
         final int ccp = getCurrentContinuationEntryPoint();
         final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
 
@@ -2522,11 +2523,14 @@
         for (final PropertyNode propertyNode : elements) {
             final Expression value = propertyNode.getValue();
             final String key = propertyNode.getKeyName();
+            final boolean isComputedOrAccessor = propertyNode.isComputed() || value == null;
+
             // Just use a pseudo-symbol. We just need something non null; use the name and zero flags.
-            final Symbol symbol = value == null ? null : new Symbol(key, 0);
-
-            if (value == null) {
-                gettersSetters.add(propertyNode);
+            final Symbol symbol = isComputedOrAccessor ? null : new Symbol(key, 0);
+
+            if (isComputedOrAccessor) {
+                // Properties with computed names or getter/setters need special handling.
+                specialProperties.add(propertyNode);
             } else if (propertyNode.getKey() instanceof IdentNode &&
                        key.equals(ScriptObject.PROTO_PROPERTY_NAME)) {
                 // ES6 draft compliant __proto__ inside object literal
@@ -2542,7 +2546,7 @@
 
             //for literals, a value of null means object type, i.e. the value null or getter setter function
             //(I think)
-            final Class<?> valueType = (!useDualFields() || value == null || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass();
+            final Class<?> valueType = (!useDualFields() || isComputedOrAccessor || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass();
             tuples.add(new MapTuple<Expression>(key, symbol, Type.typeFor(valueType), value) {
                 @Override
                 public Class<?> getValueType() {
@@ -2590,26 +2594,41 @@
             method.invoke(ScriptObject.SET_GLOBAL_OBJECT_PROTO);
         }
 
-        for (final PropertyNode propertyNode : gettersSetters) {
-            final FunctionNode getter = propertyNode.getGetter();
-            final FunctionNode setter = propertyNode.getSetter();
-
-            assert getter != null || setter != null;
-
-            method.dup().loadKey(propertyNode.getKey());
-            if (getter == null) {
-                method.loadNull();
+        for (final PropertyNode propertyNode : specialProperties) {
+
+            method.dup();
+
+            if (propertyNode.isComputed()) {
+                assert propertyNode.getKeyName() == null;
+                loadExpressionAsObject(propertyNode.getKey());
+            } else {
+                method.loadKey(propertyNode.getKey());
+            }
+
+            if (propertyNode.getValue() != null) {
+                loadExpressionAsObject(propertyNode.getValue());
+                method.load(0);
+                method.invoke(ScriptObject.GENERIC_SET);
             } else {
-                getter.accept(this);
-            }
-
-            if (setter == null) {
-                method.loadNull();
-            } else {
-                setter.accept(this);
-            }
-
-            method.invoke(ScriptObject.SET_USER_ACCESSORS);
+                final FunctionNode getter = propertyNode.getGetter();
+                final FunctionNode setter = propertyNode.getSetter();
+
+                assert getter != null || setter != null;
+
+                if (getter == null) {
+                    method.loadNull();
+                } else {
+                    getter.accept(this);
+                }
+
+                if (setter == null) {
+                    method.loadNull();
+                } else {
+                    setter.accept(this);
+                }
+
+                method.invoke(ScriptObject.SET_USER_ACCESSORS);
+            }
         }
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java	Mon Oct 03 12:35:51 2016 -0400
@@ -86,11 +86,11 @@
     }
 
     /**
-     * Get the name of the property key
-     * @return key name
+     * Get the name of the property key, or {@code null} if key is a computed name.
+     * @return key name or null
      */
     public String getKeyName() {
-        return key instanceof PropertyKey ? ((PropertyKey) key).getPropertyName() : null;
+        return !computed && key instanceof PropertyKey ? ((PropertyKey) key).getPropertyName() : null;
     }
 
     @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Mon Oct 03 12:35:51 2016 -0400
@@ -1176,10 +1176,9 @@
                     labelStatement();
                     return;
                 }
-                final boolean allowPropertyFunction = (reparseFlags & ScriptFunctionData.IS_PROPERTY_ACCESSOR) != 0;
-                final boolean isES6Method = (reparseFlags & ScriptFunctionData.IS_ES6_METHOD) != 0;
-                if(allowPropertyFunction) {
-                    final String ident = (String)getValue();
+
+                if ((reparseFlags & ScriptFunctionData.IS_PROPERTY_ACCESSOR) != 0) {
+                    final String ident = (String) getValue();
                     final long propertyToken = token;
                     final int propertyLine = line;
                     if (GET_NAME.equals(ident)) {
@@ -1191,19 +1190,22 @@
                         addPropertyFunctionStatement(propertySetterFunction(propertyToken, propertyLine));
                         return;
                     }
-                } else if (isES6Method) {
-                    final String ident = (String)getValue();
-                    IdentNode identNode = createIdentNode(token, finish, ident).setIsPropertyName();
-                    final long propertyToken = token;
-                    final int propertyLine = line;
-                    next();
-                    // Code below will need refinement once we fully support ES6 class syntax
-                    final int flags = CONSTRUCTOR_NAME.equals(ident) ? FunctionNode.ES6_IS_CLASS_CONSTRUCTOR : FunctionNode.ES6_IS_METHOD;
-                    addPropertyFunctionStatement(propertyMethodFunction(identNode, propertyToken, propertyLine, false, flags, false));
-                    return;
                 }
             }
 
+            if ((reparseFlags & ScriptFunctionData.IS_ES6_METHOD) != 0
+                    && (type == IDENT || type == LBRACKET || isNonStrictModeIdent())) {
+                final String ident = (String)getValue();
+                final long propertyToken = token;
+                final int propertyLine = line;
+                final Expression propertyKey = propertyName();
+
+                // Code below will need refinement once we fully support ES6 class syntax
+                final int flags = CONSTRUCTOR_NAME.equals(ident) ? FunctionNode.ES6_IS_CLASS_CONSTRUCTOR : FunctionNode.ES6_IS_METHOD;
+                addPropertyFunctionStatement(propertyMethodFunction(propertyKey, propertyToken, propertyLine, false, flags, false));
+                return;
+            }
+
             expressionStatement();
             break;
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Mon Oct 03 12:35:51 2016 -0400
@@ -186,7 +186,10 @@
 
     /** Method handle for setting the user accessors of a ScriptObject */
     //TODO fastpath this
-    public static final Call SET_USER_ACCESSORS = virtualCall(MethodHandles.lookup(), ScriptObject.class, "setUserAccessors", void.class, String.class, ScriptFunction.class, ScriptFunction.class);
+    public static final Call SET_USER_ACCESSORS = virtualCallNoLookup(ScriptObject.class, "setUserAccessors", void.class, Object.class, ScriptFunction.class, ScriptFunction.class);
+
+    /** Method handle for generic property setter */
+    public static final Call GENERIC_SET = virtualCallNoLookup(ScriptObject.class, "set", void.class, Object.class, Object.class, int.class);
 
     static final MethodHandle[] SET_SLOW = new MethodHandle[] {
         findOwnMH_V("set", void.class, Object.class, int.class, int.class),
@@ -1063,12 +1066,13 @@
      * @param getter {@link UserAccessorProperty} defined getter, or null if none
      * @param setter {@link UserAccessorProperty} defined setter, or null if none
      */
-    public final void setUserAccessors(final String key, final ScriptFunction getter, final ScriptFunction setter) {
-        final Property oldProperty = getMap().findProperty(key);
+    public final void setUserAccessors(final Object key, final ScriptFunction getter, final ScriptFunction setter) {
+        final Object realKey = JSType.toPropertyKey(key);
+        final Property oldProperty = getMap().findProperty(realKey);
         if (oldProperty instanceof UserAccessorProperty) {
             modifyOwnProperty(oldProperty, oldProperty.getFlags(), getter, setter);
         } else {
-            addOwnProperty(newUserAccessors(key, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter));
+            addOwnProperty(newUserAccessors(realKey, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter));
         }
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Mon Oct 03 12:35:51 2016 -0400
@@ -190,3 +190,105 @@
 
 Number.prototype.toPrecision=returns a string representing the number to a specified precision in fixed-point or exponential notation
 
+Date.parse=returns a number, the UTC time value corresponding to the date and time interpreted from the given string argument, returns NAN if the argument is not recognized
+
+Date.UTC=returns the number of milliseconds in the given date object since January 1, 1970, 00:00:00 universal time
+
+Date.now=returns the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC
+
+Date.prototype.toString=returns the string value representing the given date object
+
+Date.prototype.toDateString=returns the string value representing the date portion of the given date object
+
+Date.prototype.toTimeString=returns the string value representing the time portion of the given date object
+
+Date.prototype.toLocaleString=returns the string value representing the date according to language specific conventions
+
+Date.prototype.toLocaleDateString=returns the string value representing the date portion of the given date object according to language specific conventions
+
+Date.prototype.toLocaleTimeString=returns the string value representing the time portion of the given date object according to language specific conventions
+
+Date.prototype.valueOf=returns the number of milliseconds between January 1, 1970, 00:00:00 UTC and the given date
+
+Date.prototype.getTime=returns the number representing milliseconds elapsed between January 1, 1970, 00:00:00 UTC and the given date
+
+Date.prototype.getFullYear=returns the year of the given date according to local time
+
+Date.prototype.getUTCFullYear=returns the year of the given date according to universal time
+
+Date.prototype.getMonth=returns the month between 0 to 11 of the given date according to local time
+
+Date.prototype.getUTCMonth=returns the month between 0 and 11 of the given date according to universal time
+
+Date.prototype.getDate=returns the day of the month for the given date according to local time
+
+Date.prototype.getUTCDate=returns the day of the month for the given date according to universal time
+
+Date.prototype.getDay=returns the day of the week for the given date according to local time, 0 represents Sunday
+
+Date.prototype.getUTCDay=returns the day of the week for the given date according to universal time, 0 represents Sunday
+
+Date.prototype.getHours=returns the hour in the given date, according to local time
+
+Date.prototype.getUTCHours=returns the hour in the given date, according to universal time
+
+Date.prototype.getMinutes=returns the minutes in the given date, according to local time
+
+Date.prototype.getUTCMinutes=returns the minutes in the given date, according to universal time
+
+Date.prototype.getSeconds=returns the seconds in the given date, according to local time
+
+Date.prototype.getUTCSeconds=returns the seconds in the given date, according to universal time
+
+Date.prototype.getMilliseconds=returns the milliseconds in the given date, according to local time
+
+Date.prototype.getUTCMilliseconds=returns the milliseconds in the given date, according to universal time
+
+Date.prototype.getTimezoneOffset=returns the difference between local time and UTC time in minutes
+
+Date.prototype.setTime=sets the date object to the time given, which is represented by the number of milliseconds since January 1, 1970, 00:00:00 UTC
+
+Date.prototype.setMilliseconds=sets the milliseconds for the given date according to local time
+
+Date.prototype.setUTCMilliseconds=sets the milliseconds for the given date according to universal time
+
+Date.prototype.setSeconds=sets the seconds for the given date according to local time
+
+Date.prototype.setUTCSeconds=sets the seconds for the given date according to universal time
+
+Date.prototype.setMinutes=sets the minutes for the given date according to local time
+
+Date.prototype.setUTCMinutes=sets the minutes for the given date according to universal time
+
+Date.prototype.setHours=sets the hours for the given date according to local time
+
+Date.prototype.setUTCHours=sets the hours for the given date according to universal time
+
+Date.prototype.setDate=sets the day of the month for the given date according to local time
+
+Date.prototype.setUTCDate=sets the day of the month for the given date according to universal time
+
+Date.prototype.setMonth=sets the month for the given date according to the currently set year
+
+Date.prototype.setUTCMonth=sets the month for the given date according to the universal time
+
+Date.prototype.setFullYear=sets the full year for the given date according to local time
+
+Date.prototype.toUTCString=converts the given date to a string using UTC time zone
+
+Date.prototype.toISOString=returns the string value in ISO 8601 format for the given date according to universal time
+
+Date.prototype.toJSON=returns the string representation of the given date
+
+RegExp.prototype.exec=returns an array object containing the results of match of given string against regular expression, null if no match found
+
+RegExp.prototype.test=returns true if match of given string against regular expression found, else returns false
+
+RegExp.prototype.toString=returns string representation of regular expression
+
+Error.prototype.toString=returns string representation of error object
+
+JSON.parse=returns an object by parsing given string as JSON
+
+JSON.stringify=returns a JSON string corresponding to the given ECMAScript value
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property-duplicate.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+var obj = {
+    get ['a']() {
+        throw new Error('should not be called');
+    },
+    get ['a']() {
+        throw new Error('should not be called');
+    },
+    get ['a']() {
+        return 'a';
+    }
+};
+
+Assert.assertEquals(obj.a, 'a');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property-getter.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,66 @@
+/*
+ * 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-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function f(x) {
+    return x;
+}
+
+var d = 'd';
+var n = 3;
+var s1 = Symbol();
+var s2 = Symbol();
+
+var object = {
+    get a() {  return 'a' },
+    get ['b']() { return 'b' },
+    get [f('c')]() { return 'c' },
+    get [d]() { return d },
+    get [1]() { return 1 },
+    get [f(2)]() { return 2 },
+    get [n]() { return 3 },
+    get [s1]() { return s1 },
+    get [f(s2)]() { return s2 }
+};
+
+
+Assert.assertEquals(object.a, 'a');
+Assert.assertEquals(object.b, 'b');
+Assert.assertEquals(object.c, 'c');
+Assert.assertEquals(object.d, 'd');
+Assert.assertEquals(object[1], 1);
+Assert.assertEquals(object[2], 2);
+Assert.assertEquals(object[3], 3);
+Assert.assertEquals(object[s1], s1);
+Assert.assertEquals(object[s2], s2);
+
+for (var s of ['a', 'b', 'c', 'd', 1, 2, 3, s1, s2]) {
+    Assert.assertEquals(object[s], s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property-method.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,66 @@
+/*
+ * 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-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function f(x) {
+    return x;
+}
+
+var d = 'd';
+var n = 3;
+var s1 = Symbol();
+var s2 = Symbol();
+
+var object = {
+    a() {  return 'a' },
+    ['b']() { return 'b' },
+    [f('c')]() { return 'c' },
+    [d]() { return d },
+    [1]() { return 1 },
+    [f(2)]() { return 2 },
+    [n]() { return 3 },
+    [s1]() { return s1 },
+    [f(s2)]() { return s2 }
+};
+
+
+Assert.assertEquals(object.a(), 'a');
+Assert.assertEquals(object.b(), 'b');
+Assert.assertEquals(object.c(), 'c');
+Assert.assertEquals(object.d(), 'd');
+Assert.assertEquals(object[1](), 1);
+Assert.assertEquals(object[2](), 2);
+Assert.assertEquals(object[3](), 3);
+Assert.assertEquals(object[s1](), s1);
+Assert.assertEquals(object[s2](), s2);
+
+for (var s of ['a', 'b', 'c', 'd', 1, 2, 3, s1, s2]) {
+    Assert.assertEquals(object[s](), s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property-number.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,54 @@
+/*
+ * 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-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function f(x) {
+    return x;
+}
+
+var object = {
+    [1.5]: 'a',
+    get [f(1e+40)]() { return 'b' },
+    [0.0001]: 'c',
+    [-0]: 'd',
+    [Infinity]: 'e',
+    [-Infinity]: 'f',
+    [NaN]: 'g'
+
+};
+
+
+Assert.assertEquals(object['1.5'], 'a');
+Assert.assertEquals(object['1e+40'], 'b');
+Assert.assertEquals(object['0.0001'], 'c');
+Assert.assertEquals(object[0], 'd');
+Assert.assertEquals(object[Infinity], 'e');
+Assert.assertEquals(object[-Infinity], 'f');
+Assert.assertEquals(object[NaN], 'g');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property-setter.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+var counter = 0;
+
+var obj = {
+    set ['a'](x) {
+        counter++;
+    }
+};
+
+obj.a = 'a';
+Assert.assertTrue(counter === 1);
+obj.a = 'a';
+Assert.assertTrue(counter === 2);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/es6/computed-property.js	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,66 @@
+/*
+ * 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-8164467: ES6 computed properties are implemented wrongly
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function f(x) {
+    return x;
+}
+
+var d = 'd';
+var n = 3;
+var s1 = Symbol();
+var s2 = Symbol();
+
+var object = {
+    a: 'a',
+    ['b']: 'b',
+    [f('c')]: 'c',
+    [d]: d,
+    [1]: 1,
+    [f(2)]: 2,
+    [n]: 3,
+    [s1]: s1,
+    [f(s2)]: s2
+};
+
+
+Assert.assertEquals(object.a, 'a');
+Assert.assertEquals(object.b, 'b');
+Assert.assertEquals(object.c, 'c');
+Assert.assertEquals(object.d, 'd');
+Assert.assertEquals(object[1], 1);
+Assert.assertEquals(object[2], 2);
+Assert.assertEquals(object[3], 3);
+Assert.assertEquals(object[s1], s1);
+Assert.assertEquals(object[s2], s2);
+
+for (var s of ['a', 'b', 'c', 'd', 1, 2, 3, s1, s2]) {
+    Assert.assertEquals(object[s], s);
+}
--- a/nashorn/test/script/trusted/JDK-8006529.js	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/test/script/trusted/JDK-8006529.js	Mon Oct 03 12:35:51 2016 -0400
@@ -38,7 +38,7 @@
  * We cannot use direct Java class (via dynalink bean linker) to Compiler
  * and FunctionNode because of package-access check and so reflective calls.
  */
-
+var Reflector           = Java.type("jdk.nashorn.test.models.Reflector");
 var forName             = java.lang.Class["forName(String)"];
 var Parser              = forName("jdk.nashorn.internal.parser.Parser").static
 var Compiler            = forName("jdk.nashorn.internal.codegen.Compiler").static
@@ -69,7 +69,11 @@
 var lhsMethod = BinaryNode.class.getMethod("lhs")
 var binaryRhsMethod = BinaryNode.class.getMethod("rhs")
 var debugIdMethod = Debug.class.getMethod("id", java.lang.Object.class)
-var compilePhases = CompilationPhases.class.getField("COMPILE_UPTO_BYTECODE").get(null);
+var compilePhases = Reflector.get(CompilationPhases.class.getField("COMPILE_UPTO_BYTECODE"), null);
+
+function invoke(m, obj) {
+    return Reflector.invoke(m, obj);
+}
 
 // These are method names of methods in FunctionNode class
 var allAssertionList = ['isVarArg', 'needsParentScope', 'needsCallee', 'hasScopeBlock', 'usesSelfSymbol', 'isSplit', 'hasEval', 'allVarsInScope', 'isStrict']
@@ -86,7 +90,7 @@
 
 // returns functionNode.getBody().getStatements().get(0)
 function getFirstFunction(functionNode) {
-    var f = findFunction(getBodyMethod.invoke(functionNode))
+    var f = findFunction(invoke(getBodyMethod, functionNode))
     if (f == null) {
         throw new Error();
     }
@@ -95,7 +99,7 @@
 
 function findFunction(node) {
     if(node instanceof Block) {
-        var stmts = getStatementsMethod.invoke(node)
+        var stmts = invoke(getStatementsMethod, node)
         for(var i = 0; i < stmts.size(); ++i) {
             var retval = findFunction(stmts.get(i))
             if(retval != null) {
@@ -103,13 +107,13 @@
             }
         }
     } else if(node instanceof VarNode) {
-        return findFunction(getInitMethod.invoke(node))
+        return findFunction(invoke(getInitMethod, node))
     } else if(node instanceof UnaryNode) {
-        return findFunction(rhsMethod.invoke(node))
+        return findFunction(invoke(rhsMethod, node))
     } else if(node instanceof BinaryNode) {
-        return findFunction(lhsMethod.invoke(node)) || findFunction(binaryRhsMethod.invoke(node))
+        return findFunction(invoke(lhsMethod, node)) || findFunction(invoke(binaryRhsMethod, node))
     } else if(node instanceof ExpressionStatement) {
-        return findFunction(getExpressionMethod.invoke(node))
+        return findFunction(invoke(getExpressionMethod, node))
     } else if(node instanceof FunctionNode) {
         return node
     }
@@ -131,12 +135,12 @@
     var ctxt = getContextMethod.invoke(null);
     var env = getEnvMethod.invoke(ctxt);
 
-    var parser   = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance());
-    var func     = parseMethod.invoke(parser);
+    var parser   = Reflector.newInstance(ParserConstructor, env, source, ThrowErrorManager.class.newInstance());
+    var func     = invoke(parseMethod, parser);
 
-    var compiler = CompilerConstructor.invoke(null, ctxt, source, false);
+    var compiler = Reflector.invoke(CompilerConstructor, null, ctxt, source, false);
 
-    return compileMethod.invoke(compiler, func, phases);
+    return Reflector.invoke(compileMethod, compiler, func, phases);
 };
 
 var allAssertions = (function() {
@@ -161,9 +165,10 @@
     }
     for(var assertion in allAssertions) {
         var expectedValue = !!assertions[assertion]
-        var actualValue = functionNodeMethods[assertion].invoke(f)
+        var actualValue = invoke(functionNodeMethods[assertion], f)
         if(actualValue !== expectedValue) {
-            throw "Expected " + assertion + " === " + expectedValue + ", got " + actualValue + " for " + f + ":" + debugIdMethod.invoke(null, f);
+            throw "Expected " + assertion + " === " + expectedValue + ", got " + actualValue + " for " + f + ":" 
+                + invoke(debugIdMethod, null, f);
         }
     }
 }
--- a/nashorn/test/script/trusted/event_queue.js	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/test/script/trusted/event_queue.js	Mon Oct 03 12:35:51 2016 -0400
@@ -36,6 +36,7 @@
 print(Debug);
 print();
 
+var Reflector     = Java.type("jdk.nashorn.test.models.Reflector");
 var forName       = java.lang.Class["forName(String)"];
 var RuntimeEvent  = forName("jdk.nashorn.internal.runtime.events.RuntimeEvent").static;
 var getValue      = RuntimeEvent.class.getMethod("getValue");
@@ -84,19 +85,19 @@
     var e = events[i];
     print("event #" + i);
     print("\tevent class=" + e.getClass());
-    print("\tvalueClass in event=" + getValueClass.invoke(e));
-    var v = getValue.invoke(e);
+    print("\tvalueClass in event=" + Reflector.invoke(getValueClass, e));
+    var v = Reflector.invoke(getValue, e);
     print("\tclass of value=" + v.getClass());
-    print("\treturn type=" + getReturnType.invoke(v));
+    print("\treturn type=" + Reflector.invoke(getReturnType, v));
     lastInLoop = events[i];
 }
 
 print();
 print("in loop last class = " + lastInLoop.getClass());
-print("in loop last value class = " + getValueClass.invoke(lastInLoop));
-var rexInLoop = getValue.invoke(lastInLoop);
+print("in loop last value class = " + Reflector.invoke(getValueClass, lastInLoop));
+var rexInLoop = Reflector.invoke(getValue, lastInLoop);
 print("in loop rex class = " + rexInLoop.getClass());
-print("in loop rex return type = " + getReturnType.invoke(rexInLoop));
+print("in loop rex return type = " + Reflector.invoke(getReturnType, rexInLoop));
 
 //try last runtime events
 var last = Debug.getLastRuntimeEvent();
@@ -106,10 +107,10 @@
 print();
 
 print("last class = " + last.getClass());
-print("last value class = " + getValueClass.invoke(last));
-var rex = getValue.invoke(last);
+print("last value class = " + Reflector.invoke(getValueClass, last));
+var rex = Reflector.invoke(getValue, last);
 print("rex class = " + rex.getClass());
-print("rex return type = " + getReturnType.invoke(rex));
+print("rex return type = " + Reflector.invoke(getReturnType, rex));
 
 //try the capacity setter
 print();
--- a/nashorn/test/script/trusted/optimistic_recompilation.js	Wed Sep 28 11:17:51 2016 +0200
+++ b/nashorn/test/script/trusted/optimistic_recompilation.js	Mon Oct 03 12:35:51 2016 -0400
@@ -32,6 +32,7 @@
  * @run
  */
 
+var Reflector     = Java.type("jdk.nashorn.test.models.Reflector");
 var forName       = java.lang.Class["forName(String)"];
 var RuntimeEvent  = forName("jdk.nashorn.internal.runtime.events.RuntimeEvent").static;
 var getValue      = RuntimeEvent.class.getMethod("getValue");
@@ -42,6 +43,10 @@
 var setReturnTypeAndValue = [];
 var expectedValues = [];
 
+function invoke(m, obj) {
+    return Reflector.invoke(m, obj);
+}
+
 function checkExpectedRecompilation(f, expectedValues, testCase) {
     Debug.clearRuntimeEvents();
     print(f());
@@ -51,12 +56,12 @@
     if (events.length ==  expectedValues.length) {
         for (var i in events) {
             var e = events[i];
-            var returnValue = getReturnValue.invoke(e);
+            var returnValue = invoke(getReturnValue, e);
             if (typeof returnValue != 'undefined') {
-            setReturnTypeAndValue[i] = [getReturnType.invoke(getValue.invoke(e)), returnValue];
+                setReturnTypeAndValue[i] = [invoke(getReturnType, invoke(getValue, e)), returnValue];
             } else {
                 returnValue = "undefined";
-                setReturnTypeAndValue[i] = [getReturnType.invoke(getValue.invoke(e)), returnValue];
+                setReturnTypeAndValue[i] = [invoke(getReturnType, invoke(getValue, e)), returnValue];
             }
             if (!setReturnTypeAndValue[i].toString().equals(expectedValues[i].toString())) {
                 fail("The return values are not as expected. Expected value: " + expectedValues[i] + " and got: " + setReturnTypeAndValue[i] + " in test case: " + f);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/Reflector.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.test.models;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Module;
+import jdk.nashorn.internal.runtime.Context;
+
+/**
+ * Few tests reflectively invoke or read fields of Nashorn classes
+ * and objects - but of packages that are not exported to any module!
+ * But, those packages are qualified exported to test [java] code
+ * such as this class. So, test scripts can invoke the methods of this
+ * class instead.
+ */
+public final class Reflector {
+    private Reflector() {}
+    private static final Module NASHORN_MOD = Context.class.getModule();
+
+    public static Object invoke(Method m, Object self, Object...args) {
+        if (m.getDeclaringClass().getModule() != NASHORN_MOD) {
+            throw new RuntimeException(m + " is not from Nashorn module");
+        }
+
+        try {
+            return m.invoke(self, args);
+        } catch (final Exception e) {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public static Object newInstance(Constructor c, Object...args) {
+        if (c.getDeclaringClass().getModule() != NASHORN_MOD) {
+            throw new RuntimeException(c + " is not from Nashorn module");
+        }
+
+        try {
+            return c.newInstance(args);
+        } catch (final Exception e) {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public static Object get(Field f, Object self) {
+        if (f.getDeclaringClass().getModule() != NASHORN_MOD) {
+            throw new RuntimeException(f + " is not from Nashorn module");
+        }
+
+        try {
+            return f.get(self);
+        } catch (final Exception e) {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -26,8 +26,7 @@
 import com.sun.javatest.Harness;
 import com.sun.javatest.Parameters;
 import com.sun.javatest.TestResult;
-import com.sun.javatest.regtest.RegressionParameters;
-import com.sun.javatest.regtest.OS;
+import com.sun.javatest.InterviewParameters;
 import jdk.test.failurehandler.*;
 
 import java.io.File;
@@ -119,7 +118,7 @@
     @Override
     public void startingTestRun(Parameters params) {
         // TODO find a better way to get JDKs
-        RegressionParameters rp = (RegressionParameters) params;
+        InterviewParameters rp = (InterviewParameters) params;
         Map<?,?> map = new HashMap<>();
         rp.save(map);
         compileJdk = (String) map.get("regtest.compilejdk");
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java	Mon Oct 03 12:35:51 2016 -0400
@@ -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
@@ -23,7 +23,6 @@
 
 package jdk.test.failurehandler.jtreg;
 
-import com.sun.javatest.regtest.OS;
 import com.sun.javatest.regtest.TimeoutHandler;
 import jdk.test.failurehandler.*;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/OS.java	Mon Oct 03 12:35:51 2016 -0400
@@ -0,0 +1,56 @@
+/*
+ * 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 jdk.test.failurehandler.jtreg;
+
+// Stripped down version of jtreg internal class com.sun.javatest.regtest.config.OS
+class OS {
+    public final String family;
+
+    private static OS current;
+
+    public static OS current() {
+        if (current == null) {
+            String name = System.getProperty("os.name");
+            current = new OS(name);
+        }
+        return current;
+    }
+
+    private OS(String name) {
+        if (name.startsWith("Linux")) {
+            family = "linux";
+        } else if (name.startsWith("Mac") || name.startsWith("Darwin")) {
+            family = "mac";
+        } else if (name.startsWith("SunOS") || name.startsWith("Solaris")) {
+            family = "solaris";
+        } else if (name.startsWith("Windows")) {
+            family = "windows";
+        } else {
+            // use first word of name
+            family = name.replaceFirst("^([^ ]+).*", "$1");
+        }
+    }
+}
+
+
--- a/test/lib/jdk/test/lib/Platform.java	Wed Sep 28 11:17:51 2016 +0200
+++ b/test/lib/jdk/test/lib/Platform.java	Mon Oct 03 12:35:51 2016 -0400
@@ -116,6 +116,14 @@
         return (jdkDebug.toLowerCase().contains("debug"));
     }
 
+    public static boolean isSlowDebugBuild() {
+        return (jdkDebug.toLowerCase().equals("slowdebug"));
+    }
+
+    public static boolean isFastDebugBuild() {
+        return (jdkDebug.toLowerCase().equals("fastdebug"));
+    }
+
     public static String getVMVersion() {
         return vmVersion;
     }
--- a/test/lib/jdk/test/lib/unsafe/UnsafeHelper.java	Wed Sep 28 11:17:51 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * 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 jdk.test.lib.unsafe;
-
-import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Field;
-
-
-/**
- * Helper class for accessing the jdk.internal.misc.Unsafe functionality
- */
-public final class UnsafeHelper {
-    private static Unsafe unsafe = null;
-
-    /**
-     * @return Unsafe instance.
-     */
-    public static synchronized Unsafe getUnsafe() {
-        if (unsafe == null) {
-            try {
-                Field f = Unsafe.class.getDeclaredField("theUnsafe");
-                f.setAccessible(true);
-                unsafe = (Unsafe) f.get(null);
-            } catch (NoSuchFieldException | IllegalAccessException e) {
-                throw new RuntimeException("Unable to get Unsafe instance.", e);
-            }
-        }
-        return unsafe;
-    }
-}
-