Merge
authorlana
Mon, 13 Mar 2017 19:58:52 +0000
changeset 44209 3c1dfeb9f6f6
parent 44098 53dd71855a5a (current diff)
parent 44208 c5f0f55bfc59 (diff)
child 44211 6de725fb76cd
child 46843 c092a843a8f9
Merge
hotspot/test/gc/arguments/TestExplicitGCInvokesConcurrentAndUnloadsClasses.java
hotspot/test/gc/startup_warnings/TestDefNewCMS.java
hotspot/test/gc/startup_warnings/TestParNewCMS.java
hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java
hotspot/test/runtime/NMT/AutoshutdownNMT.java
jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest5.out
jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest7.out
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package.html
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentFragment.java
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.properties
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.properties
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.properties
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.properties
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/gbind/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/runtime/package.html
jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/util/Uri.java
jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.properties
jdk/.hgtags
jdk/src/java.base/macosx/native/launcher/jexec.c
jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
jdk/test/ProblemList.txt
langtools/test/tools/javac/6627362/x/Object.java
langtools/test/tools/javac/T4093617/java.base/Object.java
langtools/test/tools/javac/diags/examples/ModuleInfoWithXModuleSourcePath/Extra.java
langtools/test/tools/javac/diags/examples/ModuleInfoWithXModuleSourcePath/module-info.java
langtools/test/tools/javac/diags/examples/ModuleInfoWithXmoduleClasspath/ModuleInfoWithXmoduleClasspath.java
langtools/test/tools/javac/diags/examples/ModuleInfoWithXmoduleClasspath/additional/module-info.java
langtools/test/tools/javac/diags/examples/NoSuperclass.java
langtools/test/tools/javac/diags/examples/XModuleWithModulePath/XModuleWithModulePath.java
langtools/test/tools/javac/meth/BadPolySig.java
langtools/test/tools/javac/modules/XModuleTest.java
langtools/test/tools/javac/redefineObject/java.base/Object1.java
langtools/test/tools/javac/redefineObject/java.base/Object2.java
--- a/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -1,3 +1,5 @@
+fa3e76b477829afc4476f0b725cfaa440a6fd917 jdk-9+157
+b5015f742ba648184bb7fc547197bd33ebfde30d jdk-9+158
 1cc8dd79fd1cd13d36b385196271a29632c67c3b jdk7-b24
 bf2517e15f0c0f950e5b3143c4ca11e2df73dcc1 jdk7-b25
 5ae7db536e3fcf6be78e45b240a9058095e0ed38 jdk7-b26
@@ -399,3 +401,5 @@
 8c70d170e62c0c58b5bc3ba666bd140399b98c9c jdk-10+0
 45b751afd11e6c05991cf4913c5a0ac3304fcc4e jdk-9+154
 f4aff695ffe05cfdb69d8af25a4ddc6a029754ea jdk-9+155
+06bce0388880b5ff8e040e4a9d72a3ea11dac321 jdk-9+156
+74116beae88a8f17a80301aa6c83865c82f10ece jdk-10+1
--- a/.hgtags-top-repo	Thu Mar 09 21:35:19 2017 +0000
+++ b/.hgtags-top-repo	Mon Mar 13 19:58:52 2017 +0000
@@ -396,5 +396,9 @@
 71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151
 ef056360ddf3977d7d2ddbeb456a4d612d19ea05 jdk-9+152
 816a6d03a7c44edfbd8780110529f1bdc3964fb9 jdk-9+153
+8d22611ffb6540bc1ace64a00c048c8b82d8c69a jdk-10+0
 8d26916eaa21b689835ffc1c0dbf12470aa9be61 jdk-9+154
 688a3863c00ebc089ab17ee1fc46272cbbd96815 jdk-9+155
+783ec7542cf7154e5d2b87f55bb97d28f81e9ada jdk-9+156
+4eb77fb98952dc477a4229575c81d2263a9ce711 jdk-9+157
+a4087bc10a88a43ea3ad0919b5b4af1c86977221 jdk-9+158
--- a/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/common/autoconf/basics.m4	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/autoconf/basics.m4	Mon Mar 13 19:58:52 2017 +0000
@@ -1202,6 +1202,18 @@
 # Check for support for specific options in bash
 AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
 [
+  # Check bash version
+  # Extra [ ] to stop m4 mangling
+  [ BASH_VER=`$BASH --version | $SED -n  -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'` ]
+  AC_MSG_CHECKING([bash version])
+  AC_MSG_RESULT([$BASH_VER])
+
+  BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1`
+  BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2`
+  if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then
+    AC_MSG_ERROR([bash version 3.2 or better is required])
+  fi
+
   # Test if bash supports pipefail.
   AC_MSG_CHECKING([if bash supports pipefail])
   if ${BASH} -c 'set -o pipefail'; then
--- a/common/autoconf/generated-configure.sh	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/autoconf/generated-configure.sh	Mon Mar 13 19:58:52 2017 +0000
@@ -5170,7 +5170,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1486175373
+DATE_WHEN_GENERATED=1486679715
 
 ###############################################################################
 #
@@ -24092,6 +24092,20 @@
   fi
 
 
+  # Check bash version
+  # Extra [ ] to stop m4 mangling
+   BASH_VER=`$BASH --version | $SED -n  -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking bash version" >&5
+$as_echo_n "checking bash version... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH_VER" >&5
+$as_echo "$BASH_VER" >&6; }
+
+  BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1`
+  BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2`
+  if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then
+    as_fn_error $? "bash version 3.2 or better is required" "$LINENO" 5
+  fi
+
   # Test if bash supports pipefail.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if bash supports pipefail" >&5
 $as_echo_n "checking if bash supports pipefail... " >&6; }
--- a/common/autoconf/version-numbers	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/autoconf/version-numbers	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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 @@
 
 # Default version numbers to use unless overridden by configure
 
-DEFAULT_VERSION_MAJOR=9
+DEFAULT_VERSION_MAJOR=10
 DEFAULT_VERSION_MINOR=0
 DEFAULT_VERSION_SECURITY=0
 DEFAULT_VERSION_PATCH=0
--- a/common/bin/unshuffle_list.txt	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/bin/unshuffle_list.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -361,8 +361,8 @@
 jdk/src/java.base/share/native/libverify/check_format.c : jdk/src/share/native/common/check_format.c
 jdk/src/java.base/share/native/libverify/opcodes.in_out : jdk/src/share/native/common/opcodes.in_out
 jdk/src/java.base/share/native/libzip : jdk/src/share/native/java/util/zip
-jdk/src/java.base/share/native/libzip/zlib-1.2.8 : jdk/src/share/native/java/util/zip/zlib-1.2.8
-jdk/src/java.base/share/native/libzip/zlib-1.2.8/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib-1.2.8/patches/ChangeLog_java
+jdk/src/java.base/share/native/libzip/zlib : jdk/src/share/native/java/util/zip/zlib
+jdk/src/java.base/share/native/libzip/zlib/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib/patches/ChangeLog_java
 jdk/src/java.base/unix/classes/java/io : jdk/src/solaris/classes/java/io
 jdk/src/java.base/unix/classes/java/lang : jdk/src/solaris/classes/java/lang
 jdk/src/java.base/unix/classes/java/net : jdk/src/solaris/classes/java/net
--- a/common/conf/jib-profiles.js	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/conf/jib-profiles.js	Mon Mar 13 19:58:52 2017 +0000
@@ -1080,7 +1080,7 @@
         + "." + (minor != null ? minor : version_numbers.get("DEFAULT_VERSION_MINOR"))
         + "." + (security != null ? security :  version_numbers.get("DEFAULT_VERSION_SECURITY"))
         + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH"));
-    while (version.match(".*\.0$")) {
+    while (version.match(".*\\.0$")) {
         version = version.substring(0, version.length - 2);
     }
     return version;
--- a/common/nb_native/nbproject/configurations.xml	Thu Mar 09 21:35:19 2017 +0000
+++ b/common/nb_native/nbproject/configurations.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -1223,7 +1223,7 @@
                   <in>check_format.c</in>
                 </df>
                 <df name="libzip">
-                  <df name="zlib-1.2.8">
+                  <df name="zlib">
                     <in>compress.c</in>
                     <in>deflate.c</in>
                     <in>gzclose.c</in>
@@ -38283,7 +38283,7 @@
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../build/support/headers/java.base</pElem>
             <pElem>../../make</pElem>
           </incDir>
@@ -38304,7 +38304,7 @@
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../build/support/headers/java.base</pElem>
             <pElem>../../make</pElem>
           </incDir>
@@ -38325,7 +38325,7 @@
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../build/support/headers/java.base</pElem>
             <pElem>../../make</pElem>
           </incDir>
@@ -38346,7 +38346,7 @@
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../build/support/headers/java.base</pElem>
             <pElem>../../make</pElem>
           </incDir>
@@ -38367,7 +38367,7 @@
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../build/support/headers/java.base</pElem>
             <pElem>../../make</pElem>
           </incDir>
@@ -38377,14 +38377,14 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/compress.c"
-            ex="false"
-            tool="0"
-            flavor2="0">
-        <cTool flags="4">
-        </cTool>
-      </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/deflate.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/compress.c"
+            ex="false"
+            tool="0"
+            flavor2="0">
+        <cTool flags="4">
+        </cTool>
+      </item>
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/deflate.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38394,7 +38394,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzclose.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/gzclose.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38404,7 +38404,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzlib.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/gzlib.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38414,7 +38414,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzread.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/gzread.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38424,7 +38424,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzwrite.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/gzwrite.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38434,7 +38434,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/infback.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/infback.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38444,7 +38444,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inffast.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/inffast.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38454,7 +38454,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inflate.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/inflate.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38464,7 +38464,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inftrees.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/inftrees.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38474,7 +38474,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/trees.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/trees.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38484,7 +38484,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/uncompr.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/uncompr.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38494,7 +38494,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zadler32.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/zadler32.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38504,7 +38504,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zcrc32.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/zcrc32.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -38514,7 +38514,7 @@
           </preprocessorList>
         </cTool>
       </item>
-      <item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zutil.c"
+      <item path="../../jdk/src/java.base/share/native/libzip/zlib/zutil.c"
             ex="false"
             tool="0"
             flavor2="0">
@@ -41203,7 +41203,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41232,7 +41232,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41261,7 +41261,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41290,7 +41290,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41319,7 +41319,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41348,7 +41348,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41377,7 +41377,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41406,7 +41406,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41435,7 +41435,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41464,7 +41464,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41493,7 +41493,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41522,7 +41522,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41551,7 +41551,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41580,7 +41580,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41609,7 +41609,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41638,7 +41638,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41667,7 +41667,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41696,7 +41696,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41725,7 +41725,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41754,7 +41754,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41783,7 +41783,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41812,7 +41812,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41841,7 +41841,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41870,7 +41870,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41899,7 +41899,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41928,7 +41928,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41957,7 +41957,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -41986,7 +41986,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42015,7 +42015,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42044,7 +42044,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42073,7 +42073,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42102,7 +42102,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42131,7 +42131,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42160,7 +42160,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42189,7 +42189,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42218,7 +42218,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42247,7 +42247,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42276,7 +42276,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42305,7 +42305,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42334,7 +42334,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42363,7 +42363,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42413,7 +42413,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42442,7 +42442,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -42471,7 +42471,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -46557,7 +46557,7 @@
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjli</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjli</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../make</pElem>
           </incDir>
           <preprocessorList>
@@ -46639,15 +46639,15 @@
           </preprocessorList>
         </cTool>
       </folder>
-      <folder path="0/jdk/src/java.base/share/native/libzip/zlib-1.2.8">
-        <cTool>
-          <incDir>
-            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/giflib</pElem>
-            <pElem>../../jdk/src/java.desktop/share/native/libjavajpeg</pElem>
-            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
-            <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+      <folder path="0/jdk/src/java.base/share/native/libzip/zlib">
+        <cTool>
+          <incDir>
+            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/giflib</pElem>
+            <pElem>../../jdk/src/java.desktop/share/native/libjavajpeg</pElem>
+            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
+            <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
+            <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -46712,7 +46712,7 @@
           <incDir>
             <pElem>../../jdk/src/java.base/unix/native/libjli</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjli</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../make</pElem>
           </incDir>
           <preprocessorList>
@@ -47250,7 +47250,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -47598,7 +47598,7 @@
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
             <pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
             <pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@@ -47996,7 +47996,7 @@
             <pElem>../../jdk/src/jdk.pack/share/native/common-unpack</pElem>
             <pElem>../../jdk/src/java.base/share/native/libjava</pElem>
             <pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
-            <pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
+            <pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
             <pElem>../../jdk/src/java.base/share/native/include</pElem>
             <pElem>../../jdk/src/java.base/linux/native/include</pElem>
             <pElem>../../jdk/src/java.base/unix/native/include</pElem>
--- a/corba/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/corba/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -396,5 +396,9 @@
 77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
 ff8cb43c07c069b1debdee44cb88ca22db1ec757 jdk-9+152
 68a8e8658511093b322a46ed04b2a321e1da2a43 jdk-9+153
+d66f97a610a6beac987740edc2bf6a70f46ba574 jdk-10+0
 078ebe23b584466dc8346e620d7821d91751e5a9 jdk-9+154
 a545f54babfa31aa7eb611f36031609acd617cbc jdk-9+155
+907c26240cd481579e919bfd23740797ff8ce1c8 jdk-9+156
+9383da04b385cca46b7ca67f3a39ac1b673e09fe jdk-9+157
+de6bdf38935fa753183ca288bed5c06a23c0bb12 jdk-9+158
--- a/corba/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/corba/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/corba/src/java.corba/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/corba/src/java.corba/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,8 @@
 
 /**
  * Defines the Java binding of the OMG CORBA APIs, and the RMI-IIOP API.
+ *
+ * @since 9
  */
 @Deprecated(since="9", forRemoval=true)
 module java.corba {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Mon Mar 13 19:58:52 2017 +0000
@@ -106,13 +106,13 @@
  *
  *     <LI>check in properties parameter, if any
  *
- *     <LI>check in the System properties
+ *     <LI>check in the System properties, if any
  *
  *     <LI>check in the orb.properties file located in the user.home
- *         directory (if any)
+ *         directory, if any
  *
- *     <LI>check in the orb.properties file located in the java.home/lib
- *         directory (if any)
+ *     <LI>check in the orb.properties file located in the run-time image,
+ *         if any
  *
  *     <LI>fall back on a hardcoded default behavior (use the Java&nbsp;IDL
  *         implementation)
@@ -170,9 +170,15 @@
  * Thus, where appropriate, it is necessary that
  * the classes for this alternative ORBSingleton are available on the application's class path.
  * It should be noted that the singleton ORB is system wide.
- *
+ * <P>
  * When a per-application ORB is created via the 2-arg init methods,
  * then it will be located using the thread context class loader.
+ * <P>
+ * The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location,
+ * in the Java run-time image, to search for orb.properties.
+ * This location is not intended for user editable configuration files.
+ * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties,
+ * and thereafter the ${java.home}/lib directory.
  *
  * @since   JDK1.2
  */
@@ -271,14 +277,25 @@
                     }
 
                     String javaHome = System.getProperty("java.home");
-                    fileName = javaHome + File.separator
-                        + "lib" + File.separator + "orb.properties";
-                    props = getFileProperties( fileName ) ;
+
+                    fileName = javaHome + File.separator + "conf"
+                            + File.separator + "orb.properties";
+                    props = getFileProperties(fileName);
+
+                    if (props != null) {
+                        String value = props.getProperty(name);
+                        if (value != null)
+                            return value;
+                    }
+
+                    fileName = javaHome + File.separator + "lib"
+                            + File.separator + "orb.properties";
+                    props = getFileProperties(fileName);
 
                     if (props == null)
-                        return null ;
+                        return null;
                     else
-                        return props.getProperty( name ) ;
+                        return props.getProperty(name);
                 }
             }
         );
--- a/hotspot/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -556,5 +556,9 @@
 2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
 31f1d26c60df7b2e516a4f84160d76ba017d4e09 jdk-9+152
 217ba81b9a4ce8698200370175aa2db86a39f66c jdk-9+153
+fc7e94cb748507366b839e859f865f724467446a jdk-10+0
 a9fdfd55835ef9dccb7f317b07249bd66653b874 jdk-9+154
 f3b3d77a1751897413aae43ac340a130b6fa2ae1 jdk-9+155
+43139c588ea48b6504e52b6c3dec530b17b1fdb4 jdk-9+156
+b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157
+4e78f30935229f13ce7c43089621cf7169f5abac jdk-9+158
--- a/hotspot/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1922,12 +1922,17 @@
     }
 
     if (opr2->is_constant()) {
+      bool is_32bit = false; // width of register operand
       jlong imm;
+
       switch(opr2->type()) {
+      case T_INT:
+        imm = opr2->as_constant_ptr()->as_jint();
+        is_32bit = true;
+        break;
       case T_LONG:
         imm = opr2->as_constant_ptr()->as_jlong();
         break;
-      case T_INT:
       case T_ADDRESS:
         imm = opr2->as_constant_ptr()->as_jint();
         break;
@@ -1942,14 +1947,14 @@
       }
 
       if (Assembler::operand_valid_for_add_sub_immediate(imm)) {
-        if (type2aelembytes(opr1->type()) <= 4)
+        if (is_32bit)
           __ cmpw(reg1, imm);
         else
           __ cmp(reg1, imm);
         return;
       } else {
         __ mov(rscratch1, imm);
-        if (type2aelembytes(opr1->type()) <= 4)
+        if (is_32bit)
           __ cmpw(reg1, rscratch1);
         else
           __ cmp(reg1, rscratch1);
--- a/hotspot/src/cpu/aarch64/vm/c1_globals_aarch64.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c1_globals_aarch64.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -45,10 +45,8 @@
 // We compile very aggressively with the builtin simulator because
 // doing so greatly reduces run times and tests more code.
 define_pd_global(intx, CompileThreshold,             150 );
-define_pd_global(intx, BackEdgeThreshold,            500);
 #else
 define_pd_global(intx, CompileThreshold,             1500 );
-define_pd_global(intx, BackEdgeThreshold,            100000);
 #endif
 
 define_pd_global(intx, OnStackReplacePercentage,     933  );
@@ -76,6 +74,4 @@
 define_pd_global(bool, CSEArrayLength,               false);
 define_pd_global(bool, TwoOperandLIRForm,            false );
 
-define_pd_global(intx, SafepointPollOffset,          0  );
-
 #endif // CPU_AARCH64_VM_C1_GLOBALS_AARCH64_HPP
--- a/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -43,7 +43,6 @@
 define_pd_global(bool, ProfileInterpreter,           true);
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,7 @@
 
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.target.Backend;
+import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder;
 import org.graalvm.compiler.hotspot.stubs.Stub;
 
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@@ -48,7 +49,7 @@
     }
 
     public HotSpotCompiledCode compiledCode(CompilationResult result) {
-        return stub.getCompiledCode(backend);
+        return HotSpotCompiledCodeBuilder.createCompiledCode(null, null, result);
     }
 
 }
--- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
   }
 
 
-  if (strlen(alt_root) + strlen(name) < PATH_MAX) {
+  if (strlen(alt_root) + strlen(name) > PATH_MAX) {
     // Buffer too small.
     return -1;
   }
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,13 +150,7 @@
    // Helper methods
 
    private void printGCAlgorithm(Map flagMap) {
-       // print about new generation
-       long l = getFlagValue("UseParNewGC", flagMap);
-       if (l == 1L) {
-          System.out.println("using parallel threads in the new generation.");
-       }
-
-       l = getFlagValue("UseTLAB", flagMap);
+       long l = getFlagValue("UseTLAB", flagMap);
        if (l == 1L) {
           System.out.println("using thread-local object allocation.");
        }
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,6 +114,8 @@
                     }
                 });
 
+                writeHeapRecordPrologue();
+
                 // write JavaThreads
                 writeJavaThreads();
 
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,8 @@
  * WARNING: This format is still under development, and is subject to
  * change without notice.
  *
- * header    "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2" (0-terminated)
- * u4        size of identifiers. Identifiers are used to represent
+ * header     "JAVA PROFILE 1.0.2" (0-terminated)
+ * u4         size of identifiers. Identifiers are used to represent
  *            UTF8 strings, objects, stack traces, etc. They usually
  *            have the same size as host pointers. For example, on
  *            Solaris and Win32, the size is 4.
@@ -294,10 +294,9 @@
  *                u2        stack trace depth
  *
  *
- * When the header is "JAVA PROFILE 1.0.2" a heap dump can optionally
- * be generated as a sequence of heap dump segments. This sequence is
- * terminated by an end record. The additional tags allowed by format
- * "JAVA PROFILE 1.0.2" are:
+ * A heap dump can optionally be generated as a sequence of heap dump
+ * segments. This sequence is terminated by an end record. The additional
+ * tags allowed by format "JAVA PROFILE 1.0.2" are:
  *
  * HPROF_HEAP_DUMP_SEGMENT  denote a heap dump segment
  *
@@ -310,8 +309,6 @@
 
 public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
 
-    // The heap size threshold used to determine if segmented format
-    // ("JAVA PROFILE 1.0.2") should be used.
     private static final long HPROF_SEGMENTED_HEAP_DUMP_THRESHOLD = 2L * 0x40000000;
 
     // The approximate size of a heap segment. Used to calculate when to create
@@ -319,7 +316,6 @@
     private static final long HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE = 1L * 0x40000000;
 
     // hprof binary file header
-    private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
     private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
 
     // constants in enum HprofTag
@@ -380,6 +376,7 @@
     private static final int JVM_SIGNATURE_ARRAY   = '[';
     private static final int JVM_SIGNATURE_CLASS   = 'L';
 
+    private static final long MAX_U4_VALUE = 0xFFFFFFFFL;
     int serialNum = 1;
 
     public synchronized void write(String fileName) throws IOException {
@@ -469,7 +466,6 @@
             // length later - hprof format requires length.
             out.flush();
             currentSegmentStart = fos.getChannel().position();
-
             // write dummy length of 0 and we'll fix it later.
             out.writeInt(0);
         }
@@ -479,7 +475,7 @@
     protected void writeHeapRecordEpilogue() throws IOException {
         if (useSegmentedHeapDump) {
             out.flush();
-            if ((fos.getChannel().position() - currentSegmentStart - 4) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
+            if ((fos.getChannel().position() - currentSegmentStart - 4L) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
                 fillInHeapRecordLength();
                 currentSegmentStart = 0;
             }
@@ -488,14 +484,14 @@
 
     private void fillInHeapRecordLength() throws IOException {
 
-        // now get current position to calculate length
+        // now get the current position to calculate length
         long dumpEnd = fos.getChannel().position();
 
-        // calculate length of heap data
+        // calculate the length of heap data
         long dumpLenLong = (dumpEnd - currentSegmentStart - 4L);
 
         // Check length boundary, overflow could happen but is _very_ unlikely
-        if(dumpLenLong >= (4L * 0x40000000)){
+        if (dumpLenLong >= (4L * 0x40000000)) {
             throw new RuntimeException("Heap segment size overflow.");
         }
 
@@ -517,6 +513,71 @@
         fos.getChannel().position(currentPosition);
     }
 
+    // get the size in bytes for the requested type
+    private long getSizeForType(int type) throws IOException {
+        switch (type) {
+            case TypeArrayKlass.T_BOOLEAN:
+                return BOOLEAN_SIZE;
+            case TypeArrayKlass.T_INT:
+                return INT_SIZE;
+            case TypeArrayKlass.T_CHAR:
+                return CHAR_SIZE;
+            case TypeArrayKlass.T_SHORT:
+                return SHORT_SIZE;
+            case TypeArrayKlass.T_BYTE:
+                return BYTE_SIZE;
+            case TypeArrayKlass.T_LONG:
+                return LONG_SIZE;
+            case TypeArrayKlass.T_FLOAT:
+                return FLOAT_SIZE;
+            case TypeArrayKlass.T_DOUBLE:
+                return DOUBLE_SIZE;
+            default:
+                throw new RuntimeException(
+                    "Should not reach here: Unknown type: " + type);
+         }
+    }
+
+    private int getArrayHeaderSize(boolean isObjectAarray) {
+        return isObjectAarray?
+            ((int) BYTE_SIZE + 2 * (int) INT_SIZE + 2 * (int) OBJ_ID_SIZE):
+            (2 * (int) BYTE_SIZE + 2 * (int) INT_SIZE + (int) OBJ_ID_SIZE);
+    }
+
+    // Check if we need to truncate an array
+    private int calculateArrayMaxLength(long originalArrayLength,
+                                        int headerSize,
+                                        long typeSize,
+                                        String typeName) throws IOException {
+
+        long length = originalArrayLength;
+
+        // now get the current position to calculate length
+        long dumpEnd = fos.getChannel().position();
+        long originalLengthInBytes = originalArrayLength * typeSize;
+
+        // calculate the length of heap data
+        long currentRecordLength = (dumpEnd - currentSegmentStart - 4L);
+        if (currentRecordLength > 0 &&
+            (currentRecordLength + headerSize + originalLengthInBytes) > MAX_U4_VALUE) {
+            fillInHeapRecordLength();
+            currentSegmentStart = 0;
+            writeHeapRecordPrologue();
+            currentRecordLength = 0;
+        }
+
+        // Calculate the max bytes we can use.
+        long maxBytes = (MAX_U4_VALUE - (headerSize + currentRecordLength));
+
+        if (originalLengthInBytes > maxBytes) {
+            length = maxBytes/typeSize;
+            System.err.println("WARNING: Cannot dump array of type " + typeName
+                               + " with length " + originalArrayLength
+                               + "; truncating to length " + length);
+        }
+        return (int) length;
+    }
+
     private void writeClassDumpRecords() throws IOException {
         SystemDictionary sysDict = VM.getVM().getSystemDictionary();
         ClassLoaderDataGraph cldGraph = VM.getVM().getClassLoaderDataGraph();
@@ -694,12 +755,16 @@
     }
 
     protected void writeObjectArray(ObjArray array) throws IOException {
+        int headerSize = getArrayHeaderSize(true);
+        final int length = calculateArrayMaxLength(array.getLength(),
+                                                   headerSize,
+                                                   OBJ_ID_SIZE,
+                                                   "Object");
         out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP);
         writeObjectID(array);
         out.writeInt(DUMMY_STACK_TRACE_ID);
-        out.writeInt((int) array.getLength());
+        out.writeInt(length);
         writeObjectID(array.getKlass().getJavaMirror());
-        final int length = (int) array.getLength();
         for (int index = 0; index < length; index++) {
             OopHandle handle = array.getOopHandleAt(index);
             writeObjectID(getAddressValue(handle));
@@ -707,101 +772,101 @@
     }
 
     protected void writePrimitiveArray(TypeArray array) throws IOException {
+        int headerSize = getArrayHeaderSize(false);
+        TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
+        final int type = (int) tak.getElementType();
+        final String typeName = tak.getElementTypeName();
+        final long typeSize = getSizeForType(type);
+        final int length = calculateArrayMaxLength(array.getLength(),
+                                                   headerSize,
+                                                   typeSize,
+                                                   typeName);
         out.writeByte((byte) HPROF_GC_PRIM_ARRAY_DUMP);
         writeObjectID(array);
         out.writeInt(DUMMY_STACK_TRACE_ID);
-        out.writeInt((int) array.getLength());
-        TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
-        final int type = (int) tak.getElementType();
+        out.writeInt(length);
         out.writeByte((byte) type);
         switch (type) {
             case TypeArrayKlass.T_BOOLEAN:
-                writeBooleanArray(array);
+                writeBooleanArray(array, length);
                 break;
             case TypeArrayKlass.T_CHAR:
-                writeCharArray(array);
+                writeCharArray(array, length);
                 break;
             case TypeArrayKlass.T_FLOAT:
-                writeFloatArray(array);
+                writeFloatArray(array, length);
                 break;
             case TypeArrayKlass.T_DOUBLE:
-                writeDoubleArray(array);
+                writeDoubleArray(array, length);
                 break;
             case TypeArrayKlass.T_BYTE:
-                writeByteArray(array);
+                writeByteArray(array, length);
                 break;
             case TypeArrayKlass.T_SHORT:
-                writeShortArray(array);
+                writeShortArray(array, length);
                 break;
             case TypeArrayKlass.T_INT:
-                writeIntArray(array);
+                writeIntArray(array, length);
                 break;
             case TypeArrayKlass.T_LONG:
-                writeLongArray(array);
+                writeLongArray(array, length);
                 break;
             default:
-                throw new RuntimeException("should not reach here");
+                throw new RuntimeException(
+                    "Should not reach here: Unknown type: " + type);
         }
     }
 
-    private void writeBooleanArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeBooleanArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = BOOLEAN_BASE_OFFSET + index * BOOLEAN_SIZE;
              out.writeBoolean(array.getHandle().getJBooleanAt(offset));
         }
     }
 
-    private void writeByteArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeByteArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = BYTE_BASE_OFFSET + index * BYTE_SIZE;
              out.writeByte(array.getHandle().getJByteAt(offset));
         }
     }
 
-    private void writeShortArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeShortArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = SHORT_BASE_OFFSET + index * SHORT_SIZE;
              out.writeShort(array.getHandle().getJShortAt(offset));
         }
     }
 
-    private void writeIntArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeIntArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = INT_BASE_OFFSET + index * INT_SIZE;
              out.writeInt(array.getHandle().getJIntAt(offset));
         }
     }
 
-    private void writeLongArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeLongArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = LONG_BASE_OFFSET + index * LONG_SIZE;
              out.writeLong(array.getHandle().getJLongAt(offset));
         }
     }
 
-    private void writeCharArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeCharArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = CHAR_BASE_OFFSET + index * CHAR_SIZE;
              out.writeChar(array.getHandle().getJCharAt(offset));
         }
     }
 
-    private void writeFloatArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeFloatArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = FLOAT_BASE_OFFSET + index * FLOAT_SIZE;
              out.writeFloat(array.getHandle().getJFloatAt(offset));
         }
     }
 
-    private void writeDoubleArray(TypeArray array) throws IOException {
-        final int length = (int) array.getLength();
+    private void writeDoubleArray(TypeArray array, int length) throws IOException {
         for (int index = 0; index < length; index++) {
              long offset = DOUBLE_BASE_OFFSET + index * DOUBLE_SIZE;
              out.writeDouble(array.getHandle().getJDoubleAt(offset));
@@ -996,12 +1061,7 @@
     // writes hprof binary file header
     private void writeFileHeader() throws IOException {
         // version string
-        if(useSegmentedHeapDump) {
-            out.writeBytes(HPROF_HEADER_1_0_2);
-        }
-        else {
-            out.writeBytes(HPROF_HEADER_1_0_1);
-        }
+        out.writeBytes(HPROF_HEADER_1_0_2);
         out.writeByte((byte)'\0');
 
         // write identifier size. we use pointers as identifiers.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java	Mon Mar 13 19:58:52 2017 +0000
@@ -27,8 +27,6 @@
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
 import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
 
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.ResolvedJavaType;
@@ -147,21 +145,34 @@
         }
     }
 
-    private final Map<Class<?>, WeakReference<ResolvedJavaType>> typeMap = new WeakHashMap<>();
+    private final ClassValue<WeakReference<ResolvedJavaType>> resolvedJavaType = new ClassValue<WeakReference<ResolvedJavaType>>() {
+        @Override
+        protected WeakReference<ResolvedJavaType> computeValue(Class<?> type) {
+            return new WeakReference<>(createClass(type));
+        }
+    };
 
     /**
      * Gets the JVMCI mirror for a {@link Class} object.
      *
      * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
      */
-    public synchronized ResolvedJavaType fromClass(Class<?> javaClass) {
-        WeakReference<ResolvedJavaType> typeRef = typeMap.get(javaClass);
-        ResolvedJavaType type = typeRef != null ? typeRef.get() : null;
-        if (type == null) {
-            type = createClass(javaClass);
-            typeMap.put(javaClass, new WeakReference<>(type));
+    public ResolvedJavaType fromClass(Class<?> javaClass) {
+        ResolvedJavaType javaType = null;
+        while (javaType == null) {
+            WeakReference<ResolvedJavaType> type = resolvedJavaType.get(javaClass);
+            javaType = type.get();
+            if (javaType == null) {
+                /*
+                 * If the referent has become null, clear out the current value
+                 * and let computeValue above create a new value.  Reload the
+                 * value in a loop because in theory the WeakReference referent
+                 * can be reclaimed at any point.
+                 */
+                resolvedJavaType.remove(javaClass);
+            }
         }
-        return type;
+        return javaType;
     }
 
     /**
--- a/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Mon Mar 13 19:58:52 2017 +0000
@@ -90,17 +90,10 @@
     protected InstalledCode code;
 
     /**
-     * Compilation result from which {@link #code} was created.
-     */
-    protected CompilationResult compResult;
-
-    /**
      * The registers destroyed by this stub (from the caller's perspective).
      */
     private Set<Register> destroyedCallerRegisters;
 
-    private HotSpotCompiledCode compiledCode;
-
     public void initDestroyedCallerRegisters(Set<Register> registers) {
         assert registers != null;
         assert destroyedCallerRegisters == null || registers.equals(destroyedCallerRegisters) : "cannot redefine";
@@ -184,35 +177,13 @@
     public synchronized InstalledCode getCode(final Backend backend) {
         if (code == null) {
             try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
-                final StructuredGraph graph = getGraph(getStubCompilationId());
-
-                // Stubs cannot be recompiled so they cannot be compiled with assumptions
-                assert graph.getAssumptions() == null;
-
-                if (!(graph.start() instanceof StubStartNode)) {
-                    StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
-                    newStart.setStateAfter(graph.start().stateAfter());
-                    graph.replaceFixed(graph.start(), newStart);
-                }
-
                 CodeCacheProvider codeCache = providers.getCodeCache();
-
-                compResult = new CompilationResult(toString(), GeneratePIC.getValue());
-                try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
-                    Suites suites = createSuites();
-                    emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
-                    LIRSuites lirSuites = createLIRSuites();
-                    emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
-                    assert checkStubInvariants();
-                } catch (Throwable e) {
-                    throw Debug.handle(e);
-                }
-
-                assert destroyedCallerRegisters != null;
+                CompilationResult compResult = buildCompilationResult(backend);
                 try (Scope s = Debug.scope("CodeInstall", compResult)) {
+                    assert destroyedCallerRegisters != null;
                     // Add a GeneratePIC check here later, we don't want to install
                     // code if we don't have a corresponding VM global symbol.
-                    compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
+                    HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
                     code = codeCache.installCode(null, compiledCode, null, null, false);
                 } catch (Throwable e) {
                     throw Debug.handle(e);
@@ -226,6 +197,44 @@
         return code;
     }
 
+    @SuppressWarnings("try")
+    private CompilationResult buildCompilationResult(final Backend backend) {
+        CompilationResult compResult = new CompilationResult(toString(), GeneratePIC.getValue());
+        final StructuredGraph graph = getGraph(getStubCompilationId());
+
+        // Stubs cannot be recompiled so they cannot be compiled with assumptions
+        assert graph.getAssumptions() == null;
+
+        if (!(graph.start() instanceof StubStartNode)) {
+            StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
+            newStart.setStateAfter(graph.start().stateAfter());
+            graph.replaceFixed(graph.start(), newStart);
+        }
+
+        try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
+            Suites suites = createSuites();
+            emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
+            LIRSuites lirSuites = createLIRSuites();
+            emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
+            assert checkStubInvariants(compResult);
+        } catch (Throwable e) {
+            throw Debug.handle(e);
+        }
+        return compResult;
+    }
+
+    /**
+     * Gets a {@link CompilationResult} that can be used for code generation. Required for AOT.
+     */
+    @SuppressWarnings("try")
+    public CompilationResult getCompilationResult(final Backend backend) {
+        try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
+            return buildCompilationResult(backend);
+        } catch (Throwable e) {
+            throw Debug.handle(e);
+        }
+    }
+
     public CompilationIdentifier getStubCompilationId() {
         return new StubCompilationIdentifier(this);
     }
@@ -233,7 +242,7 @@
     /**
      * Checks the conditions a compilation must satisfy to be installed as a RuntimeStub.
      */
-    private boolean checkStubInvariants() {
+    private boolean checkStubInvariants(CompilationResult compResult) {
         assert compResult.getExceptionHandlers().isEmpty() : this;
 
         // Stubs cannot be recompiled so they cannot be compiled with
@@ -278,24 +287,4 @@
         }
         return lirSuites;
     }
-
-    /**
-     * Gets the HotSpotCompiledCode that was created during installation.
-     */
-    public synchronized HotSpotCompiledCode getCompiledCode(final Backend backend) {
-        getCompilationResult(backend);
-        assert compiledCode != null;
-        return compiledCode;
-    }
-
-    /**
-     * Gets the compilation result for this stub, compiling it first if necessary, and installing it
-     * in code.
-     */
-    public synchronized CompilationResult getCompilationResult(final Backend backend) {
-        if (code == null) {
-            getCode(backend);
-        }
-        return compResult;
-    }
 }
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3050,15 +3050,12 @@
   thr_yield();
 }
 
-// Interface for setting lwp priorities.  If we are using T2 libthread,
-// which forces the use of BoundThreads or we manually set UseBoundThreads,
-// all of our threads will be assigned to real lwp's.  Using the thr_setprio
-// function is meaningless in this mode so we must adjust the real lwp's priority
+// Interface for setting lwp priorities.  We are using T2 libthread,
+// which forces the use of bound threads, so all of our threads will
+// be assigned to real lwp's.  Using the thr_setprio function is
+// meaningless in this mode so we must adjust the real lwp's priority.
 // The routines below implement the getting and setting of lwp priorities.
 //
-// Note: T2 is now the only supported libthread. UseBoundThreads flag is
-//       being deprecated and all threads are now BoundThreads
-//
 // Note: There are three priority scales used on Solaris.  Java priotities
 //       which range from 1 to 10, libthread "thr_setprio" scale which range
 //       from 0 to 127, and the current scheduling class of the process we
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -248,7 +248,9 @@
   } else if ((lf = x->array()->as_LoadField()) != NULL) {
     ciField* field = lf->field();
     if (field->is_static_constant()) {
-      assert(PatchALot || ScavengeRootsInCode < 2, "Constant field loads are folded during parsing");
+      // Constant field loads are usually folded during parsing.
+      // But it doesn't happen with PatchALot, ScavengeRootsInCode < 2, or when
+      // holder class is being initialized during parsing (for static fields).
       ciObject* c = field->constant_value().as_object();
       if (!c->is_null_object()) {
         set_constant(c->as_array()->length());
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1413,6 +1413,17 @@
   append(c);
 }
 
+void LIR_List::null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null) {
+  if (deoptimize_on_null) {
+    // Emit an explicit null check and deoptimize if opr is null
+    CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_null_check, Deoptimization::Action_none);
+    cmp(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL));
+    branch(lir_cond_equal, T_OBJECT, deopt);
+  } else {
+    // Emit an implicit null check
+    append(new LIR_Op1(lir_null_check, opr, info));
+  }
+}
 
 void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
                         LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -2113,7 +2113,7 @@
   void   pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64,   src, dst, T_LONG, lir_patch_none, NULL)); }
   void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
 
-  void null_check(LIR_Opr opr, CodeEmitInfo* info)         { append(new LIR_Op1(lir_null_check, opr, info)); }
+  void null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null = false);
   void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
     append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
   }
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1752,8 +1752,10 @@
   if (x->needs_null_check() &&
       (needs_patching ||
        MacroAssembler::needs_explicit_null_check(x->offset()))) {
-    // emit an explicit null check because the offset is too large
-    __ null_check(object.result(), new CodeEmitInfo(info));
+    // Emit an explicit null check because the offset is too large.
+    // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
+    // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
+    __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
   }
 
   LIR_Address* address;
@@ -1838,8 +1840,10 @@
       obj = new_register(T_OBJECT);
       __ move(LIR_OprFact::oopConst(NULL), obj);
     }
-    // emit an explicit null check because the offset is too large
-    __ null_check(obj, new CodeEmitInfo(info));
+    // Emit an explicit null check because the offset is too large.
+    // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
+    // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
+    __ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching);
   }
 
   LIR_Opr reg = rlock_result(x, field_type);
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -101,6 +101,7 @@
   _debug_info = NULL;
   _dependencies = NULL;
   _failure_reason = NULL;
+  _inc_decompile_count_on_failure = true;
   _compilable = MethodCompilable;
   _break_at_compile = false;
   _compiler_data = NULL;
@@ -161,6 +162,7 @@
   _debug_info = NULL;
   _dependencies = NULL;
   _failure_reason = NULL;
+  _inc_decompile_count_on_failure = true;
   _compilable = MethodCompilable_never;
   _break_at_compile = false;
   _compiler_data = NULL;
@@ -902,7 +904,12 @@
     if (deps.is_klass_type())  continue;  // skip klass dependencies
     Klass* witness = deps.check_dependency();
     if (witness != NULL) {
-      record_failure("invalid non-klass dependency");
+      if (deps.type() == Dependencies::call_site_target_value) {
+        _inc_decompile_count_on_failure = false;
+        record_failure("call site target change");
+      } else {
+        record_failure("invalid non-klass dependency");
+      }
       return;
     }
   }
@@ -1017,7 +1024,7 @@
     if (failing()) {
       // While not a true deoptimization, it is a preemptive decompile.
       MethodData* mdo = method()->method_data();
-      if (mdo != NULL) {
+      if (mdo != NULL && _inc_decompile_count_on_failure) {
         mdo->inc_decompile_count();
       }
 
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -55,6 +55,7 @@
   DebugInformationRecorder* _debug_info;
   Dependencies*    _dependencies;
   const char*      _failure_reason;
+  bool             _inc_decompile_count_on_failure;
   int              _compilable;
   bool             _break_at_compile;
   int              _num_inlined_bytecodes;
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -2269,6 +2269,7 @@
   compute_offset(_monitors_offset,   k, vmSymbols::monitors_name(),    vmSymbols::object_array_signature());
   compute_offset(_locals_offset,     k, vmSymbols::locals_name(),      vmSymbols::object_array_signature());
   compute_offset(_operands_offset,   k, vmSymbols::operands_name(),    vmSymbols::object_array_signature());
+  compute_offset(_mode_offset,       k, vmSymbols::mode_name(),        vmSymbols::int_signature());
 }
 
 void java_lang_reflect_AccessibleObject::compute_offsets() {
@@ -3658,6 +3659,7 @@
 int java_lang_LiveStackFrameInfo::_monitors_offset;
 int java_lang_LiveStackFrameInfo::_locals_offset;
 int java_lang_LiveStackFrameInfo::_operands_offset;
+int java_lang_LiveStackFrameInfo::_mode_offset;
 int java_lang_AssertionStatusDirectives::classes_offset;
 int java_lang_AssertionStatusDirectives::classEnabled_offset;
 int java_lang_AssertionStatusDirectives::packages_offset;
@@ -3728,6 +3730,10 @@
   element->obj_field_put(_operands_offset, value);
 }
 
+void java_lang_LiveStackFrameInfo::set_mode(oop element, int value) {
+  element->int_field_put(_mode_offset, value);
+}
+
 // Support for java Assertions - java_lang_AssertionStatusDirectives.
 
 void java_lang_AssertionStatusDirectives::set_classes(oop o, oop val) {
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1380,11 +1380,13 @@
   static int _monitors_offset;
   static int _locals_offset;
   static int _operands_offset;
+  static int _mode_offset;
 
  public:
   static void set_monitors(oop info, oop value);
   static void set_locals(oop info, oop value);
   static void set_operands(oop info, oop value);
+  static void set_mode(oop info, int value);
 
   static void compute_offsets();
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -325,14 +325,8 @@
   template(java_lang_StackStreamFactory_AbstractStackWalker, "java/lang/StackStreamFactory$AbstractStackWalker") \
   template(doStackWalk_signature,                     "(JIIII)Ljava/lang/Object;")                \
   template(asPrimitive_name,                          "asPrimitive")                              \
-  template(asPrimitive_int_signature,                 "(I)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_long_signature,                "(J)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_short_signature,               "(S)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_byte_signature,                "(B)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_char_signature,                "(C)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_float_signature,               "(F)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_double_signature,              "(D)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
-  template(asPrimitive_boolean_signature,             "(Z)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+  template(asPrimitive_int_signature,                 "(I)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
+  template(asPrimitive_long_signature,                "(J)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
                                                                                                   \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \
@@ -444,6 +438,7 @@
   template(monitors_name,                             "monitors")                                 \
   template(locals_name,                               "locals")                                   \
   template(operands_name,                             "operands")                                 \
+  template(mode_name,                                 "mode")                                     \
   template(oop_size_name,                             "oop_size")                                 \
   template(static_oop_field_count_name,               "static_oop_field_count")                   \
   template(protection_domain_name,                    "protection_domain")                        \
--- a/hotspot/src/share/vm/code/codeCache.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1211,7 +1211,7 @@
   CompiledMethodIterator iter;
   while(iter.next_alive()) {
     CompiledMethod* nm = iter.method();
-    if (nm->is_marked_for_deoptimization()) {
+    if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
       nm->make_not_entrant();
     }
   }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1146,6 +1146,14 @@
   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
   assert(!is_zombie(), "should not already be a zombie");
 
+  if (_state == state) {
+    // Avoid taking the lock if already in required state.
+    // This is safe from races because the state is an end-state,
+    // which the nmethod cannot back out of once entered.
+    // No need for fencing either.
+    return false;
+  }
+
   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
   nmethodLocker nml(this);
   methodHandle the_method(method());
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -488,9 +488,6 @@
   _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
   _cms_start_registered(false)
 {
-  if (ExplicitGCInvokesConcurrentAndUnloadsClasses) {
-    ExplicitGCInvokesConcurrent = true;
-  }
   // Now expand the span and allocate the collection support structures
   // (MUT, marking bit map etc.) to cover both generations subject to
   // collection.
@@ -2559,10 +2556,8 @@
 // Decide if we want to enable class unloading as part of the
 // ensuing concurrent GC cycle. We will collect and
 // unload classes if it's the case that:
-// (1) an explicit gc request has been made and the flag
-//     ExplicitGCInvokesConcurrentAndUnloadsClasses is set, OR
-// (2) (a) class unloading is enabled at the command line, and
-//     (b) old gen is getting really full
+//  (a) class unloading is enabled at the command line, and
+//  (b) old gen is getting really full
 // NOTE: Provided there is no change in the state of the heap between
 // calls to this method, it should have idempotent results. Moreover,
 // its results should be monotonically increasing (i.e. going from 0 to 1,
@@ -2575,11 +2570,7 @@
 // below.
 void CMSCollector::update_should_unload_classes() {
   _should_unload_classes = false;
-  // Condition 1 above
-  if (_full_gc_requested && ExplicitGCInvokesConcurrentAndUnloadsClasses) {
-    _should_unload_classes = true;
-  } else if (CMSClassUnloadingEnabled) { // Condition 2.a above
-    // Disjuncts 2.b.(i,ii,iii) above
+  if (CMSClassUnloadingEnabled) {
     _should_unload_classes = (concurrent_cycles_since_last_unload() >=
                               CMSClassUnloadingMaxInterval)
                            || _cmsGen->is_too_full();
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -711,29 +711,6 @@
   guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
 }
 
-#ifndef PRODUCT
-void HeapRegionRemSet::print() {
-  HeapRegionRemSetIterator iter(this);
-  size_t card_index;
-  while (iter.has_next(card_index)) {
-    HeapWord* card_start = _bot->address_for_index(card_index);
-    tty->print_cr("  Card " PTR_FORMAT, p2i(card_start));
-  }
-  if (iter.n_yielded() != occupied()) {
-    tty->print_cr("Yielded disagrees with occupied:");
-    tty->print_cr("  " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
-                  " coarse, " SIZE_FORMAT_W(6) " fine).",
-                  iter.n_yielded(),
-                  iter.n_yielded_coarse(), iter.n_yielded_fine());
-    tty->print_cr("  " SIZE_FORMAT_W(6) " occ     (" SIZE_FORMAT_W(6)
-                           " coarse, " SIZE_FORMAT_W(6) " fine).",
-                  occupied(), occ_coarse(), occ_fine());
-  }
-  guarantee(iter.n_yielded() == occupied(),
-            "We should have yielded all the represented cards.");
-}
-#endif
-
 void HeapRegionRemSet::cleanup() {
   SparsePRT::cleanup_all();
 }
@@ -917,10 +894,6 @@
     // Otherwise...
     break;
   }
-  assert(ParallelGCThreads > 1 ||
-         n_yielded() == _hrrs->occupied(),
-         "Should have yielded all the cards in the rem set "
-         "(in the non-par case).");
   return false;
 }
 
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -290,8 +290,6 @@
   // consumed by the strong code roots.
   size_t strong_code_roots_mem_size();
 
-  void print() PRODUCT_RETURN;
-
   // Called during a stop-world phase to perform any deferred cleanups.
   static void cleanup();
 
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2199,7 +2199,6 @@
   ResourceMark rm;
   assert(is_method(), "must be method");
   st->print_cr("%s", internal_name());
-  // get the effect of PrintOopAddress, always, for methods:
   st->print_cr(" - this oop:          " INTPTR_FORMAT, p2i(this));
   st->print   (" - method holder:     "); method_holder()->print_value_on(st); st->cr();
   st->print   (" - constants:         " INTPTR_FORMAT " ", p2i(constants()));
--- a/hotspot/src/share/vm/opto/type.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/opto/type.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -373,7 +373,7 @@
   if (con_type != NULL && field->is_call_site_target()) {
     ciCallSite* call_site = holder->as_call_site();
     if (!call_site->is_constant_call_site()) {
-      ciMethodHandle* target = call_site->get_target();
+      ciMethodHandle* target = con.as_object()->as_method_handle();
       Compile::current()->dependencies()->assert_call_site_target_value(call_site, target);
     }
   }
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2967,14 +2967,7 @@
   JVMWrapper("JVM_Yield");
   if (os::dont_yield()) return;
   HOTSPOT_THREAD_YIELD();
-
-  // When ConvertYieldToSleep is off (default), this matches the classic VM use of yield.
-  // Critical for similar threading behaviour
-  if (ConvertYieldToSleep) {
-    os::sleep(thread, MinSleepInterval, false);
-  } else {
-    os::naked_yield();
-  }
+  os::naked_yield();
 JVM_END
 
 
@@ -2998,18 +2991,7 @@
   EventThreadSleep event;
 
   if (millis == 0) {
-    // When ConvertSleepToYield is on, this matches the classic VM implementation of
-    // JVM_Sleep. Critical for similar threading behaviour (Win32)
-    // It appears that in certain GUI contexts, it may be beneficial to do a short sleep
-    // for SOLARIS
-    if (ConvertSleepToYield) {
-      os::naked_yield();
-    } else {
-      ThreadState old_state = thread->osthread()->get_state();
-      thread->osthread()->set_state(SLEEPING);
-      os::sleep(thread, MinSleepInterval, false);
-      thread->osthread()->set_state(old_state);
-    }
+    os::naked_yield();
   } else {
     ThreadState old_state = thread->osthread()->get_state();
     thread->osthread()->set_state(SLEEPING);
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1230,8 +1230,12 @@
     assert(thread->is_VM_thread(), "wrong thread");
 
     // get JavaThread for whom we are proxy
-    JavaThread *real_thread =
-        (JavaThread *)((VMThread *)thread)->vm_operation()->calling_thread();
+    Thread *calling_thread = ((VMThread *)thread)->vm_operation()->calling_thread();
+    if (!calling_thread->is_Java_thread()) {
+      // cannot post an event to a non-JavaThread
+      return;
+    }
+    JavaThread *real_thread = (JavaThread *)calling_thread;
 
     JvmtiEnvIterator it;
     for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1208,9 +1208,10 @@
     if (reference_klass != NULL && reference_klass->is_instance_klass()) {
       // Emulate LinkResolver::check_klass_accessability.
       Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
-      if (Reflection::verify_class_access(caller,
-                                          reference_klass,
-                                          true) != Reflection::ACCESS_OK) {
+      if (caller != SystemDictionary::Object_klass()
+          && Reflection::verify_class_access(caller,
+                                             reference_klass,
+                                             true) != Reflection::ACCESS_OK) {
         THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), reference_klass->external_name());
       }
     }
--- a/hotspot/src/share/vm/prims/stackwalk.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -173,7 +173,11 @@
   }
 }
 
-oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
+// Create and return a LiveStackFrame.PrimitiveSlot (if needed) for the
+// StackValue at the given index. 'type' is expected to be T_INT, T_LONG,
+// T_OBJECT, or T_CONFLICT.
+oop LiveFrameStream::create_primitive_slot_instance(StackValueCollection* values,
+                                                    int i, BasicType type, TRAPS) {
   Klass* k = SystemDictionary::resolve_or_null(vmSymbols::java_lang_LiveStackFrameInfo(), CHECK_NULL);
   instanceKlassHandle ik (THREAD, k);
 
@@ -182,8 +186,8 @@
   Symbol* signature = NULL;
 
   // ## TODO: type is only available in LocalVariable table, if present.
-  // ## StackValue type is T_INT or T_OBJECT.
-  switch (values->at(i)->type()) {
+  // ## StackValue type is T_INT or T_OBJECT (or converted to T_LONG on 64-bit)
+  switch (type) {
     case T_INT:
       args.push_int(values->int_at(i));
       signature = vmSymbols::asPrimitive_int_signature();
@@ -195,42 +199,26 @@
       break;
 
     case T_FLOAT:
-      args.push_float(values->float_at(i));
-      signature = vmSymbols::asPrimitive_float_signature();
-      break;
-
     case T_DOUBLE:
-      args.push_double(values->double_at(i));
-      signature = vmSymbols::asPrimitive_double_signature();
-      break;
-
     case T_BYTE:
-      args.push_int(values->int_at(i));
-      signature = vmSymbols::asPrimitive_byte_signature();
-      break;
-
     case T_SHORT:
-      args.push_int(values->int_at(i));
-      signature = vmSymbols::asPrimitive_short_signature();
-      break;
-
     case T_CHAR:
-      args.push_int(values->int_at(i));
-      signature = vmSymbols::asPrimitive_char_signature();
-      break;
-
     case T_BOOLEAN:
-      args.push_int(values->int_at(i));
-      signature = vmSymbols::asPrimitive_boolean_signature();
-      break;
+      THROW_MSG_(vmSymbols::java_lang_InternalError(), "Unexpected StackValue type", NULL);
 
     case T_OBJECT:
       return values->obj_at(i)();
 
     case T_CONFLICT:
       // put a non-null slot
-      args.push_int(0);
-      signature = vmSymbols::asPrimitive_int_signature();
+      #ifdef _LP64
+        args.push_long(0);
+        signature = vmSymbols::asPrimitive_long_signature();
+      #else
+        args.push_int(0);
+        signature = vmSymbols::asPrimitive_int_signature();
+      #endif
+
       break;
 
     default: ShouldNotReachHere();
@@ -252,9 +240,19 @@
   objArrayHandle array_h(THREAD, array_oop);
   for (int i = 0; i < values->size(); i++) {
     StackValue* st = values->at(i);
-    oop obj = create_primitive_value_instance(values, i, CHECK_(empty));
-    if (obj != NULL)
+    BasicType type = st->type();
+    int index = i;
+#ifdef _LP64
+    if (type != T_OBJECT && type != T_CONFLICT) {
+        intptr_t ret = st->get_int(); // read full 64-bit slot
+        type = T_LONG;                // treat as long
+        index--;                      // undo +1 in StackValueCollection::long_at
+    }
+#endif
+    oop obj = create_primitive_slot_instance(values, index, type, CHECK_(empty));
+    if (obj != NULL) {
       array_h->obj_at_put(i, obj);
+    }
   }
   return array_h;
 }
@@ -286,6 +284,13 @@
     StackValueCollection* expressions = _jvf->expressions();
     GrowableArray<MonitorInfo*>* monitors = _jvf->monitors();
 
+    int mode = 0;
+    if (_jvf->is_interpreted_frame()) {
+      mode = MODE_INTERPRETED;
+    } else if (_jvf->is_compiled_frame()) {
+      mode = MODE_COMPILED;
+    }
+
     if (!locals->is_empty()) {
       objArrayHandle locals_h = values_to_object_array(locals, CHECK);
       java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
@@ -298,6 +303,7 @@
       objArrayHandle monitors_h = monitors_to_object_array(monitors, CHECK);
       java_lang_LiveStackFrameInfo::set_monitors(stackFrame(), monitors_h());
     }
+    java_lang_LiveStackFrameInfo::set_mode(stackFrame(), mode);
   }
 }
 
--- a/hotspot/src/share/vm/prims/stackwalk.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -92,11 +92,16 @@
 
 class LiveFrameStream : public BaseFrameStream {
 private:
+  enum {
+    MODE_INTERPRETED = 0x01,
+    MODE_COMPILED    = 0x02
+  };
+
   javaVFrame*           _jvf;
 
   void fill_live_stackframe(Handle stackFrame, const methodHandle& method, TRAPS);
-  static oop create_primitive_value_instance(StackValueCollection* values,
-                                             int i, TRAPS);
+  static oop create_primitive_slot_instance(StackValueCollection* values,
+                                            int i, BasicType type, TRAPS);
   static objArrayHandle monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors,
                                                  TRAPS);
   static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS);
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Mar 13 19:58:52 2017 +0000
@@ -375,53 +375,17 @@
   // -------------- Deprecated Flags --------------
   // --- Non-alias flags - sorted by obsolete_in then expired_in:
   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "AutoGCSelectPauseMillis",      JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "UseAutoGCSelectPolicy",        JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "UseParNewGC",                  JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "ExplicitGCInvokesConcurrentAndUnloadsClasses", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "ConvertSleepToYield",          JDK_Version::jdk(9), JDK_Version::jdk(10),     JDK_Version::jdk(11) },
-  { "ConvertYieldToSleep",          JDK_Version::jdk(9), JDK_Version::jdk(10),     JDK_Version::jdk(11) },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
   { "CreateMinidumpOnCrash",        JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "CMSMarkStackSizeMax",          JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "CMSMarkStackSize",             JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "G1MarkStackSize",              JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "ParallelMarkingThreads",       JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
-  { "ParallelCMSThreads",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
 
   // -------------- Obsolete Flags - sorted by expired_in --------------
-  { "UseOldInlining",                JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "SafepointPollOffset",           JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "UseBoundThreads",               JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "DefaultThreadPriority",         JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "NoYieldsInMicrolock",           JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "BackEdgeThreshold",             JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "UseNewReflection",              JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "ReflectionWrapResolutionErrors",JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "VerifyReflectionBytecodes",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "AutoShutdownNMT",               JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "NmethodSweepFraction",          JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "NmethodSweepCheckInterval",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "CodeCacheMinimumFreeSpace",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-#ifndef ZERO
-  { "UseFastAccessorMethods",        JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "UseFastEmptyMethods",           JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-#endif // ZERO
-  { "UseCompilerSafepoints",         JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "AdaptiveSizePausePolicy",       JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "ParallelGCRetainPLAB",          JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "ThreadSafetyMargin",            JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "LazyBootClassLoader",           JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "StarvationMonitorInterval",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "PreInflateSpin",                JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "JNIDetachReleasesMonitors",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "UseAltSigs",                    JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "SegmentedHeapDumpThreshold",    JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "PrintOopAddress",               JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-  { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
-  { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
+  { "ConvertSleepToYield",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
+  { "ConvertYieldToSleep",           JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
+  { "MinSleepInterval",              JDK_Version::jdk(9),      JDK_Version::jdk(10), JDK_Version::jdk(11) },
+  { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
+  { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
@@ -444,11 +408,6 @@
 
 static AliasedFlag const aliased_jvm_flags[] = {
   { "DefaultMaxRAMFraction",    "MaxRAMFraction"    },
-  { "CMSMarkStackSizeMax",      "MarkStackSizeMax"  },
-  { "CMSMarkStackSize",         "MarkStackSize"     },
-  { "G1MarkStackSize",          "MarkStackSize"     },
-  { "ParallelMarkingThreads",   "ConcGCThreads"     },
-  { "ParallelCMSThreads",       "ConcGCThreads"     },
   { "CreateMinidumpOnCrash",    "CreateCoredumpOnCrash" },
   { NULL, NULL}
 };
@@ -1547,7 +1506,6 @@
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
          "control point invariant");
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1588,7 +1546,6 @@
 void Arguments::set_cms_and_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
   disable_adaptive_size_policy("UseConcMarkSweepGC");
@@ -1728,16 +1685,6 @@
   NOT_LP64(ShouldNotReachHere(); return 0);
 }
 
-bool Arguments::should_auto_select_low_pause_collector() {
-  if (UseAutoGCSelectPolicy &&
-      !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
-      (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
-    log_trace(gc)("Automatic selection of the low pause collector based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
-    return true;
-  }
-  return false;
-}
-
 void Arguments::set_use_compressed_oops() {
 #ifndef ZERO
 #ifdef _LP64
@@ -1841,16 +1788,7 @@
 void Arguments::select_gc_ergonomically() {
 #if INCLUDE_ALL_GCS
   if (os::is_server_class_machine()) {
-    if (!UseAutoGCSelectPolicy) {
-       FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
-    } else {
-      if (should_auto_select_low_pause_collector()) {
-        FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true);
-        FLAG_SET_ERGO_IF_DEFAULT(bool, UseParNewGC, true);
-      } else {
-        FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true);
-      }
-    }
+    FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
   } else {
     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
   }
@@ -1859,7 +1797,6 @@
   UNSUPPORTED_OPTION(UseParallelGC);
   UNSUPPORTED_OPTION(UseParallelOldGC);
   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
-  UNSUPPORTED_OPTION(UseParNewGC);
   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
 #endif // INCLUDE_ALL_GCS
 }
@@ -2073,7 +2010,6 @@
   if (!ClassUnloading) {
     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
-    FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false);
   }
 #endif // INCLUDE_ALL_GCS
 }
@@ -2428,18 +2364,6 @@
     return false;
   }
 
-  if (UseConcMarkSweepGC && !UseParNewGC) {
-    jio_fprintf(defaultStream::error_stream(),
-        "It is not possible to combine the DefNew young collector with the CMS collector.\n");
-    return false;
-  }
-
-  if (UseParNewGC && !UseConcMarkSweepGC) {
-    jio_fprintf(defaultStream::error_stream(),
-        "It is not possible to combine the ParNew young collector with any collector other than CMS.\n");
-    return false;
-  }
-
   return true;
 }
 
@@ -3726,11 +3650,6 @@
     }
   }
 
-  if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
-    // CMS can only be used with ParNew
-    FLAG_SET_ERGO(bool, UseParNewGC, true);
-  }
-
   if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -480,9 +480,6 @@
   static julong limit_by_allocatable_memory(julong size);
   // Setup heap size
   static void set_heap_size();
-  // Based on automatic selection criteria, should the
-  // low pause collector be used.
-  static bool should_auto_select_low_pause_collector();
 
   // Bytecode rewriting
   static void set_bytecode_flags();
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1159,13 +1159,6 @@
   product_pd(bool, DontYieldALot,                                           \
           "Throw away obvious excess yield calls")                          \
                                                                             \
-  product(bool, ConvertSleepToYield, true,                                  \
-          "Convert sleep(0) to thread yield ")                              \
-                                                                            \
-  product(bool, ConvertYieldToSleep, false,                                 \
-          "Convert yield to a sleep of MinSleepInterval to simulate Win32 " \
-          "behavior")                                                       \
-                                                                            \
   develop(bool, UseDetachedThreads, true,                                   \
           "Use detached threads that are recycled upon termination "        \
           "(for Solaris only)")                                             \
@@ -1479,11 +1472,6 @@
           "A System.gc() request invokes a concurrent collection; "         \
           "(effective only when using concurrent collectors)")              \
                                                                             \
-  product(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false,        \
-          "A System.gc() request invokes a concurrent collection and "      \
-          "also unloads classes during such a concurrent gc cycle "         \
-          "(effective only when UseConcMarkSweepGC)")                       \
-                                                                            \
   product(bool, GCLockerInvokesConcurrent, false,                           \
           "The exit of a JNI critical section necessitating a scavenge, "   \
           "also kicks off a background concurrent collection")              \
@@ -1501,9 +1489,6 @@
   product(bool, UseCMSBestFit, true,                                        \
           "Use CMS best fit allocation strategy")                           \
                                                                             \
-  product(bool, UseParNewGC, false,                                         \
-          "Use parallel threads in the new generation")                     \
-                                                                            \
   product(uintx, ParallelGCBufferWastePct, 10,                              \
           "Wasted fraction of parallel allocation buffer")                  \
           range(0, 100)                                                     \
@@ -2059,13 +2044,6 @@
           "Maximum fraction (1/n) of virtual memory used for ergonomically "\
           "determining maximum heap size")                                  \
                                                                             \
-  product(bool, UseAutoGCSelectPolicy, false,                               \
-          "Use automatic collection selection policy")                      \
-                                                                            \
-  product(uintx, AutoGCSelectPauseMillis, 5000,                             \
-          "Automatic GC selection pause threshold in milliseconds")         \
-          range(0, max_uintx)                                               \
-                                                                            \
   product(bool, UseAdaptiveSizePolicy, true,                                \
           "Use adaptive generation sizing policies")                        \
                                                                             \
@@ -3003,10 +2981,6 @@
   develop(intx, DontYieldALotInterval,    10,                               \
           "Interval between which yields will be dropped (milliseconds)")   \
                                                                             \
-  develop(intx, MinSleepInterval,     1,                                    \
-          "Minimum sleep() interval (milliseconds) when "                   \
-          "ConvertSleepToYield is off (used for Solaris)")                  \
-                                                                            \
   develop(intx, ProfilerPCTickThreshold,    15,                             \
           "Number of ticks in a PC buckets to be a hotspot")                \
                                                                             \
--- a/hotspot/test/ProblemList.txt	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/ProblemList.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -73,6 +73,7 @@
 
 serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
 serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
+serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
 
 #############################################################################
 
--- a/hotspot/test/TEST.groups	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/TEST.groups	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -209,11 +209,8 @@
   gc/g1/TestShrinkToOneRegion.java \
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/startup_warnings/TestCMS.java \
-  gc/startup_warnings/TestDefNewCMS.java \
   gc/startup_warnings/TestParallelGC.java \
   gc/startup_warnings/TestParallelScavengeSerialOld.java \
-  gc/startup_warnings/TestParNewCMS.java \
-  gc/startup_warnings/TestParNewSerialOld.java \
   runtime/SharedArchiveFile/SharedArchiveFile.java
 
 # Minimal VM on Compact 2 adds in some compact2 tests
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/TestUnresolvedField.jasm	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 compiler/c1/TestUnresolvedField version 52:0 {
+    public static Method testGetField:"()V" stack 1 locals 1 {
+        aconst_null;
+        getfield Field T.f:I; // T does not exist
+        return;
+    }
+
+    public static Method testPutField:"()V" stack 2 locals 1 {
+        aconst_null;
+        iconst_0;
+        putfield Field T.f:I; // T does not exist
+        return;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/TestUnresolvedFieldMain.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173373
+ * @compile TestUnresolvedField.jasm
+ * @run main/othervm -XX:TieredStopAtLevel=1 -Xcomp
+ *                   -XX:CompileCommand=compileonly,compiler.c1.TestUnresolvedField::test*
+ *                   compiler.c1.TestUnresolvedFieldMain
+ */
+
+package compiler.c1;
+
+public class TestUnresolvedFieldMain {
+    public static void main(String[] args) {
+        try {
+          TestUnresolvedField.testGetField();
+        } catch (java.lang.NoClassDefFoundError error) {
+          // Expected
+        }
+        try {
+          TestUnresolvedField.testPutField();
+        } catch (java.lang.NoClassDefFoundError error) {
+          // Expected
+        }
+    }
+}
--- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,6 @@
 
 /**
  * @test
- * @modules java.base/jdk.internal.misc
  * @library /test/lib /
  *
  * @run driver compiler.jsr292.ContinuousCallSiteTargetChange
@@ -31,6 +30,7 @@
 
 package compiler.jsr292;
 
+import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
@@ -39,15 +39,26 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.MutableCallSite;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 public class ContinuousCallSiteTargetChange {
-    static void testServer() throws Exception {
+    static final int ITERATIONS = Integer.parseInt(System.getProperty("iterations", "50"));
+
+    static void runTest(Class<?> test, String... extraArgs) throws Exception {
+        List<String> argsList = new ArrayList<>(
+                List.of("-XX:+IgnoreUnrecognizedVMOptions",
+                    "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
+                    "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining"));
+
+        argsList.addAll(Arrays.asList(extraArgs));
+
+        argsList.add(test.getName());
+        argsList.add(Integer.toString(ITERATIONS));
+
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+IgnoreUnrecognizedVMOptions",
-                "-server", "-XX:-TieredCompilation", "-Xbatch",
-                "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
-                "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                Test.class.getName(), "100");
+                argsList.toArray(new String[argsList.size()]));
 
         OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
 
@@ -55,30 +66,42 @@
 
         analyzer.shouldNotContain("made not compilable");
         analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
+
     }
 
-    static void testClient() throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:+IgnoreUnrecognizedVMOptions",
-                "-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
-                "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
-                "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
-                Test.class.getName(), "100");
+    static void testServer(Class<?> test, String... args) throws Exception {
+        List<String> extraArgsList = new ArrayList<>(
+                List.of("-server", "-XX:-TieredCompilation"));
+        extraArgsList.addAll(Arrays.asList(args));
 
-        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+        runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
+    }
 
-        analyzer.shouldHaveExitValue(0);
+    static void testClient(Class<?> test, String... args) throws Exception {
+        List<String> extraArgsList = new ArrayList<>(
+                List.of("-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1"));
+        extraArgsList.addAll(Arrays.asList(args));
 
-        analyzer.shouldNotContain("made not compilable");
-        analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
+        runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
     }
 
     public static void main(String[] args) throws Exception {
-        testServer();
-        testClient();
+        testServer(RecompilationTest.class, "-Xbatch");
+        testClient(RecompilationTest.class, "-Xbatch");
+
+        testServer(PingPongTest.class);
+        testClient(PingPongTest.class);
     }
 
-    static class Test {
+    static MethodHandle findStatic(Class<?> cls, String name, MethodType mt) {
+        try {
+            return MethodHandles.lookup().findStatic(cls, name, mt);
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+
+    static class RecompilationTest {
         static final MethodType mt = MethodType.methodType(void.class);
         static final CallSite cs = new MutableCallSite(mt);
 
@@ -96,7 +119,7 @@
         }
 
         static void iteration() throws Throwable {
-            MethodHandle mh1 = MethodHandles.lookup().findStatic(ContinuousCallSiteTargetChange.Test.class, "f", mt);
+            MethodHandle mh1 = findStatic(RecompilationTest.class, "f", mt);
             cs.setTarget(mh1);
             for (int i = 0; i < 20_000; i++) {
                 test1();
@@ -111,4 +134,38 @@
             }
         }
     }
+
+    static class PingPongTest {
+        static final MethodType mt = MethodType.methodType(void.class);
+        static final CallSite cs = new MutableCallSite(mt);
+
+        static final MethodHandle mh = cs.dynamicInvoker();
+
+        static final MethodHandle ping = findStatic(PingPongTest.class, "ping", mt);
+        static final MethodHandle pong = findStatic(PingPongTest.class, "pong", mt);
+
+        static void ping() {
+            Asserts.assertEQ(cs.getTarget(), ping, "wrong call site target");
+            cs.setTarget(pong);
+        }
+
+        static void pong() {
+            Asserts.assertEQ(cs.getTarget(), pong, "wrong call site target");
+            cs.setTarget(ping);
+        }
+
+        static void iteration() throws Throwable {
+            cs.setTarget(ping);
+            for (int i = 0; i < 20_000; i++) {
+                mh.invokeExact();
+            }
+        }
+
+        public static void main(String[] args) throws Throwable {
+            int iterations = Integer.parseInt(args[0]);
+            for (int i = 0; i < iterations; i++) {
+                iteration();
+            }
+        }
+    }
 }
--- a/hotspot/test/compiler/jsr292/patches/java.base/java/lang/invoke/MethodHandleHelper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/compiler/jsr292/patches/java.base/java/lang/invoke/MethodHandleHelper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -84,7 +84,7 @@
 
         public static MethodHandle make(MethodHandle target) {
             LambdaForm lform = DelegatingMethodHandle.makeReinvokerForm(
-                    target, -1, DelegatingMethodHandle.class, "reinvoker.dontInline",
+                    target, -1, DelegatingMethodHandle.class,
                 /*forceInline=*/false, DelegatingMethodHandle.NF_getTarget, null);
             return new NonInlinedReinvoker(target, lform);
         }
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -44,6 +44,8 @@
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:CompileCommand=exclude,*::check
  *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
+ *                   -XX:CompileCommand=dontinline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,testFrame
+ *                   -XX:CompileCommand=inline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,recurse
  *                   -Xbatch
  *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
  *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@@ -119,14 +121,25 @@
         }
         Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
                 + "Method unexpectedly not compiled");
+        Asserts.assertTrue(WB.getMethodCompilationLevel(METHOD) == 4, getName()
+                + "Method not compiled at level 4");
         testFrame("someString", COMPILE_THRESHOLD);
     }
 
     private void testFrame(String str, int iteration) {
         Helper helper = new Helper(str);
-        check(iteration);
+        recurse(2, iteration);
         Asserts.assertTrue((helper.string != null) && (this != null)
-                && (helper != null), getName() + " : some locals are null");
+                           && (helper != null), String.format("%s : some locals are null", getName()));
+    }
+    private void recurse(int depth, int iteration) {
+        if (depth == 0) {
+            check(iteration);
+        } else {
+            Integer s = new Integer(depth);
+            recurse(depth - 1, iteration);
+            Asserts.assertEQ(s.intValue(), depth, String.format("different values: %s != %s", s.intValue(), depth));
+        }
     }
 
     private void check(int iteration) {
--- a/hotspot/test/gc/arguments/TestExplicitGCInvokesConcurrentAndUnloadsClasses.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +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.
- */
-
-/*
- * @test TestExplicitGCInvokesConcurrentAndUnloadsClasses
- * @summary Test that the flag ExplicitGCInvokesConcurrentAndUnloadsClasses is deprecated
- * @bug 8170388
- * @key gc
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @run driver TestExplicitGCInvokesConcurrentAndUnloadsClasses
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-public class TestExplicitGCInvokesConcurrentAndUnloadsClasses {
-    public static void main(String[] args) throws Exception {
-        ProcessBuilder pb =
-            ProcessTools.createJavaProcessBuilder("-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses",
-                                                  "-Xlog:gc",
-                                                  "-version");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("ExplicitGCInvokesConcurrentAndUnloadsClasses was deprecated");
-        output.shouldHaveExitValue(0);
-    }
-}
--- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,6 @@
         assertVMOption(output, "UseSerialGC",        !isServer);
         // CMS is never default
         assertVMOption(output, "UseConcMarkSweepGC", false);
-        assertVMOption(output, "UseParNewGC",        false);
     }
 
     public static void main(String[] args) throws Exception {
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 TestDefNewCMS
-* @key gc
-* @bug 8065972
-* @summary Test that the unsupported DefNew+CMS combination does not start
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-*          java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestDefNewCMS {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("It is not possible to combine the DefNew young collector with the CMS collector.");
-    output.shouldContain("Error");
-    output.shouldHaveExitValue(1);
-  }
-
-}
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 TestParNewCMS
-* @key gc
-* @bug 8065972
-* @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-*          java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-
-public class TestParNewCMS {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Option UseParNewGC was deprecated in version");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 TestParNewSerialOld
-* @key gc
-* @bug 8065972
-* @summary Test that the unsupported ParNew+SerialOld combination does not start
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-*          java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-
-public class TestParNewSerialOld {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("It is not possible to combine the ParNew young collector with any collector other than CMS.");
-    output.shouldContain("Error");
-    output.shouldHaveExitValue(1);
-  }
-
-}
--- a/hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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.
- */
-
-/*
- * @test TestUseAutoGCSelectPolicy
- * @key gc
- * @bug 8166461 8167494
- * @summary Test that UseAutoGCSelectPolicy and AutoGCSelectPauseMillis do print a warning message
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- */
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestUseAutoGCSelectPolicy {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseAutoGCSelectPolicy", "-XX:AutoGCSelectPauseMillis=3000", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("UseAutoGCSelectPolicy was deprecated in version 9.0");
-    output.shouldContain("AutoGCSelectPauseMillis was deprecated in version 9.0");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-}
--- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,18 +37,18 @@
 
     // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449)
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:UseOldInliningPlusJunk", "-version");
+        "-XX:ConvertSleepToYieldPlusJunk", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unrecognized VM option 'UseOldInliningPlusJunk'"); // Must identify bad option.
+    output.shouldContain("Unrecognized VM option 'ConvertSleepToYieldPlusJunk'"); // Must identify bad option.
     output.shouldHaveExitValue(1);
 
-    // Case 2: Newly obsolete integer-valued flags should be recognized as newly obsolete (8073989)
+    // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989)
     ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
-        "-XX:NmethodSweepFraction=10", "-version");
+        "-XX:+ConvertSleepToYield", "-version");
 
     OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
     output2.shouldContain("Ignoring option").shouldContain("support was removed");
-    output2.shouldContain("NmethodSweepFraction");
+    output2.shouldContain("ConvertSleepToYield");
   }
 }
--- a/hotspot/test/runtime/CommandLine/VMAliasOptions.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/VMAliasOptions.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,6 @@
      */
     public static final String[][] ALIAS_OPTIONS = {
         {"DefaultMaxRAMFraction",   "MaxRAMFraction", "1032"},
-        {"CMSMarkStackSizeMax",     "MarkStackSizeMax", "1032"},
-        {"CMSMarkStackSize",        "MarkStackSize", "1032"},
-        {"G1MarkStackSize",         "MarkStackSize", "1032"},
-        {"ParallelMarkingThreads",  "ConcGCThreads", "2"},
-        {"ParallelCMSThreads",      "ConcGCThreads", "2"},
         {"CreateMinidumpOnCrash",   "CreateCoredumpOnCrash", "false" },
     };
 
--- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,17 +41,9 @@
     public static final String[][] DEPRECATED_OPTIONS = {
         // deprecated non-alias flags:
         {"MaxGCMinorPauseMillis", "1032"},
-        {"UseParNewGC", "false"},
-        {"ConvertSleepToYield", "false" },
-        {"ConvertYieldToSleep", "false" },
 
         // deprecated alias flags (see also aliased_jvm_flags):
         {"DefaultMaxRAMFraction", "4"},
-        {"CMSMarkStackSizeMax", "1032"},
-        {"CMSMarkStackSize", "1032"},
-        {"G1MarkStackSize", "1032"},
-        {"ParallelMarkingThreads", "2"},
-        {"ParallelCMSThreads", "2"},
         {"CreateMinidumpOnCrash", "false"}
     };
 
--- a/hotspot/test/runtime/LocalLong/LocalLongHelper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/LocalLong/LocalLongHelper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -30,10 +30,10 @@
 
 public class LocalLongHelper {
     static StackWalker sw;
-    static Method intValue;
+    static Method longValue;
     static Method getLocals;
     static Class<?> primitiveValueClass;
-    static Method primitiveType;
+    static Method primitiveSize;
     static Method getMethodType;
     static Field memberName;
     static Field offset;
@@ -43,27 +43,29 @@
         new LocalLongHelper().longArg(0xC0FFEE, 0x1234567890ABCDEFL);
     }
 
-    // locals[2] contains the high byte of the long argument.
+    // locals[2] contains the unused slot of the long argument.
     public long longArg(int i, long l) throws Throwable {
         List<StackFrame> frames = sw.walk(s -> s.collect(Collectors.toList()));
         Object[] locals = (Object[]) getLocals.invoke(frames.get(0));
 
-        int locals_2 = (int) intValue.invoke(locals[2]);
-        if (locals_2 != 0){
-            throw new RuntimeException("Expected locals_2 == 0");
+        if (8 == (int) primitiveSize.invoke(locals[2])) { // Only test 64-bit
+            long locals_2 = (long) longValue.invoke(locals[2]);
+            if (locals_2 != 0){
+                throw new RuntimeException("Expected locals_2 == 0");
+            }
         }
         return l; // Don't want l to become a dead var
     }
 
     private static void setupReflectionStatics() throws Throwable {
         Class<?> liveStackFrameClass = Class.forName("java.lang.LiveStackFrame");
-        primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveValue");
+        primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveSlot");
 
         getLocals = liveStackFrameClass.getDeclaredMethod("getLocals");
         getLocals.setAccessible(true);
 
-        intValue = primitiveValueClass.getDeclaredMethod("intValue");
-        intValue.setAccessible(true);
+        longValue = primitiveValueClass.getDeclaredMethod("longValue");
+        longValue.setAccessible(true);
 
         Class<?> stackFrameInfoClass = Class.forName("java.lang.StackFrameInfo");
         memberName = stackFrameInfoClass.getDeclaredField("memberName");
@@ -80,20 +82,8 @@
         f.setAccessible(true);
         Object localsAndOperandsOption = f.get(null);
 
-        primitiveType = primitiveValueClass.getDeclaredMethod("type");
-        primitiveType.setAccessible(true);
-
+        primitiveSize = primitiveValueClass.getDeclaredMethod("size");
+        primitiveSize.setAccessible(true);
         sw = (StackWalker) ewsNI.invoke(null, java.util.Collections.emptySet(), localsAndOperandsOption);
     }
-
-    private static String type(Object o) throws Throwable {
-        if (primitiveValueClass.isInstance(o)) {
-            final char c = (char) primitiveType.invoke(o);
-            return String.valueOf(c);
-        } else if (o != null) {
-            return o.getClass().getName();
-        } else {
-            return "null";
-        }
-    }
 }
--- a/hotspot/test/runtime/NMT/AutoshutdownNMT.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key nmt
- * @summary Test for deprecated message if -XX:-AutoShutdownNMT is specified
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- */
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class AutoshutdownNMT {
-
-    public static void main(String args[]) throws Exception {
-
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-XX:NativeMemoryTracking=detail",
-                "-XX:-AutoShutdownNMT",
-                "-version");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Ignoring option AutoShutdownNMT");
-    }
-}
--- a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java	Mon Mar 13 19:58:52 2017 +0000
@@ -68,7 +68,7 @@
         // Packages:          none
         // Packages exported: none
         ModuleDescriptor descriptor_first_mod =
-                ModuleDescriptor.module("first_mod")
+                ModuleDescriptor.newModule("first_mod")
                         .requires("java.base")
                         .requires("second_mod")
                         .build();
@@ -78,7 +78,7 @@
         // Packages:          p2
         // Packages exported: p2 is exported to first_mod
         ModuleDescriptor descriptor_second_mod =
-                ModuleDescriptor.module("second_mod")
+                ModuleDescriptor.newModule("second_mod")
                         .requires("java.base")
                         .exports("p2", Set.of("first_mod"))
                         .build();
@@ -89,7 +89,7 @@
         // Resolves "first_mod"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod"));
+                .resolve(finder, ModuleFinder.of(), Set.of("first_mod"));
 
         // Map each module to the same class loader
         Map<String, ClassLoader> map = new HashMap<>();
--- a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java	Mon Mar 13 19:58:52 2017 +0000
@@ -66,9 +66,9 @@
         // Packages:          p1, p4
         // Packages exported: none
         ModuleDescriptor descriptor_first_mod =
-                ModuleDescriptor.module("first_mod")
+                ModuleDescriptor.newModule("first_mod")
                         .requires("java.base")
-                        .contains(Set.of("p1", "p4"))
+                        .packages(Set.of("p1", "p4"))
                         .build();
 
         // Define module:     second_mod
@@ -76,7 +76,7 @@
         // Packages:          p2
         // Packages exported: p2 is exported to first_mod
         ModuleDescriptor descriptor_second_mod =
-                ModuleDescriptor.module("second_mod")
+                ModuleDescriptor.newModule("second_mod")
                         .requires("java.base")
                         .exports("p2", Set.of("first_mod"))
                         .build();
@@ -87,7 +87,7 @@
         // Resolves "first_mod" and "second_mod"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
+                .resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
 
         // Map each module to this class loader
         Map<String, ClassLoader> map = new HashMap<>();
--- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can not read module m2, then class p1.c1
- *          in module m1 can not access p2.c2 in module m2.
+ * @summary Test that if module m1x can not read module m2x, then class p1.c1
+ *          in module m1x can not access p2.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-//                  defines m2 --> packages p2
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+//                  defines m2x --> packages p2
+//                  defines m3x --> packages p3
 //
-// m1 can not read m2
-// package p2 in m2 is exported to m1
+// m1x can not read m2x
+// package p2 in m2x is exported to m1x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
-// Access denied since m1 can not read m2.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+// Access denied since m1x can not read m2x.
 //
 public class CheckRead {
 
@@ -64,65 +64,65 @@
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m3
+        // Define module:     m1x
+        // Can read:          java.base, m3x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m3")
+                        .requires("m3x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: p2 is exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
-        // Define module:     m3
-        // Can read:          java.base, m2
+        // Define module:     m3x
+        // Can read:          java.base, m2x
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
-                        .requires("m2")
-                        .contains("p3")
+                        .requires("m2x")
+                        .packages(Set.of("p3"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
-        map.put("m3", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
+        map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1, m2 and m3
+        // Create Layer that contains m1x, m2x and m3x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("cannot access")) {
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can not read module m2, then class p1.c1
- *          in module m1 can not access p2.c2 in module m2.
+ * @summary Test that if module m1x can not read module m2x, then class p1.c1
+ *          in module m1x can not access p2.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+//                  defines m3x --> packages p3
 //
-// m1 can not read m2
-// package p2 in m2 is exported to m1
+// m1x can not read m2x
+// package p2 in m2x is exported to m1x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
-// Access denied since m1 can not read m2.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+// Access denied since m1x can not read m2x.
 //
 public class DiffCL_CheckRead {
 
@@ -64,65 +64,65 @@
     // publicly defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m3
+        // Define module:     m1x
+        // Can read:          java.base, m3x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m3")
+                        .requires("m3x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: p2 is exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
-        // Define module:     m3
-        // Can read:          java.base, m2
+        // Define module:     m3x
+        // Can read:          java.base, m2x
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
-                        .requires("m2")
-                        .contains("p3")
+                        .requires("m2x")
+                        .packages(Set.of("p3"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
-        map.put("m3", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
+        map.put("m3x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1, m2 and m3
+        // Create Layer that contains m1x, m2x and m3x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
-        assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("cannot access")) {
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2
- *          is exported specifically to module m3, then class p1.c1 in m1 can not
- *          access p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x
+ *          is exported specifically to module m3x, then class p1.c1 in m1x can not
+ *          access p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+//                  defines m3x --> packages p3
 //
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
 //
 public class DiffCL_ExpQualOther {
 
@@ -65,66 +65,66 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2, m3
+        // Define module:     m1x
+        // Can read:          java.base, m2x, m3x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
-                        .requires("m3")
+                        .requires("m2x")
+                        .requires("m3x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
-        // Can read:          java.base, m3
+        // Define module:     m2x
+        // Can read:          java.base, m3x
         // Packages:          p2
-        // Packages exported: p2 is exported to m3
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported to m3x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m3"))
+                        .exports("p2", Set.of("m3x"))
                         .build();
 
-        // Define module:     m3
-        // Can read:          java.base, m2
+        // Define module:     m3x
+        // Can read:          java.base, m2x
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
-                        .requires("m2")
-                        .contains("p3")
+                        .requires("m2x")
+                        .packages(Set.of("p3"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
-        map.put("m3", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
+        map.put("m3x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
-        assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
- *          Access allowed since m1 can read m2 and package p2 is exported to m1.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+ *          Access allowed since m1x can read m2x and package p2 is exported to m1x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,14 +47,14 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
 //
 public class DiffCL_ExpQualToM1 {
 
@@ -63,45 +63,45 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported to unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: package p2 is exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: package p2 is exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
@@ -109,7 +109,7 @@
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
         }
     }
 
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, and package p2 in m2 is
- *          exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, and package p2 in m2x is
+ *          exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,14 +47,14 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported
 // unqualifiedly.
 //
 public class DiffCL_ExpUnqual {
@@ -64,45 +64,45 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: package p2 is exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: package p2 is exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
                         .exports("p2")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
@@ -110,7 +110,7 @@
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
         }
     }
 
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2 is not
- *          exported, then class p1.c1 in m1 can not read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
+ *          exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,13 +47,13 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
 // Access denied since p2 is not exported.
 //
 public class DiffCL_PkgNotExp {
@@ -63,52 +63,52 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p2")
+                        .packages(Set.of("p2"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
           if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules java.base/jdk.internal.module
@@ -50,10 +50,10 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-//                  package p1 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p1
+//                  package p1 in m1x is exported unqualifiedly
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in
+// class p1.c1 defined in m1x tries to access p2.c2 defined in
 // in unnamed module.
 //
 // Three access attempts occur in this test:
@@ -62,7 +62,7 @@
 //   2. In this scenario a strict module establishes readability
 //      to the particular unnamed module it is trying to access.
 //      Access is allowed.
-//   3. Module m1 in the test_looseModuleLayer() method
+//   3. Module m1x in the test_looseModuleLayer() method
 //      is transitioned to a loose module, access
 //      to all unnamed modules is allowed.
 //
@@ -71,41 +71,41 @@
  // Create Layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
  // readability to an unnamed module that p2.c2 is defined in.
  public void test_strictModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MyDiffClassLoader.loader1 = new MyDiffClassLoader();
      MyDiffClassLoader.loader2 = new MyDiffClassLoader();
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader2
      // to achieve differing class loaders.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", MyDiffClassLoader.loader1);
+     map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+     assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1
@@ -114,109 +114,109 @@
      // Attempt access
      try {
          p1_c1_class.newInstance();
-         throw new RuntimeException("Test Failed, strict module m1 should not be able " +
+         throw new RuntimeException("Test Failed, strict module m1x should not be able " +
                                     "to access public type p2.c2 defined in unnamed module");
      } catch (IllegalAccessError e) {
      }
 }
 
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
  // readability to an unnamed module that p2.c2 is defined in.
  public void test_strictModuleUnnamedReadableLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MyDiffClassLoader.loader1 = new MyDiffClassLoader();
      MyDiffClassLoader.loader2 = new MyDiffClassLoader();
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader2
      // to achieve differing class loaders.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", MyDiffClassLoader.loader1);
+     map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+     assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1ReadEdgeDiffLoader
      Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1ReadEdgeDiffLoader");
 
      try {
-        // Read edge between m1 and the unnamed module that loads p2.c2 is established in
+        // Read edge between m1x and the unnamed module that loads p2.c2 is established in
         // c1ReadEdgeDiffLoader's ctor before attempting access.
         p1_c1_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, module m1 has established readability to p2/c2 loader's " +
+         throw new RuntimeException("Test Failed, module m1x has established readability to p2/c2 loader's " +
                                     "unnamed module, access should be allowed: " + e.getMessage());
      }
  }
 
- // Module m1 is a loose module and thus can read all unnamed modules.
+ // Module m1x is a loose module and thus can read all unnamed modules.
  public void test_looseModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MyDiffClassLoader.loader1 = new MyDiffClassLoader();
      MyDiffClassLoader.loader2 = new MyDiffClassLoader();
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader2
      // to achieve differing class loaders.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", MyDiffClassLoader.loader1);
+     map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+     assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1Loose
      Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1Loose");
 
-     // change m1 to read all unnamed modules
-     Module m1 = layer.findModule("m1").get();
-     jdk.internal.module.Modules.addReadsAllUnnamed(m1);
+     // change m1x to read all unnamed modules
+     Module m1x = layer.findModule("m1x").get();
+     jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
 
      try {
          p1_c1_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, loose module m1 should be able to access " +
+         throw new RuntimeException("Test Failed, loose module m1x should be able to access " +
                                     "public type p2.c2 defined in unnamed module: " + e.getMessage());
      }
  }
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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
- * @summary class p3.c3 defined in module m1 tries to access c4 defined in an unnamed package
+ * @summary class p3.c3 defined in module m1x tries to access c4 defined in an unnamed package
  *          and an unnamed module.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
@@ -48,10 +48,10 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p3
-//                  package p3 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p3
+//                  package p3 in m1x is exported unqualifiedly
 //
-// class p3.c3 defined in m1 tries to access c4 defined in
+// class p3.c3 defined in m1x tries to access c4 defined in
 // in unnamed module.
 //
 // Two access attempts occur in this test:
@@ -66,41 +66,41 @@
  // Create Layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
  // readability to an unnamed module that c4 is defined in.
  public void test_strictModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p3
      // Packages exported: p3 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p3")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MyDiffClassLoader.loader1 = new MyDiffClassLoader();
      MyDiffClassLoader.loader2 = new MyDiffClassLoader();
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader2
      // to achieve differing class loaders.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", MyDiffClassLoader.loader1);
+     map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+     assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p3.c3
@@ -109,58 +109,58 @@
      // Attempt access
      try {
          p3_c3_class.newInstance();
-         throw new RuntimeException("Test Failed, strict module m1 should not be able to access " +
+         throw new RuntimeException("Test Failed, strict module m1x should not be able to access " +
                                     "public type c4 defined in unnamed module");
      } catch (IllegalAccessError e) {
      }
 }
 
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
  // readability to an unnamed module that c4 is defined in.
  public void test_strictModuleUnnamedReadableLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p3
      // Packages exported: p3 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p3")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MyDiffClassLoader.loader1 = new MyDiffClassLoader();
      MyDiffClassLoader.loader2 = new MyDiffClassLoader();
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader2
      // to achieve differing class loaders.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", MyDiffClassLoader.loader1);
+     map.put("m1x", MyDiffClassLoader.loader1);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+     assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p3.c3ReadEdgeDiffLoader
      Class p3_c3_class = MyDiffClassLoader.loader1.loadClass("p3.c3ReadEdgeDiffLoader");
 
      try {
-        // Read edge between m1 and the unnamed module that loads c4 is established in
+        // Read edge between m1x and the unnamed module that loads c4 is established in
         // C3ReadEdgeDiffLoader's ctor before attempting access.
         p3_c3_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, module m1 has established readability to " +
+         throw new RuntimeException("Test Failed, module m1x has established readability to " +
                                     "c4 loader's unnamed module, access should be allowed: " + e.getMessage());
      }
  }
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2
- *          is exported specifically to module m3, then class p1.c1 in m1 can not
- *          access p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x
+ *          is exported specifically to module m3x, then class p1.c1 in m1x can not
+ *          access p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -48,15 +48,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-//                  defines m2 --> packages p2
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+//                  defines m2x --> packages p2
+//                  defines m3x --> packages p3
 //
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
 //
 public class ExpQualOther {
 
@@ -65,66 +65,66 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2, m3
+        // Define module:     m1x
+        // Can read:          java.base, m2x, m3x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
-                        .requires("m3")
+                        .requires("m2x")
+                        .requires("m3x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: p2 is exported to m3
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported to m3x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m3"))
+                        .exports("p2", Set.of("m3x"))
                         .build();
 
-        // Define module:     m3
-        // Can read:          java.base, m2
+        // Define module:     m3x
+        // Can read:          java.base, m2x
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
-                        .requires("m2")
-                        .contains("p3")
+                        .requires("m2x")
+                        .packages(Set.of("p3"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
-        map.put("m3", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
+        map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, AND package p2 in m2 is
- *          exported qualifiedly to m1, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, AND package p2 in m2x is
+ *          exported qualifiedly to m1x, then class p1.c1 in m1x can read p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -53,52 +53,52 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: p2 is exported qualifiedly to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported qualifiedly to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
         }
     }
 
--- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, AND package p2 in module2 is
- *          exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, AND package p2 in module_two is
+ *          exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -53,45 +53,45 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: p2 is exported unqualifiedly
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
                         .exports("p2")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
--- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test if package p2 in module m2 is exported to all unnamed,
- *          then class p1.c1 in an unnamed module can read p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is exported to all unnamed,
+ *          then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules java.base/jdk.internal.module
@@ -49,15 +49,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly
 //
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
 // Access allowed, an unnamed module can read all modules and p2 in module
-//           m2 is exported to all unnamed modules.
+//           m2x is exported to all unnamed modules.
 
 public class ExportAllUnnamed {
 
@@ -66,51 +66,51 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: p2 is exported unqualifiedly
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         Class p2_c2_class = MySameClassLoader.loader1.loadClass("p2.c2");
-        Module m2 = p2_c2_class.getModule();
+        Module m2x = p2_c2_class.getModule();
 
-        // Export m2/p2 to all unnamed modules.
-        jdk.internal.module.Modules.addExportsToAllUnnamed(m2, "p2");
+        // Export m2x/p2 to all unnamed modules.
+        jdk.internal.module.Modules.addExportsToAllUnnamed(m2x, "p2");
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
--- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2 is not
- *          exported, then class p1.c1 in m1 can not read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
+ *          exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -47,13 +47,13 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-//                  defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+//                  defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
 // Access denied since p2 is not exported.
 //
 public class PkgNotExp {
@@ -63,51 +63,51 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p2")
+                        .packages(Set.of("p2"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 and m2
+        // Create Layer that contains m1x and m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
           if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/Umod.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules java.base/jdk.internal.module
@@ -50,10 +50,10 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-//                  package p1 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p1
+//                  package p1 in m1x is exported unqualifiedly
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in
+// class p1.c1 defined in m1x tries to access p2.c2 defined in
 // in unnamed module.
 //
 // Three access attempts occur in this test:
@@ -62,7 +62,7 @@
 //   2. In this scenario a strict module establishes readability
 //      to the particular unnamed module it is trying to access.
 //      Access is allowed.
-//   3. Module m1 in the test_looseModuleLayer() method
+//   3. Module m1x in the test_looseModuleLayer() method
 //      is transitioned to a loose module, access
 //      to all unnamed modules is allowed.
 //
@@ -71,38 +71,38 @@
  // Create Layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
  // readability to an unnamed module that p2.c2 is defined in.
  public void test_strictModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader.
      MySameClassLoader loader = new MySameClassLoader();
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", loader);
+     map.put("m1x", loader);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == loader);
+     assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1
@@ -111,103 +111,103 @@
      // Attempt access
      try {
          p1_c1_class.newInstance();
-         throw new RuntimeException("Test Failed, strict module m1, type p1.c1, should not be able " +
+         throw new RuntimeException("Test Failed, strict module m1x, type p1.c1, should not be able " +
                                     "to access public type p2.c2 defined in unnamed module");
      } catch (IllegalAccessError e) {
      }
  }
 
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
  // readability to an unnamed module that p2.c2 is defined in.
  public void test_strictModuleUnnamedReadableLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MySameClassLoader loader = new MySameClassLoader();
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", loader);
+     map.put("m1x", loader);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == loader);
+     assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1ReadEdge
      Class p1_c1_class = loader.loadClass("p1.c1ReadEdge");
 
      try {
-       // Read edge between m1 and the unnamed module that loads p2.c2 is established in
+       // Read edge between m1x and the unnamed module that loads p2.c2 is established in
        // c1ReadEdge's ctor before attempting access.
        p1_c1_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, strict module m1, type p1.c1ReadEdge, should be able to acccess public type " +
+         throw new RuntimeException("Test Failed, strict module m1x, type p1.c1ReadEdge, should be able to acccess public type " +
                                     "p2.c2 defined in unnamed module: " + e.getMessage());
      }
 }
 
- // Module m1 is a loose module and thus can read all unnamed modules.
+ // Module m1x is a loose module and thus can read all unnamed modules.
  public void test_looseModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p1
      // Packages exported: p1 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p1")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MySameClassLoader loader = new MySameClassLoader();
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c2 will be loaded in an unnamed module/loader.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", loader);
+     map.put("m1x", loader);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == loader);
+     assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p1.c1Loose
      Class p1_c1_class = loader.loadClass("p1.c1Loose");
 
-     // change m1 to read all unnamed modules
-     Module m1 = layer.findModule("m1").get();
-     jdk.internal.module.Modules.addReadsAllUnnamed(m1);
+     // change m1x to read all unnamed modules
+     Module m1x = layer.findModule("m1x").get();
+     jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
 
      try {
          p1_c1_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, strict module m1, type p1.c1Loose, should be able to acccess public type " +
+         throw new RuntimeException("Test Failed, strict module m1x, type p1.c1Loose, should be able to acccess public type " +
                                     "p2.c2 defined in unnamed module: " + e.getMessage());
      }
  }
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 /*
  * @test
- * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
+ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
  *          Access is denied, since an unnamed module can read all modules but p2 in module
- *          m2 is exported specifically to module m1, not to all modules.
+ *          m2x is exported specifically to module m1x, not to all modules.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
 //
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
 // Access denied, an unnamed module can read all modules but p2 in module
-//             m2 is exported specifically to module m1 not to all modules.
+//             m2x is exported specifically to module m1x not to all modules.
 //
 public class UmodDiffCL_ExpQualOther {
 
@@ -65,53 +65,53 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
+        // Define module:     m1x
         // Can read:          java.base
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
-        // NOTE: module m1 does not define a package named p1.
+        // NOTE: module m1x does not define a package named p1.
         //       p1 will be loaded in an unnamed module.
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1, not unqualifiedly");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x, not unqualifiedly");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
- *          Access allowed, an unnamed module can read all modules and p2 in module m2
+ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
+ *          Access allowed, an unnamed module can read all modules and p2 in module m2x
  *          which is exported unqualifiedly.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
@@ -48,15 +48,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly.
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly.
 //
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
 // Access allowed, an unnamed module can read all modules and p2 in module
-//              m2 which is exported unqualifiedly.
+//              m2x which is exported unqualifiedly.
 //
 public class UmodDiffCL_ExpUnqual {
 
@@ -65,53 +65,53 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
                         .exports("p2")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
-        // NOTE: module m1 does not define a package named p1.
+        // NOTE: module m1x does not define a package named p1.
         //       p1 will be loaded in an unnamed module.
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2");
+            throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2x");
         }
     }
 
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 /*
  * @test
- * @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2.
+ * @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x.
  *          Access is denied since even though unnamed module can read all modules, p2
- *          in module m2 is not exported at all.
+ *          in module m2x is not exported at all.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
 //
-// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x
 // Access denied since even though unnamed module can read all modules, p2
-// in module m2 is not exported at all.
+// in module m2x is not exported at all.
 //
 public class UmodDiffCL_PkgNotExp {
 
@@ -64,53 +64,53 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p2")
+                        .packages(Set.of("p2"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
-        // NOTE: module m1 does not define a package named p1.
+        // NOTE: module m1x does not define a package named p1.
         //       p1 will be loaded in an unnamed module.
         Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to an unnamed module)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to an unnamed module)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
           if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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
- * @summary class p3.c3 defined in module m1 tries to access c4 defined in unnamed module.
+ * @summary class p3.c3 defined in module m1x tries to access c4 defined in unnamed module.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -48,10 +48,10 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> packages p3
-//                  package p3 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p3
+//                  package p3 in m1x is exported unqualifiedly
 //
-// class p3.c3 defined in m1 tries to access c4 defined in
+// class p3.c3 defined in m1x tries to access c4 defined in
 // in unnamed module.
 //
 // Two access attempts occur in this test:
@@ -66,38 +66,38 @@
  // Create Layers over the boot layer to test different
  // accessing scenarios of a named module to an unnamed module.
 
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
  // readability to an unnamed module that c4 is defined in.
  public void test_strictModuleLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p3
      // Packages exported: p3 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p3")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c4 will be loaded in an unnamed module/loader.
      MySameClassLoader loader = new MySameClassLoader();
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", loader);
+     map.put("m1x", loader);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == loader);
+     assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p3.c3
@@ -106,55 +106,55 @@
      // Attempt access
      try {
          p3_c3_class.newInstance();
-         throw new RuntimeException("Test Failed, strict module m1, type p3.c3, should not be able to access " +
+         throw new RuntimeException("Test Failed, strict module m1x, type p3.c3, should not be able to access " +
                                     "public type c4 defined in unnamed module");
      } catch (IllegalAccessError e) {
      }
  }
 
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
  // readability to an unnamed module that c4 is defined in.
  public void test_strictModuleUnnamedReadableLayer() throws Throwable {
 
-     // Define module:     m1
+     // Define module:     m1x
      // Can read:          java.base
      // Packages:          p3
      // Packages exported: p3 is exported unqualifiedly
-     ModuleDescriptor descriptor_m1 =
-             ModuleDescriptor.module("m1")
+     ModuleDescriptor descriptor_m1x =
+             ModuleDescriptor.newModule("m1x")
                      .requires("java.base")
                      .exports("p3")
                      .build();
 
      // Set up a ModuleFinder containing all modules for this layer.
-     ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+     ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
 
-     // Resolves "m1"
+     // Resolves "m1x"
      Configuration cf = Layer.boot()
              .configuration()
-             .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+             .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
      MySameClassLoader loader = new MySameClassLoader();
-     // map module m1 to class loader.
+     // map module m1x to class loader.
      // class c4 will be loaded in an unnamed module/loader.
      Map<String, ClassLoader> map = new HashMap<>();
-     map.put("m1", loader);
+     map.put("m1x", loader);
 
-     // Create Layer that contains m1
+     // Create Layer that contains m1x
      Layer layer = Layer.boot().defineModules(cf, map::get);
 
-     assertTrue(layer.findLoader("m1") == loader);
+     assertTrue(layer.findLoader("m1x") == loader);
      assertTrue(layer.findLoader("java.base") == null);
 
      // now use the same loader to load class p3.c3ReadEdge
      Class p3_c3_class = loader.loadClass("p3.c3ReadEdge");
 
      try {
-        // Read edge between m1 and the unnamed module that loads c4 is established in
+        // Read edge between m1x and the unnamed module that loads c4 is established in
         // c3ReadEdge's ctor before attempting access.
         p3_c3_class.newInstance();
      } catch (IllegalAccessError e) {
-         throw new RuntimeException("Test Failed, module m1, type p3.c3ReadEdge, has established readability to " +
+         throw new RuntimeException("Test Failed, module m1x, type p3.c3ReadEdge, has established readability to " +
                                     "c4 loader's unnamed module, access should be allowed: " + e.getMessage());
      }
  }
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 /*
  * @test
- * @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2.
+ * @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2x.
  *          Access is denied, since an unnamed module can read all modules but p6 in module
- *          m2 is exported specifically to module m1, not to all modules.
+ *          m2x is exported specifically to module m1x, not to all modules.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p6
 //
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
 //
-// class c5 defined in an unnamed module tries to access p6.c6 defined in m2
+// class c5 defined in an unnamed module tries to access p6.c6 defined in m2x
 // Access denied, an unnamed module can read all modules but p6 in module
-//             m2 is exported specifically to module m1 not to all modules.
+//             m2x is exported specifically to module m1x not to all modules.
 //
 public class UmodUpkgDiffCL_ExpQualOther {
 
@@ -65,51 +65,51 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p6
-        // Packages exported: p6 exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p6 exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p6", Set.of("m1"))
+                        .exports("p6", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class c5
         Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
         try {
             c5_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m1, not unqualifiedly");
+            throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m1x, not unqualifiedly");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary class c5 in an unnamed module can read module m2, but package p6 in module m2 is not exported.
- *          Access denied since even though unnamed module can read all modules, p6 in module m2 is not exported at all.
+ * @summary class c5 in an unnamed module can read module m2x, but package p6 in module m2x is not exported.
+ *          Access denied since even though unnamed module can read all modules, p6 in module m2x is not exported at all.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MyDiffClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p6
 //
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
 //
-// class c5 defined in unnamed module tries to access p6.c6 defined in m2
+// class c5 defined in unnamed module tries to access p6.c6 defined in m2x
 // Access denied since even though unnamed module can read all modules, p6
-// in module m2 is not exported at all.
+// in module m2x is not exported at all.
 //
 public class UmodUpkgDiffCL_NotExp {
 
@@ -64,53 +64,53 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p6
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p6")
+                        .packages(Set.of("p6"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MyDiffClassLoader.loader1);
-        map.put("m2", MyDiffClassLoader.loader2);
+        map.put("m1x", MyDiffClassLoader.loader1);
+        map.put("m2x", MyDiffClassLoader.loader2);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+        assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class c5
-        // NOTE: module m1 does not define any packages.
+        // NOTE: module m1x does not define any packages.
         //       c5 will be loaded in an unnamed module.
         Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
         try {
             c5_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported to " +
+            throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported to " +
                                        "an unnamed module that c5 is defined within)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if class c5 in an unnamed module can read package p6 in module m2, but package p6 in module m2 is
- *          exported qualifiedly to module m3, then class c5 in an unnamed module can not read p6.c6 in module m2.
+ * @summary Test that if class c5 in an unnamed module can read package p6 in module m2x, but package p6 in module m2x is
+ *          exported qualifiedly to module m3x, then class c5 in an unnamed module can not read p6.c6 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p6
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p6
+//                  defines m3x --> packages p3
 //
-// m1 can read m2
-// package p6 in m2 is exported to m3
+// m1x can read m2x
+// package p6 in m2x is exported to m3x
 //
-// class c5 defined in m1 tries to access p6.c6 defined in m2
-// Access denied since although m1 can read m2, p6 is exported only to m3.
+// class c5 defined in m1x tries to access p6.c6 defined in m2x
+// Access denied since although m1x can read m2x, p6 is exported only to m3x.
 //
 public class UmodUpkg_ExpQualOther {
 
@@ -64,63 +64,63 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1 (need to define m1 to establish the Layer successfully)
-        // Can read:          java.base, m2, m3
+        // Define module:     m1x (need to define m1x to establish the Layer successfully)
+        // Can read:          java.base, m2x, m3x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
-                        .requires("m3")
+                        .requires("m2x")
+                        .requires("m3x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p6
-        // Packages exported: p6 is exported to m3
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p6 is exported to m3x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p6", Set.of("m3"))
+                        .exports("p6", Set.of("m3x"))
                         .build();
 
-        // Define module:     m3
+        // Define module:     m3x
         // Can read:          java.base
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
-        map.put("m3", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
+        map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1, m2 and m3
+        // Create Layer that contains m1x, m2x and m3x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class c5
         Class c5_class = MySameClassLoader.loader1.loadClass("c5");
         try {
             c5_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m3, not unqualifiedly to everyone)");
+            throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m3x, not unqualifiedly to everyone)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test if package p6 in module m2 is not exported, then class c5
- *          in an unnamed module can not access p6.c2 in module m2.
+ * @summary Test if package p6 in module m2x is not exported, then class c5
+ *          in an unnamed module can not access p6.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -46,13 +46,13 @@
 import java.util.Set;
 import myloaders.MySameClassLoader;
 
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p6
 //
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
 //
-// class c5 defined in an unnamed module tries to access p6.c2 defined in m2
+// class c5 defined in an unnamed module tries to access p6.c2 defined in m2x
 // Access denied since p6 is not exported.
 //
 public class UmodUpkg_NotExp {
@@ -62,51 +62,51 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p6
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p6")
+                        .packages(Set.of("p6"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 and m2
+        // Create Layer that contains m1x and m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class c5
         Class c5_class = MySameClassLoader.loader1.loadClass("c5");
         try {
             c5_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported)");
+            throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
           if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test that if package p2 in module m2 is exported to module m3,
- *          then class p1.c1 in an unnamed module can not read p2.c2 in module m2.
+ * @summary Test that if package p2 in module m2x is exported to module m3x,
+ *          then class p1.c1 in an unnamed module can not read p2.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p2
-//                  defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p2
+//                  defines m3x --> packages p3
 //
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
 //
 public class Umod_ExpQualOther {
 
@@ -64,63 +64,63 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1 (need to define m1 to establish the Layer successfully)
-        // Can read:          java.base, m2, m3
+        // Define module:     m1x (need to define m1x to establish the Layer successfully)
+        // Can read:          java.base, m2x, m3x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
-                        .requires("m3")
+                        .requires("m2x")
+                        .requires("m3x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: p2 is exported to m3
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: p2 is exported to m3x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m3"))
+                        .exports("p2", Set.of("m3x"))
                         .build();
 
-        // Define module:     m3
+        // Define module:     m3x
         // Can read:          java.base
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
-        map.put("m3", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
+        map.put("m3x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1, m2 and m3
+        // Create Layer that contains m1x, m2x and m3x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3, not unqualifiedly to everyone)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x, not unqualifiedly to everyone)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test if package p2 in module m2 is exported unqualifiedly,
- *          then class p1.c1 in an unnamed module can read p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is exported unqualifiedly,
+ *          then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
 import myloaders.MySameClassLoader;
 
 //
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly
 //
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
 // Access allowed, an unnamed module can read all modules and p2 in module
-//           m2 which is exported unqualifiedly.
+//           m2x which is exported unqualifiedly.
 
 public class Umod_ExpUnqual {
 
@@ -64,44 +64,44 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: p2 is exported unqualifiedly
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
                         .exports("p2")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +25,8 @@
 
 /*
  * @test
- * @summary Test if package p2 in module m2 is not exported, then class p1.c1
- *          in an unnamed module can not access p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is not exported, then class p1.c1
+ *          in an unnamed module can not access p2.c2 in module m2x.
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @compile myloaders/MySameClassLoader.java
@@ -46,13 +46,13 @@
 import java.util.Set;
 import myloaders.MySameClassLoader;
 
-// ClassLoader1 --> defines m1 --> no packages
-//                  defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+//                  defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
 //
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
 // Access denied since p2 is not exported.
 //
 public class Umod_PkgNotExp {
@@ -62,51 +62,51 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          none
         // Packages exported: none
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
         // Packages exported: none
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .contains("p2")
+                        .packages(Set.of("p2"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
-        map.put("m1", MySameClassLoader.loader1);
-        map.put("m2", MySameClassLoader.loader1);
+        map.put("m1x", MySameClassLoader.loader1);
+        map.put("m2x", MySameClassLoader.loader1);
 
-        // Create Layer that contains m1 and m2
+        // Create Layer that contains m1x and m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
 
-        assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
-        assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+        assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
         Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
         } catch (IllegalAccessError e) {
           System.out.println(e.getMessage());
           if (!e.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1Loose.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1Loose.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 
 public class c1Loose {
     public c1Loose() {
-        // Attempt access - access should succeed since m1 is a loose module
+        // Attempt access - access should succeed since m1x is a loose module
         p2.c2 c2_obj = new p2.c2();
         c2_obj.method2();
     }
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,12 @@
 
 public class c1ReadEdge {
     public c1ReadEdge() {
-        // Establish read edge from module m1, where c1ReadEdge is defined,
+        // Establish read edge from module m1x, where c1ReadEdge is defined,
         // to the unnamed module, where p2.c2 will be defined.
-        Module m1 = c1ReadEdge.class.getModule();
+        Module m1x = c1ReadEdge.class.getModule();
         ClassLoader loader = c1ReadEdge.class.getClassLoader();
         Module unnamed_module = loader.getUnnamedModule();
-        m1.addReads(unnamed_module);
+        m1x.addReads(unnamed_module);
 
         // Attempt access - access should succeed
         p2.c2 c2_obj = new p2.c2();
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,32 +28,32 @@
 
 public class c1ReadEdgeDiffLoader {
     public c1ReadEdgeDiffLoader() {
-        // The goal is to establish a read edge between module m1
+        // The goal is to establish a read edge between module m1x
         // which is the module where p1.c1ReadEdgeDiffLoader is defined,
         // and the unnamed module that defines p2.c2.  This must be
         // done in 2 steps:
         //
-        // Step #1: Establish a read edge between m1, where c1ReadEdgeDiffLoader
+        // Step #1: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
         //          is defined, and the System ClassLoader's unnamed module,
         //          where MyDiffClassLoader is defined. This read edge
         //          is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
         //
-        // Step #2: Establish a read edge between m1, where c1ReadEdgeDiffLoader
+        // Step #2: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
         //          is defined, and the MyDiffClassLoader.loader2's unnamed module,
         //          where p2.c2 will be defined.
 
-        // Step #1: read edge m1 -> System ClassLoader's unnamed module
-        Module m1 = c1ReadEdgeDiffLoader.class.getModule();
+        // Step #1: read edge m1x -> System ClassLoader's unnamed module
+        Module m1x = c1ReadEdgeDiffLoader.class.getModule();
         ClassLoader system_loader = ClassLoader.getSystemClassLoader();
-        Module unnamed_module1 = system_loader.getUnnamedModule();
-        m1.addReads(unnamed_module1);
+        Module unnamed_module_one = system_loader.getUnnamedModule();
+        m1x.addReads(unnamed_module_one);
 
-        // Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
+        // Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
         ClassLoader loader2 = MyDiffClassLoader.loader2;
-        Module unnamed_module2 = loader2.getUnnamedModule();
-        m1.addReads(unnamed_module2);
+        Module unnamed_module_two = loader2.getUnnamedModule();
+        m1x.addReads(unnamed_module_two);
 
-        // Attempt access - access should succeed since m1 can read
+        // Attempt access - access should succeed since m1x can read
         //                  MyDiffClassLoader.loader2's unnamed module
         p2.c2 c2_obj = new p2.c2();
         c2_obj.method2();
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +26,12 @@
  * import java.lang.reflect.*;
  * public class c3ReadEdge {
  *    public c3ReadEdge() {
- *       // Establish read edge from module m1, where c3ReadEdge is defined,
+ *       // Establish read edge from module m1x, where c3ReadEdge is defined,
  *       // to the unnamed module, where c4 will be defined.
- *       Module m1 = c3ReadEdge.class.getModule();
+ *       Module m1x = c3ReadEdge.class.getModule();
  *       ClassLoader loader = c3ReadEdge.class.getClassLoader();
  *       Module unnamed_module = loader.getUnnamedModule();
- *       m1.addReads(unnamed_module);
+ *       m1x.addReads(unnamed_module);
  *       // Attempt access - access should succeed
  *       c4 c4_obj = new c4();
  *       c4_obj.method4();
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,32 +28,32 @@
  *
  * public class c3ReadEdgeDiffLoader {
  *    public c3ReadEdgeDiffLoader() {
- *       // The goal is to establish a read edge between module m1
+ *       // The goal is to establish a read edge between module m1x
  *       // which is the module where p3.c3ReadEdgeDiffLoader is defined,
  *       // and the unnamed module that defines c4.  This must be
  *       // done in 2 steps:
  *       //
- *       // Step #1: Establish a read edge between m1, where c3ReadEdgeDiffLoader
+ *       // Step #1: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
  *       //          is defined, and the System ClassLoader's unnamed module,
  *       //          where MyDiffClassLoader is defined. This read edge
  *       //          is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
  *       //
- *       // Step #2: Establish a read edge between m1, where c3ReadEdgeDiffLoader
+ *       // Step #2: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
  *       //          is defined, and the MyDiffClassLoader.loader2's unnamed module,
  *       //          where c4 will be defined.
  *
- *       // Step #1: read edge m1 -> System ClassLoader's unnamed module
- *       Module m1 = c3ReadEdgeDiffLoader.class.getModule();
+ *       // Step #1: read edge m1x -> System ClassLoader's unnamed module
+ *       Module m1x = c3ReadEdgeDiffLoader.class.getModule();
  *       ClassLoader system_loader = ClassLoader.getSystemClassLoader();
- *       Module unnamed_module1 = system_loader.getUnnamedModule();
- *       m1.addReads(unnamed_module1);
+ *       Module unnamed_module_one = system_loader.getUnnamedModule();
+ *       m1x.addReads(unnamed_module_one);
  *
- *       // Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
+ *       // Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
  *       ClassLoader loader2 = MyDiffClassLoader.loader2;
- *       Module unnamed_module2 = loader2.getUnnamedModule();
- *       m1.addReads(unnamed_module2);
+ *       Module unnamed_module_two = loader2.getUnnamedModule();
+ *       m1x.addReads(unnamed_module_two);
  *
- *       // Attempt access - should succeed since m1 can read
+ *       // Attempt access - should succeed since m1x can read
  *       //                  MyDiffClassLoader.loader2's unnamed module
  *       c4 c4_obj = new c4();
  *       c4_obj.method4();
--- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
     // and then test that a class in the unnamed module can access a package in a
     // named module that has been exported to all unnamed modules.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2;
+        Object m1x, m2x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -55,16 +55,16 @@
         ClassLoader this_cldr = AccessCheckAllUnnamed.class.getClassLoader();
 
         // Define a module for p3.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
         try {
             ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2");
@@ -74,7 +74,7 @@
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAllUnnamed(m2, null);
+            ModuleHelper.AddModuleExportsToAllUnnamed(m2x, null);
             throw new RuntimeException("Failed to get the expected NPE for null package");
         } catch(NullPointerException e) {
             // Expected
@@ -88,21 +88,21 @@
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p3");
+            ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p3");
             throw new RuntimeException("Failed to get the expected IAE for package in other module");
         } catch(IllegalArgumentException e) {
             // Expected
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p4");
+            ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p4");
             throw new RuntimeException("Failed to get the expected IAE for package not in module");
         } catch(IllegalArgumentException e) {
             // Expected
         }
 
-        // Export package p2 in m2 to allUnnamed.
-        ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p2");
+        // Export package p2 in m2x to allUnnamed.
+        ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p2");
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should succeed because
         // p1 is in an unnamed module and p2.c2 is exported to all unnamed modules.
--- a/hotspot/test/runtime/modules/AccessCheckExp.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckExp.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,10 +39,10 @@
 
 public class AccessCheckExp {
 
-    // Test that if module1 can read module2, but package p2 in module2 is not
-    // exported then class p1.c1 in module1 can not read p2.c2 in module2.
+    // Test that if module_one can read module_two, but package p2 in module_two is not
+    // exported then class p1.c1 in module_one can not read p2.c2 in module_two.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2;
+        Object m1x, m2x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -54,28 +54,28 @@
         ClassLoader this_cldr = AccessCheckExp.class.getClassLoader();
 
         // Define a module for p1.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
-        // Make package p1 in m1 visible to everyone.
-        ModuleHelper.AddModuleExportsToAll(m1, "p1");
+        // Make package p1 in m1x visible to everyone.
+        ModuleHelper.AddModuleExportsToAll(m1x, "p1");
 
         // p1.c1's ctor tries to call a method in p2.c2, but p2.c2 is not
         // exported.  So should get IllegalAccessError.
-        ModuleHelper.AddReadsModule(m1, m2);
+        ModuleHelper.AddReadsModule(m1x, m2x);
 
         Class p1_c1_class = Class.forName("p1.c1");
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported");
         } catch (IllegalAccessError f) {
             System.out.println(f.getMessage());
             if (!f.getMessage().contains("does not export")) {
--- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,16 +38,16 @@
 
 public class AccessCheckJavaBase {
 
-    // Test that a class defined to module2 always can read java.base.
+    // Test that a class defined to module_two always can read java.base.
     public static void main(String args[]) throws Throwable {
         // Get the class loader for AccessCheckJavaBase and assume it's also used to
         // load class p2.c2.
         ClassLoader this_cldr = AccessCheckJavaBase.class.getClassLoader();
 
         // Define a module for p2.
-        Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
+        Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
 
         // p2.c2 can read its superclass java.lang.Object defined within java.base
         try {
--- a/hotspot/test/runtime/modules/AccessCheckRead.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckRead.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,10 +39,10 @@
 
 public class AccessCheckRead {
 
-    // Test that a class in a package in module1 cannot access a class in
-    // a package n module2 if module1 cannot read module2.
+    // Test that a class in a package in module_one cannot access a class in
+    // a package in module_two if module_one cannot read module_two.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2;
+        Object m1x, m2x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -54,19 +54,19 @@
         ClassLoader this_cldr = AccessCheckRead.class.getClassLoader();
 
         // Define a module for p1.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
-        // Make package p1 in m1 visible to everyone.
-        ModuleHelper.AddModuleExportsToAll(m1, "p1");
+        // Make package p1 in m1x visible to everyone.
+        ModuleHelper.AddModuleExportsToAll(m1x, "p1");
 
         Class p1_c1_class = Class.forName("p1.c1");
 
@@ -74,7 +74,7 @@
         // cannot read p2's module.  So should get IllegalAccessError.
         try {
             p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (m1 can't read m2)");
+            throw new RuntimeException("Failed to get IAE (m1x can't read m2x)");
         } catch (IllegalAccessError e) {
             System.out.println(e.getMessage());
             if (!e.getMessage().contains("does not read") ||
--- a/hotspot/test/runtime/modules/AccessCheckSuper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckSuper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,17 +48,17 @@
         ClassLoader this_cldr = AccessCheckSuper.class.getClassLoader();
 
         // Define a module for p2.
-        Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
+        Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
 
         // Define a module for p3.
-        Object m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
-        assertNotNull(m3, "Module should not be null");
-        ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
+        Object m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
+        assertNotNull(m3x, "Module should not be null");
+        ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
 
-        // Since a readability edge has not been established between module2
-        // and module3, p3.c3 cannot read its superclass p2.c2.
+        // Since a readability edge has not been established between module_two
+        // and module_three, p3.c3 cannot read its superclass p2.c2.
         try {
             Class p3_c3_class = Class.forName("p3.c3");
             throw new RuntimeException("Failed to get IAE (can't read superclass)");
--- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
     // Test that a class in the unnamed module can not access a package in a
     // named module that has not been unqualifiedly exported.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2;
+        Object m1x, m2x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -54,17 +54,17 @@
         ClassLoader this_cldr = AccessCheckUnnamed.class.getClassLoader();
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should fail because
         // p1 is in the unnamed module and p2.c2 is not unqualifiedly exported.
         Class p1_c1_class = Class.forName("p1.c1");
         try {
             Object c1_obj = p1_c1_class.newInstance();
-            throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to unnamed module)");
+            throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to unnamed module)");
         } catch (IllegalAccessError f) {
             System.out.println(f.getMessage());
             if (!f.getMessage().contains("does not export p2 to unnamed module")) {
--- a/hotspot/test/runtime/modules/AccessCheckWorks.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckWorks.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,11 +39,11 @@
 
 public class AccessCheckWorks {
 
-    // Check that a class in a package in module1 can successfully access a
-    // class in module2 when module1 can read module2 and the class's package
+    // Check that a class in a package in module_one can successfully access a
+    // class in module_two when module_one can read module_two and the class's package
     // has been exported.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2;
+        Object m1x, m2x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -55,24 +55,24 @@
         ClassLoader this_cldr = AccessCheckWorks.class.getClassLoader();
 
         // Define a module for p1.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
-        // Make package p1 in m1 visible to everyone.
-        ModuleHelper.AddModuleExportsToAll(m1, "p1");
+        // Make package p1 in m1x visible to everyone.
+        ModuleHelper.AddModuleExportsToAll(m1x, "p1");
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should work because
         // p1's module can read p2's module and p2 is exported to p1's module.
-        ModuleHelper.AddReadsModule(m1, m2);
-        ModuleHelper.AddModuleExports(m2, "p2", m1);
+        ModuleHelper.AddReadsModule(m1x, m2x);
+        ModuleHelper.AddModuleExports(m2x, "p2", m1x);
         Class p1_c1_class = Class.forName("p1.c1");
         p1_c1_class.newInstance();
     }
--- a/hotspot/test/runtime/modules/CCE_module_msg.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/CCE_module_msg.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,21 +83,21 @@
         ClassLoader this_cldr = CCE_module_msg.class.getClassLoader();
 
         // Define a module for p2.
-        Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
         try {
-            ModuleHelper.AddModuleExportsToAll(m2, "p2");
+            ModuleHelper.AddModuleExportsToAll(m2x, "p2");
             Object p2Obj = new p2.c2();
             System.out.println((String)p2Obj);
             throw new RuntimeException("ClassCastException wasn't thrown, test failed.");
         } catch (ClassCastException cce) {
             String exception = cce.getMessage();
             System.out.println(exception);
-            if (exception.contains("module2/p2.c2") ||
-                !(exception.contains("module2@") &&
+            if (exception.contains("module_two/p2.c2") ||
+                !(exception.contains("module_two@") &&
                   exception.contains("/p2.c2 cannot be cast to java.base/java.lang.String"))) {
                 throw new RuntimeException("Wrong message: " + exception);
             }
--- a/hotspot/test/runtime/modules/ExportTwice.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ExportTwice.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
     // Also, check that a package can be exported to a specific package and then
     // exported unqualifiedly.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2, m3;
+        Object m1x, m2x, m3x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -56,37 +56,37 @@
         ClassLoader this_cldr = ExportTwice.class.getClassLoader();
 
         // Define a module for p1.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
         // Define a module for p3.
-        m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
-        assertNotNull(m3, "Module should not be null");
-        ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m3, jlObject_jlrM);
+        m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
+        assertNotNull(m3x, "Module should not be null");
+        ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
+        ModuleHelper.AddReadsModule(m3x, jlObject_jlrM);
 
-        // Make package p1 in m1 visible to everyone.
-        ModuleHelper.AddModuleExportsToAll(m1, "p1");
+        // Make package p1 in m1x visible to everyone.
+        ModuleHelper.AddModuleExportsToAll(m1x, "p1");
 
-        // Try to export p1 only to m2 after it was exported unqualifiedly.  It
+        // Try to export p1 only to m2x after it was exported unqualifiedly.  It
         // should silently succeed.
-        ModuleHelper.AddModuleExports(m1, "p1", m2);
+        ModuleHelper.AddModuleExports(m1x, "p1", m2x);
 
-        // Export p2 to m3 then export it again unqualifiedly.
-        ModuleHelper.AddModuleExports(m2, "p2", m3);
-        ModuleHelper.AddModuleExportsToAll(m2, "p2");
+        // Export p2 to m3x then export it again unqualifiedly.
+        ModuleHelper.AddModuleExports(m2x, "p2", m3x);
+        ModuleHelper.AddModuleExportsToAll(m2x, "p2");
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should work because
         // p1's module can read p2's module and p2 is now exported unqualifiedly.
-        ModuleHelper.AddReadsModule(m1, m2);
+        ModuleHelper.AddReadsModule(m1x, m2x);
         Class p1_c1_class = Class.forName("p1.c1");
         p1_c1_class.newInstance();
     }
--- a/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -67,8 +67,8 @@
     }
 
     public static void main(String[] args) throws Exception {
-        testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
-        testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
+        testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.FindException");
+        testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.FindException");
         testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
         testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
                    "WARNING: package xyzz not in java.base");
--- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,10 +39,10 @@
 
 public class JVMAddModuleExportToAllUnnamed {
 
-    // Check that a class in a package in module1 cannot access a class
+    // Check that a class in a package in module_one cannot access a class
     // that is in the unnamed module if the accessing package is strict.
     public static void main(String args[]) throws Throwable {
-        Object m1;
+        Object m1x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -54,13 +54,13 @@
         ClassLoader this_cldr = JVMAddModuleExportToAllUnnamed.class.getClassLoader();
 
         // Define a module for p1.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
-        // Make package p1 in m1 visible to everyone.
-        ModuleHelper.AddModuleExportsToAll(m1, "p1");
+        // Make package p1 in m1x visible to everyone.
+        ModuleHelper.AddModuleExportsToAll(m1x, "p1");
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should not work
         // because p2 is in the unnamed module and p1.c1 is strict.
--- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
     // and then test that a class in the unnamed module can access a package in
     // a named module that has been exported unqualifiedly.
     public static void main(String args[]) throws Throwable {
-        Object m1, m2, m3;
+        Object m1x, m2x, m3x;
 
         // Get the java.lang.reflect.Module object for module java.base.
         Class jlObject = Class.forName("java.lang.Object");
@@ -55,16 +55,16 @@
         ClassLoader this_cldr = JVMAddModuleExportsToAll.class.getClassLoader();
 
         // Define a module for p3.
-        m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
-        assertNotNull(m1, "Module should not be null");
-        ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
-        ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+        m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
+        assertNotNull(m1x, "Module should not be null");
+        ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
+        ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
 
         // Define a module for p2.
-        m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
-        assertNotNull(m2, "Module should not be null");
-        ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
-        ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+        m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+        assertNotNull(m2x, "Module should not be null");
+        ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+        ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
 
         try {
             ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
@@ -74,7 +74,7 @@
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAll(m2, null);
+            ModuleHelper.AddModuleExportsToAll(m2x, null);
             throw new RuntimeException("Failed to get the expected NPE for null package");
         } catch(NullPointerException e) {
             // Expected
@@ -88,26 +88,26 @@
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAll(m2, "p3");
+            ModuleHelper.AddModuleExportsToAll(m2x, "p3");
             throw new RuntimeException("Failed to get the expected IAE for package that is in another module");
         } catch(IllegalArgumentException e) {
             // Expected
         }
 
         try {
-            ModuleHelper.AddModuleExportsToAll(m2, "p4");
+            ModuleHelper.AddModuleExportsToAll(m2x, "p4");
             throw new RuntimeException("Failed to get the expected IAE for package not in any module");
         } catch(IllegalArgumentException e) {
             // Expected
         }
 
-        // Export package p2 in m2 unqualifiedly. Then, do a qualified export
-        // of p2 in m2 to m3.  This should not affect the unqualified export.
-        m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p4" });
-        assertNotNull(m3, "Module m3 should not be null");
-        ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p4" });
-        ModuleHelper.AddModuleExportsToAll(m2, "p2");
-        ModuleHelper.AddModuleExports(m2, "p2", m3);
+        // Export package p2 in m2x unqualifiedly. Then, do a qualified export
+        // of p2 in m2x to m3x.  This should not affect the unqualified export.
+        m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p4" });
+        assertNotNull(m3x, "Module m3x should not be null");
+        ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p4" });
+        ModuleHelper.AddModuleExportsToAll(m2x, "p2");
+        ModuleHelper.AddModuleExports(m2x, "p2", m3x);
 
         // p1.c1's ctor tries to call a method in p2.c2.  This should succeed because
         // p1 is in an unnamed module and p2.c2 is exported unqualifiedly.
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,25 +40,25 @@
     public static void main(String args[]) throws Throwable {
         MyClassLoader cl1 = new MyClassLoader();
         MyClassLoader cl3 = new MyClassLoader();
-        Object module1, module2, module3;
+        Object module_one, module_two, module_three;
         boolean result;
 
-        module1 = ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
-        assertNotNull(module1, "Module should not be null");
-        ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
-        module2 = ModuleHelper.ModuleObject("module2", cl1, new String[] { "yourpackage" });
-        assertNotNull(module2, "Module should not be null");
-        ModuleHelper.DefineModule(module2, "9.0", "module2/here", new String[] { "yourpackage" });
-        module3 = ModuleHelper.ModuleObject("module3", cl3, new String[] { "package/num3" });
-        assertNotNull(module3, "Module should not be null");
-        ModuleHelper.DefineModule(module3, "9.0", "module3/here", new String[] { "package/num3" });
+        module_one = ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
+        assertNotNull(module_one, "Module should not be null");
+        ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
+        module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" });
+        assertNotNull(module_two, "Module should not be null");
+        ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" });
+        module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" });
+        assertNotNull(module_three, "Module should not be null");
+        ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" });
 
         // Simple call
-        ModuleHelper.AddModulePackage(module1, "new_package");
+        ModuleHelper.AddModulePackage(module_one, "new_package");
 
         // Add a package and export it
-        ModuleHelper.AddModulePackage(module1, "package/num3");
-        ModuleHelper.AddModuleExportsToAll(module1, "package/num3");
+        ModuleHelper.AddModulePackage(module_one, "package/num3");
+        ModuleHelper.AddModuleExportsToAll(module_one, "package/num3");
 
         // Null module argument, expect an NPE
         try {
@@ -78,7 +78,7 @@
 
         // Null package argument, expect an NPE
         try {
-            ModuleHelper.AddModulePackage(module1, null);
+            ModuleHelper.AddModulePackage(module_one, null);
             throw new RuntimeException("Failed to get the expected NPE");
         } catch(NullPointerException e) {
             // Expected
@@ -86,7 +86,7 @@
 
         // Existing package, expect an ISE
         try {
-            ModuleHelper.AddModulePackage(module1, "yourpackage");
+            ModuleHelper.AddModulePackage(module_one, "yourpackage");
             throw new RuntimeException("Failed to get the expected ISE");
         } catch(IllegalStateException e) {
             // Expected
@@ -94,7 +94,7 @@
 
         // Invalid package name, expect an IAE
         try {
-            ModuleHelper.AddModulePackage(module1, "your.package");
+            ModuleHelper.AddModulePackage(module_one, "your.package");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
@@ -102,7 +102,7 @@
 
         // Invalid package name, expect an IAE
         try {
-            ModuleHelper.AddModulePackage(module1, ";your/package");
+            ModuleHelper.AddModulePackage(module_one, ";your/package");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
@@ -110,7 +110,7 @@
 
         // Invalid package name, expect an IAE
         try {
-            ModuleHelper.AddModulePackage(module1, "7[743");
+            ModuleHelper.AddModulePackage(module_one, "7[743");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
@@ -118,7 +118,7 @@
 
         // Empty package name, expect an IAE
         try {
-            ModuleHelper.AddModulePackage(module1, "");
+            ModuleHelper.AddModulePackage(module_one, "");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
@@ -126,8 +126,8 @@
 
         // Add package named "java" to an module defined to a class loader other than the boot or platform loader.
         try {
-            // module1 is defined to a MyClassLoader class loader.
-            ModuleHelper.AddModulePackage(module1, "java/foo");
+            // module_one is defined to a MyClassLoader class loader.
+            ModuleHelper.AddModulePackage(module_one, "java/foo");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             if (!e.getMessage().contains("prohibited package name")) {
@@ -136,10 +136,10 @@
         }
 
         // Package "javabar" should be ok
-        ModuleHelper.AddModulePackage(module1, "javabar");
+        ModuleHelper.AddModulePackage(module_one, "javabar");
 
         // Package named "java" defined to the boot class loader, should be ok
-        Object module_javabase = module1.getClass().getModule();
+        Object module_javabase = module_one.getClass().getModule();
         ModuleHelper.AddModulePackage(module_javabase, "java/foo");
 
         // Package named "java" defined to the platform class loader, should be ok
--- a/hotspot/test/runtime/modules/JVMDefineModule.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
 /* Invalid test, won't compile.
         // Invalid classloader argument, expect an IAE
         try {
-            m = ModuleHelper.ModuleObject("mymodule1", new Object(), new String[] { "mypackage1" });
+            m = ModuleHelper.ModuleObject("mymodule_one", new Object(), new String[] { "mypackage1" });
             ModuleHelper.DefineModule(m,  "9.0", "mymodule/here", new String[] { "mypackage1" });
             throw new RuntimeException("Failed to get expected IAE for bad loader");
         } catch(IllegalArgumentException e) {
--- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,10 +79,10 @@
         }
 
         MyClassLoader cl1 = new MyClassLoader();
-        Module module1 = (Module)ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
-        assertNotNull(module1, "Module should not be null");
-        ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
-        if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module1) {
+        Module module_one = (Module)ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
+        assertNotNull(module_one, "Module should not be null");
+        ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
+        if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module_one) {
             throw new RuntimeException("Wrong module returned for cl1 mypackage");
         }
     }
--- a/hotspot/test/runtime/modules/ModuleHelper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleHelper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -84,7 +84,7 @@
         }
 
         ModuleDescriptor descriptor =
-            ModuleDescriptor.module(name).contains(pkg_set).build();
+            ModuleDescriptor.newModule(name).packages(pkg_set).build();
         URI uri = URI.create("module:/" + name);
 
         return java.lang.reflect.ModuleHelper.newModule(loader, descriptor);
--- a/hotspot/test/runtime/modules/ModuleOptionsTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleOptionsTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -43,7 +43,7 @@
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
             "--add-modules=i_dont_exist", "--add-modules=java.base", "-version");
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("ResolutionException");
+        output.shouldContain("FindException");
         output.shouldContain("i_dont_exist");
         output.shouldHaveExitValue(1);
 
--- a/hotspot/test/runtime/modules/ModuleStress/CustomSystemClassLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/CustomSystemClassLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  */
 
 /**
- * A custom system ClassLoader to define the module "m2" to during iterations of
+ * A custom system ClassLoader to define the module "m2x" to during iterations of
  * differing test runs within the test ModuleStress.java
  */
 public class CustomSystemClassLoader extends ClassLoader {
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +35,15 @@
 import java.util.Set;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-// Java System Class Loader --> defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+// Java System Class Loader --> defines m3x --> packages p3
 //
-// m1 can read m2
-// package p2 in m2 is exported to m1 and m3
+// m1x can read m2x
+// package p2 in m2x is exported to m1x and m3x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
 //
 public class ModuleNonBuiltinCLMain {
 
@@ -52,62 +52,62 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported to unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
-        // Can read:          java.base, m3
+        // Define module:     m2x
+        // Can read:          java.base, m3x
         // Packages:          p2
-        // Packages exported: package p2 is exported to m1 and m3
+        // Packages exported: package p2 is exported to m1x and m3x
         Set<String> targets = new HashSet<>();
-        targets.add("m1");
-        targets.add("m3");
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        targets.add("m1x");
+        targets.add("m3x");
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .requires("m3")
+                        .requires("m3x")
                         .exports("p2", targets)
                         .build();
 
-        // Define module:     m3
+        // Define module:     m3x
         // Can read:          java.base
         // Packages:          p3
         // Packages exported: none
-        ModuleDescriptor descriptor_m3 =
-                ModuleDescriptor.module("m3")
+        ModuleDescriptor descriptor_m3x =
+                ModuleDescriptor.newModule("m3x")
                         .requires("java.base")
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to differing user defined class loaders for this test
         Map<String, ClassLoader> map = new HashMap<>();
         Loader1 cl1 = new Loader1();
         Loader2 cl2 = new Loader2();
         ClassLoader cl3 = ClassLoader.getSystemClassLoader();
-        map.put("m1", cl1);
-        map.put("m2", cl2);
-        map.put("m3", cl3);
+        map.put("m1x", cl1);
+        map.put("m2x", cl2);
+        map.put("m3x", cl3);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
-        assertTrue(layer.findLoader("m1") == cl1);
-        assertTrue(layer.findLoader("m2") == cl2);
-        assertTrue(layer.findLoader("m3") == cl3);
+        assertTrue(layer.findLoader("m1x") == cl1);
+        assertTrue(layer.findLoader("m2x") == cl2);
+        assertTrue(layer.findLoader("m3x") == cl3);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
@@ -115,7 +115,7 @@
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
         }
     }
 
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,14 +34,14 @@
 import java.util.Set;
 
 //
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader1 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader1 --> defines m2x --> packages p2
 //
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
 //
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
 //
 public class ModuleSameCLMain {
 
@@ -50,45 +50,45 @@
     // publically defined classes within packages of those modules.
     public void createLayerOnBoot() throws Throwable {
 
-        // Define module:     m1
-        // Can read:          java.base, m2
+        // Define module:     m1x
+        // Can read:          java.base, m2x
         // Packages:          p1
         // Packages exported: p1 is exported to unqualifiedly
-        ModuleDescriptor descriptor_m1 =
-                ModuleDescriptor.module("m1")
+        ModuleDescriptor descriptor_m1x =
+                ModuleDescriptor.newModule("m1x")
                         .requires("java.base")
-                        .requires("m2")
+                        .requires("m2x")
                         .exports("p1")
                         .build();
 
-        // Define module:     m2
+        // Define module:     m2x
         // Can read:          java.base
         // Packages:          p2
-        // Packages exported: package p2 is exported to m1
-        ModuleDescriptor descriptor_m2 =
-                ModuleDescriptor.module("m2")
+        // Packages exported: package p2 is exported to m1x
+        ModuleDescriptor descriptor_m2x =
+                ModuleDescriptor.newModule("m2x")
                         .requires("java.base")
-                        .exports("p2", Set.of("m1"))
+                        .exports("p2", Set.of("m1x"))
                         .build();
 
         // Set up a ModuleFinder containing all modules for this layer.
-        ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+        ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
 
-        // Resolves "m1"
+        // Resolves "m1x"
         Configuration cf = Layer.boot()
                 .configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+                .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
 
         // map each module to the same class loader for this test
         Map<String, ClassLoader> map = new HashMap<>();
         Loader1 cl1 = new Loader1();
-        map.put("m1", cl1);
-        map.put("m2", cl1);
+        map.put("m1x", cl1);
+        map.put("m2x", cl1);
 
-        // Create Layer that contains m1 & m2
+        // Create Layer that contains m1x & m2x
         Layer layer = Layer.boot().defineModules(cf, map::get);
-        assertTrue(layer.findLoader("m1") == cl1);
-        assertTrue(layer.findLoader("m2") == cl1);
+        assertTrue(layer.findLoader("m1x") == cl1);
+        assertTrue(layer.findLoader("m2x") == cl1);
         assertTrue(layer.findLoader("java.base") == null);
 
         // now use the same loader to load class p1.c1
@@ -96,7 +96,7 @@
         try {
             p1_c1_class.newInstance();
         } catch (IllegalAccessError e) {
-            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+            throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
         }
     }
 
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
              InMemoryJavaCompiler.compile("p1.c1", source1), System.getProperty("test.classes"));
 
         // Test #2: Load two modules defined to the same customer class loader.
-        //   m1's module readability list and package p2's exportability should
+        //   m1x's module readability list and package p2's exportability should
         //   not be walked at a GC safepoint since both modules are defined to
         //   the same loader and thus have the exact same life cycle.
         pb = ProcessTools.createJavaProcessBuilder(
@@ -97,7 +97,7 @@
           .shouldHaveExitValue(0);
 
         // Test #3: Load two modules in differing custom class loaders.
-        //   m1's module readability list and package p2's exportability list must
+        //   m1x's module readability list and package p2's exportability list must
         //   be walked at a GC safepoint since both modules are defined to non-builtin
         //   class loaders which could die and thus be unloaded.
         pb = ProcessTools.createJavaProcessBuilder(
@@ -106,15 +106,15 @@
              "ModuleNonBuiltinCLMain");
 
         oa = new OutputAnalyzer(pb.start());
-        oa.shouldContain("module m1 reads list must be walked")
-          .shouldContain("package p2 defined in module m2, exports list must be walked")
-          .shouldNotContain("module m2 reads list must be walked")
+        oa.shouldContain("module m1x reads list must be walked")
+          .shouldContain("package p2 defined in module m2x, exports list must be walked")
+          .shouldNotContain("module m2x reads list must be walked")
           .shouldHaveExitValue(0);
 
         // Test #4: Load two modules in differing custom class loaders,
         //   of which one has been designated as the custom system class loader
         //   via -Djava.system.class.loader=CustomSystemClassLoader. Since
-        //   m3 is defined to the system class loader, m2's module readability
+        //   m3x is defined to the system class loader, m2x's module readability
         //   list does not have to be walked at a GC safepoint, but package p2's
         //   exportability list does.
         pb = ProcessTools.createJavaProcessBuilder(
@@ -124,8 +124,8 @@
              "ModuleNonBuiltinCLMain");
 
         oa = new OutputAnalyzer(pb.start());
-        oa.shouldContain("package p2 defined in module m2, exports list must be walked")
-          .shouldNotContain("module m2 reads list must be walked")
+        oa.shouldContain("package p2 defined in module m2x, exports list must be walked")
+          .shouldNotContain("module m2x reads list must be walked")
           .shouldHaveExitValue(0);
 
     }
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java	Mon Mar 13 19:58:52 2017 +0000
@@ -48,7 +48,7 @@
 
         Configuration cf = layerBoot
                 .configuration()
-                .resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
+                .resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
 
         Module testModule = Main.class.getModule();
         ClassLoader scl = ClassLoader.getSystemClassLoader();
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java	Mon Mar 13 19:58:52 2017 +0000
@@ -48,7 +48,7 @@
 
         Configuration cf = layerBoot
                 .configuration()
-                .resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
+                .resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
 
         Module testModule = MainGC.class.getModule();
         ClassLoader scl = ClassLoader.getSystemClassLoader();
--- a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,8 @@
 
   public static void main(String args[]) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-      "--patch-module=module1=module1_dir",
-      "--patch-module=module1=module1_dir",
+      "--patch-module=module_one=module_one_dir",
+      "--patch-module=module_one=module_one_dir",
       "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
     output.shouldContain("java.lang.ExceptionInInitializerError");
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -82,12 +82,11 @@
         Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
 
         // Load a new named module
-        ModuleDescriptor descriptor
-                = ModuleDescriptor.module(MY_MODULE_NAME).build();
+        ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build();
         ModuleFinder finder = finderOf(descriptor);
         ClassLoader loader = new ClassLoader() {};
         Configuration parent = Layer.boot().configuration();
-        Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
+        Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
         Layer my = Layer.boot().defineModules(cf, m -> loader);
 
         // Verify that the loaded module is indeed reported by JVMTI
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/LingeredAppWithLargeArray.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.apps.LingeredApp;
+
+public class LingeredAppWithLargeArray extends LingeredApp {
+    public static void main(String args[]) {
+        int[] hugeArray = new int[Integer.MAX_VALUE/2];
+        LingeredApp.main(args);
+    }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/TestHeapDumpForLargeArray.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.nio.file.Files;
+import java.io.IOException;
+import java.io.BufferedInputStream;
+import java.util.stream.Collectors;
+import java.io.FileInputStream;
+
+import sun.jvm.hotspot.HotSpotAgent;
+import sun.jvm.hotspot.debugger.*;
+
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.Asserts;
+
+/*
+ * @test
+ * @library /test/lib
+ * @bug 8171084
+ * @requires (vm.bits == "64" & os.maxMemory > 8g)
+ * @modules java.base/jdk.internal.misc
+ *          jdk.hotspot.agent/sun.jvm.hotspot
+ *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
+ *          jdk.hotspot.agent/sun.jvm.hotspot.oops
+ *          jdk.hotspot.agent/sun.jvm.hotspot.debugger
+ * @run main/timeout=1800/othervm -Xmx8g TestHeapDumpForLargeArray
+ */
+
+public class TestHeapDumpForLargeArray {
+
+    private static LingeredAppWithLargeArray theApp = null;
+
+    private static void attachAndDump(String heapDumpFileName,
+                                      long lingeredAppPid) throws Exception {
+
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
+        launcher.addToolArg("jmap");
+        launcher.addToolArg("--binaryheap");
+        launcher.addToolArg("--dumpfile");
+        launcher.addToolArg(heapDumpFileName);
+        launcher.addToolArg("--pid");
+        launcher.addToolArg(Long.toString(lingeredAppPid));
+
+        ProcessBuilder processBuilder = new ProcessBuilder();
+        processBuilder.command(launcher.getCommand());
+        System.out.println(
+            processBuilder.command().stream().collect(Collectors.joining(" ")));
+
+        OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
+        SAOutput.shouldHaveExitValue(0);
+        SAOutput.shouldNotContain("Heap segment size overflow");
+        SAOutput.shouldContain("truncating to");
+        SAOutput.shouldContain("heap written to");
+        SAOutput.shouldContain(heapDumpFileName);
+        System.out.println(SAOutput.getOutput());
+
+    }
+
+    public static void main (String... args) throws Exception {
+
+        String heapDumpFileName = "LargeArrayHeapDump.bin";
+
+        if (!Platform.shouldSAAttach()) {
+            System.out.println(
+               "SA attach not expected to work - test skipped.");
+            return;
+        }
+
+        File heapDumpFile = new File(heapDumpFileName);
+        if (heapDumpFile.exists()) {
+            heapDumpFile.delete();
+        }
+
+        try {
+            List<String> vmArgs = new ArrayList<String>();
+            vmArgs.add("-XX:+UsePerfData");
+            vmArgs.add("-Xmx8g");
+            vmArgs.addAll(Utils.getVmOptions());
+
+            theApp = new LingeredAppWithLargeArray();
+            LingeredApp.startApp(vmArgs, theApp);
+            attachAndDump(heapDumpFileName, theApp.getPid());
+        } finally {
+            LingeredApp.stopApp(theApp);
+            heapDumpFile.delete();
+        }
+    }
+}
--- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -53,7 +53,6 @@
 
 public class JMapHProfLargeHeapTest {
     private static final String HEAP_DUMP_FILE_NAME = "heap.bin";
-    private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
     private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
     private static final long M = 1024L;
     private static final long G = 1024L * M;
@@ -65,9 +64,7 @@
         }
 
         // All heap dumps should create 1.0.2 file format
-        // Hotspot internal heapdumper always use HPROF_HEADER_1_0_2 format,
-        // but SA heapdumper still use HPROF_HEADER_1_0_1 for small heaps
-        testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1);
+        testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
 
         /**
          * This test was deliberately commented out since the test system lacks
--- a/hotspot/test/testlibrary/jittester/Makefile	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/testlibrary/jittester/Makefile	Mon Mar 13 19:58:52 2017 +0000
@@ -108,7 +108,7 @@
 	$(shell if [ ! -d $(CLASSES_DIR) ]; then mkdir -p $(CLASSES_DIR); fi)
 
 install: clean_testbase testgroup testroot copytestlibrary copyaot JAR cleantmp
-	$(JAVA) --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
+	$(JAVA) --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
 
 clean_testbase:
 	@rm -rf $(TESTBASE_DIR)
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Mon Mar 13 19:58:52 2017 +0000
@@ -43,6 +43,7 @@
     protected final Path generatorDir;
     protected final Function<String, String[]> preRunActions;
     protected final String jtDriverOptions;
+    private static final String DISABLE_WARNINGS = "-XX:-PrintWarnings";
 
     protected TestsGenerator(String suffix) {
         this(suffix, s -> new String[0], "");
@@ -57,8 +58,8 @@
 
     protected void generateGoldenOut(String mainClassName) {
         String classPath = getRoot() + File.pathSeparator + generatorDir;
-        ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", "-Xverify", "-cp", classPath,
-                mainClassName);
+        ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", DISABLE_WARNINGS, "-Xverify",
+                "-cp", classPath, mainClassName);
         String goldFile = mainClassName + ".gold";
         try {
             runProcess(pb, generatorDir.resolve(goldFile).toString());
@@ -128,6 +129,8 @@
                   .append("\n");
         }
         header.append(" * @run driver jdk.test.lib.jittester.jtreg.JitTesterDriver ")
+              .append(DISABLE_WARNINGS)
+              .append(" ")
               .append(jtDriverOptions)
               .append(" ")
               .append(mainClassName)
--- a/jaxp/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -396,5 +396,9 @@
 13c6906bfc861d99dc35a19c80b7a99f0b0ac58d jdk-9+151
 7e3da313b1746578da648155e37dd8526e83153d jdk-9+152
 1384504d2cd0e55c5e0becaeaf40ab05cae959d6 jdk-9+153
+0908877116d17c6e59092ec7d53ef687a96d3278 jdk-10+0
 7fa738305436d14c0926df0f04892890cacc766b jdk-9+154
 48fa77af153288b08ba794e1616a7b0685f3b67e jdk-9+155
+e930c373aaa4e0e712c9a25ba4b03d473b48c294 jdk-9+156
+412df235a8a229469a2cb9e7bb274d43277077d2 jdk-9+157
+60e670a65e07cc309951bd838b484401e6dd7847 jdk-9+158
--- a/jaxp/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -438,7 +438,7 @@
         Layer bootLayer = Layer.boot();
 
         Configuration cf = bootLayer.configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of(mn));
+                .resolve(finder, ModuleFinder.of(), Set.of(mn));
 
         PrivilegedAction<Layer> pa = () -> bootLayer.defineModules(cf, name -> loader);
         Layer layer = AccessController.doPrivileged(pa);
@@ -483,10 +483,11 @@
             String pn = _tfactory.getPackageName();
             assert pn != null && pn.length() > 0;
 
-            ModuleDescriptor descriptor = ModuleDescriptor.module(mn)
-                    .requires("java.xml")
-                    .exports(pn)
-                    .build();
+            ModuleDescriptor descriptor =
+                ModuleDescriptor.newModule(mn, Set.of(ModuleDescriptor.Modifier.SYNTHETIC))
+                                .requires("java.xml")
+                                .exports(pn)
+                                .build();
 
             Module m = createModule(descriptor, loader);
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -743,7 +743,7 @@
             // scan XMLDecl
             try {
                 if (fEntityScanner.skipString(XMLDECL)) {
-                    if (fEntityScanner.peekChar() == ' ') {
+                    if (XMLChar.isSpace(fEntityScanner.peekChar())) {
                         fMarkupDepth++;
                         scanXMLDeclOrTextDecl(false);
                     } else {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Mon Mar 13 19:58:52 2017 +0000
@@ -415,9 +415,15 @@
     /** Current DTD scanner. */
     protected XMLDTDScanner fCurrentDTDScanner;
 
-    /** Flag indiciating whether XML11 components have been initialized. */
+    /** Flag indicating whether XML11 components have been initialized. */
     private boolean f11Initialized = false;
 
+    /** Flag indicating whether the symbol table instance was specified during construction **/
+    private boolean fSymbolTableProvided = false;
+
+    /** Flag indicating if the symbol table was initialized and never used before that **/
+    private boolean fSymbolTableJustInitialized = true;
+
     //
     // Constructors
     //
@@ -566,15 +572,18 @@
         };
         addRecognizedProperties(recognizedProperties);
 
-        if (symbolTable == null) {
-                symbolTable = new SymbolTable();
+        // Remember if symbolTable was provided from outside
+        fSymbolTableProvided = symbolTable != null;
+        if (!fSymbolTableProvided) {
+            fSymbolTable = new SymbolTable();
+        } else {
+            fSymbolTable = symbolTable;
         }
-        fSymbolTable = symbolTable;
         fProperties.put(SYMBOL_TABLE, fSymbolTable);
 
         fGrammarPool = grammarPool;
         if (fGrammarPool != null) {
-                        fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
+            fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
         }
 
         fEntityManager = new XMLEntityManager();
@@ -840,6 +849,7 @@
                 fValidationManager.reset();
                 fVersionDetector.reset(this);
                 fConfigUpdated = true;
+                resetSymbolTable();
                 resetCommon();
 
                 short version = fVersionDetector.determineDocVersion(fInputSource);
@@ -858,15 +868,7 @@
                 // resets and sets the pipeline.
                 fVersionDetector.startDocumentParsing((XMLEntityHandler) fCurrentScanner, version);
                 fInputSource = null;
-            } catch (XNIException ex) {
-                if (PRINT_EXCEPTION_STACK_TRACE)
-                    ex.printStackTrace();
-                throw ex;
-            } catch (IOException ex) {
-                if (PRINT_EXCEPTION_STACK_TRACE)
-                    ex.printStackTrace();
-                throw ex;
-            } catch (RuntimeException ex) {
+            } catch (IOException | RuntimeException ex) {
                 if (PRINT_EXCEPTION_STACK_TRACE)
                     ex.printStackTrace();
                 throw ex;
@@ -879,15 +881,7 @@
 
         try {
             return fCurrentScanner.scanDocument(complete);
-        } catch (XNIException ex) {
-            if (PRINT_EXCEPTION_STACK_TRACE)
-                ex.printStackTrace();
-            throw ex;
-        } catch (IOException ex) {
-            if (PRINT_EXCEPTION_STACK_TRACE)
-                ex.printStackTrace();
-            throw ex;
-        } catch (RuntimeException ex) {
+        } catch (IOException | RuntimeException ex) {
             if (PRINT_EXCEPTION_STACK_TRACE)
                 ex.printStackTrace();
             throw ex;
@@ -1589,6 +1583,23 @@
         }
     }
 
+
+    /**
+     * Reset the symbol table if it wasn't provided during construction
+     * and its not the first time when parse is called after initialization
+     */
+    private void resetSymbolTable() {
+        if (!fSymbolTableProvided) {
+            if (fSymbolTableJustInitialized) {
+                // Skip symbol table reallocation for the first parsing process
+                fSymbolTableJustInitialized = false;
+            } else {
+                fSymbolTable = new SymbolTable();
+                fProperties.put(SYMBOL_TABLE, fSymbolTable);
+            }
+        }
+    }
+
     /**
      * Returns the state of a feature. This method calls getFeature()
      * on ParserConfigurationSettings, bypassing getFeature() on this
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -717,7 +717,9 @@
      */
     public final void endDocument() throws org.xml.sax.SAXException
     {
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            flushCharactersBuffer();
+        }
         flushPending();
         if (m_doIndent && !m_isprevtext)
         {
@@ -776,9 +778,11 @@
         Attributes atts)
         throws SAXException
     {
-        // will add extra one if having namespace but no matter
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            // will add extra one if having namespace but no matter
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
         ElemContext elemContext = m_elemContext;
 
         // clean up any pending things first
@@ -839,8 +843,10 @@
             writer.write('<');
             writer.write(name);
 
-            m_childNodeNumStack.push(m_childNodeNum);
-            m_childNodeNum = 0;
+            if (m_doIndent) {
+                m_childNodeNumStack.add(m_childNodeNum);
+                m_childNodeNum = 0;
+            }
 
             if (m_tracer != null)
                 firePseudoAttributes();
@@ -915,7 +921,9 @@
         final String name)
         throws org.xml.sax.SAXException
     {
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            flushCharactersBuffer();
+        }
         // deal with any pending issues
         if (m_cdataTagOpen)
             closeCDATA();
@@ -997,12 +1005,11 @@
                 }
             }
 
-            m_childNodeNum = m_childNodeNumStack.pop();
-            // clean up because the element has ended
-            if ((elemFlags & ElemDesc.WHITESPACESENSITIVE) != 0)
-                m_ispreserve = true;
-            m_isprevtext = false;
-
+            if (m_doIndent) {
+                m_childNodeNum = m_childNodeNumStack.remove(m_childNodeNumStack.size() - 1);
+                // clean up because the element has ended
+                m_isprevtext = false;
+            }
             // fire off the end element event
             if (m_tracer != null)
                 super.fireEndElem(name);
@@ -1018,11 +1025,6 @@
             }
 
             // some more clean because the element has ended.
-            if (!elemContext.m_startTagOpen)
-            {
-                if (m_doIndent && !m_preserves.isEmpty())
-                    m_preserves.pop();
-            }
             m_elemContext = elemContext.m_prev;
 //            m_isRawStack.pop();
         }
@@ -1525,7 +1527,6 @@
                     closeStartTag();
                     m_elemContext.m_startTagOpen = false;
                 }
-                m_ispreserve = true;
 
 //              With m_ispreserve just set true it looks like shouldIndent()
 //              will always return false, so drop any possible indentation.
@@ -1602,8 +1603,6 @@
                     m_elemContext.m_startTagOpen = false;
                 }
 
-                m_ispreserve = true;
-
                 if (shouldIndent())
                     indent();
 
@@ -1640,8 +1639,10 @@
     public void processingInstruction(String target, String data)
         throws org.xml.sax.SAXException
     {
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
         // Process any pending starDocument and startElement first.
         flushPending();
 
@@ -1790,11 +1791,6 @@
              */
             if (m_StringOfCDATASections != null)
                 m_elemContext.m_isCdataSection = isCdataSection();
-            if (m_doIndent)
-            {
-                m_isprevtext = false;
-                m_preserves.push(m_ispreserve);
-            }
 
             }
             catch(IOException e)
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -20,34 +20,36 @@
 
 package com.sun.org.apache.xml.internal.serializer;
 
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
-import com.sun.org.apache.xml.internal.serializer.utils.Utils;
-import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
-import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Deque;
 import java.util.EmptyStackException;
 import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
-import java.util.Queue;
 import java.util.Set;
 import java.util.StringTokenizer;
+
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
+
 import org.w3c.dom.Node;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
+import com.sun.org.apache.xml.internal.serializer.utils.Utils;
+import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
+
 /**
  * This abstract class is a base class for other stream
  * serializers (xml, html, text ...) that write output to a stream.
@@ -103,7 +105,7 @@
      * If m_childNodeNum > 1, the text node will be indented.
      *
      */
-    protected Deque<Integer> m_childNodeNumStack = new ArrayDeque<>();
+    protected List<Integer> m_childNodeNumStack = new ArrayList<>();
 
     protected int m_childNodeNum = 0;
 
@@ -115,26 +117,6 @@
 
     protected boolean m_ispreserveSpace = false;
 
-    /**
-     * Stack to keep track of whether or not we need to
-     * preserve whitespace.
-     *
-     * Used to push/pop values used for the field m_ispreserve, but
-     * m_ispreserve is only relevant if m_doIndent is true.
-     * If m_doIndent is false this field has no impact.
-     *
-     */
-    protected BoolStack m_preserves = new BoolStack();
-
-    /**
-     * State flag to tell if preservation of whitespace
-     * is important.
-     *
-     * Used only in shouldIndent() but only if m_doIndent is true.
-     * If m_doIndent is false this flag has no impact.
-     *
-     */
-    protected boolean m_ispreserve = false;
 
     /**
      * State flag that tells if the previous node processed
@@ -1267,7 +1249,6 @@
                 closeStartTag();
                 m_elemContext.m_startTagOpen = false;
             }
-            m_ispreserve = true;
 
             if (shouldIndent())
                 indent();
@@ -1357,8 +1338,6 @@
                 m_elemContext.m_startTagOpen = false;
             }
 
-            m_ispreserve = true;
-
             m_writer.write(ch, start, length);
         }
         catch (IOException e)
@@ -1405,8 +1384,8 @@
         if (length == 0 || (isInEntityRef()))
             return;
 
-        final boolean shouldFormat = shouldFormatOutput();
-        if (m_elemContext.m_startTagOpen && !shouldFormat)
+        final boolean shouldNotFormat = !shouldFormatOutput();
+        if (m_elemContext.m_startTagOpen)
         {
             closeStartTag();
             m_elemContext.m_startTagOpen = false;
@@ -1432,8 +1411,12 @@
 
         if (m_disableOutputEscapingStates.peekOrFalse() || (!m_escaping))
         {
-            charactersRaw(chars, start, length);
-            m_isprevtext = true;
+            if (shouldNotFormat) {
+                charactersRaw(chars, start, length);
+                m_isprevtext = true;
+            } else {
+                m_charactersBuffer.addRawText(chars, start, length);
+            }
             // time to fire off characters generation event
             if (m_tracer != null)
                 super.fireCharEvent(chars, start, length);
@@ -1441,16 +1424,16 @@
             return;
         }
 
-        if (m_elemContext.m_startTagOpen && !shouldFormat)
+        if (m_elemContext.m_startTagOpen)
         {
             closeStartTag();
             m_elemContext.m_startTagOpen = false;
         }
 
-        if (shouldFormat) {
+        if (shouldNotFormat) {
+            outputCharacters(chars, start, length);
+        } else {
             m_charactersBuffer.addText(chars, start, length);
-        } else {
-            outputCharacters(chars, start, length);
         }
 
         // time to fire off characters generation event
@@ -1465,7 +1448,14 @@
      * @return True if the content should be formatted.
      */
     protected boolean shouldFormatOutput() {
-        return !m_ispreserveSpace && m_doIndent;
+        return m_doIndent && !m_ispreserveSpace;
+    }
+
+    /**
+     * @return True if the content in current element should be formatted.
+     */
+    public boolean getIndent() {
+        return shouldFormatOutput();
     }
 
     /**
@@ -1506,12 +1496,6 @@
                     i = lastDirty;
                 }
             }
-            /* If there is some non-whitespace, mark that we may need
-             * to preserve this. This is only important if we have indentation on.
-             */
-            if (i < end)
-                m_ispreserve = true;
-
 
 //          int lengthClean;    // number of clean characters in a row
 //          final boolean[] isAsciiClean = m_charInfo.getASCIIClean();
@@ -1577,12 +1561,7 @@
      */
     final protected void flushCharactersBuffer() throws SAXException {
         try {
-            if (shouldFormatOutput() && m_charactersBuffer.hasContent()) {
-                if (m_elemContext.m_startTagOpen) {
-                    closeStartTag();
-                    m_elemContext.m_startTagOpen = false;
-                }
-
+            if (shouldFormatOutput() && m_charactersBuffer.isAnyCharactersBuffered()) {
                 if (m_elemContext.m_isCdataSection) {
                     /*
                      * due to cdata-section-elements atribute, we need this as
@@ -1594,11 +1573,16 @@
                 }
 
                 m_childNodeNum++;
+                boolean skipBeginningNewlines = false;
                 if (shouldIndentForText()) {
                     indent();
                     m_startNewLine = true;
+                    // newline has always been added here because if this is the
+                    // text before the first element, shouldIndent() won't
+                    // return true.
+                    skipBeginningNewlines = true;
                 }
-                m_charactersBuffer.flush();
+                m_charactersBuffer.flush(skipBeginningNewlines);
             }
         } catch (IOException e) {
             throw new SAXException(e);
@@ -1858,8 +1842,10 @@
         if (isInEntityRef())
             return;
 
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
 
         if (m_needToCallStartDocument)
         {
@@ -1890,8 +1876,6 @@
             if (namespaceURI != null)
                 ensurePrefixIsDeclared(namespaceURI, name);
 
-            m_ispreserve = false;
-
             if (shouldIndent() && m_startNewLine)
             {
                 indent();
@@ -1912,11 +1896,13 @@
         if (atts != null)
             addAttributes(atts);
 
-        m_ispreserveSpace = m_preserveSpaces.peekOrFalse();
-        m_preserveSpaces.push(m_ispreserveSpace);
-
-        m_childNodeNumStack.push(m_childNodeNum);
-        m_childNodeNum = 0;
+        if (m_doIndent) {
+            m_ispreserveSpace = m_preserveSpaces.peekOrFalse();
+            m_preserveSpaces.push(m_ispreserveSpace);
+
+            m_childNodeNumStack.add(m_childNodeNum);
+            m_childNodeNum = 0;
+        }
 
         m_elemContext = m_elemContext.push(namespaceURI,localName,name);
         m_isprevtext = false;
@@ -2128,7 +2114,9 @@
         if (isInEntityRef())
             return;
 
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            flushCharactersBuffer();
+        }
         // namespaces declared at the current depth are no longer valid
         // so get rid of them
         m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null);
@@ -2175,16 +2163,13 @@
             throw new SAXException(e);
         }
 
-        if (!m_elemContext.m_startTagOpen && m_doIndent)
-        {
-            m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
+        if (m_doIndent) {
+            m_ispreserveSpace = m_preserveSpaces.popAndTop();
+            m_childNodeNum = m_childNodeNumStack.remove(m_childNodeNumStack.size() - 1);
+
+            m_isprevtext = false;
         }
 
-        m_ispreserveSpace = m_preserveSpaces.popAndTop();
-        m_childNodeNum = m_childNodeNumStack.pop();
-
-        m_isprevtext = false;
-
         // fire off the end element event
         if (m_tracer != null)
             super.fireEndElem(name);
@@ -2320,8 +2305,10 @@
         int start_old = start;
         if (isInEntityRef())
             return;
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
         if (m_elemContext.m_startTagOpen)
         {
             closeStartTag();
@@ -2501,8 +2488,10 @@
      */
     public void startCDATA() throws org.xml.sax.SAXException
     {
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
 
         m_cdataStartCalled = true;
     }
@@ -2588,12 +2577,6 @@
              */
             if (m_StringOfCDATASections != null)
                 m_elemContext.m_isCdataSection = isCdataSection();
-
-            if (m_doIndent)
-            {
-                m_isprevtext = false;
-                m_preserves.push(m_ispreserve);
-            }
         }
 
     }
@@ -2943,7 +2926,9 @@
         String value,
         boolean xslAttribute)
     {
-        if (m_charactersBuffer.isAnyCharactersBuffered()) {
+        if (!m_charactersBuffer.isAnyCharactersBuffered()) {
+            return doAddAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
+        } else {
             /*
              * If stylesheet includes xsl:copy-of an attribute node, XSLTC will
              * fire an addAttribute event. When a text node is handling in
@@ -2954,8 +2939,6 @@
              *
              */
             return m_attributes.getIndex(rawName) < 0;
-        } else {
-            return doAddAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
         }
     }
 
@@ -3086,7 +3069,7 @@
             }
         }
 
-        if (rawName.equals("xml:space")) {
+        if (m_doIndent && rawName.equals("xml:space")) {
             if (value.equals("preserve")) {
                 m_ispreserveSpace = true;
                 if (m_preserveSpaces.size() > 0)
@@ -3227,8 +3210,6 @@
          // Leave m_format alone for now - Brian M.
          // this.m_format = null;
          this.m_inDoctype = false;
-         this.m_ispreserve = false;
-         this.m_preserves.clear();
          this.m_ispreserveSpace = false;
          this.m_preserveSpaces.clear();
          this.m_childNodeNum = 0;
@@ -3411,6 +3392,7 @@
         }
     }
 
+
     /**
      * This inner class is used to buffer the text nodes and the entity
      * reference nodes if indentation is on. There is only one CharacterBuffer
@@ -3425,20 +3407,21 @@
          */
         private abstract class GenericCharacters {
             /**
-             * @return True if having any character other than whitespace or
-             *         line feed.
+             * @return True if all characters in this Text are newlines.
              */
-            abstract boolean hasContent();
-
-            abstract void flush() throws SAXException;
+            abstract boolean flush(boolean skipBeginningNewlines) throws SAXException;
 
             /**
-             * Converts this GenericCharacters to a new character array.
+             * Converts this GenericCharacters to a new character array. This
+             * method is used to handle cdata-section-elements attribute in
+             * xsl:output. Therefore it doesn't need to consider
+             * skipBeginningNewlines because the text will be involved with CDATA
+             * tag.
              */
             abstract char[] toChars();
         }
 
-        private Queue<GenericCharacters> bufferedCharacters = new ArrayDeque<>();
+        private List<GenericCharacters> bufferedCharacters = new ArrayList<>();
 
         /**
          * Append a text node to the buffer.
@@ -3451,27 +3434,21 @@
                     text = Arrays.copyOfRange(chars, start, start + length);
                 }
 
-                boolean hasContent() {
-                    for (int i = 0; i < text.length; i++) {
-                        if (!isWhiteSpace(text[i])) {
+                boolean flush(boolean skipBeginningNewlines) throws SAXException {
+                    int start = 0;
+                    while (skipBeginningNewlines && text[start] == '\n') {
+                        start++;
+                        if (start == text.length) {
                             return true;
                         }
                     }
+                    outputCharacters(text, start, text.length - start);
                     return false;
                 }
 
-                void flush() throws SAXException {
-                    outputCharacters(text, 0, text.length);
-                }
-
                 char[] toChars() {
                     return text;
                 }
-
-                boolean isWhiteSpace(char ch) {
-                    return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
-                }
-
             });
         }
 
@@ -3480,12 +3457,22 @@
          */
         public void addEntityReference(String entityName) {
             bufferedCharacters.add(new GenericCharacters() {
-                boolean hasContent() {
-                    return true;
-                }
-
-                void flush() throws SAXException {
-                    outputEntityReference(entityName);
+                boolean flush(boolean skipBeginningNewlines) throws SAXException {
+                    if (m_elemContext.m_startTagOpen)
+                    {
+                        closeStartTag();
+                        m_elemContext.m_startTagOpen = false;
+                    }
+                    if (m_cdataTagOpen)
+                        closeCDATA();
+                    char[] cs = toChars();
+                    try {
+                        m_writer.write(cs, 0, cs.length);
+                        m_isprevtext = true;
+                    } catch (IOException e) {
+                        throw new SAXException(e);
+                    }
+                    return false;
                 }
 
                 char[] toChars() {
@@ -3495,35 +3482,69 @@
         }
 
         /**
-         * @return True if any GenericCharacters is already buffered.
+         * Append a raw text to the buffer. Used to handle raw characters event.
          */
-        public boolean isAnyCharactersBuffered() {
-            return !bufferedCharacters.isEmpty();
+        public void addRawText(final char chars[], final int start, final int length) {
+            bufferedCharacters.add(new GenericCharacters() {
+                char[] text;
+
+                {
+                    text = Arrays.copyOfRange(chars, start, start + length);
+                }
+
+                boolean flush(boolean skipBeginningNewlines) throws SAXException {
+                    try {
+                        int start = 0;
+                        while (skipBeginningNewlines && text[start] == '\n') {
+                            start++;
+                            if (start == text.length) {
+                                return true;
+                            }
+                        }
+                        m_writer.write(text, start, text.length - start);
+                        m_isprevtext = true;
+                    } catch (IOException e) {
+                        throw new SAXException(e);
+                    }
+                    return false;
+                }
+
+                char[] toChars() {
+                    return text;
+                }
+            });
         }
 
         /**
-         * @return True if any buffered GenericCharacters has content.
+         * @return True if any GenericCharacters are buffered.
          */
-        public boolean hasContent() {
-            return bufferedCharacters.stream().anyMatch(GenericCharacters::hasContent);
+        public boolean isAnyCharactersBuffered() {
+            return bufferedCharacters.size() > 0;
         }
 
         /**
          * Flush all buffered GenericCharacters.
          */
-        public void flush() throws SAXException {
-            GenericCharacters element;
-            while ((element = bufferedCharacters.poll()) != null)
-                element.flush();
+        public void flush(boolean skipBeginningNewlines) throws SAXException {
+            Iterator<GenericCharacters> itr = bufferedCharacters.iterator();
+
+            boolean continueSkipBeginningNewlines = skipBeginningNewlines;
+            while (itr.hasNext()) {
+                GenericCharacters element = itr.next();
+                continueSkipBeginningNewlines = element.flush(continueSkipBeginningNewlines);
+                itr.remove();
+            }
         }
 
         /**
          * Converts all buffered GenericCharacters to a new character array.
          */
         public char[] toChars() {
-            return bufferedCharacters.stream().map(GenericCharacters::toChars)
-                    .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString()
-                    .toCharArray();
+            StringBuilder sb = new StringBuilder();
+            for (GenericCharacters element : bufferedCharacters) {
+                sb.append(element.toChars());
+            }
+            return sb.toString().toCharArray();
         }
 
         /**
@@ -3534,6 +3555,7 @@
         }
     }
 
+
     // Implement DTDHandler
     /**
      * If this method is called, the serializer is used as a
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -88,8 +88,6 @@
 
         setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration());
 
-        m_ispreserve = xmlListener.m_ispreserve;
-        m_preserves = xmlListener.m_preserves;
         m_ispreserveSpace = xmlListener.m_ispreserveSpace;
         m_preserveSpaces = xmlListener.m_preserveSpaces;
         m_childNodeNum = xmlListener.m_childNodeNum;
@@ -201,7 +199,9 @@
      */
     public void endDocument() throws org.xml.sax.SAXException
     {
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            flushCharactersBuffer();
+        }
         flushPending();
         if (m_doIndent && !m_isprevtext)
         {
@@ -235,11 +235,6 @@
      */
     public void startPreserving() throws org.xml.sax.SAXException
     {
-
-        // Not sure this is really what we want.  -sb
-        m_preserves.push(true);
-
-        m_ispreserve = true;
     }
 
     /**
@@ -251,9 +246,6 @@
      */
     public void endPreserving() throws org.xml.sax.SAXException
     {
-
-        // Not sure this is really what we want.  -sb
-        m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
     }
 
     /**
@@ -273,8 +265,10 @@
         if (isInEntityRef())
             return;
 
-        m_childNodeNum++;
-        flushCharactersBuffer();
+        if (m_doIndent) {
+            m_childNodeNum++;
+            flushCharactersBuffer();
+        }
         flushPending();
 
         if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING))
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1024,7 +1024,8 @@
                 return;
             }
 
-            if (bDispatch) {
+            if (bDispatch
+                    && (!fSerializer.getIndent() || !node.getData().replace('\n', ' ').trim().isEmpty())) {
                 dispatachChars(node);
             }
         }
--- a/jaxp/src/java.xml/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 /**
  * Defines the Java API for XML Processing (JAXP), the Streaming API for XML (StAX),
  * the Simple API for XML (SAX), and the W3C Document Object Model (DOM) API.
+ *
+ * @since 9
  */
 module java.xml {
     exports javax.xml;
@@ -53,12 +55,6 @@
     exports org.xml.sax;
     exports org.xml.sax.ext;
     exports org.xml.sax.helpers;
-    exports com.sun.org.apache.xerces.internal.dom to
-        java.xml.ws;
-    exports com.sun.org.apache.xerces.internal.jaxp to
-        java.xml.ws;
-    exports com.sun.org.apache.xerces.internal.util to
-        java.xml.ws;
     exports com.sun.org.apache.xml.internal.dtm to
         java.xml.crypto;
     exports com.sun.org.apache.xml.internal.utils to
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -22,6 +22,7 @@
  */
 package org.w3c.dom.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static org.testng.Assert.assertEquals;
@@ -157,7 +158,7 @@
         Element element = (Element) document.getElementsByTagName("sender").item(0);
         parentElement.insertBefore(createTestDocumentFragment(document), element);
 
-        String outputfile = "InsertBefore.out";
+        String outputfile = USER_DIR + "InsertBefore.out";
         String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
         tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
@@ -175,7 +176,7 @@
         Element element = (Element) document.getElementsByTagName("sender").item(0);
         parentElement.replaceChild(createTestDocumentFragment(document), element);
 
-        String outputfile = "ReplaceChild3.out";
+        String outputfile = USER_DIR + "ReplaceChild3.out";
         String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
         tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -22,6 +22,7 @@
  */
 package test.astro;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.filenameToURL;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -130,7 +131,7 @@
         impl = (DOMImplementationLS) db.getDOMImplementation();
         LSSerializer domSerializer = impl.createLSSerializer();
         MyDOMOutput mydomoutput = new MyDOMOutput();
-        try (OutputStream os = new FileOutputStream("test.out")) {
+        try (OutputStream os = new FileOutputStream(USER_DIR + "test.out")) {
             mydomoutput.setByteStream(os);
             mydomoutput.setEncoding("UTF-8");
             assertTrue(domSerializer.write(doc, mydomoutput));
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -96,7 +96,7 @@
     public void testOneLayer() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
         Configuration cf1 = Layer.boot().configuration()
-                .resolveRequiresAndUses(finder1, ModuleFinder.of(), Set.of("test"));
+                .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
         Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
         ClassLoader cl1 = layer1.findLoader("test");
@@ -126,12 +126,12 @@
     public void testTwoLayer() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
         Configuration cf1 = Layer.boot().configuration()
-                .resolveRequiresAndUses(finder1, ModuleFinder.of(), Set.of("test"));
+                .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
         Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
 
         ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
-        Configuration cf2 = cf1.resolveRequiresAndUses(finder2, ModuleFinder.of(), Set.of("test"));
+        Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
         ClassLoader cl2 = layer2.findLoader("test");
 
@@ -160,12 +160,12 @@
     public void testTwoLayerWithDuplicate() throws Exception {
         ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1, MOD_DIR2);
         Configuration cf1 = Layer.boot().configuration()
-                .resolveRequiresAndUses(finder1, ModuleFinder.of(), Set.of("test"));
+                .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
         Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
 
         ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
-        Configuration cf2 = cf1.resolveRequiresAndUses(finder2, ModuleFinder.of(), Set.of("test"));
+        Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
         ClassLoader cl2 = layer2.findLoader("test");
 
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -60,7 +60,7 @@
 
 /*
  * @test
- * @bug 6439439 8087303
+ * @bug 6439439 8087303 8174025
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  * @run testng/othervm -DrunSecMngr=true common.prettyprint.PrettyPrintTest
  * @run testng/othervm common.prettyprint.PrettyPrintTest
@@ -69,29 +69,30 @@
 @Listeners({jaxp.library.FilePolicy.class})
 public class PrettyPrintTest {
     /*
-     * test CDATA, elements only, text and element, whitespace and element,
-     * xml:space property and nested xml:space property, mixed node types.
+     * test CDATA, elements only, text and element, xml:space property, mixed
+     * node types.
      */
     @DataProvider(name = "xml-data")
     public Object[][] xmlData() throws Exception {
         return new Object[][] {
-                { read("xmltest1.xml"), read("xmltest1.out") },
-                { read("xmltest2.xml"), read("xmltest2.out") },
-                { read("xmltest3.xml"), read("xmltest3.out") },
-                { read("xmltest4.xml"), read("xmltest4.out") },
-                { read("xmltest5.xml"), read("xmltest5.out") },
-                { read("xmltest6.xml"), read("xmltest6.out") },
-                { read("xmltest7.xml"), read("xmltest7.out") },
-                { read("xmltest8.xml"), read("xmltest8.out") } };
+                { "xmltest1.xml", "xmltest1.out" },
+                { "xmltest2.xml", "xmltest2.out" },
+                { "xmltest3.xml", "xmltest3.out" },
+                { "xmltest4.xml", "xmltest4.out" },
+                { "xmltest6.xml", "xmltest6.out" },
+                { "xmltest8.xml", "xmltest8.out" } };
     }
 
     /*
      * @bug 8087303
-     * Test the whitespace text nodes are serialized with pretty-print by LSSerializer and transformer correctly
+     * Test the xml document are serialized with pretty-print by
+     * LSSerializer and transformer correctly
      *
      */
     @Test(dataProvider = "xml-data")
-    public void testXMLPrettyPrint(String source, String expected) throws Exception {
+    public void testXMLPrettyPrint(String sourceFile, String expectedFile) throws Exception {
+        String source = read(sourceFile);
+        String expected = read(expectedFile);
         // test it's no change if no pretty-print
         String result = serializerWrite(toXmlDocument(source), false);
         assertTrue(toXmlDocument(source).isEqualNode(toXmlDocument(result)), "The actual is: " + result);
@@ -104,26 +105,100 @@
         assertEquals(transform(toXmlDocument(source), true).replaceAll("\r\n", "\n"), expected);
     }
 
+
     /*
-     * test pure text content, and sequent Text nodes.
+     * @bug 8087303
+     * Test a single text node is serialized with pretty-print by
+     * LSSerializer and transformer correctly
+     *
      */
-    @DataProvider(name = "xml-node-data")
-    public Object[][] xmlNodeData() throws Exception {
-        return new Object[][] {
-                { newTextNode(read("nodetest1.txt")), read("nodetest1.out") },
-                { createDocWithSequentTextNodes(), read("nodetest2.out") } };
+    @Test
+    public void testSingleTextNode() throws Exception {
+        Node xml = newTextNode(read("nodetest1.txt"));
+        String expected = read("nodetest1.out");
+        assertEquals(serializerWrite(xml, true), expected);
+        assertEquals(transform(xml, true).replaceAll("\r\n", "\n"), expected);
+    }
+
+    /*
+     * @bug 8087303
+     * Test the transformer shall keep all whitespace text node in
+     * sequent text nodes
+     *
+     */
+    @Test
+    public void testSequentTextNodesWithTransformer() throws Exception {
+        Node xml = createDocWithSequentTextNodes();
+        String expected = read("nodetest2.out");
+        assertEquals(transform(xml, true).replaceAll("\r\n", "\n"), expected);
     }
 
     /*
      * @bug 8087303
-     * Test the whitespace text nodes are serialized with pretty-print by LSSerializer and transformer correctly,
-     * doesn't compare with the source because the test data is Node object
+     * Test LSSerializer shall eliminate the whitespace text node
+     * in sequent text nodes
+     *
+     */
+    @Test
+    public void testSequentTextNodesWithLSSerializer() throws Exception {
+        Node xml = createDocWithSequentTextNodes();
+        String expected = read("nodetest2ls.out");
+        assertEquals(serializerWrite(xml, true), expected);
+    }
+
+
+    /*
+     * test whitespace and element, nested xml:space property.
+     */
+    @DataProvider(name = "xml-data-whitespace-ls")
+    public Object[][] whitespaceLS() throws Exception {
+        return new Object[][] {
+                { "xmltest5.xml", "xmltest5ls.out" },
+                { "xmltest7.xml", "xmltest7ls.out" } };
+    }
+
+    /*
+     * @bug 8087303
+     * Test LSSerializer shall eliminate the whitespace text node
+     * unless xml:space="preserve"
      *
      */
-    @Test(dataProvider = "xml-node-data")
-    public void testXMLNodePrettyPrint(Node xml, String expected) throws Exception {
-        assertEquals(serializerWrite(xml, true), expected);
-        assertEquals(transform(xml, true).replaceAll("\r\n", "\n"), expected);
+    @Test(dataProvider = "xml-data-whitespace-ls")
+    public void testWhitespaceWithLSSerializer(String sourceFile, String expectedFile) throws Exception {
+        String source = read(sourceFile);
+        String expected = read(expectedFile);
+        // test it's no change if no pretty-print
+        String result = serializerWrite(toXmlDocument(source), false);
+        assertTrue(toXmlDocument(source).isEqualNode(toXmlDocument(result)), "The actual is: " + result);
+        // test pretty-print
+        assertEquals(serializerWrite(toXmlDocument(source), true), expected);
+    }
+
+    /*
+     * test whitespace and element, nested xml:space property.
+     */
+    @DataProvider(name = "xml-data-whitespace-xslt")
+    public Object[][] whitespaceXSLT() throws Exception {
+        return new Object[][] {
+                { "xmltest5.xml", "xmltest5xslt.out" },
+                { "xmltest7.xml", "xmltest7xslt.out" } };
+    }
+
+    /*
+     * @bug 8087303
+     * Test the transformer shall format the output but keep all
+     * whitespace text node even if xml:space="preserve"
+     *
+     */
+    @Test(dataProvider = "xml-data-whitespace-xslt")
+    public void testWhitespaceWithTransformer(String sourceFile, String expectedFile) throws Exception {
+        String source = read(sourceFile);
+        String expected = read(expectedFile);
+        // test it's no change if no pretty-print
+        String result = transform(toXmlDocument(source), false);
+        assertTrue(toXmlDocument(source).isEqualNode(toXmlDocument(result)), "The actual is: " + result);
+        // test pretty-print
+        assertEquals(transform(toXmlDocument(source), true).replaceAll("\r\n", "\n"), expected);
     }
 
     /*
@@ -132,12 +207,14 @@
     @DataProvider(name = "html-data")
     public Object[][] htmlData() throws Exception {
         return new Object[][] {
-            { read("htmltest1.xml"), read("htmltest1.out") },
-            { read("htmltest2.xml"), read("htmltest2.out") },
-            { read("htmltest3.xml"), read("htmltest3.out") },
-            { read("htmltest4.xml"), read("htmltest4.out") },
-            { read("htmltest5.xml"), read("htmltest5.out") },
-            { read("htmltest6.xml"), read("htmltest6.out") } };
+            { "htmltest1.xml", "htmltest1.out" },
+            { "htmltest2.xml", "htmltest2.out" },
+            { "htmltest3.xml", "htmltest3.out" },
+            { "htmltest4.xml", "htmltest4.out" },
+            { "htmltest5.xml", "htmltest5.out" },
+            { "htmltest6.xml", "htmltest6.out" },
+            /* @bug 8174025, test whitespace between inline elements */
+            { "htmltest7.xml", "htmltest7.out" } };
     }
 
     /*
@@ -146,7 +223,9 @@
      *
      */
     @Test(dataProvider = "html-data")
-    public void testTransformToHTML(String source, String expected) throws Exception {
+    public void testTransformToHTML(String sourceFile, String expectedFile) throws Exception {
+        String source = read(sourceFile);
+        String expected = read(expectedFile);
         // test it's no change if no pretty-print
         StringWriter writer = new StringWriter();
         getTransformer(true, false).transform(new StreamSource(new StringReader(source)), new StreamResult(writer));
@@ -158,6 +237,27 @@
         assertEquals(writer.toString().replaceAll("\r\n", "\n"), expected);
     }
 
+    /*
+     * @bug 8174025
+     * Test the serializer can handle <xsl:text disable-output-escaping="yes"> correctly.
+     *
+     */
+    @Test
+    public void testDisableOutputEscaping() throws Exception {
+        final String xsl ="generate-catalog.xsl";
+        final String xml ="simple-entity-resolver-config.xml";
+        final String expectedOutput ="simple-entity-resolver-config-transformed.xml";
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTemplates(new StreamSource(new StringReader(read(xsl)))).newTransformer();
+
+        String key = "schemaBase";
+        String value = "schemas";
+        transformer.setParameter(key, value);
+        StringWriter writer = new StringWriter();
+        transformer.transform(new StreamSource(new StringReader(read(xml))), new StreamResult(writer));
+        assertEquals(writer.toString().replaceAll("\r\n", "\n"), read(expectedOutput));
+    }
+
     @Test
     public void testLSSerializerFormatPrettyPrint() {
 
@@ -298,6 +398,9 @@
         Document doc = db.newDocument();
         Node root = doc.createElement("root");
         doc.appendChild(root);
+        root.appendChild(doc.createTextNode("\n"));
+        root.appendChild(doc.createTextNode("\n"));
+        root.appendChild(doc.createTextNode("\n"));
         root.appendChild(doc.createTextNode(" "));
         root.appendChild(doc.createTextNode("t"));
         root.appendChild(doc.createTextNode("\n"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/generate-catalog.xsl	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?> 
+ <!-- Stylesheet for generating the entity-resolver document in XCatalog format --> 
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
+
+       <xsl:output method="xml" indent="yes"/> 
+       <xsl:param name="schemaBase"/> 
+       <xsl:template match="entity-resolver-config"> 
+          <catalog xmlns="xmlns:xml:catalog" 
+                   prefer="system" 
+                   xml:base="{$schemaBase}" > 
+                    
+                   <xsl:for-each select="entity"> 
+                    
+                          <!-- Generate System Id --> 
+                          <xsl:text disable-output-escaping="yes">&lt;system systemId="</xsl:text> 
+                          <xsl:value-of select="system-id/text()"/> 
+                          <xsl:text>" uri="</xsl:text> 
+                          <xsl:value-of select="location/text()"/> 
+                          <xsl:text disable-output-escaping="yes">" /&gt;&#10;</xsl:text> 
+                   </xsl:for-each> 
+             </catalog> 
+    </xsl:template> 
+ </xsl:stylesheet>
\ No newline at end of file
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/htmltest1.xml	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/htmltest1.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-<rss version="2.0"><channel xml:space="preserve"><title>Java Tutorials and Examples 1</title> <language>en-us</language></channel></rss>
\ No newline at end of file
+<rss version="2.0"><channel xml:space="preserve"><title>Java Tutorials and Examples 1</title><language>en-us</language></channel></rss>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/htmltest7.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,7 @@
+<html>
+    <body>
+        <p>
+             <span>this</span> <span>is</span> <span>a</span>  <span>whitespace</span>  <span>inline element</span>  <span>test</span>  
+        </p>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/htmltest7.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,1 @@
+<html><body><p> <span>this</span> <span>is</span> <span>a</span>  <span>whitespace</span>  <span>inline element</span>  <span>test</span>  </p></body></html>
\ No newline at end of file
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/nodetest2.out	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/nodetest2.out	Mon Mar 13 19:58:52 2017 +0000
@@ -1,19 +1,30 @@
 <root>
      t
 t   
-    <child1/>
+    <child1> 
+</child1>
     t
-    <child2/>
-    <child3/>
-    <child4/>
+    <child2> </child2>
+     
+    <child3> </child3>
+     
+    <child4> </child4>
+     
     <child5>
         t
         <child51>
+             
             <child511>t</child511>
+             
         </child51>
         t
     </child5>
+     
     <!-- test comment -->
+     
+
     <!-- -->
+    
     <?target1 test?>
+      
 </root>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/nodetest2ls.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,18 @@
+<root>
+    tt
+    <child1/>
+    t
+    <child2/>
+    <child3/>
+    <child4/>
+    <child5>
+        t
+        <child51>
+            <child511>t</child511>
+        </child51>
+        t
+    </child5>
+    <!-- test comment -->
+    <!-- -->
+    <?target1 test?>
+</root>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/simple-entity-resolver-config-transformed.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><catalog prefer="system" xml:base="schemas" xmlns="xmlns:xml:catalog"><system systemId="http://www.example.test/oracle/schema/example1.xsd" uri="META-INF/example1.xsd" />
+<system systemId="http://www.example.test/oracle/schema/example2.xsd" uri="META-INF/example2.xsd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/simple-entity-resolver-config.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+ <entity-resolver-config 
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+     xsi:noNamespaceSchemaLocation="http://www.example.test/schema.xsd" 
+     schema-major-version="1" 
+     schema-minor-version="1"> 
+
+     <entity> 
+         <description>Example 1 Schema Type library 10.0 </description> 
+         <public-id>>-//Oracle//Example 1 Schema Type library 10.0//EN</public-id> 
+         <system-id>http://www.example.test/oracle/schema/example1.xsd</system-id> 
+         <location>META-INF/example1.xsd</location> 
+     </entity> 
+     <entity> 
+         <description>Example 2 Schema Type library 10.0 </description> 
+         <public-id>>-//Oracle//Example 2 Schema Type library 10.0//EN</public-id> 
+         <system-id>http://www.example.test/oracle/schema/example2.xsd</system-id> 
+         <location>META-INF/example2.xsd</location> 
+     </entity> 
+ </entity-resolver-config>
\ No newline at end of file
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest5.out	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<rss version="2.0">
-    <channel>
-        <title>Java Tutorials and Examples 1</title>
-        <language>en-us</language>
-    </channel>
-    <a>
-        <b/>
-    </a>
-    <c/>
-</rss>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest5ls.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,10 @@
+<rss version="2.0">
+    <channel>
+        <title>Java Tutorials and Examples 1</title>
+        <language>en-us</language>
+    </channel>
+    <a>
+        <b/>
+    </a>
+    <c/>
+</rss>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest5xslt.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,15 @@
+<rss version="2.0">
+    <channel>
+         
+        <title>Java Tutorials and Examples 1</title>
+         
+        <language>en-us</language>
+    </channel>
+    <a>
+        <b> </b>
+    </a>
+     
+    <c>
+ 
+</c>
+</rss>
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest7.out	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<rss>
-    <layer1 xml:space="preserve"> <title>Java </title> <layer2 xml:space="asfsa"> <layer3> <layer4 xml:space="default">
-                    <l5>5</l5>
-                </layer4> </layer3> </layer2> <layer2 xml:space="default">
-            <layer3>
-                <l4/>
-            </layer3>
-            <layer3 xml:space="preserve"> <l4> </l4> </layer3>
-        </layer2> </layer1>
-</rss>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest7ls.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,10 @@
+<rss>
+    <layer1 xml:space="preserve"> <title>Java </title> <layer2 xml:space="asfsa"> <layer3> <layer4 xml:space="default">
+                    <l5>5</l5>
+                </layer4> </layer3> </layer2> <layer2 xml:space="default">
+            <layer3>
+                <l4/>
+            </layer3>
+            <layer3 xml:space="preserve"> <l4> </l4> </layer3>
+        </layer2> </layer1>
+</rss>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest7xslt.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,17 @@
+<rss>
+    <layer1 xml:space="preserve"> <title>Java </title> <layer2 xml:space="asfsa"> <layer3> <layer4 xml:space="default">
+                     
+                    <l5>5</l5>
+                     
+ 
+                </layer4> </layer3> </layer2> <layer2 xml:space="default">
+             
+            <layer3>
+                 
+                <l4> </l4>
+                 
+            </layer3>
+             
+            <layer3 xml:space="preserve"> <l4> </l4> </layer3>
+        </layer2> </layer1>
+</rss>
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest8.out	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest8.out	Mon Mar 13 19:58:52 2017 +0000
@@ -1,25 +1,20 @@
 <root>
-    
-     t
+         t
     <![CDATA[ ]]>
-    
-t   
+    t   
     
     <child1/>
-    
-    t
+        t
     <!-- test comment -->
     <child2/>
     <child5>
-        
-        t
+                t
         <?target1 test?>
         <child51>
             <child511>t</child511>
         </child51>
         <?target1 test?>
-        
-        t
+                t
     
     </child5>
 </root>
--- a/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest8.xml	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/prettyprint/xmltest8.xml	Mon Mar 13 19:58:52 2017 +0000
@@ -2,14 +2,7 @@
      t<![CDATA[ ]]>
 t   
     <child1/>
-    t<!-- test comment -->
-    <child2/>
-    <child5>
-        t<?target1 test?>
-        <child51>
-            <child511>t</child511>
-        </child51><?target1 test?>
+    t<!-- test comment --><child2/><child5>
+        t<?target1 test?><child51><child511>t</child511></child51><?target1 test?>
         t
-    </child5>
-    
-</root> 
+    </child5></root> 
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -279,11 +279,11 @@
                 "<author>\n" +
                 "    <a>&name1;Jo Smith</a>\n" +
                 "    <b>b &name2;Jo Smith &name1;Jo Smith b</b>\n" +
-                "    <c> &name;Jo Smith </c>\n" +
+                "    <c>&name;Jo Smith </c>\n" +
                 "    <d>&ele1;d</d>\n" +
-                "    <e> &ele2;eee </e>\n" +
+                "    <e>&ele2;eee </e>\n" +
                 "    <f>&lt;att&gt;</f>\n" +
-                "    <g> &ele; g</g>\n" +
+                "    <g>&ele; g</g>\n" +
                 "    <h>&ele2;</h>\n" +
                 "</author>\n");
 
@@ -301,7 +301,7 @@
                 "<author>\n" +
                 "    <a>&name;Jo Smith</a>\n" +
                 "    <b>b &name;Jo Smith &name;Jo Smith b</b>\n" +
-                "    <c> &name;Jo Smith </c>\n" +
+                "    <c>&name;Jo Smith </c>\n" +
                 "    <d>\n" +
                 "        <aa>\n" +
                 "            <bb>text</bb>\n" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 parsers;
+
+import java.io.StringReader;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/**
+ * @test
+ * @bug 8169450
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.BaseParsingTest
+ * @run testng/othervm parsers.BaseParsingTest
+ * @summary Tests that verify base parsing
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class BaseParsingTest {
+
+    @DataProvider(name = "xmlDeclarations")
+    public static Object[][] xmlDeclarations() {
+        return new Object[][]{
+            {"<?xml version=\"1.0\"?><root><test>t</test></root>"},
+            {"<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><test>t</test></root>"},
+            {"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone='yes'?><root><test>t</test></root>"},
+            {"<?xml\n"
+                + " version=\"1.0\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version=\"1.0\"\n"
+                + " encoding=\"UTF-8\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version=\"1.0\"\n"
+                + " encoding=\"UTF-8\"\n"
+                + " standalone=\"yes\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version\n"
+                + "=\n"
+                + "\"1.0\"\n"
+                + " encoding\n"
+                + "=\n"
+                + "\"UTF-8\"\n"
+                + " standalone\n"
+                + "=\n"
+                + "\"yes\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml version=\"1.1\"?><root><test>t</test></root>"},
+            {"<?xml version=\"1.1\" encoding=\"UTF-8\"?><root><test>t</test></root>"},
+            {"<?xml version=\"1.1\" encoding=\"UTF-8\" standalone='yes'?><root><test>t</test></root>"},
+            {"<?xml\n"
+                + " version=\"1.1\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version=\"1.1\"\n"
+                + " encoding=\"UTF-8\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version=\"1.1\"\n"
+                + " encoding=\"UTF-8\"\n"
+                + " standalone=\"yes\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"},
+            {"<?xml\n"
+                + " version\n"
+                + "=\n"
+                + "\"1.1\"\n"
+                + " encoding\n"
+                + "=\n"
+                + "\"UTF-8\"\n"
+                + " standalone\n"
+                + "=\n"
+                + "\"yes\"?>\n"
+                + "<root>\n"
+                + " <test>t</test>\n"
+                + "</root>"}
+        };
+    }
+
+    /**
+     * @bug 8169450
+     * Verifies that the parser successfully parses the declarations provided in
+     * xmlDeclarations. Exception would otherwise be thrown as reported in 8169450.
+     *
+     * XML Declaration according to https://www.w3.org/TR/REC-xml/#NT-XMLDecl
+     * [23] XMLDecl     ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
+     * [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')
+     * [25] Eq          ::= S? '=' S? [26] VersionNum ::= '1.' [0-9]+
+     *
+     * @param xml the test xml
+     * @throws Exception if the parser fails to parse the xml
+     */
+    @Test(dataProvider = "xmlDeclarations")
+    public void test(String xml) throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newDefaultFactory();
+        XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(xml));
+        while (xsr.hasNext()) {
+            xsr.next();
+        }
+    }
+
+    /**
+     * @bug 8169450
+     * This particular issue does not appear in DOM parsing since the spaces are
+     * normalized during version detection. This test case then serves as a guard
+     * against such an issue from occuring in the version detection.
+     *
+     * @param xml the test xml
+     * @throws Exception if the parser fails to parse the xml
+     */
+    @Test(dataProvider = "xmlDeclarations")
+    public void testWithDOM(String xml) throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.parse(new InputSource(new StringReader(xml)));
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,7 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 
 import java.io.File;
@@ -61,7 +62,7 @@
             return;
         }
         try {
-            File dir = new File(ALPHA);
+            File dir = new File(USER_DIR + ALPHA);
             dir.delete();
             dir.mkdir();
             File main = new File(dir, "main.xml");
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,7 @@
 
 package sax;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 
@@ -69,7 +70,7 @@
     @Test
     public void testParse() {
         File src = new File(getClass().getResource(xml).getFile());
-        File dst = new File(xml1);
+        File dst = new File(USER_DIR + xml1);
         try {
             copyFile(src, dst);
             SAXParserFactory spf = SAXParserFactory.newInstance();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/SymbolTableResetTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 sax;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @test
+ * @bug 8173390
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.SymbolTableResetTest
+ * @run testng/othervm sax.SymbolTableResetTest
+ * @summary Test that SAXParser reallocates symbol table during
+ *          subsequent parse operations
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SymbolTableResetTest {
+
+    /*
+     * Test mimics the SAXParser usage in SAAJ-RI that reuses the
+     * parsers from the internal pool. To avoid memory leaks, symbol
+     * table associated with the parser should be reallocated during each
+     * parse() operation.
+     */
+    @Test
+    public void testReset() throws Exception {
+        // Dummy xml input for parser
+        String input = "<dummy>Test</dummy>";
+        // Create SAXParser
+        SAXParserFactory  spf = SAXParserFactory.newInstance();
+        SAXParser p = spf.newSAXParser();
+        // First parse iteration
+        p.parse(new InputSource(new StringReader(input)), new DefaultHandler());
+        // Get first symbol table reference
+        Object symTable1 = p.getProperty(SYMBOL_TABLE_PROPERTY);
+        p.reset();
+        // Second parse iteration
+        p.parse(new InputSource(new StringReader(input)), new DefaultHandler());
+        // Get second symbol table reference
+        Object symTable2 = p.getProperty(SYMBOL_TABLE_PROPERTY);
+        // Symbol table references should be different
+        Assert.assertNotSame(symTable1, symTable2, "Symbol table references");
+    }
+
+    // Symbol table property
+    private static final String SYMBOL_TABLE_PROPERTY = "http://apache.org/xml/properties/internal/symbol-table";
+
+}
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package stream;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
@@ -67,15 +69,15 @@
     }
 
     public class MyRunnable implements Runnable {
-        final int no;
+        final String no;
 
         MyRunnable(int no) {
-            this.no = no;
+            this.no = String.valueOf(no);
         }
 
         public void run() {
             try {
-                FileOutputStream fos = new FileOutputStream("" + no);
+                FileOutputStream fos = new FileOutputStream(USER_DIR + no);
                 XMLStreamWriter w = getWriter(fos);
                 // System.out.println("Writer="+w+" Thread="+Thread.currentThread());
                 w.writeStartDocument();
@@ -89,7 +91,7 @@
                 w.close();
                 fos.close();
 
-                FileInputStream fis = new FileInputStream("" + no);
+                FileInputStream fis = new FileInputStream(USER_DIR + no);
                 XMLStreamReader r = getReader(fis);
                 while (r.hasNext()) {
                     r.next();
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package stream.XMLEventWriterTest;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -58,7 +60,7 @@
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
 
     private static final String INPUT_FILE = "W2JDLR4002TestService.wsdl.data";
-    private static final String OUTPUT_FILE = "Encoded.wsdl";
+    private static final String OUTPUT_FILE = USER_DIR + "Encoded.wsdl";
 
     /**
      * Unit test for writing namespaces when namespaceURI == null.
@@ -126,7 +128,7 @@
 
         try {
             InputStream in = getClass().getResourceAsStream("ReaderToWriterTest.wsdl");
-            OutputStream out = new FileOutputStream("ReaderToWriterTest-out.xml");
+            OutputStream out = new FileOutputStream(USER_DIR + "ReaderToWriterTest-out.xml");
 
             XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
             XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package stream.XMLStreamWriterTest;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -84,7 +86,7 @@
         System.out.println("Test StreamWriter with out any namespace functionality");
 
         try {
-            String outputFile = files[0] + ".out";
+            String outputFile = USER_DIR + files[0] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -98,7 +100,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[0] + ".out", files[0] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[0] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testOne Failed " + ex);
@@ -113,7 +115,7 @@
         System.out.println("Test StreamWriter's Namespace Context");
 
         try {
-            String outputFile = files[1] + ".out";
+            String outputFile = USER_DIR + files[1] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -157,7 +159,7 @@
         System.out.println("Test StreamWriter for proper element sequence.");
 
         try {
-            String outputFile = files[2] + ".out";
+            String outputFile = USER_DIR + files[2] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -172,7 +174,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[2] + ".out", files[2] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[2] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testThree Failed " + ex);
@@ -188,7 +190,7 @@
 
         try {
 
-            String outputFile = files[3] + ".out";
+            String outputFile = USER_DIR + files[3] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -205,7 +207,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[3] + ".out", files[3] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[3] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testFour Failed " + ex);
@@ -221,7 +223,7 @@
 
         try {
 
-            String outputFile = files[4] + ".out";
+            String outputFile = USER_DIR + files[4] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -265,7 +267,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[4] + ".out", files[4] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[4] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testFive Failed " + ex);
@@ -281,7 +283,7 @@
 
         try {
 
-            String outputFile = files[5] + ".out";
+            String outputFile = USER_DIR + files[5] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -325,7 +327,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[5] + ".out", files[5] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[5] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testSix Failed " + ex);
@@ -341,7 +343,7 @@
 
         try {
 
-            String outputFile = files[6] + ".out";
+            String outputFile = USER_DIR + files[6] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -374,7 +376,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[6] + ".out", files[6] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[6] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testSeven Failed " + ex);
@@ -390,7 +392,7 @@
 
         try {
 
-            String outputFile = files[7] + ".out";
+            String outputFile = USER_DIR + files[7] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -424,7 +426,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[7] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             ex.printStackTrace();
@@ -442,7 +444,7 @@
 
         try {
 
-            String outputFile = files[8] + ".out";
+            String outputFile = USER_DIR + files[8] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -476,7 +478,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[8] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testNine Failed " + ex);
@@ -491,7 +493,7 @@
         System.out.println("Test StreamWriter supplied with no namespace information and" + "isRepairingNamespace is set to true.");
         try {
 
-            String outputFile = files[9] + ".out";
+            String outputFile = USER_DIR + files[9] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -542,7 +544,7 @@
         System.out.println("Test StreamWriter supplied with  namespace information passed through startElement and" + "isRepairingNamespace is set to true.");
         try {
 
-            String outputFile = files[10] + ".out";
+            String outputFile = USER_DIR + files[10] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -576,7 +578,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[10] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testEleven Failed " + ex);
@@ -592,7 +594,7 @@
 
         try {
 
-            String outputFile = files[11] + ".out";
+            String outputFile = USER_DIR + files[11] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -643,7 +645,7 @@
 
         try {
 
-            String outputFile = files[12] + ".out";
+            String outputFile = USER_DIR + files[12] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -695,7 +697,7 @@
 
         try {
 
-            String outputFile = files[14] + ".out";
+            String outputFile = USER_DIR + files[14] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -55,7 +57,7 @@
     // save dtd file to current working directory to avoid writing into source repository
     public void copyDTDtoWorkDir() throws IOException {
         try (FileInputStream dtdres = new FileInputStream(getClass().getResource("Bug4693341.dtd").getPath());
-             FileOutputStream dtdwork = new FileOutputStream("Bug4693341.dtd");) {
+             FileOutputStream dtdwork = new FileOutputStream(USER_DIR + "Bug4693341.dtd");) {
             int n;
             byte[] buffer = new byte[1024];
             while((n = dtdres.read(buffer)) > -1) {
@@ -71,7 +73,7 @@
 
             copyDTDtoWorkDir();
 
-            File outf = new File("Bug4693341.out");
+            File outf = new File(USER_DIR + "Bug4693341.out");
             StreamResult result = new StreamResult(new FileOutputStream(outf));
 
             String in = getClass().getResource("Bug4693341.xml").getPath();
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 
 import javax.xml.transform.Source;
@@ -58,7 +60,7 @@
 
     private final String XML_FILE = "catalog.xml";
     private final String XML10_FILE = "catalog_10.xml"; // 1.0 version document
-    private final String TEMP_FILE = "tmp.xml";
+    private final String TEMP_FILE = USER_DIR + "tmp.xml";
     private final String EXPECTED_VERSION = "1.1";
     static private Transformer idTransform = null;
 
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,7 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
 
 import java.io.File;
@@ -52,7 +53,7 @@
     @Test
     public final void test() {
         try {
-            File test = new File("bug6216226.txt");
+            File test = new File(USER_DIR + "bug6216226.txt");
             TransformerFactory tf = TransformerFactory.newInstance();
             Transformer xformer = tf.newTransformer();
             StringReader st = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?><doc></doc>");
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileOutputStream;
 
 import javax.xml.transform.Result;
@@ -65,7 +67,7 @@
             Transformer xformer = template.newTransformer();
             // Prepare the input and output files
             Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
-            Result result = new StreamResult(new FileOutputStream(outFilename));
+            Result result = new StreamResult(new FileOutputStream(USER_DIR + outFilename));
             // Apply the xsl file to the source file and write the result to the
             // output file
             xformer.transform(source, result);
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,7 @@
 
 package transform;
 
+import java.io.FilePermission;
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -46,6 +47,7 @@
 import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
 import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
 import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 
 /*
@@ -77,7 +79,9 @@
         Transformer t = tf.newTransformer(new StreamSource(new StringReader(xsl)));
 
         //Transform the xml
-        t.transform(new StreamSource(new StringReader(xml)), new StreamResult(new StringWriter()));
+        tryRunWithTmpPermission(
+                () -> t.transform(new StreamSource(new StringReader(xml)), new StreamResult(new StringWriter())),
+                new FilePermission(output, "write"), new FilePermission(redirect, "write"));
 
         // Verifies that the output is redirected successfully
         String userDir = getSystemProperty("user.dir");
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package transform.util;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.InputStream;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -34,7 +36,7 @@
 
     protected String type;
 
-    protected final String TEMP_FILE = "tmp.xml";
+    protected final String TEMP_FILE = USER_DIR + "tmp.xml";
 
     public abstract Source prepareSource(InputStream is) throws Exception;
 
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,8 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileWriter;
 
@@ -122,7 +124,7 @@
             Validator schemaValidator = schemaGrammar.newValidator();
 
             Source staxSrc = new StAXSource(staxReader);
-            File resultFile = new File("gMonths.result.xml");
+            File resultFile = new File(USER_DIR + "gMonths.result.xml");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,6 +23,7 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
 
 import java.io.File;
@@ -61,7 +62,7 @@
 
         File resultFile = null;
         try {
-            resultFile = new File("stax.result");
+            resultFile = new File(USER_DIR + "stax.result");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -88,7 +89,7 @@
 
         File resultFile = null;
         try {
-            resultFile = new File("stax.result");
+            resultFile = new File(USER_DIR + "stax.result");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -117,7 +118,7 @@
         // test valid gMonths
         File resultFile = null;
         try {
-            resultFile = new File("gMonths.result.xml");
+            resultFile = new File(USER_DIR + "gMonths.result.xml");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -144,7 +145,7 @@
         // test invalid gMonths
         File invalidResultFile = null;
         try {
-            invalidResultFile = new File("gMonths-invalid.result.xml");
+            invalidResultFile = new File(USER_DIR + "gMonths-invalid.result.xml");
             if (invalidResultFile.exists()) {
                 invalidResultFile.delete();
             }
--- a/jaxws/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -399,5 +399,9 @@
 c48b4d4768b1c2b8fe5d1a844ca13732e5dfbe2a jdk-9+151
 6f8fb1cf7e5f61c40dcc3654f9a623c505f6de1f jdk-9+152
 7a532a9a227137155b905341d4b99939db51220e jdk-9+153
+34af95c7dbff74f3448fcdb7d745524e8a1cc88a jdk-10+0
 34af95c7dbff74f3448fcdb7d745524e8a1cc88a jdk-9+154
 9b9918656c97724fd89c04a8547043bbd37f5935 jdk-9+155
+7c829eba781409b4fe15392639289af1553dcf63 jdk-9+156
+b7e70e1e0154e1d2c69f814e03a8800ef8634fe0 jdk-9+157
+e53b322357382209fb553b9a1541ccfd12cbcb6c jdk-9+158
--- a/jaxws/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/jaxws/src/java.activation/share/classes/META-INF/mimetypes.default	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.activation/share/classes/META-INF/mimetypes.default	Mon Mar 13 19:58:52 2017 +0000
@@ -7,6 +7,7 @@
 image/ief		ief
 image/jpeg		jpeg jpg jpe JPG
 image/tiff		tiff tif
+image/png		png PNG
 image/x-xwindowdump	xwd
 application/postscript	ai eps ps
 application/rtf		rtf
--- a/jaxws/src/java.activation/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.activation/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,8 @@
 
 /**
  * Defines the JavaBeans Activation Framework (JAF) API.
+ *
+ * @since 9
  */
 module java.activation {
     requires transitive java.datatransfer;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,9 +54,7 @@
     public Object[] getArguments();
     public String getResourceBundleName();
 
-    public default ResourceBundle getResourceBundle(Locale locale) {
-        return null;
-    }
+    public ResourceBundle getResourceBundle(Locale locale);
 
     /**
      * Special constant that represents a message that
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import java.util.Locale;
 import java.util.ResourceBundle;
 
+
 /**
  * @author WS Development Team
  */
@@ -42,13 +43,9 @@
     private final String _key;
     private final Object[] _args;
 
+    @Deprecated
     public LocalizableMessage(String bundlename, String key, Object... args) {
-        _bundlename = bundlename;
-        _rbSupplier = null;
-        _key = key;
-        if(args==null)
-            args = new Object[0];
-        _args = args;
+        this(bundlename, null, key, args);
     }
 
     public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier,
@@ -61,15 +58,17 @@
         _args = args;
     }
 
-
+    @Override
     public String getKey() {
         return _key;
     }
 
+    @Override
     public Object[] getArguments() {
         return Arrays.copyOf(_args, _args.length);
     }
 
+    @Override
     public String getResourceBundleName() {
         return _bundlename;
     }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
     private final String _bundlename;
     private final ResourceBundleSupplier _rbSupplier;
 
+    @Deprecated
     public LocalizableMessageFactory(String bundlename) {
         _bundlename = bundlename;
         _rbSupplier = null;
@@ -58,4 +59,5 @@
          */
         ResourceBundle getResourceBundle(Locale locale);
     }
+
 }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package com.sun.istack.internal.localization;
 
-import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Locale;
@@ -41,7 +40,7 @@
 public class Localizer {
 
     private final Locale _locale;
-    private final HashMap _resourceBundles;
+    private final HashMap<String, ResourceBundle> _resourceBundles;
 
     public Localizer() {
         this(Locale.getDefault());
@@ -49,7 +48,7 @@
 
     public Localizer(Locale l) {
         _locale = l;
-        _resourceBundles = new HashMap();
+        _resourceBundles = new HashMap<>();
     }
 
     public Locale getLocale() {
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
 
 package com.sun.istack.internal.localization;
 
+import java.util.Locale;
+import java.util.ResourceBundle;
+
 /**
  * {@link Localizable} that wraps a non-localizable string.
  *
@@ -39,13 +42,20 @@
         this.msg = msg;
     }
 
+    @Override
     public String getKey() {
         return Localizable.NOT_LOCALIZABLE;
     }
+    @Override
     public Object[] getArguments() {
         return new Object[]{msg};
     }
+    @Override
     public String getResourceBundleName() {
         return "";
     }
+    @Override
+    public ResourceBundle getResourceBundle(Locale locale) {
+        return null;
+    }
 }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -533,4 +533,14 @@
      * @since 2.2.6
      */
     public static final String DISABLE_XML_SECURITY  = "com.sun.xml.internal.bind.disableXmlSecurity";
+
+    /**
+     * If true and element namespace is not specified, namespace of parent element will be used.
+     * The default value is false.
+     *
+     * Boolean
+     * @since 2.3.0
+     */
+    public static final String BACKUP_WITH_PARENT_NAMESPACE = "com.sun.xml.internal.bind.backupWithParentNamespace";
+
 }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,8 @@
                 "is not active.  Using JAXB's implementation");
         }
 
+        Boolean backupWithParentNamespace = getPropertyValue(properties, JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE, Boolean.class);
+
         RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class);
 
         Collection<TypeReference> tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class);
@@ -144,6 +146,7 @@
         builder.setSupressAccessorWarnings(supressAccessorWarnings);
         builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling);
         builder.setDisableSecurityProcessing(disablesecurityProcessing);
+        builder.setBackupWithParentNamespace(backupWithParentNamespace);
         return builder.build();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Code that deals with low level byte code manipulation.
+ */
+package com.sun.xml.internal.bind.v2.bytecode;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-
-
-<body>
-  Code that deals with low level byte code manipulation.
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Abstraction around reading annotations, to support internal/external annotations.
+ */
+package com.sun.xml.internal.bind.v2.model.annotation;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  Abstraction around reading annotations, to support internal/external annotations.
-</body></html>
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,24 +29,25 @@
 
 /**
  * listen to static errors found during building a JAXB model from a set of classes.
- * Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
+ * Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
  *
  * <p>
  * All the static errors have to be reported while constructing a
- * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder#link} completes.
- * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder} wraps an {@link ErrorHandler} and all the model
+ * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} completes.
+ * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} wraps an {@link ErrorHandler} and all the model
  * components should report errors through it.
  *
  * <p>
  * {@link IllegalAnnotationException} is a checked exception to remind
  * the model classes to report it rather than to throw it.
  *
- * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
+ * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI
  * @author Kohsuke Kawaguchi
  */
 public interface ErrorHandler {
     /**
      * Receives a notification for an error in the annotated code.
+     * @param e
      */
     void error( IllegalAnnotationException e );
 }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
     public final boolean isOrdered;
 
     /**
-     * {@link com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
+     * {@code com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
      * {@link #ELEMENT}, {@link #REFERENCE}, and {@link #MAP} in this order.
      */
     public final int propertyIndex;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,18 +34,22 @@
  *
  * <p>
  * This interface is only meant to be used as a return type from
- * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
+ * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
  *
  * @author Kohsuke Kawaguchi
+ * @param <T>
+ * @param <C>
  */
 public interface RegistryInfo<T,C> {
     /**
      * Returns all the references to other types in this registry.
+     * @return
      */
     Set<TypeInfo<T,C>> getReferences();
 
     /**
      * Returns the class with {@link XmlRegistry}.
+     * @return
      */
     C getClazz();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Implementation of the com.sun.xml.internal.bind.j2s.model package.
+ */
+package com.sun.xml.internal.bind.v2.model.impl;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-
-
-<body>
-Implementation of the com.sun.xml.internal.bind.j2s.model package.
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
+ */
+package com.sun.xml.internal.bind.v2.model.nav;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
-</body></html>
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -242,6 +242,16 @@
     private Set<XmlNs> xmlNsSet = null;
 
     /**
+     * If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified.
+     * The default value is null for System {code}com.sun.xml.internal.bind.backupWithParentNamespace{code} property to be used,
+     * and false is assumed if it's not set either.
+     *
+     * Boolean
+     * @since 2.3.0
+     */
+    public Boolean backupWithParentNamespace = null;
+
+    /**
      * Returns declared XmlNs annotations (from package-level annotation XmlSchema
      *
      * @return set of all present XmlNs annotations
@@ -263,6 +273,7 @@
         this.supressAccessorWarnings = builder.supressAccessorWarnings;
         this.improvedXsiTypeHandling = builder.improvedXsiTypeHandling;
         this.disableSecurityProcessing = builder.disableSecurityProcessing;
+        this.backupWithParentNamespace = builder.backupWithParentNamespace;
 
         Collection<TypeReference> typeRefs = builder.typeRefs;
 
@@ -1024,6 +1035,7 @@
         private boolean allNillable;
         private boolean improvedXsiTypeHandling = true;
         private boolean disableSecurityProcessing = true;
+        private Boolean backupWithParentNamespace = null; // null for System property to be used
 
         public JAXBContextBuilder() {};
 
@@ -1039,6 +1051,7 @@
             this.xmlAccessorFactorySupport = baseImpl.xmlAccessorFactorySupport;
             this.allNillable = baseImpl.allNillable;
             this.disableSecurityProcessing = baseImpl.disableSecurityProcessing;
+            this.backupWithParentNamespace = baseImpl.backupWithParentNamespace;
         }
 
         public JAXBContextBuilder setRetainPropertyInfo(boolean val) {
@@ -1101,6 +1114,11 @@
             return this;
         }
 
+        public JAXBContextBuilder setBackupWithParentNamespace(Boolean backupWithParentNamespace) {
+            this.backupWithParentNamespace = backupWithParentNamespace;
+            return this;
+        }
+
         public JAXBContextImpl build() throws JAXBException {
 
             // fool-proof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Code that implements JAXBContext, Unmarshaller, and Marshaller.
+ */
+package com.sun.xml.internal.bind.v2.runtime;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-
-
-<body>
-Code that implements JAXBContext, Unmarshaller, and Marshaller.
-</body>
-</html>
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
 
     private static final Logger logger = Util.getClassLogger();
 
-    protected static final boolean noOptimize = Runtime.version().major() >= 9 ||
+    protected static final boolean noOptimize =
         Util.getSystemProperty(ClassTailor.class.getName()+".noOptimize")!=null;
 
     static {
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,11 @@
 
 import com.sun.xml.internal.bind.Util;
 import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
+import java.lang.reflect.Field;
+import java.security.CodeSource;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
 
 /**
  * A {@link ClassLoader} used to "inject" optimized accessor classes
@@ -131,7 +136,7 @@
     /**
      * Injected classes keyed by their names.
      */
-    private final Map<String, Class> classes = new HashMap<String, Class>();
+    private final Map<String, Class> classes = new HashMap<>();
     private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
     private final Lock r = rwl.readLock();
     private final Lock w = rwl.writeLock();
@@ -141,26 +146,59 @@
      * False otherwise, which happens if this classloader can't see {@link Accessor}.
      */
     private final boolean loadable;
-    private static final Method defineClass;
-    private static final Method resolveClass;
-    private static final Method findLoadedClass;
+    private static Method defineClass;
+    private static Method resolveClass;
+    private static Method findLoadedClass;
+    private static Object U;
 
     static {
-        Method[] m = AccessController.doPrivileged(
-                new PrivilegedAction<Method[]>() {
+        try {
+            Method[] m = AccessController.doPrivileged(
+                    new PrivilegedAction<Method[]>() {
+                @Override
+                public Method[] run() {
+                    return new Method[]{
+                        getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
+                        getMethod(ClassLoader.class, "resolveClass", Class.class),
+                        getMethod(ClassLoader.class, "findLoadedClass", String.class)
+                    };
+                }
+            }
+            );
+            defineClass = m[0];
+            resolveClass = m[1];
+            findLoadedClass = m[2];
+        } catch (Throwable t) {
+            try {
+                U = AccessController.doPrivileged(new PrivilegedExceptionAction() {
                     @Override
-                    public Method[] run() {
-                        return new Method[]{
-                                getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
-                                getMethod(ClassLoader.class, "resolveClass", Class.class),
-                                getMethod(ClassLoader.class, "findLoadedClass", String.class)
-                        };
+                    public Object run() throws Exception {
+                        Class u = Class.forName("sun.misc.Unsafe");
+                        Field theUnsafe = u.getDeclaredField("theUnsafe");
+                        theUnsafe.setAccessible(true);
+                        return theUnsafe.get(null);
                     }
-                }
-        );
-        defineClass = m[0];
-        resolveClass = m[1];
-        findLoadedClass = m[2];
+                });
+                defineClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+                    @Override
+                    public Method run() throws Exception {
+                        try {
+                            return U.getClass().getMethod("defineClass",
+                                    new Class[]{String.class,
+                                        byte[].class,
+                                        Integer.TYPE,
+                                        Integer.TYPE,
+                                        ClassLoader.class,
+                                        ProtectionDomain.class});
+                        } catch (NoSuchMethodException | SecurityException ex) {
+                            throw ex;
+                        }
+                    }
+                });
+            } catch (SecurityException | PrivilegedActionException ex) {
+                Logger.getLogger(Injector.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
     }
 
     private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) {
@@ -210,13 +248,11 @@
             rlocked = false;
 
             //find loaded class from classloader
-            if (c == null) {
+            if (c == null && findLoadedClass != null) {
 
                 try {
                     c = (Class) findLoadedClass.invoke(parent, className.replace('/', '.'));
-                } catch (IllegalArgumentException e) {
-                    logger.log(Level.FINE, "Unable to find " + className, e);
-                } catch (IllegalAccessException e) {
+                } catch (IllegalArgumentException | IllegalAccessException e) {
                     logger.log(Level.FINE, "Unable to find " + className, e);
                 } catch (InvocationTargetException e) {
                     Throwable t = e.getTargetException();
@@ -253,9 +289,13 @@
 
                     // we need to inject a class into the
                     try {
-                        c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
-                        resolveClass.invoke(parent, c);
-                    } catch (IllegalAccessException e) {
+                        if (resolveClass != null) {
+                            c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
+                            resolveClass.invoke(parent, c);
+                        } else {
+                            c = (Class) defineClass.invoke(U, className.replace('/', '.'), image, 0, image.length, parent, Injector.class.getProtectionDomain());
+                        }
+                    } catch (IllegalAccessException  e) {
                         logger.log(Level.FINE, "Unable to inject " + className, e);
                         return null;
                     } catch (InvocationTargetException e) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Hosts optimized
+ * {@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor},
+ * {@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and {@link com.sun.xml.internal.bind.v2.runtime.Transducer}.
+ *
+ * <h2>How it works</h2>
+ * <p>
+ * Most of the classes in this package are "templates." At run-time, A template class file is slightly modified to match
+ * the target Java Bean, then it will be loaded into the VM.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect.opt;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-Hosts optimized
-{@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor},
-{@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and
-{@link com.sun.xml.internal.bind.v2.runtime.Transducer}.
-
-<h2>How it works</h2>
-<p>
-  Most of the classes in this package are "templates." At run-time,
-  A template class file is slightly modified to match the target Java Bean,
-  then it will be loaded into the VM.
-</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Abstraction around accessing data of actual objects.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  Abstraction around accessing data of actual objects.
-</body></html>
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
 import org.w3c.dom.Node;
 
 /**
- * Object that returns the current location that the {@link com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
+ * Object that returns the current location that the {@code com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
  * is parsing.
  *
  * @author Kohsuke Kawaguchi
@@ -41,6 +41,7 @@
 public interface LocatorEx extends Locator {
     /**
      * Gets the current location in a {@link ValidationEventLocator} object.
+     * @return
      */
     ValidationEventLocator getLocation();
 
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,9 @@
 
 import javax.xml.namespace.QName;
 
+import com.sun.xml.internal.bind.Util;
 import com.sun.xml.internal.bind.api.AccessorException;
+import com.sun.xml.internal.bind.api.JAXBRIContext;
 import com.sun.xml.internal.bind.v2.WellKnownNamespace;
 import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl;
 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
@@ -231,11 +233,26 @@
     @Override
     public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException {
         ChildLoader child = childUnmarshallers.get(arg.uri,arg.local);
-        if (child == null) {
-            child = catchAll;
-            if (child==null) {
-                super.childElement(state,arg);
-                return;
+        if(child == null) {
+            Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace;
+                        backupWithParentNamespace = backupWithParentNamespace != null
+                                        ? backupWithParentNamespace
+                                        : Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE));
+            if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) {
+                Iterator<?> typeNamesIt = beanInfo.getTypeNames().iterator();
+                QName parentQName = null;
+                if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) {
+                    parentQName = (QName) typeNamesIt.next();
+                    String parentUri = parentQName.getNamespaceURI();
+                    child = childUnmarshallers.get(parentUri, arg.local);
+                }
+            }
+            if (child == null) {
+                child = catchAll;
+                if(child==null) {
+                    super.childElement(state,arg);
+                    return;
+                }
             }
         }
 
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,5 +23,8 @@
  * questions.
  */
 
+/**
+ * XML Schema writer generated by TXW.
+ */
 @com.sun.xml.internal.txw2.annotation.XmlNamespace("http://www.w3.org/2001/XMLSchema")
 package com.sun.xml.internal.bind.v2.schemagen.xmlschema;
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-
-
-<body>
-XML Schema writer generated by TXW.
-</body>
-</html>
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,7 +158,7 @@
             Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
             return newInstance(contextPath, spFactory, classLoader, properties);
         } catch (ClassNotFoundException x) {
-            throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
+            throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
 
         } catch (RuntimeException | JAXBException x) {
             // avoid wrapping RuntimeException to JAXBException,
@@ -228,7 +228,7 @@
         }
     }
 
-    private static Object instantiateProviderIfNecessary(Class<?> implClass) throws JAXBException {
+    private static Object instantiateProviderIfNecessary(final Class<?> implClass) throws JAXBException {
         try {
             if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
                 return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@@ -254,7 +254,7 @@
         try {
             spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader());
         } catch (ClassNotFoundException e) {
-            throw new JAXBException(e);
+            throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), e);
         }
 
         if (logger.isLoggable(Level.FINE)) {
@@ -525,6 +525,7 @@
         } else {
             return (ClassLoader) java.security.AccessController.doPrivileged(
                     new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             return Thread.currentThread().getContextClassLoader();
                         }
@@ -539,6 +540,7 @@
         } else {
             return (ClassLoader) java.security.AccessController.doPrivileged(
                     new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             return c.getClassLoader();
                         }
@@ -552,6 +554,7 @@
         } else {
             return (ClassLoader) java.security.AccessController.doPrivileged(
                     new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             return ClassLoader.getSystemClassLoader();
                         }
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Messages.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Messages.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,9 @@
     static final String PROVIDER_NOT_FOUND = // 1 arg
         "ContextFinder.ProviderNotFound";
 
+    static final String DEFAULT_PROVIDER_NOT_FOUND = // 0 args
+        "ContextFinder.DefaultProviderNotFound";
+
     static final String COULD_NOT_INSTANTIATE = // 2 args
         "ContextFinder.CouldNotInstantiate";
 
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Messages.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Messages.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
 ContextFinder.ProviderNotFound = \
         Provider {0} not found
 
+ContextFinder.DefaultProviderNotFound = \
+        Implementation of JAXB-API has not been found on module path or classpath.
+
 ContextFinder.CouldNotInstantiate = \
         Provider {0} could not be instantiated: {1}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined
+ * sub-classes to allow arbitrary Java classes to be used with JAXB.
+ * <p>
+ * <h2>Package Specification</h2>
+ * <p>
+ * <ul>
+ * <li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB Specification</a>
+ * </ul>
+ * <p>
+ * <h2>Related Documentation</h2>
+ * <p>
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li>The <a href="http://jaxb.java.net">JAXB Website</a>
+ * </ul>
+ *
+ * @see <a href="http://jaxb.java.net">JAXB Website</a>
+ */
+package javax.xml.bind.annotation.adapters;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * <B>JAXB Provider Use Only:</b> Provides partial default implementations for
+ * some of the <code>javax.xml.bind</code> interfaces.
+ * <p>
+ * <p>
+ * JAXB Providers can extend these classes and implement the abstract
+ * methods.
+ * <p>
+ * <h2>Package Specification</h2>
+ * <p>
+ * <ul>
+ * <li><a href="https://jaxb.java.net/">JAXB Specification</a>
+ * </ul>
+ * <p>
+ * <h2>Related Documentation</h2>
+ * <p>
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
+ * </ul>
+ *
+ * @see <a href="https://jaxb.java.net/">JAXB Website</a>
+ */
+package javax.xml.bind.helpers;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Provides a runtime binding framework for client applications including
+ * unmarshalling, marshalling, and validation capabilities.
+ * <p>
+ * <p>
+ * <code>JAXBContext</code> is the client-entry point to the runtime binding
+ * framework.
+ * <p>
+ * <p>
+ * <h2>Package Specification</h2>
+ * <p>
+ * <ul>
+ * <li><a href="https://jaxb.java.net/">JAXB Specification</a>
+ * </ul>
+ * <p>
+ * <h2>Related Documentation</h2>
+ * <p>
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
+ * </ul>
+ *
+ * @see <a href="https://jaxb.java.net/">JAXB Website</a>
+ */
+package javax.xml.bind;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Useful client utility classes.
+ * <p>
+ * <h2>Package Specification</h2>
+ * <p>
+ * <ul>
+ * <li><a href="https://jaxb.java.net/">JAXB Specification</a>
+ * </ul>
+ * <p>
+ * <h2>Related Documentation</h2>
+ * <p>
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
+ * </ul>
+ *
+ * @see <a href="https://jaxb.java.net/">JAXB Website</a>
+ */
+package javax.xml.bind.util;
--- a/jaxws/src/java.xml.bind/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 /**
  * Defines the Java Architecture for XML Binding (JAXB) API.
+ *
+ * @since 9
  */
 module java.xml.bind {
     requires transitive java.activation;
@@ -32,6 +34,7 @@
     requires java.compiler;
     requires java.desktop;
     requires java.logging;
+    requires jdk.unsupported;
 
     uses javax.xml.bind.JAXBContextFactory;
 
--- a/jaxws/src/java.xml.ws.annotation/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws.annotation/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,6 +26,8 @@
 /**
  * Defines a subset of the Common Annotations API to support programs running
  * on the Java SE Platform.
+ *
+ * @since 9
  */
 module java.xml.ws.annotation {
     exports javax.annotation;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/LazyEnvelopeSource.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/LazyEnvelopeSource.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,7 @@
 public interface LazyEnvelopeSource extends javax.xml.transform.Source {
     /**
      * Retrieve payload qname without materializing its contents
-     * @return
-     * @throws SOAPException
+     * @return payload QName
      */
     public QName getPayloadQName();
     public XMLStreamReader readToBodyStarTag() throws XMLStreamException;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/SOAPExceptionImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/SOAPExceptionImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,6 +86,7 @@
     /**
      * Constructs a <code>SOAPExceptionImpl</code> object initialized
      * with the given <code>Throwable</code> object.
+     * @param cause cause
      */
     public SOAPExceptionImpl(Throwable cause) {
         super (cause.toString());
@@ -106,6 +107,7 @@
      *         message of the embedded <code>Throwable</code> object,
      *         if there is one
      */
+    @Override
     public String getMessage() {
         String message = super.getMessage ();
         if (message == null && cause != null) {
@@ -124,6 +126,7 @@
      *         if there is none
      */
 
+    @Override
     public Throwable getCause() {
         return cause;
     }
@@ -157,6 +160,7 @@
      *         method has already been called on this <code>SOAPExceptionImpl</code>
      *         object
      */
+    @Override
     public synchronized Throwable initCause(Throwable cause)
     {
         if(this.cause != null) {
@@ -170,6 +174,7 @@
         return this;
     }
 
+    @Override
     public void printStackTrace() {
         super.printStackTrace();
         if (cause != null) {
@@ -178,6 +183,7 @@
         }
     }
 
+    @Override
     public void printStackTrace(PrintStream s) {
         super.printStackTrace(s);
         if (cause != null) {
@@ -186,6 +192,7 @@
         }
     }
 
+    @Override
     public void printStackTrace(PrintWriter s) {
         super.printStackTrace(s);
         if (cause != null) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -512,9 +512,13 @@
                         : httpConnection.getInputStream());
                 // If no reply message is returned,
                 // content-Length header field value is expected to be zero.
-                // InputStream#available() can't be used here - it just says no data *YET*!
+                // java SE 6 documentation says :
+                // available() : an estimate of the number of bytes that can be read
+                //(or skipped over) from this input stream without blocking
+                //or 0 when it reaches the end of the input stream.
                 if ((httpIn == null )
-                        || (httpConnection.getContentLength() == 0)) {
+                        || (httpConnection.getContentLength() == 0)
+                        || (httpIn.available() == 0)) {
                     response = null;
                     log.warning("SAAJ0014.p2p.content.zero");
                 } else {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MultipartDataSource.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/MultipartDataSource.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
      * @return          the MimeBodyPart
      * @exception       IndexOutOfBoundsException if the given index
      *                  is out of range.
-     * @exception       MessagingException
+     * @exception       MessagingException thrown in case of error
      */
     public MimeBodyPart getBodyPart(int index) throws MessagingException;
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -115,6 +115,8 @@
      * <code>contentType</code> field. <p>
      *
      * MimeBodyParts may be added later.
+     *
+     * @param subtype subtype.
      */
     public BMMimeMultipart(String subtype) {
         super(subtype);
@@ -142,7 +144,9 @@
      * skips the 'preamble' and reads bytes till the terminating
      * boundary and creates MimeBodyParts for each part of the stream.
      *
-     * @param   ds      DataSource, can be a MultipartDataSource
+     * @param   ds      DataSource, can be a MultipartDataSource.
+     * @param   ct      content type.
+     * @exception MessagingException in case of error.
      */
     public BMMimeMultipart(DataSource ds, ContentType ct)
         throws MessagingException {
@@ -197,6 +201,7 @@
      *
      * @since   JavaMail 1.2
      */
+    @Override
     protected  void parse() throws  MessagingException {
         if (parsed)
             return;
@@ -694,6 +699,7 @@
      * separated by a boundary.
      */
 
+    @Override
     public void writeTo(OutputStream os)
             throws IOException, MessagingException {
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ContentDisposition.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ContentDisposition.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,6 +100,7 @@
     /**
      * Return the specified parameter value. Returns <code>null</code>
      * if this parameter is absent.
+     * @param name parameter name.
      * @return  parameter value
      * @since           JavaMail 1.2
      */
@@ -123,7 +124,7 @@
 
     /**
      * Set the primary type. Overrides existing primary type.
-     * @param   primaryType     primary type
+     * @param   disposition disposition value
      * @since           JavaMail 1.2
      */
     public void setDisposition(String disposition) {
@@ -162,6 +163,7 @@
      * @return  RFC2045 style string
      * @since           JavaMail 1.2
      */
+    @Override
     public String toString() {
         if (disposition == null)
             return null;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ContentType.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/ContentType.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,6 +136,7 @@
     /**
      * Return the specified parameter value. Returns <code>null</code>
      * if this parameter is absent.
+     * @param name parameter name
      * @return  parameter value
      */
     public String getParameter(String name) {
@@ -200,6 +201,7 @@
      *
      * @return  RFC2045 style string
      */
+    @Override
     public String toString() {
         if (primaryType == null || subType == null) // need both
             return null;
@@ -218,7 +220,7 @@
     /**
      * Match with the specified ContentType object. This method
      * compares <strong>only the <code>primaryType</code> and
-     * <code>subType</code> </strong>. The parameters of both operands
+     * <code>primaryType</code> </strong>. The parameters of both operands
      * are ignored. <p>
      *
      * For example, this method will return <code>true</code> when
@@ -232,6 +234,8 @@
      * and <strong>"text/*" </strong>
      *
      * @param   cType to compare this against
+     * @return true if <code>primaryType</code> and <code>subType</code>
+     * match specified content type.
      */
     public boolean match(ContentType cType) {
         // Match primaryType
@@ -266,6 +270,10 @@
      * For example, this method will return <code>true</code> when
      * comparing the ContentType for <strong>"text/plain"</strong>
      * with <strong>"text/*" </strong>
+     *
+     * @param s content type
+     * @return true if <code>primaryType</code> and <code>subType</code>
+     * match specified content type.
      */
     public boolean match(String s) {
         try {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/HeaderTokenizer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/HeaderTokenizer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,14 +95,15 @@
          * one of the following:
          * <ul>
          * <li><code>ATOM</code> A sequence of ASCII characters
-         *      delimited by either SPACE, CTL, "(", <"> or the
-         *      specified SPECIALS
+         *      delimited by either SPACE, CTL, "(", &lt;"&gt; or the
+         *      specified SPECIALS</li>
          * <li><code>QUOTEDSTRING</code> A sequence of ASCII characters
-         *      within quotes
+         *      within quotes</li>
          * <li><code>COMMENT</code> A sequence of ASCII characters
-         *      within "(" and ")".
-         * <li><code>EOF</code> End of header
+         *      within "(" and ")".</li>
+         * <li><code>EOF</code> End of header</li>
          * </ul>
+         * @return type
          */
         public int getType() {
             return type;
@@ -176,6 +177,7 @@
      * Constructor. The RFC822 defined delimiters - RFC822 - are
      * used to delimit ATOMS. Also comments are skipped and not
      * returned as tokens
+     * @param header The header that is tokenized.
      */
     public HeaderTokenizer(String header)  {
         this(header, RFC822);
@@ -317,7 +319,7 @@
             currentPos++; // re-position currentPos
             char ch[] = new char[1];
             ch[0] = c;
-            return new Token((int)c, new String(ch));
+            return new Token(c, new String(ch));
         }
 
         // Check for ATOM
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,13 +48,12 @@
  * until the blank line that indicates end of header. The input stream
  * is positioned at the start of the body. The lines are stored
  * within the object and can be extracted as either Strings or
- * {@link Header} objects. <p>
- * <p/>
+ * {@link Header} objects.
+ * <p>
  * This class is mostly intended for service providers. MimeMessage
- * and MimeBody use this class for holding their headers. <p>
- * <p/>
- * <hr> <strong>A note on RFC822 and MIME headers</strong><p>
- * <p/>
+ * and MimeBody use this class for holding their headers.
+ * <hr> <strong>A note on RFC822 and MIME headers</strong>
+ * <p>
  * RFC822 and MIME header fields <strong>must</strong> contain only
  * US-ASCII characters. If a header contains non US-ASCII characters,
  * it must be encoded as per the rules in RFC 2047. The MimeUtility
@@ -65,7 +64,7 @@
  * header fields must be folded (wrapped) before being sent if they
  * exceed the line length limitation for the transport (1000 bytes for
  * SMTP).  Received headers may have been folded.  The application is
- * responsible for folding and unfolding headers as appropriate. <p>
+ * responsible for folding and unfolding headers as appropriate.
  *
  * @author John Mani
  * @author Bill Shannon
@@ -90,12 +89,13 @@
      * Read and parse the given RFC822 message stream till the
      * blank line separating the header from the body. The input
      * stream is left positioned at the start of the body. The
-     * header lines are stored internally. <p>
-     * <p/>
+     * header lines are stored internally.
+     * <p>
      * For efficiency, wrap a BufferedInputStream around the actual
      * input stream and pass it as the parameter.
      *
      * @param   is RFC822 input stream
+     * @exception MessagingException in case of error
      */
     public InternetHeaders(InputStream is) throws MessagingException {
         load(is);
@@ -104,13 +104,14 @@
     /**
      * Read and parse the given RFC822 message stream till the
      * blank line separating the header from the body. Store the
-     * header lines inside this InternetHeaders object. <p>
-     * <p/>
+     * header lines inside this InternetHeaders object.
+     * <p>
      * Note that the header lines are added into this InternetHeaders
      * object, so any existing headers in this object will not be
      * affected.
      *
      * @param   is RFC822 input stream
+     * @exception MessagingException in case of error
      */
     public void load(InputStream is) throws MessagingException {
         // Read header lines until a blank line. It is valid
@@ -208,9 +209,9 @@
     /**
      * Change the first header line that matches name
      * to have value, adding a new header if no existing header
-     * matches. Remove all matching headers but the first. <p>
-     * <p/>
-     * Note that RFC822 headers can only contain US-ASCII characters
+     * matches. Remove all matching headers but the first.
+     * <p>
+     * Note that RFC822 headers can only contain US-ASCII characters.
      *
      * @param   name    header name
      * @param   value   header value
@@ -242,8 +243,7 @@
     }
 
     /**
-     * Add a header with the specified name and value to the header list. <p>
-     * <p/>
+     * Add a header with the specified name and value to the header list.
      * Note that RFC822 headers can only contain US-ASCII characters.
      *
      * @param   name    header name
@@ -285,15 +285,15 @@
      *
      * @return  Header objects
      */
-    public List<? extends Header> getAllHeaders() {
+    public FinalArrayList<hdr> getAllHeaders() {
         return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
     }
 
     /**
      * Add an RFC822 header line to the header store.
      * If the line starts with a space or tab (a continuation line),
-     * add it to the last header line in the list. <p>
-     * <p/>
+     * add it to the last header line in the list.
+     * <p>
      * Note that RFC822 headers can only contain US-ASCII characters
      *
      * @param   line    raw RFC822 header line
@@ -316,15 +316,19 @@
 
     /**
      * Return all the header lines as a collection
+     *
+     * @return list of header lines.
      */
     public List<String> getAllHeaderLines() {
         if(headerValueView==null)
             headerValueView = new AbstractList<String>() {
-                public String get(int index) {
+                @Override
+                                public String get(int index) {
                     return headers.get(index).line;
                 }
 
-                public int size() {
+                @Override
+                                public int size() {
                     return headers.size();
                 }
             };
@@ -368,6 +372,7 @@
     /*
      * Return the "name" part of the header line.
      */
+    @Override
     public String getName() {
         return name;
     }
@@ -375,6 +380,7 @@
     /*
      * Return the "value" part of the header line.
      */
+    @Override
     public String getValue() {
         int i = line.indexOf(':');
         if (i < 0)
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
 
 
-import com.sun.xml.internal.messaging.saaj.packaging.mime.Header;
 import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
 import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
 import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
@@ -52,12 +51,12 @@
 /**
  * This class represents a MIME body part.
  * MimeBodyParts are contained in <code>MimeMultipart</code>
- * objects. <p>
- *
+ * objects.
+ * <p>
  * MimeBodyPart uses the <code>InternetHeaders</code> class to parse
- * and store the headers of that body part. <p>
+ * and store the headers of that body part.
  *
- * <hr><strong>A note on RFC 822 and MIME headers</strong><p>
+ * <hr><strong>A note on RFC 822 and MIME headers</strong>
  *
  * RFC 822 header fields <strong>must</strong> contain only
  * US-ASCII characters. MIME allows non ASCII characters to be present
@@ -70,7 +69,7 @@
  * header fields must be folded (wrapped) before being sent if they
  * exceed the line length limitation for the transport (1000 bytes for
  * SMTP).  Received headers may have been folded.  The application is
- * responsible for folding and unfolding headers as appropriate. <p>
+ * responsible for folding and unfolding headers as appropriate.
  *
  * @author John Mani
  * @author Bill Shannon
@@ -179,6 +178,8 @@
      * the delimiter strings.
      *
      * @param   is      the body part Input Stream
+     *
+     * @exception MessagingException in case of error
      */
     public MimeBodyPart(InputStream is) throws MessagingException {
         if (!(is instanceof ByteArrayInputStream) &&
@@ -216,6 +217,7 @@
      *
      * @param   headers The header of this part
      * @param   content bytes representing the body of this part.
+     * @param   len content length.
      */
     public MimeBodyPart(InternetHeaders headers, byte[] content, int len) {
         this.headers = headers;
@@ -242,6 +244,7 @@
     /**
      * Return the containing <code>MimeMultipart</code> object,
      * or <code>null</code> if not known.
+     * @return parent part.
      */
     public MimeMultipart getParent() {
         return parent;
@@ -253,6 +256,7 @@
      * <code>addBodyPart</code> method.  <code>parent</code> may be
      * <code>null</code> if the <code>MimeBodyPart</code> is being removed
      * from its containing <code>MimeMultipart</code>.
+     * @param parent parent part
      * @since   JavaMail 1.1
      */
     public void setParent(MimeMultipart parent) {
@@ -351,6 +355,9 @@
      * If the <code>subType</code> of <code>mimeType</code> is the
      * special character '*', then the subtype is ignored during the
      * comparison.
+     *
+     * @param mimeType string
+     * @return true if it is valid mime type
      */
     public boolean isMimeType(String mimeType) {
         boolean result;
@@ -375,6 +382,9 @@
      * This implementation uses <code>getHeader(name)</code>
      * to obtain the requisite header field.
      *
+     * @return content disposition
+     * @exception MessagingException in case of error
+     *
      * @see #headers
      */
     public String getDisposition() throws MessagingException {
@@ -392,6 +402,9 @@
      * If the disposition is null, any existing "Content-Disposition"
      * header field is removed.
      *
+     * @param disposition value
+     *
+     * @exception MessagingException in case of error
      * @exception       IllegalStateException if this body part is
      *                  obtained from a READ_ONLY folder.
      */
@@ -423,6 +436,9 @@
      * This implementation uses <code>getHeader(name)</code>
      * to obtain the requisite header field.
      *
+     * @return encoding
+     * @exception MessagingException in case of error
+     *
      * @see #headers
      */
     public String getEncoding() throws MessagingException {
@@ -465,6 +481,8 @@
      *
      * This implementation uses <code>getHeader(name)</code>
      * to obtain the requisite header field.
+     *
+     * @return conent id
      */
     public String getContentID() {
         return getHeader("Content-ID", null);
@@ -475,6 +493,7 @@
      * If the <code>cid</code> parameter is null, any existing
      * "Content-ID" is removed.
      *
+     * @param cid content id
      * @exception       IllegalStateException if this body part is
      *                  obtained from a READ_ONLY folder.
      * @since           JavaMail 1.3
@@ -493,6 +512,8 @@
      *
      * This implementation uses <code>getHeader(name)</code>
      * to obtain the requisite header field.
+     *
+     * @return content MD5 sum
      */
     public String getContentMD5() {
         return getHeader("Content-MD5", null);
@@ -501,6 +522,8 @@
     /**
      * Set the "Content-MD5" header field of this body part.
      *
+     * @param md5 content md5 sum
+     *
      * @exception       IllegalStateException if this body part is
      *                  obtained from a READ_ONLY folder.
      */
@@ -516,6 +539,9 @@
      *
      * This implementation uses <code>getHeader(name)</code>
      * to obtain the requisite header field.
+     *
+     * @return array of language tags
+     * @exception MessagingException in case of error
      */
     public String[] getContentLanguage() throws MessagingException {
         String s = getHeader("Content-Language", null);
@@ -663,6 +689,7 @@
      * Returns <code>null</code> if both are absent.
      *
      * @return  filename
+     * @exception MessagingException in case of error
      */
     public String getFileName() throws MessagingException {
         String filename = null;
@@ -692,6 +719,9 @@
      * Sets the "filename" parameter of the "Content-Disposition"
      * header field of this body part.
      *
+     * @param filename filename
+     *
+     * @exception MessagingException in case of error
      * @exception       IllegalStateException if this body part is
      *                  obtained from a READ_ONLY folder.
      */
@@ -769,9 +799,14 @@
      * This implementation simply calls the <code>getContentStream</code>
      * method.
      *
+     * @return input stream
+     *
+     * @exception MessagingException in case of error
+     *
      * @see     #getInputStream
      * @see     #getContentStream
      * @since   JavaMail 1.2
+     *
      */
     public InputStream getRawInputStream() throws MessagingException {
         return getContentStream();
@@ -782,24 +817,30 @@
      *
      * The implementation provided here works just like the
      * the implementation in MimeMessage.
+     *
+     * @return data handler
      */
     public DataHandler getDataHandler() {
         if (mimePart != null) {
             //return an inputstream
             return new DataHandler(new DataSource() {
 
+                @Override
                 public InputStream getInputStream() throws IOException {
                     return mimePart.read();
                 }
 
+                @Override
                 public OutputStream getOutputStream() throws IOException {
                     throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option");
                 }
 
+                @Override
                 public String getContentType() {
                     return mimePart.getContentType();
                 }
 
+                @Override
                 public String getName() {
                     return "MIMEPart Wrapped DataSource";
                 }
@@ -890,6 +931,8 @@
      * If the charset is already known, use the
      * setText() version that takes the charset parameter.
      *
+     * @param text string
+     *
      * @see     #setText(String text, String charset)
      */
     public void setText(String text) {
@@ -902,6 +945,9 @@
      * charset. The given Unicode string will be charset-encoded
      * using the specified charset. The charset is also used to set
      * the "charset" parameter.
+     *
+     * @param text string
+     * @param charset character set
      */
     public void setText(String text, String charset) {
         if (charset == null) {
@@ -932,7 +978,9 @@
     /**
      * Output the body part as an RFC 822 format stream.
      *
-     * @exception MessagingException
+     * @param os output stream
+     *
+     * @exception MessagingException in case of error
      * @exception IOException   if an error occurs writing to the
      *                          stream or if an error is generated
      *                          by the javax.activation layer.
@@ -1033,6 +1081,8 @@
 
     /**
      * Remove all headers with this name.
+     *
+     * @param name header name
      */
     public void removeHeader(String name) {
         headers.removeHeader(name);
@@ -1041,14 +1091,18 @@
     /**
      * Return all the headers from this Message as an Enumeration of
      * Header objects.
+     *
+     * @return all headers
      */
-    public List<? extends Header> getAllHeaders() {
+    public FinalArrayList<hdr> getAllHeaders() {
         return headers.getAllHeaders();
     }
 
 
     /**
      * Add a header line to this body part
+     *
+     * @param line header line to add
      */
     public void addHeaderLine(String line) {
         headers.addHeaderLine(line);
@@ -1075,6 +1129,8 @@
      * <br>
      * In both cases this method is typically called by the
      * <code>Message.saveChanges</code> method.
+     *
+     * @exception MessagingException in case of error.
      */
     protected void updateHeaders() throws MessagingException {
         DataHandler dh = getDataHandler();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,7 @@
      * <code>contentType</code> field. <p>
      *
      * MimeBodyParts may be added later.
+     * @param subtype subtype.
      */
     public MimeMultipart(String subtype) {
         //super();
@@ -163,6 +164,8 @@
      *      This must be the same information as {@link DataSource#getContentType()}.
      *      All the callers of this method seem to have this object handy, so
      *      for performance reason this method accepts it. Can be null.
+     *
+     * @exception MessagingException in case of error
      */
     public MimeMultipart(DataSource ds, ContentType ct) throws MessagingException {
         // 'ds' was not a MultipartDataSource, we have
@@ -189,7 +192,8 @@
     /**
      * Return the number of enclosed MimeBodyPart objects.
      *
-     * @return          number of parts
+     * @return          number of parts.
+     * @throws MessagingException in case of error.
      */
     public  int getCount() throws MessagingException {
         parse();
@@ -202,8 +206,8 @@
     /**
      * Get the specified MimeBodyPart.  BodyParts are numbered starting at 0.
      *
-     * @param index     the index of the desired MimeBodyPart
-     * @return          the MimeBodyPart
+     * @param index     the index of the desired MimeBodyPart.
+     * @return          the MimeBodyPart.
      * @exception       MessagingException if no such MimeBodyPart exists
      */
     public  MimeBodyPart getBodyPart(int index)
@@ -221,6 +225,7 @@
      *
      * @param  CID      the ContentID of the desired part
      * @return          the MimeBodyPart
+     * @exception       MessagingException if no such MimeBodyPart exists.
      */
     public  MimeBodyPart getBodyPart(String CID)
                         throws MessagingException {
@@ -256,6 +261,8 @@
      * expensive for a specific MimeMultipart subclass, then it
      * might itself want to track whether its internal state actually
      * did change, and do the header updating only if necessary.
+     *
+     * @exception       MessagingException in case of error.
      */
     protected void updateHeaders() throws MessagingException {
         for (int i = 0; i < parts.size(); i++)
@@ -265,6 +272,11 @@
     /**
      * Iterates through all the parts and outputs each Mime part
      * separated by a boundary.
+     *
+     * @param os output stream.
+     *
+     * @exception IOException if an I/O Error occurs.
+     * @exception MessagingException in case of error.
      */
     public void writeTo(OutputStream os)
             throws IOException, MessagingException {
@@ -291,6 +303,8 @@
      * method is called by all other methods that need data for
      * the body parts, to make sure the data has been parsed.
      *
+     * @exception MessagingException in case of error.
+     *
      * @since   JavaMail 1.2
      */
     protected  void parse() throws MessagingException {
@@ -490,8 +504,9 @@
      * necessary.  This implementation simply constructs and returns
      * an InternetHeaders object.
      *
-     * @param   is      the InputStream to read the headers from
-     * @exception       MessagingException
+     * @param   is      the InputStream to read the headers from.
+     * @return headers.
+     * @exception       MessagingException in case of error.
      * @since           JavaMail 1.2
      */
     protected InternetHeaders createInternetHeaders(InputStream is)
@@ -506,8 +521,10 @@
      * necessary.  This implementation simply constructs and returns
      * a MimeBodyPart object.
      *
-     * @param   headers         the headers for the body part
-     * @param   content         the content of the body part
+     * @param   headers         the headers for the body part.
+     * @param   content         the content of the body part.
+     * @param   len             the content length.
+     * @return  MimeBodyPart
      * @since                   JavaMail 1.2
      */
     protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content, int len) {
@@ -521,8 +538,9 @@
      * necessary.  This implementation simply constructs and returns
      * a MimeBodyPart object.
      *
-     * @param   is              InputStream containing the body part
-     * @exception               MessagingException
+     * @param   is              InputStream containing the body part.
+     * @return  MimeBodyPart.
+     * @exception               MessagingException in case of error.
      * @since                   JavaMail 1.2
      */
     protected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException {
@@ -543,8 +561,8 @@
      * a specific multipart subtype.
      *
      * @param   mp      MimeMultipart datasource
+     * @exception               MessagingException in case of error.
      */
-
     protected void setMultipartDataSource(MultipartDataSource mp)
                         throws MessagingException {
         contentType = new ContentType(mp.getContentType());
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePartDataSource.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimePartDataSource.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,8 @@
 
     /**
      * Constructor, that constructs a DataSource from a MimeBodyPart.
+     *
+     * @param part body part
      */
     public MimePartDataSource(MimeBodyPart part) {
         this.part = part;
@@ -68,6 +70,7 @@
      *
      * @return  decoded input stream
      */
+    @Override
     public InputStream getInputStream() throws IOException {
 
         try {
@@ -88,7 +91,8 @@
      *
      * This implementation throws the UnknownServiceException.
      */
-    public OutputStream getOutputStream() throws IOException {
+    @Override
+        public OutputStream getOutputStream() throws IOException {
         throw new UnknownServiceException();
     }
 
@@ -98,6 +102,7 @@
      * This implementation just invokes the <code>getContentType</code>
      * method on the MimeBodyPart.
      */
+    @Override
     public String getContentType() {
         return part.getContentType();
     }
@@ -107,7 +112,8 @@
      *
      * This implementation just returns an empty string.
      */
-    public String getName() {
+    @Override
+        public String getName() {
         try {
                 return part.getFileName();
         } catch (MessagingException mex) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeUtility.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeUtility.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,11 +65,11 @@
  * <p>
  * Note that to get the actual bytes of a mail-safe String (say,
  * for sending over SMTP), one must do
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *
  *      byte[] bytes = string.getBytes("iso-8859-1");
  *
- * </pre></blockquote><p>
+ * </pre></blockquote>
  *
  * The <code>setHeader</code> and <code>addHeader</code> methods
  * on MimeMessage and MimeBodyPart assume that the given header values
@@ -222,6 +222,10 @@
      * <code>DataHandler</code> uses a thread, a pair of pipe streams,
      * and the <code>writeTo</code> method to produce the data. <p>
      *
+     * @param dh data handler
+     *
+     * @return encoding
+     *
      * @since   JavaMail 1.2
      */
     public static String getEncoding(DataHandler dh) {
@@ -294,6 +298,7 @@
      * @param   is              input stream
      * @param   encoding        the encoding of the stream.
      * @return                  decoded input stream.
+     * @exception MessagingException in case of error
      */
     public static InputStream decode(InputStream is, String encoding)
                 throws MessagingException {
@@ -323,6 +328,7 @@
      * @param   encoding        the encoding of the stream.
      * @return                  output stream that applies the
      *                          specified encoding.
+     * @exception MessagingException in case of error
      */
     public static OutputStream encode(OutputStream os, String encoding)
                 throws MessagingException {
@@ -358,6 +364,7 @@
      *                          with uuencode)
      * @return                  output stream that applies the
      *                          specified encoding.
+     * @exception MessagingException in case of error
      * @since                   JavaMail 1.2
      */
     public static OutputStream encode(OutputStream os, String encoding,
@@ -397,7 +404,7 @@
      * "unstructured" RFC 822 headers. <p>
      *
      * Example of usage:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *
      *  MimeBodyPart part = ...
      *  String rawvalue = "FooBar Mailer, Japanese version 1.1"
@@ -411,7 +418,7 @@
      *   // setHeader() failure
      *  }
      *
-     * </pre></blockquote><p>
+     * </pre></blockquote>
      *
      * @param   text    unicode string
      * @return  Unicode string containing only US-ASCII characters
@@ -446,6 +453,7 @@
      *          encoded are in the ASCII charset, otherwise "B" encoding
      *          is used.
      * @return  Unicode string containing only US-ASCII characters
+     * @exception UnsupportedEncodingException in case of unsupported encoding
      */
     public static String encodeText(String text, String charset,
                                     String encoding)
@@ -464,7 +472,7 @@
      * returned as-is <p>
      *
      * Example of usage:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *
      *  MimeBodyPart part = ...
      *  String rawvalue = null;
@@ -479,9 +487,10 @@
      *
      *  return value;
      *
-     * </pre></blockquote><p>
+     * </pre></blockquote>
      *
      * @param   etext   the possibly encoded value
+     * @return decoded text
      * @exception       UnsupportedEncodingException if the charset
      *                  conversion failed.
      */
@@ -568,7 +577,7 @@
      * The InternetAddress class, for example, uses this to encode
      * it's 'phrase' component.
      *
-     * @param   text    unicode string
+     * @param   word    unicode string
      * @return  Array of Unicode strings containing only US-ASCII
      *          characters.
      * @exception UnsupportedEncodingException if the encoding fails
@@ -590,7 +599,7 @@
      * The resulting bytes are then returned as a Unicode string
      * containing only ASCII characters. <p>
      *
-     * @param   text    unicode string
+     * @param   word    unicode string
      * @param   charset the MIME charset
      * @param   encoding the encoding to be used. Currently supported
      *          values are "B" and "Q". If this parameter is null, then
@@ -720,6 +729,7 @@
      * fails, an UnsupportedEncodingException is thrown.<p>
      *
      * @param   eword   the possibly encoded value
+     * @return deocoded word
      * @exception       ParseException if the string is not an
      *                  encoded-word as per RFC 2047.
      * @exception       UnsupportedEncodingException if the charset
@@ -847,8 +857,8 @@
      * @param   word    word to be quoted
      * @param   specials the set of special characters
      * @return          the possibly quoted word
-     * @see     javax.mail.internet.HeaderTokenizer#MIME
-     * @see     javax.mail.internet.HeaderTokenizer#RFC822
+     * @see     com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer#MIME
+     * @see     com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer#RFC822
      */
     public static String quote(String word, String specials) {
         int len = word.length();
@@ -1111,7 +1121,8 @@
             } catch (SecurityException sex) {
 
                 class NullInputStream extends InputStream {
-                    public int read() {
+                    @Override
+                   public int read() {
                         return 0;
                     }
                 }
@@ -1277,7 +1288,7 @@
         int l = s.length();
 
         for (int i = 0; i < l; i++) {
-            if (nonascii((int)s.charAt(i))) // non-ascii
+            if (nonascii(s.charAt(i))) // non-ascii
                 non_ascii++;
             else
                 ascii++;
@@ -1444,14 +1455,17 @@
         checkEOL = encodeEolStrict && breakOnNonAscii;
     }
 
+    @Override
     public void write(int b) throws IOException {
         check(b);
     }
 
+    @Override
     public void write(byte b[]) throws IOException {
         write(b, 0, b.length);
     }
 
+    @Override
     public void write(byte b[], int off, int len) throws IOException {
         len += off;
         for (int i = off; i < len ; i++)
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/SharedInputStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/SharedInputStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,9 @@
 
     /**
      * Writes the specified region to another {@link OutputStream}.
+     * @param   start   the starting position
+     * @param   end     the ending position + 1
+     * @param   out     output stream
      */
     public void writeTo(long start,long end, OutputStream out);
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/ASCIIUtility.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,9 +43,17 @@
     /**
      * Convert the bytes within the specified range of the given byte
      * array into a signed integer in the given radix . The range extends
-     * from <code>start</code> till, but not including <code>end</code>. <p>
+     * from <code>start</code> till, but not including <code>end</code>.
+     *
+     * Based on java.lang.Integer.parseInt().
      *
-     * Based on java.lang.Integer.parseInt()
+     * @param b bytes to convert to integer.
+     * @param start start of the range.
+     * @param end end of the range (not including).
+     * @param radix radix.
+     *
+     * @return integer.
+     *
      */
     public static int parseInt(byte[] b, int start, int end, int radix)
                 throws NumberFormatException {
@@ -110,7 +118,14 @@
     /**
      * Convert the bytes within the specified range of the given byte
      * array into a String. The range extends from <code>start</code>
-     * till, but not including <code>end</code>. <p>
+     * till, but not including <code>end</code>.
+     *
+     * @param b bytes to convert to integer.
+     * @param start start of the range.
+     * @param end end of the range (not including).
+     *
+     * @return integer.
+     *
      */
     public static String toString(byte[] b, int start, int end) {
         int size = end - start;
@@ -122,6 +137,15 @@
         return new String(theChars);
     }
 
+        /**
+         * Encodes specified String into a sequence of bytes using the platform's
+         * default charset, storing the result into a new byte array.
+         *
+         * @param s string to encode into byte array.
+         *
+         * @return byte array.
+         *
+         */
     public static byte[] getBytes(String s) {
         char [] chars= s.toCharArray();
         int size = chars.length;
@@ -133,6 +157,13 @@
     }
 
     /**
+         * Converts input stream to array.
+         *
+         * @param is stream to convert to array.
+         *
+         * @return byte array.
+         *
+         * @throws IOException if an I/O error occurs.
      *
      * @deprecated
      *      this is an expensive operation that require an additional
@@ -140,6 +171,7 @@
      *      Unless you absolutely need the exact size array, don't use this.
      *      Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
      */
+    @Deprecated
     public static byte[] getBytes(InputStream is) throws IOException {
         ByteOutputStream bos = null;
         try {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64DecoderStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64DecoderStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,6 +70,7 @@
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FilterInputStream#in
      */
+    @Override
     public int read() throws IOException {
         if (index >= bufsize) {
             decode(); // Fills up buffer
@@ -94,6 +95,7 @@
      *             the stream has been reached.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public int read(byte[] buf, int off, int len) throws IOException {
         int i, c;
         for (i = 0; i < len; i++) {
@@ -112,6 +114,7 @@
      * Tests if this input stream supports marks. Currently this class
      * does not support marks
      */
+    @Override
     public boolean markSupported() {
         return false; // Maybe later ..
     }
@@ -122,6 +125,7 @@
      * a close approximation in case the original encoded stream
      * contains embedded CRLFs; since the CRLFs are discarded, not decoded
      */
+    @Override
     public int available() throws IOException {
          // This is only an estimate, since in.available()
          // might include CRLFs too ..
@@ -200,6 +204,10 @@
      * in the IMAP AUTHENTICATE protocol, but not to decode the
      * entire content of a MIME part.
      *
+     * @param inbuf byte array to decode
+     *
+     * @return decoded byte array
+     *
      * NOTE: inbuf may only contain valid base64 characters.
      *       Whitespace is not ignored.
      */
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64EncoderStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BASE64EncoderStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,7 @@
      * @param      len   the number of bytes to write.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         for (int i = 0; i < len; i++)
             write(b[off + i]);
@@ -90,6 +91,7 @@
      * @param      b   the data to be written.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(byte[] b) throws IOException {
         write(b, 0, b.length);
     }
@@ -99,6 +101,7 @@
      * @param      c   the <code>byte</code>.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(int c) throws IOException {
         buffer[bufsize++] = (byte)c;
         if (bufsize == 3) { // Encoding unit = 3 bytes
@@ -112,6 +115,7 @@
      * to be encoded out to the stream.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void flush() throws IOException {
         if (bufsize > 0) { // If there's unencoded characters in the buffer ..
             encode();      // .. encode them
@@ -124,6 +128,7 @@
      * Forces any buffered output bytes to be encoded out to the stream
      * and closes this output stream
      */
+    @Override
     public void close() throws IOException {
         flush();
         out.close();
@@ -186,6 +191,10 @@
      * This method is suitable for short strings, such as those
      * in the IMAP AUTHENTICATE protocol, but not to encode the
      * entire content of a MIME part.
+     *
+     * @param inbuf byte array to encode.
+     *
+     * @return encoded byte array.
      */
     public static byte[] encode(byte[] inbuf) {
         if (inbuf.length == 0)
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BEncoderStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/BEncoderStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,10 @@
 
     /**
      * Returns the length of the encoded version of this byte array.
+     *
+     * @param b byte array.
+     *
+     * @return length of the byte array.
      */
     public static int encodedLength(byte[] b) {
         return ((b.length + 2)/3) * 4;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/LineInputStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/LineInputStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,6 +64,10 @@
      *
      * This class is similar to the deprecated
      * <code>DataInputStream.readLine()</code>
+     *
+     * @return line.
+     *
+     * @throws IOException if an I/O error occurs.
      */
     public String readLine() throws IOException {
         InputStream in = this.in;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/OutputUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/OutputUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,11 @@
 
     /**
      * Writes a string as ASCII string.
+     *
+     * @param s string.
+     * @param out output stream.
+     *
+     * @throws IOException if an I/O error occurs.
      */
     public static void writeAsAscii(String s,OutputStream out) throws IOException {
         int len = s.length();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QEncoderStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/QEncoderStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,7 @@
      * @param      c   the <code>byte</code>.
      * @exception  IOException  if an I/O error occurs.
      */
+    @Override
     public void write(int c) throws IOException {
         c = c & 0xff; // Turn off the MSB.
         if (c == ' ')
@@ -82,6 +83,11 @@
 
     /**
      * Returns the length of the encoded version of this byte array.
+     *
+     * @param b byte array.
+     * @param encodingWord whether use word or text specials.
+     *
+     * @return length.
      */
     public static int encodedLength(byte[] b, boolean encodingWord) {
         int len = 0;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/UUEncoderStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/util/UUEncoderStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,23 +83,29 @@
     /**
      * Set up the buffer name and permission mode.
      * This method has any effect only if it is invoked before
-     * you start writing into the output stream
+     * you start writing into the output stream.
+     *
+     * @param name name to set for the buffer.
+     * @param mode permission mode.
      */
     public void setNameMode(String name, int mode) {
         this.name = name;
         this.mode = mode;
     }
 
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         for (int i = 0; i < len; i++)
             write(b[off + i]);
     }
 
+    @Override
     public void write(byte[] data) throws IOException {
         write(data, 0, data.length);
     }
 
-    public void write(int c) throws IOException {
+    @Override
+        public void write(int c) throws IOException {
         /* buffer up characters till we get a line's worth, then encode
          * and write them out. Max number of characters allowed per
          * line is 45.
@@ -112,6 +118,7 @@
         }
     }
 
+    @Override
     public void flush() throws IOException {
         if (bufsize > 0) { // If there's unencoded characters in the buffer
             writePrefix();
@@ -121,6 +128,7 @@
         out.flush();
     }
 
+    @Override
     public void close() throws IOException {
         flush();
         out.close();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/Envelope.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/Envelope.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,16 +41,25 @@
 public interface Envelope extends SOAPEnvelope {
     /**
      * Get the content as a JAXP Source.
+     *
+     * @return source
      */
     Source getContent();
 
     /**
      * Output the content.
+     *
+     * @param out output stream.
+     * @exception IOException in case of an I/O error.
      */
     void output(OutputStream out) throws IOException;
 
     /**
      * Output the content.
+     *
+     * @param out output stream
+     * @param isFastInfoset true if it is fast infoset.
+     * @exception IOException in case of an I/O error.
      */
     void output(OutputStream out, boolean isFastInfoset) throws IOException;
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/FastInfosetDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/FastInfosetDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,10 @@
     }
 
     /**
-     * return the DataFlavors for this <code>DataContentHandler</code>
+     * Return the DataFlavors for this <code>DataContentHandler</code>
      * @return The DataFlavors.
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() { // throws Exception;
         DataFlavor flavors[] = new DataFlavor[1];
         flavors[0] = new ActivationDataFlavor(
@@ -59,11 +60,13 @@
     }
 
     /**
-     * return the Transfer Data of type DataFlavor from InputStream
-     * @param df The DataFlavor.
-     * @param ins The InputStream corresponding to the data.
+     * Return the Transfer Data of type DataFlavor from InputStream
+     * @param flavor The DataFlavor.
+     * @param dataSource DataSource.
      * @return The constructed Object.
+     * @exception IOException in case of an I/O error
      */
+    @Override
     public Object getTransferData(DataFlavor flavor, DataSource dataSource)
         throws IOException
     {
@@ -81,6 +84,7 @@
         return null;
     }
 
+    @Override
     public Object getContent(DataSource dataSource) throws IOException {
         try {
             return FastInfosetReflection.FastInfosetSource_new(
@@ -92,10 +96,11 @@
     }
 
     /**
-     * construct an object from a byte stream
+     * Construct an object from a byte stream
      * (similar semantically to previous method, we are deciding
      *  which one to support)
      */
+    @Override
     public void writeTo(Object obj, String mimeType, OutputStream os)
         throws IOException
     {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/GifDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/GifDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
      *
      * @return The DataFlavors
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() { // throws Exception;
         return new DataFlavor[] { getDF()};
     }
@@ -60,9 +61,11 @@
      * Return the Transfer Data of type DataFlavor from InputStream.
      *
      * @param df The DataFlavor
-     * @param ins The InputStream corresponding to the data
+     * @param ds The DataSource
      * @return String object
+     * @exception IOException in case of an I/O error
      */
+    @Override
     public Object getTransferData(DataFlavor df, DataSource ds)
         throws IOException {
         // use myDF.equals to be sure to get ActivationDataFlavor.equals,
@@ -73,6 +76,7 @@
             return null;
     }
 
+    @Override
     public Object getContent(DataSource ds) throws IOException {
         InputStream is = ds.getInputStream();
         int pos = 0;
@@ -98,7 +102,11 @@
 
     /**
      * Write the object to the output stream, using the specified MIME type.
+     * @param obj object to write
+     * @param type requested MIME type of the resulting byte stream
+     * @param os OutputStream
      */
+    @Override
     public void writeTo(Object obj, String type, OutputStream os)
                         throws IOException {
         if (obj != null && !(obj instanceof Image))
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ImageDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ImageDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,8 +67,9 @@
      *
      * @return The DataFlavors.
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() {
-        return (DataFlavor[]) Arrays.copyOf(flavor, flavor.length);
+        return Arrays.copyOf(flavor, flavor.length);
     }
 
     /**
@@ -80,6 +81,7 @@
      * @param ds The DataSource representing the data to be converted.
      * @return The constructed Object.
      */
+    @Override
     public Object getTransferData(DataFlavor df, DataSource ds)
         throws IOException {
         for (int i=0; i < flavor.length; i++) {
@@ -98,6 +100,7 @@
      * @param ds The DataSource representing the data to be converted.
      * @return The constructed Object.
      */
+    @Override
     public Object getContent(DataSource ds) throws IOException {
         return ImageIO.read(new BufferedInputStream(ds.getInputStream()));
     }
@@ -107,11 +110,11 @@
      * and write it to the output stream.
      *
      * @param obj   The object to be converted.
-     * @param mimeType  The requested MIME type of the resulting byte stream.
+     * @param type  The requested MIME type of the resulting byte stream.
      * @param os    The output stream into which to write the converted
      *          byte stream.
      */
-
+    @Override
     public void writeTo(Object obj, String type, OutputStream os)
         throws IOException {
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/JpegDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/JpegDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,10 @@
     public static final String STR_SRC = "java.awt.Image";
 
     /**
-     * return the DataFlavors for this <code>DataContentHandler</code>
+     * Return the DataFlavors for this <code>DataContentHandler</code>
      * @return The DataFlavors.
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() { // throws Exception;
         DataFlavor flavors[] = new DataFlavor[1];
 
@@ -67,11 +68,12 @@
     }
 
     /**
-     * return the Transfer Data of type DataFlavor from InputStream
-     * @param df The DataFlavor.
-     * @param ins The InputStream corresponding to the data.
+     * Return the Transfer Data of type DataFlavor from InputStream
+     * @param df The DataFlavor
+     * @param ds The DataSource
      * @return The constructed Object.
      */
+    @Override
     public Object getTransferData(DataFlavor df, DataSource ds) {
 
         // this is sort of hacky, but will work for the
@@ -98,6 +100,7 @@
     /**
      *
      */
+    @Override
     public Object getContent(DataSource ds) { // throws Exception;
         InputStream inputStream = null;
         BufferedImage jpegLoadImage = null;
@@ -109,14 +112,18 @@
         } catch (Exception e) {
         }
 
-        return (Image) jpegLoadImage;
+        return jpegLoadImage;
     }
 
     /**
-     * construct an object from a byte stream
+     * Construct an object from a byte stream
      * (similar semantically to previous method, we are deciding
      *  which one to support)
+     * @param obj object to write
+     * @param mimeType requested MIME type of the resulting byte stream
+     * @param os OutputStream
      */
+    @Override
     public void writeTo(Object obj, String mimeType, OutputStream os)
         throws IOException {
         if (!mimeType.equals("image/jpeg"))
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/LazyEnvelope.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/LazyEnvelope.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,24 +38,24 @@
 
     /**
      * Retrieve payload qname without materializing its contents
-     * @return
-     * @throws SOAPException
+     * @return QName
+     * @throws SOAPException in case of an error
      */
     public QName getPayloadQName() throws SOAPException;
 
     /**
      * Retrieve payload attribute value without materializing its contents
-     * @param localName
-     * @return
-     * @throws SOAPException
+     * @param localName local name
+     * @return payload attribute value
+     * @throws SOAPException in case of an error
      */
     public String getPayloadAttributeValue(String localName) throws SOAPException;
 
     /**
      * Retrieve payload attribute value without materializing its contents
-     * @param qName
-     * @return
-     * @throws SOAPException
+     * @param qName QName
+     * @return payload attribute value
+     * @throws SOAPException in case of an error
      */
     public String getPayloadAttributeValue(QName qName) throws SOAPException;
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
 
     /**
      * True if this part is encoded using Fast Infoset.
-     * MIME -> application/fastinfoset
+     * MIME -&gt; application/fastinfoset
      */
     protected boolean isFastInfoset = false;
 
@@ -202,6 +202,9 @@
     /**
       * Construct a new message. This will be invoked before message
       * sends.
+      *
+      * @param isFastInfoset whether it is fast infoset
+      * @param acceptFastInfoset whether to accept fast infoset
       */
     protected MessageImpl(boolean isFastInfoset, boolean acceptFastInfoset) {
         this.isFastInfoset = isFastInfoset;
@@ -214,6 +217,8 @@
 
     /**
      * Shallow copy.
+     *
+     * @param msg SoapMessage
      */
     protected MessageImpl(SOAPMessage msg) {
         if (!(msg instanceof MessageImpl)) {
@@ -233,14 +238,17 @@
     /**
      * @param stat
      *      the mask value obtained from {@link #identifyContentType(ContentType)}
+     * @return true if SOAP 1.1 Content
      */
     protected static boolean isSoap1_1Content(int stat) {
         return (stat & SOAP1_1_FLAG) != 0;
     }
 
     /**
+     * Check whether it is SOAP 1.2 content.
      * @param stat
      *      the mask value obtained from {@link #identifyContentType(ContentType)}
+     * @return true if it is SOAP 1.2 content
      */
     protected static boolean isSoap1_2Content(int stat) {
         return (stat & SOAP1_2_FLAG) != 0;
@@ -298,6 +306,9 @@
      * Construct a message from an input stream. When messages are
      * received, there's two parts -- the transport headers and the
      * message content in a transport specific stream.
+     * @param headers MimeHeaders
+     * @param in InputStream
+     * @exception SOAPExceptionImpl in case of I/O error
      */
     protected MessageImpl(MimeHeaders headers, final InputStream in)
         throws SOAPExceptionImpl {
@@ -332,6 +343,7 @@
      * received, there's two parts -- the transport headers and the
      * message content in a transport specific stream.
      *
+     * @param headers headers
      * @param contentType
      *      The parsed content type header from the headers variable.
      *      This is redundant parameter, but it avoids reparsing this header again.
@@ -339,6 +351,8 @@
      *      The result of {@link #identifyContentType(ContentType)} over
      *      the contentType parameter. This redundant parameter, but it avoids
      *      recomputing this information again.
+     * @param in input stream
+     * @exception SOAPExceptionImpl in case of an error
      */
     protected MessageImpl(MimeHeaders headers, final ContentType contentType, int stat, final InputStream in) throws SOAPExceptionImpl {
         init(headers, stat, contentType, in);
@@ -425,18 +439,22 @@
             } else if ((stat & MIME_MULTIPART_FLAG) != 0) {
                 final InputStream finalIn = in;
                 DataSource ds = new DataSource() {
+                    @Override
                     public InputStream getInputStream() {
                         return finalIn;
                     }
 
+                    @Override
                     public OutputStream getOutputStream() {
                         return null;
                     }
 
+                    @Override
                     public String getContentType() {
                         return contentType.toString();
                     }
 
+                    @Override
                     public String getName() {
                         return "";
                     }
@@ -591,10 +609,12 @@
             return Boolean.valueOf(lazyParsingProp.toString());
         }
     }
+    @Override
     public Object getProperty(String property) {
-        return (String) properties.get(property);
+        return properties.get(property);
     }
 
+    @Override
     public void setProperty(String property, Object value) {
         verify(property, value);
         properties.put(property, value);
@@ -722,6 +742,7 @@
             return "text/xml";
     }
 
+    @Override
     public MimeHeaders getMimeHeaders() {
         return this.headers;
     }
@@ -805,10 +826,12 @@
         saved = false;
     }
 
+    @Override
     public  boolean saveRequired() {
         return saved != true;
     }
 
+    @Override
     public String getContentDescription() {
         String[] values = headers.getHeader("Content-Description");
         if (values != null && values.length > 0)
@@ -816,13 +839,16 @@
         return null;
     }
 
+    @Override
     public void setContentDescription(String description) {
         headers.setHeader("Content-Description", description);
         needsSave();
     }
 
+    @Override
     public abstract SOAPPart getSOAPPart();
 
+    @Override
     public void removeAllAttachments() {
         try {
             initializeAllAttachments();
@@ -836,6 +862,7 @@
         }
     }
 
+    @Override
     public int countAttachments() {
         try {
             initializeAllAttachments();
@@ -847,6 +874,7 @@
         return 0;
     }
 
+    @Override
     public void addAttachmentPart(AttachmentPart attachment) {
         try {
             initializeAllAttachments();
@@ -864,6 +892,7 @@
 
     static private final Iterator nullIter = Collections.EMPTY_LIST.iterator();
 
+    @Override
     public Iterator getAttachments() {
         try {
             initializeAllAttachments();
@@ -897,12 +926,14 @@
         private MimeHeaders headers;
         private AttachmentPart nextAttachment;
 
+        @Override
         public boolean hasNext() {
             if (nextAttachment == null)
                 nextAttachment = nextMatch();
             return nextAttachment != null;
         }
 
+        @Override
         public AttachmentPart next() {
             if (nextAttachment != null) {
                 AttachmentPart ret = nextAttachment;
@@ -925,11 +956,13 @@
             return null;
         }
 
+        @Override
         public void remove() {
             iter.remove();
         }
     }
 
+    @Override
     public Iterator getAttachments(MimeHeaders headers) {
         try {
             initializeAllAttachments();
@@ -942,6 +975,7 @@
         return new MimeMatchingIterator(headers);
     }
 
+    @Override
     public void removeAttachments(MimeHeaders headers) {
         try {
             initializeAllAttachments();
@@ -966,10 +1000,12 @@
        // needsSave();
     }
 
+    @Override
     public AttachmentPart createAttachmentPart() {
         return new AttachmentPartImpl();
     }
 
+    @Override
     public  AttachmentPart getAttachment(SOAPElement element)
         throws SOAPException {
         try {
@@ -1187,6 +1223,7 @@
         }
     }
 
+    @Override
     public void saveChanges() throws SOAPException {
 
         // suck in all the data from the attachments and have it
@@ -1340,6 +1377,7 @@
 
     }
 
+    @Override
     public void writeTo(OutputStream out) throws SOAPException, IOException {
         if (saveRequired()){
             this.optimizeAttachmentProcessing = true;
@@ -1397,6 +1435,7 @@
         needsSave();
     }
 
+    @Override
     public SOAPBody getSOAPBody() throws SOAPException {
         SOAPBody body = getSOAPPart().getEnvelope().getBody();
         /*if (body == null) {
@@ -1405,6 +1444,7 @@
         return body;
     }
 
+    @Override
     public SOAPHeader getSOAPHeader() throws SOAPException {
         SOAPHeader hdr = getSOAPPart().getEnvelope().getHeader();
         /*if (hdr == null) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MultipartDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MultipartDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
      *
      * @return The DataFlavors
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() { // throws Exception;
         return new DataFlavor[] { myDF };
     }
@@ -51,9 +52,10 @@
      * Return the Transfer Data of type DataFlavor from InputStream.
      *
      * @param df The DataFlavor
-     * @param ins The InputStream corresponding to the data
+     * @param ds The DataSource
      * @return String object
      */
+    @Override
     public Object getTransferData(DataFlavor df, DataSource ds) {
         // use myDF.equals to be sure to get ActivationDataFlavor.equals,
         // which properly ignores Content-Type parameters in comparison
@@ -65,7 +67,11 @@
 
     /**
      * Return the content.
+     *
+     * @param ds The DataSource
+     * @return content
      */
+    @Override
     public Object getContent(DataSource ds) {
         try {
             return new MimeMultipart(
@@ -78,6 +84,7 @@
     /**
      * Write the object to the output stream, using the specific MIME type.
      */
+    @Override
     public void writeTo(Object obj, String mimeType, OutputStream os)
                         throws IOException {
         if (obj instanceof MimeMultipart) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentFragment.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
-*
-* @author SAAJ RI Development Team
-*/
-package com.sun.xml.internal.messaging.saaj.soap;
-
-import com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl;
-import com.sun.org.apache.xerces.internal.dom.DocumentFragmentImpl;
-
-public class SOAPDocumentFragment extends DocumentFragmentImpl {
-
-    public SOAPDocumentFragment(CoreDocumentImpl ownerDoc) {
-        super(ownerDoc);
-    }
-
-    public SOAPDocumentFragment() {
-        super();
-    }
-
-}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,16 +29,42 @@
 */
 package com.sun.xml.internal.messaging.saaj.soap;
 
+import com.sun.xml.internal.messaging.saaj.soap.impl.CDATAImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.ElementFactory;
+import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPCommentImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPTextImpl;
+import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.UserDataHandler;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Logger;
 
-import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
-import org.w3c.dom.*;
-
-import com.sun.xml.internal.messaging.saaj.soap.impl.*;
-import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
-import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
-
-public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
+public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Document {
 
     private static final String XMLNS = "xmlns".intern();
     protected static final Logger log =
@@ -47,8 +73,24 @@
 
     SOAPPartImpl enclosingSOAPPart;
 
+    private Document document;
+
+    private Map<Node, javax.xml.soap.Node> domToSoap = new HashMap<>();
+
     public SOAPDocumentImpl(SOAPPartImpl enclosingDocument) {
+        document = createDocument();
         this.enclosingSOAPPart = enclosingDocument;
+        register(this);
+    }
+
+    private Document createDocument() {
+        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
+        try {
+            final DocumentBuilder documentBuilder = docFactory.newDocumentBuilder();
+            return documentBuilder.newDocument();
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException("Error creating xml document", e);
+        }
     }
 
     //    public SOAPDocumentImpl(boolean grammarAccess) {
@@ -81,7 +123,7 @@
     }
 
     public DOMImplementation getImplementation() {
-        return super.getImplementation();
+        return document.getImplementation();
     }
 
     public Element getDocumentElement() {
@@ -91,7 +133,7 @@
     }
 
     protected Element doGetDocumentElement() {
-        return super.getDocumentElement();
+        return document.getDocumentElement();
     }
 
     public Element createElement(String tagName) throws DOMException {
@@ -103,7 +145,7 @@
     }
 
     public DocumentFragment createDocumentFragment() {
-        return new SOAPDocumentFragment(this);
+        return document.createDocumentFragment();
     }
 
     public org.w3c.dom.Text createTextNode(String data) {
@@ -139,7 +181,7 @@
             }
         }
 
-        return super.createAttribute(name);
+        return document.createAttribute(name);
     }
 
     public EntityReference createEntityReference(String name)
@@ -149,12 +191,15 @@
     }
 
     public NodeList getElementsByTagName(String tagname) {
-        return super.getElementsByTagName(tagname);
+        return document.getElementsByTagName(tagname);
     }
 
     public org.w3c.dom.Node importNode(Node importedNode, boolean deep)
         throws DOMException {
-        return super.importNode(importedNode, deep);
+        final Node node = document.importNode(getDomNode(importedNode), deep);
+        return node instanceof Element ?
+            ElementFactory.createElement(this, (Element) node)
+                : node;
     }
 
     public Element createElementNS(String namespaceURI, String qualifiedName)
@@ -168,26 +213,386 @@
 
     public Attr createAttributeNS(String namespaceURI, String qualifiedName)
         throws DOMException {
-        return super.createAttributeNS(namespaceURI, qualifiedName);
+        return document.createAttributeNS(namespaceURI, qualifiedName);
     }
 
     public NodeList getElementsByTagNameNS(
         String namespaceURI,
         String localName) {
-        return super.getElementsByTagNameNS(namespaceURI, localName);
+        return document.getElementsByTagNameNS(namespaceURI, localName);
     }
 
     public Element getElementById(String elementId) {
-        return super.getElementById(elementId);
+        return document.getElementById(elementId);
+    }
+
+    @Override
+    public String getInputEncoding() {
+        return document.getInputEncoding();
+    }
+
+    @Override
+    public String getXmlEncoding() {
+        return document.getXmlEncoding();
+    }
+
+    @Override
+    public boolean getXmlStandalone() {
+        return document.getXmlStandalone();
+    }
+
+    @Override
+    public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
+        document.setXmlStandalone(xmlStandalone);
+    }
+
+    @Override
+    public String getXmlVersion() {
+        return document.getXmlVersion();
+    }
+
+    @Override
+    public void setXmlVersion(String xmlVersion) throws DOMException {
+        document.setXmlVersion(xmlVersion);
+    }
+
+    @Override
+    public boolean getStrictErrorChecking() {
+        return document.getStrictErrorChecking();
+    }
+
+    @Override
+    public void setStrictErrorChecking(boolean strictErrorChecking) {
+        document.setStrictErrorChecking(strictErrorChecking);
+    }
+
+    @Override
+    public String getDocumentURI() {
+        return document.getDocumentURI();
+    }
+
+    @Override
+    public void setDocumentURI(String documentURI) {
+        document.setDocumentURI(documentURI);
+    }
+
+    @Override
+    public Node adoptNode(Node source) throws DOMException {
+        return document.adoptNode(source);
+    }
+
+    @Override
+    public DOMConfiguration getDomConfig() {
+        return document.getDomConfig();
+    }
+
+    @Override
+    public void normalizeDocument() {
+        document.normalizeDocument();
+    }
+
+    @Override
+    public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException {
+        return document.renameNode(n, namespaceURI, qualifiedName);
+    }
+
+    @Override
+    public String getNodeName() {
+        return document.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return document.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        document.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return document.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return document.getParentNode();
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return document.getChildNodes();
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return document.getFirstChild();
+    }
+
+    @Override
+    public Node getLastChild() {
+        return document.getLastChild();
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return document.getPreviousSibling();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return document.getNextSibling();
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return document.getAttributes();
+    }
+
+    @Override
+    public Document getOwnerDocument() {
+        return document.getOwnerDocument();
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return document.insertBefore(getDomNode(newChild), getDomNode(refChild));
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return document.replaceChild(getDomNode(newChild), getDomNode(oldChild));
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return document.removeChild(getDomNode(oldChild));
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return document.appendChild(getDomNode(newChild));
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return document.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return document.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        document.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return document.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return document.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return document.getPrefix();
     }
 
-    public Node cloneNode(boolean deep) {
-        SOAPPartImpl newSoapPart = getSOAPPart().doCloneNode();
-        super.cloneNode(newSoapPart.getDocument(), deep);
-        return newSoapPart;
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        document.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return document.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return document.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return document.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return document.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return document.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        document.setTextContent(textContent);
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return document.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return document.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return document.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return document.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return document.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return document.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return document.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return document.getUserData(key);
+    }
+
+    public Document getDomDocument() {
+        return document;
     }
 
-    public void cloneNode(SOAPDocumentImpl newdoc, boolean deep) {
-        super.cloneNode(newdoc, deep);
+    /**
+     * Insert a mapping information for {@link org.w3c.dom.Node} - {@link javax.xml.soap.Node}.
+     *
+     * In SAAJ, elements in DOM are expected to be interfaces of SAAJ, on the other hand in JDKs Xerces,
+     * they are casted to internal impl classes. After removal of SAAJ dependency
+     * to JDKs internal classes elements in DOM can never be both of them.
+     *
+     * @param node SAAJ wrapper node for w3c DOM node
+     */
+    public void register(javax.xml.soap.Node node) {
+        final Node domElement = getDomNode(node);
+        if (domToSoap.containsKey(domElement)) {
+            throw new IllegalStateException("Element " + domElement.getNodeName()
+                    + " is already registered");
+        }
+        domToSoap.put(domElement, node);
+    }
+
+    /**
+     * Find a soap wrapper for w3c dom node.
+     *
+     * @param node w3c dom node nullable
+     * @return soap wrapper for w3c dom node
+     *
+     * @throws
+     */
+    public javax.xml.soap.Node find(Node node) {
+        return find(node, true);
+    }
+
+    private javax.xml.soap.Node find(Node node, boolean required) {
+        if (node == null) {
+            return null;
+        }
+        if (node instanceof javax.xml.soap.Node) {
+            return (javax.xml.soap.Node) node;
+        }
+        final javax.xml.soap.Node found = domToSoap.get(node);
+        if (found == null && required) {
+            throw new IllegalArgumentException(MessageFormat.format("Cannot find SOAP wrapper for element {0}", node));
+        }
+        return found;
+    }
+
+    /**
+     * If corresponding soap wrapper exists for w3c dom node it is returned,
+     * if not passed dom element is returned.
+     *
+     * @param node w3c dom node
+     * @return soap wrapper or passed w3c dom node if not found
+     */
+    public Node findIfPresent(Node node) {
+        final javax.xml.soap.Node found = find(node, false);
+        return found != null ? found : node;
+    }
+
+    /**
+     * Extracts w3c dom node from corresponding soap wrapper.
+     *
+     * @param node soap or dom nullable
+     * @return dom node
+     */
+    public Node getDomNode(Node node) {
+        if (node instanceof SOAPDocumentImpl) {
+            return ((SOAPDocumentImpl)node).getDomElement();
+        } else if (node instanceof ElementImpl) {
+            return ((ElementImpl) node).getDomElement();
+        } else if (node instanceof SOAPTextImpl) {
+            return ((SOAPTextImpl)node).getDomElement();
+        } else if (node instanceof SOAPCommentImpl) {
+            return ((SOAPCommentImpl)node).getDomElement();
+        } else if (node instanceof CDATAImpl) {
+            return ((CDATAImpl) node).getDomElement();
+        }
+        return node;
+    }
+
+    public Document getDomElement() {
+        return document;
+    }
+
+    @Override
+    public String getValue() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setValue(String value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setParentElement(SOAPElement parent) throws SOAPException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public SOAPElement getParentElement() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void detachNode() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void recycleNode() {
+        throw new UnsupportedOperationException();
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,29 +25,56 @@
 
 package com.sun.xml.internal.messaging.saaj.soap;
 
-import java.io.*;
-import java.util.Iterator;
-import java.util.logging.Logger;
-import java.util.logging.Level;
+import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
+import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart;
+import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
+import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;
+import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
+import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection;
+import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource;
+import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import com.sun.xml.internal.messaging.saaj.util.MimeHeadersUtil;
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.UserDataHandler;
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
-import javax.xml.soap.*;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPPart;
 import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import org.w3c.dom.*;
-
-import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart;
-
-import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
-import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
-import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
-import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
-import com.sun.xml.internal.messaging.saaj.util.*;
-
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PushbackReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * SOAPPartImpl is the first attachment. This contains the XML/SOAP document.
@@ -128,20 +155,21 @@
             envelope = createEnvelopeFromSource();
         } else {
             envelope = createEmptyEnvelope(null);
-            document.insertBefore(envelope, null);
+            document.insertBefore(((EnvelopeImpl) envelope).getDomElement(), null);
         }
         return envelope;
     }
 
     protected void lookForEnvelope() throws SOAPException {
         Element envelopeChildElement = document.doGetDocumentElement();
-        if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
-            envelope = (EnvelopeImpl) envelopeChildElement;
-        } else if (!(envelopeChildElement instanceof ElementImpl)) {
+        org.w3c.dom.Node soapEnvelope = document.findIfPresent(envelopeChildElement);
+        if (soapEnvelope == null || soapEnvelope instanceof Envelope) {
+            envelope = (EnvelopeImpl) soapEnvelope;
+        } else if (document.find(envelopeChildElement) == null) {
             log.severe("SAAJ0512.soap.incorrect.factory.used");
             throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
         } else {
-            ElementImpl soapElement = (ElementImpl) envelopeChildElement;
+            ElementImpl soapElement = (ElementImpl) document.find(envelopeChildElement);
             if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
                 String prefix = soapElement.getPrefix();
                 String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
@@ -498,7 +526,7 @@
     }
 
     public NamedNodeMap getAttributes() {
-        return document.getAttributes();
+        return document.getDomDocument().getAttributes();
     }
 
     public NodeList getChildNodes() {
@@ -517,11 +545,11 @@
     }
 
     public String getLocalName() {
-        return document.getLocalName();
+        return document.getDomDocument().getLocalName();
     }
 
     public String getNamespaceURI() {
-        return document.getNamespaceURI();
+        return document.getDomDocument().getNamespaceURI();
     }
 
     public org.w3c.dom.Node getNextSibling() {
@@ -530,11 +558,11 @@
     }
 
     public String getNodeName() {
-        return document.getNodeName();
+        return document.getDomDocument().getNodeName();
     }
 
     public short getNodeType() {
-        return document.getNodeType();
+        return document.getDomDocument().getNodeType();
     }
 
     public String getNodeValue() throws DOMException {
@@ -542,23 +570,23 @@
     }
 
     public Document getOwnerDocument() {
-        return document.getOwnerDocument();
+        return document.getDomDocument().getOwnerDocument();
     }
 
     public org.w3c.dom.Node getParentNode() {
-        return document.getParentNode();
+        return document.getDomDocument().getParentNode();
     }
 
     public String getPrefix() {
-        return document.getPrefix();
+        return document.getDomDocument().getPrefix();
     }
 
     public org.w3c.dom.Node getPreviousSibling() {
-        return document.getPreviousSibling();
+        return document.getDomDocument().getPreviousSibling();
     }
 
     public boolean hasAttributes() {
-        return document.hasAttributes();
+        return document.getDomDocument().hasAttributes();
     }
 
     public boolean hasChildNodes() {
@@ -575,7 +603,7 @@
     }
 
     public boolean isSupported(String arg0, String arg1) {
-        return document.isSupported(arg0, arg1);
+        return document.getDomDocument().isSupported(arg0, arg1);
     }
 
     public void normalize() {
@@ -686,7 +714,7 @@
     }
 
     public DOMConfiguration getDomConfig() {
-        return document.getDomConfig();
+        return document.getDomDocument().getDomConfig();
     }
 
     public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException {
@@ -699,7 +727,7 @@
     }
 
     public String getDocumentURI() {
-        return document.getDocumentURI();
+        return document.getDomDocument().getDocumentURI();
     }
 
     public void  setStrictErrorChecking(boolean strictErrorChecking) {
@@ -707,15 +735,15 @@
     }
 
     public String getInputEncoding() {
-        return document.getInputEncoding();
+        return document.getDomDocument().getInputEncoding();
     }
 
     public String getXmlEncoding() {
-        return document.getXmlEncoding();
+        return document.getDomDocument().getXmlEncoding();
     }
 
     public boolean getXmlStandalone() {
-        return document.getXmlStandalone();
+        return document.getDomDocument().getXmlStandalone();
     }
 
     public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
@@ -723,7 +751,7 @@
     }
 
     public String getXmlVersion() {
-        return document.getXmlVersion();
+        return document.getDomDocument().getXmlVersion();
     }
 
     public void setXmlVersion(String xmlVersion) throws DOMException {
@@ -731,12 +759,12 @@
     }
 
     public boolean  getStrictErrorChecking() {
-        return document.getStrictErrorChecking();
+        return document.getDomDocument().getStrictErrorChecking();
     }
 
     // DOM L3 methods from org.w3c.dom.Node
     public String getBaseURI() {
-        return document.getBaseURI();
+        return document.getDomDocument().getBaseURI();
     }
 
     public short compareDocumentPosition(org.w3c.dom.Node other)
@@ -758,7 +786,7 @@
     }
 
     public String lookupPrefix(String namespaceURI) {
-        return document.lookupPrefix(namespaceURI);
+        return document.getDomDocument().lookupPrefix(namespaceURI);
     }
 
     public boolean isDefaultNamespace(String namespaceURI) {
@@ -770,7 +798,7 @@
     }
 
     public boolean isEqualNode(org.w3c.dom.Node arg) {
-        return document.isEqualNode(arg);
+        return document.getDomDocument().isEqualNode(arg);
     }
 
     public Object getFeature(String feature,
@@ -785,7 +813,7 @@
     }
 
     public Object getUserData(String key) {
-        return document.getUserData(key);
+        return document.getDomDocument().getUserData(key);
     }
 
     public void recycleNode() {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPVersionMismatchException.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPVersionMismatchException.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,9 @@
     /**
      * Constructs a <code>SOAPExceptionImpl</code> object initialized
      * with the given <code>Throwable</code> object.
+     *
+     * @param cause a <code>Throwable</code> object that is to
+     *        be embedded in this <code>SOAPExceptionImpl</code> object
      */
     public SOAPVersionMismatchException(Throwable cause) {
         super(cause);
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StringDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/StringDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
 import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
 
 /**
- * JAF data content handler for text/plain --> String
+ * JAF data content handler for text/plain --&gt; String
  *
  */
 public class StringDataContentHandler implements DataContentHandler {
@@ -51,6 +51,7 @@
      *
      * @return The DataFlavors
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() {
         return new DataFlavor[] { getDF() };
     }
@@ -62,6 +63,7 @@
      * @param ds The DataSource corresponding to the data
      * @return String object
      */
+    @Override
     public Object getTransferData(DataFlavor df, DataSource ds)
                         throws IOException {
         // use myDF.equals to be sure to get ActivationDataFlavor.equals,
@@ -72,6 +74,7 @@
             return null;
     }
 
+    @Override
     public Object getContent(DataSource ds) throws IOException {
         String enc = null;
         InputStreamReader is = null;
@@ -120,6 +123,7 @@
     /**
      * Write the object to the output stream, using the specified MIME type.
      */
+    @Override
     public void writeTo(Object obj, String type, OutputStream os)
                         throws IOException {
         if (!(obj instanceof String))
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/XmlDataContentHandler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/XmlDataContentHandler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@
      * return the DataFlavors for this <code>DataContentHandler</code>
      * @return The DataFlavors.
      */
+    @Override
     public DataFlavor[] getTransferDataFlavors() { // throws Exception;
         DataFlavor flavors[] = new DataFlavor[2];
 
@@ -69,10 +70,11 @@
 
     /**
      * return the Transfer Data of type DataFlavor from InputStream
-     * @param df The DataFlavor.
-     * @param ins The InputStream corresponding to the data.
+     * @param flavor The DataFlavor.
+     * @param dataSource The DataSource.
      * @return The constructed Object.
      */
+    @Override
     public Object getTransferData(DataFlavor flavor, DataSource dataSource)
         throws IOException {
         if (flavor.getMimeType().startsWith("text/xml") ||
@@ -87,6 +89,7 @@
     /**
      *
      */
+    @Override
     public Object getContent(DataSource dataSource) throws IOException {
         return new StreamSource(dataSource.getInputStream());
     }
@@ -96,6 +99,7 @@
      * (similar semantically to previous method, we are deciding
      *  which one to support)
      */
+    @Override
     public void writeTo(Object obj, String mimeType, OutputStream os)
         throws IOException {
         if (!mimeType.startsWith("text/xml") && !mimeType.startsWith("application/xml"))
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.*;
 import org.w3c.dom.Node;
 
@@ -60,6 +61,10 @@
         super(ownerDoc, bodyName);
     }
 
+    public BodyImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract NameImpl getFaultName(String name);
     protected abstract boolean isFault(SOAPElement child);
     protected abstract SOAPBodyElement createBodyElement(Name name);
@@ -155,7 +160,7 @@
         if (hasFault()) {
             if (fault == null) {
                 //initialize fault member
-                fault = (SOAPFault) getFirstChildElement();
+                fault = (SOAPFault) getSoapDocument().find(getFirstChildElement());
             }
             return fault;
         }
@@ -259,11 +264,12 @@
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        if ((element instanceof SOAPBodyElement) &&
+        final Node soapNode = getSoapDocument().findIfPresent(element);
+        if ((soapNode instanceof SOAPBodyElement) &&
             //this check is required because ElementImpl currently
             // implements SOAPBodyElement
-            !(element.getClass().equals(ElementImpl.class))) {
-            return (SOAPElement) element;
+            !(soapNode.getClass().equals(ElementImpl.class))) {
+            return (SOAPElement) soapNode;
         } else {
             return replaceElementWithSOAPElement(
                 element,
@@ -314,7 +320,7 @@
 
         Document document = null;
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
             factory.setNamespaceAware(true);
             DocumentBuilder builder = factory.newDocumentBuilder();
             document = builder.newDocument();
@@ -440,7 +446,7 @@
             //not lazy -Just get first child element and return its attribute
             Element elem = getFirstChildElement();
             if (elem != null) {
-                return elem.getAttribute(localName);
+                return elem.getAttribute(getLocalName());
             }
         }
         return null;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,10 +32,17 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
 
-public class CDATAImpl
-    extends com.sun.org.apache.xerces.internal.dom.CDATASectionImpl
-    implements javax.xml.soap.Text {
+public class CDATAImpl implements CDATASection, javax.xml.soap.Text {
 
     protected static final Logger log =
         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
@@ -44,8 +51,256 @@
     static final String cdataUC = "<![CDATA[";
     static final String cdataLC = "<![cdata[";
 
+    @Override
+    public Text splitText(int offset) throws DOMException {
+        return cdataSection.splitText(offset);
+    }
+
+    @Override
+    public boolean isElementContentWhitespace() {
+        return cdataSection.isElementContentWhitespace();
+    }
+
+    @Override
+    public String getWholeText() {
+        return cdataSection.getWholeText();
+    }
+
+    @Override
+    public Text replaceWholeText(String content) throws DOMException {
+        return cdataSection.replaceWholeText(content);
+    }
+
+    @Override
+    public String getData() throws DOMException {
+        return cdataSection.getData();
+    }
+
+    @Override
+    public void setData(String data) throws DOMException {
+        cdataSection.setData(data);
+    }
+
+    @Override
+    public int getLength() {
+        return cdataSection.getLength();
+    }
+
+    @Override
+    public String substringData(int offset, int count) throws DOMException {
+        return cdataSection.substringData(offset, count);
+    }
+
+    @Override
+    public void appendData(String arg) throws DOMException {
+        cdataSection.appendData(arg);
+    }
+
+    @Override
+    public void insertData(int offset, String arg) throws DOMException {
+        cdataSection.insertData(offset, arg);
+    }
+
+    @Override
+    public void deleteData(int offset, int count) throws DOMException {
+        cdataSection.deleteData(offset, count);
+    }
+
+    @Override
+    public void replaceData(int offset, int count, String arg) throws DOMException {
+        cdataSection.replaceData(offset, count, arg);
+    }
+
+    @Override
+    public String getNodeName() {
+        return cdataSection.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return cdataSection.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        cdataSection.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return cdataSection.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return cdataSection.getParentNode();
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return cdataSection.getChildNodes();
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return cdataSection.getFirstChild();
+    }
+
+    @Override
+    public Node getLastChild() {
+        return cdataSection.getLastChild();
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return cdataSection.getPreviousSibling();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return cdataSection.getNextSibling();
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return cdataSection.getAttributes();
+    }
+
+    @Override
+    public Document getOwnerDocument() {
+        return cdataSection.getOwnerDocument();
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return cdataSection.insertBefore(newChild, refChild);
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return cdataSection.replaceChild(newChild, oldChild);
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return cdataSection.removeChild(oldChild);
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return cdataSection.appendChild(newChild);
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return cdataSection.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return cdataSection.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        cdataSection.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return cdataSection.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return cdataSection.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return cdataSection.getPrefix();
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        cdataSection.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return cdataSection.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return cdataSection.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return cdataSection.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return cdataSection.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return cdataSection.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        cdataSection.setTextContent(textContent);
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return cdataSection.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return cdataSection.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return cdataSection.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return cdataSection.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return cdataSection.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return cdataSection.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return cdataSection.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return cdataSection.getUserData(key);
+    }
+
+    private CDATASection cdataSection;
+
     public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
-        super(ownerDoc, text);
+        cdataSection = ownerDoc.getDomDocument().createCDATASection(text);
+        ownerDoc.register(this);
     }
 
     public String getValue() {
@@ -87,4 +342,8 @@
     public boolean isComment() {
         return false;
     }
+
+    public CDATASection getDomElement() {
+        return cdataSection;
+    }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -31,6 +31,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.*;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Element;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
@@ -41,6 +42,10 @@
         super(ownerDoc, detailName);
     }
 
+    public DetailImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract DetailEntry createDetailEntry(Name name);
     protected abstract DetailEntry createDetailEntry(QName name);
 
@@ -65,8 +70,9 @@
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        if (element instanceof DetailEntry) {
-            return (SOAPElement) element;
+        final javax.xml.soap.Node soapNode = getSoapDocument().find(element);
+        if (soapNode instanceof DetailEntry) {
+            return (SOAPElement) soapNode;
         } else {
             DetailEntry detailEntry =
                 createDetailEntry(NameImpl.copyElementName(element));
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementFactory.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementFactory.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,22 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
-import com.sun.xml.internal.messaging.saaj.soap.ver1_1.*;
-import com.sun.xml.internal.messaging.saaj.soap.ver1_2.*;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Body1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Detail1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Fault1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Header1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Body1_2Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Detail1_2Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Envelope1_2Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Fault1_2Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Header1_2Impl;
+import com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPPart1_2Impl;
+import org.w3c.dom.Element;
+
+import java.util.Objects;
 
 
 public class ElementFactory {
@@ -54,6 +68,72 @@
             name.getNamespaceURI());
     }
 
+    /**
+     * Create element wrapper for existing DOM element.
+     *
+     * @param ownerDocument SOAP document wrapper not null
+     * @param element DOM element not null
+     * @return SOAP wrapper for DOM element
+     */
+    public static SOAPElement createElement(SOAPDocumentImpl ownerDocument, Element element) {
+        Objects.requireNonNull(ownerDocument);
+        Objects.requireNonNull(element);
+
+        String localName = element.getLocalName();
+        String namespaceUri = element.getNamespaceURI();
+        String prefix = element.getPrefix();
+
+        if ("Envelope".equalsIgnoreCase(localName)) {
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new Envelope1_1Impl(ownerDocument, element);
+            } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
+                return new Envelope1_2Impl(ownerDocument, element);
+            }
+        }
+        if ("Body".equalsIgnoreCase(localName)) {
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new Body1_1Impl(ownerDocument, element);
+            } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
+                return new Body1_2Impl(ownerDocument, element);
+            }
+        }
+        if ("Header".equalsIgnoreCase(localName)) {
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new Header1_1Impl(ownerDocument, element);
+            } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
+                return new Header1_2Impl(ownerDocument, element);
+            }
+        }
+        if ("Fault".equalsIgnoreCase(localName)) {
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new Fault1_1Impl(element, ownerDocument);
+            } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
+                return new Fault1_2Impl(element, ownerDocument);
+            }
+
+        }
+        if ("Detail".equalsIgnoreCase(localName)) {
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new Detail1_1Impl(ownerDocument, element);
+            } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
+                return new Detail1_2Impl(ownerDocument, element);
+            }
+        }
+        if ("faultcode".equalsIgnoreCase(localName)
+                || "faultstring".equalsIgnoreCase(localName)
+                || "faultactor".equalsIgnoreCase(localName)) {
+            // SOAP 1.2 does not have fault(code/string/actor)
+            // So there is no else case required
+            if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
+                return new FaultElement1_1Impl(ownerDocument,
+                        localName,
+                        prefix);
+            }
+        }
+
+        return new ElementImpl(ownerDocument, element);
+    }
+
     public static SOAPElement createElement(
         SOAPDocumentImpl ownerDocument,
         String localName,
@@ -92,28 +172,28 @@
             prefix = NameImpl.SOAP_ENVELOPE_PREFIX;
         }
 
-        if (localName.equalsIgnoreCase("Envelope")) {
+        if ("Envelope".equalsIgnoreCase(localName)) {
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
                 return new Envelope1_1Impl(ownerDocument, prefix);
             } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
                 return new Envelope1_2Impl(ownerDocument, prefix);
             }
         }
-        if (localName.equalsIgnoreCase("Body")) {
+        if ("Body".equalsIgnoreCase(localName)) {
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
                 return new Body1_1Impl(ownerDocument, prefix);
             } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
                 return new Body1_2Impl(ownerDocument, prefix);
             }
         }
-        if (localName.equalsIgnoreCase("Header")) {
+        if ("Header".equalsIgnoreCase(localName)) {
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
                 return new Header1_1Impl(ownerDocument, prefix);
             } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
                 return new Header1_2Impl(ownerDocument, prefix);
             }
         }
-        if (localName.equalsIgnoreCase("Fault")) {
+        if ("Fault".equalsIgnoreCase(localName)) {
             SOAPFault fault = null;
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
                 fault = new Fault1_1Impl(ownerDocument, prefix);
@@ -139,16 +219,16 @@
             }
 
         }
-        if (localName.equalsIgnoreCase("Detail")) {
+        if ("Detail".equalsIgnoreCase(localName)) {
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
                 return new Detail1_1Impl(ownerDocument, prefix);
             } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
                 return new Detail1_2Impl(ownerDocument, prefix);
             }
         }
-        if (localName.equalsIgnoreCase("faultcode")
-            || localName.equalsIgnoreCase("faultstring")
-            || localName.equalsIgnoreCase("faultactor")) {
+        if ("faultcode".equalsIgnoreCase(localName)
+                || "faultstring".equalsIgnoreCase(localName)
+                || "faultactor".equalsIgnoreCase(localName)) {
             // SOAP 1.2 does not have fault(code/string/actor)
             // So there is no else case required
             if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -43,9 +43,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.*;
 
-public class ElementImpl
-    extends com.sun.org.apache.xerces.internal.dom.ElementNSImpl
-    implements SOAPElement, SOAPBodyElement {
+public class ElementImpl implements SOAPElement, SOAPBodyElement {
 
     public static final String DSIG_NS = "http://www.w3.org/2000/09/xmldsig#".intern();
     public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern();
@@ -55,6 +53,69 @@
 
     protected QName elementQName;
 
+    private Element element;
+
+    private SOAPDocumentImpl soapDocument;
+
+    @Override
+    public String getTagName() {
+        return element.getTagName();
+    }
+
+    @Override
+    public String getAttribute(String name) {
+        return element.getAttribute(name);
+    }
+
+    @Override
+    public void setAttribute(String name, String value) throws DOMException {
+        boolean isQualifiedName = (name.indexOf(":") > 0);
+        //this is because of BugfixTest#testCR7020991, after removal internal dependencies
+        //SOAPDocumentImpl#createAttribute is not called anymore from xerces parent
+        if (isQualifiedName) {
+            String nsUri = null;
+            String prefix = name.substring(0, name.indexOf(":"));
+            //cannot do anything to resolve the URI if prefix is not
+            //XMLNS.
+            if (XMLNS.equals(prefix)) {
+                nsUri = ElementImpl.XMLNS_URI;
+                setAttributeNS(nsUri, name, value);
+                return;
+            }
+        }
+        element.setAttribute(name, value);
+    }
+
+    @Override
+    public void removeAttribute(String name) throws DOMException {
+        element.removeAttribute(name);
+    }
+
+    @Override
+    public Attr getAttributeNode(String name) {
+        return element.getAttributeNode(name);
+    }
+
+    @Override
+    public Attr setAttributeNode(Attr newAttr) throws DOMException {
+        return element.setAttributeNode(newAttr);
+    }
+
+    @Override
+    public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
+        return element.removeAttributeNode(oldAttr);
+    }
+
+    @Override
+    public NodeList getElementsByTagName(String name) {
+        return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name));
+    }
+
+    @Override
+    public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
+        return element.getAttributeNS(namespaceURI, localName);
+    }
+
     protected static final Logger log =
         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
                          "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
@@ -72,22 +133,27 @@
      */
     public final static String XML_URI = "http://www.w3.org/XML/1998/namespace".intern();
 
+    private final static String XMLNS = "xmlns".intern();
+
     public ElementImpl(SOAPDocumentImpl ownerDoc, Name name) {
-        super(
-            ownerDoc,
-            name.getURI(),
-            name.getQualifiedName(),
-            name.getLocalName());
+        this.soapDocument = ownerDoc;
+        this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName());
         elementQName = NameImpl.convertToQName(name);
+        getSoapDocument().register(this);
     }
 
     public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
-        super(
-            ownerDoc,
-            name.getNamespaceURI(),
-            getQualifiedName(name),
-            name.getLocalPart());
+        this.soapDocument = ownerDoc;
+        this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name));
         elementQName = name;
+        getSoapDocument().register(this);
+    }
+
+    public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        this.element = domElement;
+        this.soapDocument = ownerDoc;
+        this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
+        getSoapDocument().register(this);
     }
 
     public ElementImpl(
@@ -95,9 +161,11 @@
         String uri,
         String qualifiedName) {
 
-        super(ownerDoc, uri, qualifiedName);
+        this.soapDocument = ownerDoc;
+        this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName);
         elementQName =
             new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName));
+        getSoapDocument().register(this);
     }
 
     public void ensureNamespaceIsDeclared(String prefix, String uri) {
@@ -111,11 +179,132 @@
     }
 
     public Document getOwnerDocument() {
-        Document doc = super.getOwnerDocument();
-        if (doc instanceof SOAPDocument)
-            return ((SOAPDocument) doc).getDocument();
-        else
-            return doc;
+        return soapDocument;
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild));
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild));
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return element.removeChild(getSoapDocument().getDomNode(oldChild));
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return element.appendChild(getSoapDocument().getDomNode(newChild));
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return element.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return element.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        element.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return element.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return element.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return element.getPrefix();
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        element.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return element.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return element.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return element.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return element.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return element.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        element.setTextContent(textContent);
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return element.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return element.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return element.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return element.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return element.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return element.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return element.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return element.getUserData(key);
     }
 
     public SOAPElement addChildElement(Name name) throws SOAPException {
@@ -353,13 +542,16 @@
         // preserve the encodingStyle attr as it may get lost in the import
         String encodingStyle = element.getEncodingStyle();
 
-        ElementImpl importedElement = (ElementImpl) importElement(element);
+        final Element domElement = ((ElementImpl) element).getDomElement();
+        final Element importedElement = importElement(domElement);
         addNode(importedElement);
 
+        final SOAPElement converted = convertToSoapElement(importedElement);
+
         if (encodingStyle != null)
-            importedElement.setEncodingStyle(encodingStyle);
+            converted.setEncodingStyle(encodingStyle);
 
-        return convertToSoapElement(importedElement);
+        return converted;
     }
 
     protected Element importElement(Element element) {
@@ -374,7 +566,7 @@
 
     protected SOAPElement addElement(Name name) throws SOAPException {
         SOAPElement newElement = createElement(name);
-        addNode(newElement);
+        addNode(((ElementImpl) newElement).getDomElement());
         return newElement;
     }
 
@@ -411,7 +603,7 @@
     }
 
     protected void addNode(org.w3c.dom.Node newElement) throws SOAPException {
-        insertBefore(newElement, null);
+        insertBefore(getSoapDocument().getDomNode(newElement), null);
 
         if (getOwnerDocument() instanceof DocumentFragment)
             return;
@@ -431,7 +623,7 @@
         Node child = getFirstChild();
         while (child != null) {
             if (child instanceof Element) {
-                return ((Element) child);
+                return (Element) getSoapDocument().find(child);
             }
             child = child.getNextSibling();
         }
@@ -441,10 +633,12 @@
     protected SOAPElement findChild(NameImpl name) {
         Node eachChild = getFirstChild();
         while (eachChild != null) {
-            if (eachChild instanceof SOAPElement) {
-                SOAPElement eachChildSoap = (SOAPElement) eachChild;
-                if (eachChildSoap.getElementName().equals(name)) {
-                    return eachChildSoap;
+            if (eachChild instanceof Element) {
+                SOAPElement eachChildSoap = (SOAPElement) getSoapDocument().find(eachChild);
+                if (eachChildSoap != null) {
+                    if (eachChildSoap.getElementName().equals(name)) {
+                        return eachChildSoap;
+                    }
                 }
             }
             eachChild = eachChild.getNextSibling();
@@ -474,14 +668,14 @@
 
     protected SOAPElement addCDATA(String text) throws SOAPException {
         org.w3c.dom.Text cdata =
-            (org.w3c.dom.Text) getOwnerDocument().createCDATASection(text);
+                getOwnerDocument().createCDATASection(text);
         addNode(cdata);
         return this;
     }
 
     protected SOAPElement addText(String text) throws SOAPException {
         org.w3c.dom.Text textNode =
-            (org.w3c.dom.Text) getOwnerDocument().createTextNode(text);
+                getOwnerDocument().createTextNode(text);
         addNode(textNode);
         return this;
     }
@@ -684,8 +878,9 @@
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        if (element instanceof SOAPElement) {
-            return (SOAPElement) element;
+        final Node soapNode = getSoapDocument().findIfPresent(element);
+        if (soapNode instanceof SOAPElement) {
+            return (SOAPElement) soapNode;
         } else {
             return replaceElementWithSOAPElement(
                 element,
@@ -693,7 +888,7 @@
         }
     }
 
-    protected static SOAPElement replaceElementWithSOAPElement(
+    protected SOAPElement replaceElementWithSOAPElement(
         Element element,
         ElementImpl copy) {
 
@@ -709,7 +904,7 @@
             copy.insertBefore(nextChild, null);
         }
 
-        Node parent = element.getParentNode();
+        Node parent = getSoapDocument().find(element.getParentNode());
         if (parent != null) {
             parent.replaceChild(copy, element);
         } // XXX else throw an exception?
@@ -727,8 +922,8 @@
                 if (next == null) {
                     while (eachNode.hasNext()) {
                         Node node = eachNode.next();
-                        if (node instanceof SOAPElement) {
-                            next = node;
+                        if (node instanceof Element) {
+                            next = getSoapDocument().findIfPresent(node);
                             break;
                         }
                     }
@@ -899,14 +1094,14 @@
     protected javax.xml.soap.Node getValueNode() {
         Iterator<Node> i = getChildElements();
         while (i.hasNext()) {
-            javax.xml.soap.Node n = (javax.xml.soap.Node) i.next();
+            Node n = i.next();
             if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE ||
                 n.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE) {
                 // TODO: Hack to fix text node split into multiple lines.
                 normalize();
                 // Should remove the normalization step when this gets fixed in
                 // DOM/Xerces.
-                return (javax.xml.soap.Node) n;
+                return getSoapDocument().find(n);
             }
         }
         return null;
@@ -948,7 +1143,7 @@
         if (parentNode instanceof SOAPDocument) {
             return null;
         }
-        return (SOAPElement) parentNode;
+        return (SOAPElement) getSoapDocument().find(parentNode);
     }
 
     protected String getSOAPNamespace() {
@@ -975,7 +1170,7 @@
     public void detachNode() {
         Node parent = getParentNode();
         if (parent != null) {
-            parent.removeChild(this);
+            parent.removeChild(element);
         }
         encodingStyleAttribute.clearNameAndValue();
         // Fix for CR: 6474641
@@ -1136,17 +1331,18 @@
         return attribute == null ? null : attribute.getValue();
     }
 
-    protected static Iterator<Node> getChildElementsFrom(final Element element) {
+    protected Iterator<Node> getChildElementsFrom(final Element element) {
         return new Iterator<Node>() {
             Node next = element.getFirstChild();
             Node nextNext = null;
             Node last = null;
+            Node soapElement = getSoapDocument().findIfPresent(element);
 
             public boolean hasNext() {
                 if (next != null) {
                     return true;
                 }
-                if (next == null && nextNext != null) {
+                if (nextNext != null) {
                     next = nextNext;
                 }
 
@@ -1158,15 +1354,15 @@
                     last = next;
                     next = null;
 
-                    if ((element instanceof ElementImpl)
-                        && (last instanceof Element)) {
+                    if ((soapElement instanceof ElementImpl)
+                            && (last instanceof Element)) {
                         last =
-                            ((ElementImpl) element).convertToSoapElement(
-                                (Element) last);
+                                ((ElementImpl) soapElement).convertToSoapElement(
+                                        (Element) last);
                     }
 
                     nextNext = last.getNextSibling();
-                    return last;
+                    return getSoapDocument().findIfPresent(last);
                 }
                 throw new NoSuchElementException();
             }
@@ -1251,7 +1447,7 @@
 //                SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(value)))
 //            return;
 
-        super.setAttributeNS(namespaceURI,qualifiedName,value);
+        element.setAttributeNS(namespaceURI,qualifiedName,value);
         //String tmpLocalName = this.getLocalName();
         String tmpURI = this.getNamespaceURI();
         boolean isIDNS = false;
@@ -1270,4 +1466,116 @@
 
     }
 
+    @Override
+    public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
+        element.removeAttributeNS(namespaceURI, localName);
+    }
+
+    @Override
+    public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException {
+        return element.getAttributeNodeNS(namespaceURI, localName);
+    }
+
+    @Override
+    public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
+        return element.setAttributeNodeNS(newAttr);
+    }
+
+    @Override
+    public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
+        return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName));
+    }
+
+    @Override
+    public boolean hasAttribute(String name) {
+        return element.hasAttribute(name);
+    }
+
+    @Override
+    public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException {
+        return element.hasAttributeNS(namespaceURI, localName);
+    }
+
+    @Override
+    public TypeInfo getSchemaTypeInfo() {
+        return element.getSchemaTypeInfo();
+    }
+
+    @Override
+    public void setIdAttribute(String name, boolean isId) throws DOMException {
+        element.setIdAttribute(name, isId);
+    }
+
+    @Override
+    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
+        element.setIdAttributeNS(namespaceURI, localName, isId);
+    }
+
+    @Override
+    public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
+        element.setIdAttributeNode(idAttr, isId);
+    }
+
+    @Override
+    public String getNodeName() {
+        return element.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return element.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        element.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return element.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return getSoapDocument().find(element.getParentNode());
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return new NodeListImpl(getSoapDocument(), element.getChildNodes());
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return getSoapDocument().findIfPresent(element.getFirstChild());
+    }
+
+    @Override
+    public Node getLastChild() {
+        return getSoapDocument().findIfPresent(element.getLastChild());
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return getSoapDocument().findIfPresent(element.getPreviousSibling());
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return getSoapDocument().findIfPresent(element.getNextSibling());
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return element.getAttributes();
+    }
+
+    public Element getDomElement() {
+        return element;
+    }
+
+    public SOAPDocumentImpl getSoapDocument() {
+        return soapDocument;
+    }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/EnvelopeImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
 
 import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader;
 import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
+import org.w3c.dom.Element;
 
 /**
  * Our implementation of the SOAP envelope.
@@ -92,6 +93,10 @@
             addBody();
     }
 
+    public EnvelopeImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract NameImpl getHeaderName(String prefix);
     protected abstract NameImpl getBodyName(String prefix);
 
@@ -122,7 +127,7 @@
         }
 
         header = (HeaderImpl) createElement(headerName);
-        insertBefore(header, firstChild);
+        insertBefore(header.getDomElement(), firstChild);
         header.ensureNamespaceIsDeclared(headerName.getPrefix(), headerName.getURI());
 
         return header;
@@ -161,7 +166,7 @@
         if (body == null) {
             NameImpl bodyName = getBodyName(prefix);
             body = (BodyImpl) createElement(bodyName);
-            insertBefore(body, null);
+            insertBefore(body.getDomElement(), null);
             body.ensureNamespaceIsDeclared(bodyName.getPrefix(), bodyName.getURI());
         } else {
             log.severe("SAAJ0122.impl.body.already.exists");
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultElementImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultElementImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public abstract class FaultElementImpl
     extends ElementImpl
@@ -47,6 +48,10 @@
         super(ownerDoc, qname);
     }
 
+    public FaultElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract boolean isStandardFaultElement();
 
     public SOAPElement setElementQName(QName newName) throws SOAPException {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/FaultImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.*;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Element;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@@ -53,6 +54,9 @@
         super(ownerDoc, name);
     }
 
+    public FaultImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
 
     protected abstract NameImpl getDetailName();
     protected abstract NameImpl getFaultCodeName();
@@ -83,6 +87,7 @@
             (SOAPFaultElement) findAndConvertChildElement(getFaultStringName());
     }
 
+    @Override
     public void setFaultCode(String faultCode) throws SOAPException {
         setFaultCode(
             NameImpl.getLocalNameFromTagName(faultCode),
@@ -131,6 +136,7 @@
         }
     }
 
+    @Override
     public void setFaultCode(Name faultCodeQName) throws SOAPException {
         setFaultCode(
             faultCodeQName.getLocalName(),
@@ -138,6 +144,7 @@
             faultCodeQName.getURI());
     }
 
+    @Override
     public void setFaultCode(QName faultCodeQName) throws SOAPException {
         setFaultCode(
             faultCodeQName.getLocalPart(),
@@ -165,6 +172,7 @@
         detail = (Detail) findAndConvertChildElement(detailName);
     }
 
+    @Override
     public Detail getDetail() {
         if (detail == null)
             initializeDetail();
@@ -175,6 +183,7 @@
         return detail;
     }
 
+    @Override
     public Detail addDetail() throws SOAPException {
         if (detail == null)
             initializeDetail();
@@ -188,12 +197,15 @@
         }
     }
 
+    @Override
     public boolean hasDetail() {
         return (getDetail() != null);
     }
 
+    @Override
     public abstract void setFaultActor(String faultActor) throws SOAPException;
 
+    @Override
     public String getFaultActor() {
         if (this.faultActorElement == null)
             findFaultActorElement();
@@ -203,6 +215,7 @@
         return null;
     }
 
+    @Override
     public SOAPElement setElementQName(QName newName) throws SOAPException {
 
         log.log(
@@ -213,11 +226,13 @@
             "Cannot change name for " + elementQName.getLocalPart() + " to " + newName.getLocalPart());
     }
 
+    @Override
     protected SOAPElement convertToSoapElement(Element element) {
-        if (element instanceof SOAPFaultElement) {
-            return (SOAPElement) element;
-        } else if (element instanceof SOAPElement) {
-            SOAPElement soapElement = (SOAPElement) element;
+        final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
+        if (soapNode instanceof SOAPFaultElement) {
+            return (SOAPElement) soapNode;
+        } else if (soapNode instanceof SOAPElement) {
+            SOAPElement soapElement = (SOAPElement) soapNode;
             if (getDetailName().equals(soapElement.getElementName())) {
                 return replaceElementWithSOAPElement(element, createDetail());
             } else {
@@ -233,12 +248,12 @@
             Name elementName = NameImpl.copyElementName(element);
             ElementImpl newElement;
             if (getDetailName().equals(elementName)) {
-                newElement = (ElementImpl) createDetail();
+                newElement = createDetail();
             } else {
                 String localName = elementName.getLocalName();
                 if (isStandardFaultElement(localName))
                     newElement =
-                        (ElementImpl) createSOAPFaultElement(elementName);
+                        createSOAPFaultElement(elementName);
                 else
                     newElement = (ElementImpl) createElement(elementName);
             }
@@ -284,6 +299,7 @@
         }
     }
 
+    @Override
     protected SOAPElement addElement(Name name) throws SOAPException {
         if (getDetailName().equals(name)) {
             return addDetail();
@@ -297,6 +313,7 @@
         return super.addElement(name);
     }
 
+    @Override
     protected SOAPElement addElement(QName name) throws SOAPException {
         return addElement(NameImpl.convertToName(name));
     }
@@ -311,6 +328,8 @@
 
     /**
      * Convert an xml:lang attribute value into a Locale object
+     * @param xmlLang xml:lang attribute value
+     * @return Locale
      */
     protected static Locale xmlLangToLocale(String xmlLang) {
         if (xmlLang == null) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/HeaderImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.*;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.Element;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@@ -45,6 +46,10 @@
         super(ownerDoc, name);
     }
 
+    public HeaderImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract SOAPHeaderElement createHeaderElement(Name name)
         throws SOAPException;
     protected abstract SOAPHeaderElement createHeaderElement(QName name)
@@ -276,8 +281,9 @@
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        if (element instanceof SOAPHeaderElement) {
-            return (SOAPElement) element;
+        final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
+        if (soapNode instanceof SOAPHeaderElement) {
+            return (SOAPElement) soapNode;
         } else {
             SOAPHeaderElement headerElement;
             try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/NodeListImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.messaging.saaj.soap.impl;
+
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.Objects;
+
+/**
+ * Node list wrapper, finding SOAP elements automatically when possible.
+ *
+ * @author Roman Grigoriadi
+ */
+public class NodeListImpl implements NodeList {
+
+    private final SOAPDocumentImpl soapDocument;
+
+    private final NodeList nodeList;
+
+    public NodeListImpl(SOAPDocumentImpl soapDocument, NodeList nodeList) {
+        Objects.requireNonNull(soapDocument);
+        Objects.requireNonNull(soapDocument);
+        this.soapDocument = soapDocument;
+        this.nodeList = nodeList;
+    }
+
+    @Override
+    public Node item(int index) {
+        return soapDocument.findIfPresent(nodeList.item(index));
+    }
+
+    @Override
+    public int getLength() {
+        return nodeList.getLength();
+    }
+}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPCommentImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPCommentImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,14 +31,20 @@
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
+import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.UserDataHandler;
 
 public class SOAPCommentImpl
-    extends com.sun.org.apache.xerces.internal.dom.CommentImpl
     implements javax.xml.soap.Text, org.w3c.dom.Comment {
 
     protected static final Logger log =
@@ -47,8 +53,236 @@
     protected static ResourceBundle rb =
         log.getResourceBundle();
 
+    @Override
+    public String getData() throws DOMException {
+        return comment.getData();
+    }
+
+    @Override
+    public void setData(String data) throws DOMException {
+        comment.setData(data);
+    }
+
+    @Override
+    public int getLength() {
+        return comment.getLength();
+    }
+
+    @Override
+    public String substringData(int offset, int count) throws DOMException {
+        return comment.substringData(offset, count);
+    }
+
+    @Override
+    public void appendData(String arg) throws DOMException {
+        comment.appendData(arg);
+    }
+
+    @Override
+    public void insertData(int offset, String arg) throws DOMException {
+        comment.insertData(offset, arg);
+    }
+
+    @Override
+    public void deleteData(int offset, int count) throws DOMException {
+        comment.deleteData(offset, count);
+    }
+
+    @Override
+    public void replaceData(int offset, int count, String arg) throws DOMException {
+        comment.replaceData(offset, count, arg);
+    }
+
+    @Override
+    public String getNodeName() {
+        return comment.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return comment.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        comment.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return comment.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return comment.getParentNode();
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return comment.getChildNodes();
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return comment.getFirstChild();
+    }
+
+    @Override
+    public Node getLastChild() {
+        return comment.getLastChild();
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return comment.getPreviousSibling();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return comment.getNextSibling();
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return comment.getAttributes();
+    }
+
+    @Override
+    public Document getOwnerDocument() {
+        return comment.getOwnerDocument();
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return comment.insertBefore(newChild, refChild);
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return comment.replaceChild(newChild, oldChild);
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return comment.removeChild(oldChild);
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return comment.appendChild(newChild);
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return comment.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return comment.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        comment.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return comment.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return comment.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return comment.getPrefix();
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        comment.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return comment.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return comment.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return comment.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return comment.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return comment.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        comment.setTextContent(textContent);
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return comment.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return comment.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return comment.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return comment.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return comment.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return comment.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return comment.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return comment.getUserData(key);
+    }
+
+    private Comment comment;
+
     public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
-        super(ownerDoc, text);
+        comment = ownerDoc.getDomDocument().createComment(text);
+        ownerDoc.register(this);
     }
 
     public String getValue() {
@@ -111,4 +345,7 @@
         throw new UnsupportedOperationException("Not Supported");
     }
 
+    public Comment getDomElement() {
+        return comment;
+    }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPTextImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/SOAPTextImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,17 +32,271 @@
 
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
 
 public class SOAPTextImpl
-    extends com.sun.org.apache.xerces.internal.dom.TextImpl
     implements javax.xml.soap.Text, org.w3c.dom.Text {
 
+    @Override
+    public Text splitText(int offset) throws DOMException {
+        return textNode.splitText(offset);
+    }
+
+    @Override
+    public boolean isElementContentWhitespace() {
+        return textNode.isElementContentWhitespace();
+    }
+
+    @Override
+    public String getWholeText() {
+        return textNode.getWholeText();
+    }
+
+    @Override
+    public Text replaceWholeText(String content) throws DOMException {
+        return textNode.replaceWholeText(content);
+    }
+
+    @Override
+    public String getData() throws DOMException {
+        return textNode.getData();
+    }
+
+    @Override
+    public void setData(String data) throws DOMException {
+        textNode.setData(data);
+    }
+
+    @Override
+    public int getLength() {
+        return textNode.getLength();
+    }
+
+    @Override
+    public String substringData(int offset, int count) throws DOMException {
+        return textNode.substringData(offset, count);
+    }
+
+    @Override
+    public void appendData(String arg) throws DOMException {
+        textNode.appendData(arg);
+    }
+
+    @Override
+    public void insertData(int offset, String arg) throws DOMException {
+        textNode.insertData(offset, arg);
+    }
+
+    @Override
+    public void deleteData(int offset, int count) throws DOMException {
+        textNode.deleteData(offset, count);
+    }
+
+    @Override
+    public void replaceData(int offset, int count, String arg) throws DOMException {
+        textNode.replaceData(offset, count, arg);
+    }
+
+    @Override
+    public String getNodeName() {
+        return textNode.getNodeName();
+    }
+
+    @Override
+    public String getNodeValue() throws DOMException {
+        return textNode.getNodeValue();
+    }
+
+    @Override
+    public void setNodeValue(String nodeValue) throws DOMException {
+        textNode.setNodeValue(nodeValue);
+    }
+
+    @Override
+    public short getNodeType() {
+        return textNode.getNodeType();
+    }
+
+    @Override
+    public Node getParentNode() {
+        return textNode.getParentNode();
+    }
+
+    @Override
+    public NodeList getChildNodes() {
+        return textNode.getChildNodes();
+    }
+
+    @Override
+    public Node getFirstChild() {
+        return textNode.getFirstChild();
+    }
+
+    @Override
+    public Node getLastChild() {
+        return textNode.getLastChild();
+    }
+
+    @Override
+    public Node getPreviousSibling() {
+        return textNode.getPreviousSibling();
+    }
+
+    @Override
+    public Node getNextSibling() {
+        return textNode.getNextSibling();
+    }
+
+    @Override
+    public NamedNodeMap getAttributes() {
+        return textNode.getAttributes();
+    }
+
+    @Override
+    public Document getOwnerDocument() {
+        return textNode.getOwnerDocument();
+    }
+
+    @Override
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return textNode.insertBefore(newChild, refChild);
+    }
+
+    @Override
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return textNode.replaceChild(newChild, oldChild);
+    }
+
+    @Override
+    public Node removeChild(Node oldChild) throws DOMException {
+        return textNode.removeChild(oldChild);
+    }
+
+    @Override
+    public Node appendChild(Node newChild) throws DOMException {
+        return textNode.appendChild(newChild);
+    }
+
+    @Override
+    public boolean hasChildNodes() {
+        return textNode.hasChildNodes();
+    }
+
+    @Override
+    public Node cloneNode(boolean deep) {
+        return textNode.cloneNode(deep);
+    }
+
+    @Override
+    public void normalize() {
+        textNode.normalize();
+    }
+
+    @Override
+    public boolean isSupported(String feature, String version) {
+        return textNode.isSupported(feature, version);
+    }
+
+    @Override
+    public String getNamespaceURI() {
+        return textNode.getNamespaceURI();
+    }
+
+    @Override
+    public String getPrefix() {
+        return textNode.getPrefix();
+    }
+
+    @Override
+    public void setPrefix(String prefix) throws DOMException {
+        textNode.setPrefix(prefix);
+    }
+
+    @Override
+    public String getLocalName() {
+        return textNode.getLocalName();
+    }
+
+    @Override
+    public boolean hasAttributes() {
+        return textNode.hasAttributes();
+    }
+
+    @Override
+    public String getBaseURI() {
+        return textNode.getBaseURI();
+    }
+
+    @Override
+    public short compareDocumentPosition(Node other) throws DOMException {
+        return textNode.compareDocumentPosition(other);
+    }
+
+    @Override
+    public String getTextContent() throws DOMException {
+        return textNode.getTextContent();
+    }
+
+    @Override
+    public void setTextContent(String textContent) throws DOMException {
+        textNode.setTextContent(textContent);
+    }
+
+    @Override
+    public boolean isSameNode(Node other) {
+        return textNode.isSameNode(other);
+    }
+
+    @Override
+    public String lookupPrefix(String namespaceURI) {
+        return textNode.lookupPrefix(namespaceURI);
+    }
+
+    @Override
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return textNode.isDefaultNamespace(namespaceURI);
+    }
+
+    @Override
+    public String lookupNamespaceURI(String prefix) {
+        return textNode.lookupNamespaceURI(prefix);
+    }
+
+    @Override
+    public boolean isEqualNode(Node arg) {
+        return textNode.isEqualNode(arg);
+    }
+
+    @Override
+    public Object getFeature(String feature, String version) {
+        return textNode.getFeature(feature, version);
+    }
+
+    @Override
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return textNode.setUserData(key, data, handler);
+    }
+
+    @Override
+    public Object getUserData(String key) {
+        return textNode.getUserData(key);
+    }
+
     protected static final Logger log =
         Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
                          "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
 
+    private Text textNode;
+
     public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
-        super(ownerDoc, text);
+        textNode = ownerDoc.getDomDocument().createTextNode(text);
+        ownerDoc.register(this);
     }
 
     public String getValue() {
@@ -70,7 +324,7 @@
     public void detachNode() {
         org.w3c.dom.Node parent = getParentNode();
         if (parent != null) {
-            parent.removeChild(this);
+            parent.removeChild(getDomElement());
         }
     }
 
@@ -88,4 +342,8 @@
         }
         return txt.startsWith("<!--") && txt.endsWith("-->");
     }
+
+    public Text getDomElement() {
+        return textNode;
+    }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/name/NameImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/name/NameImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,6 +218,7 @@
         return prefix + ":" + localName;
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (!(obj instanceof Name)) {
             return false;
@@ -236,6 +237,7 @@
         return true;
     }
 
+    @Override
     public int hashCode() {
         return localName.hashCode();
     }
@@ -245,6 +247,7 @@
      *
      * @return a string for the local name.
      */
+    @Override
     public String getLocalName() {
         return localName;
     }
@@ -256,6 +259,7 @@
      *
      * @return the prefix as a string.
      */
+    @Override
     public String getPrefix() {
         return prefix;
     }
@@ -265,6 +269,7 @@
      *
      * @return the uri as a string.
      */
+    @Override
     public String getURI() {
         return uri;
     }
@@ -272,6 +277,7 @@
     /**
      * Returns a String version of the name suitable for use in an XML document.
      */
+    @Override
     public String getQualifiedName() {
         if (qualifiedName == null) {
             if (prefix != null && prefix.length() > 0) {
@@ -285,6 +291,9 @@
 
     /**
      * Create a name object for a SOAP1.1 Envelope.
+     *
+     * @param prefix prefix
+     * @return Envelope Name
      */
     public static NameImpl createEnvelope1_1Name(String prefix) {
         return new Envelope1_1Name(prefix);
@@ -292,6 +301,9 @@
 
     /**
      * Create a name object for a SOAP1.2 Envelope.
+     *
+     * @param prefix prefix
+     * @return Envelope Name
      */
     public static NameImpl createEnvelope1_2Name(String prefix) {
         return new Envelope1_2Name(prefix);
@@ -299,6 +311,9 @@
 
     /**
      * Create a name object for a SOAP1.1 Header.
+     *
+     * @param prefix prefix
+     * @return Header Name
      */
     public static NameImpl createHeader1_1Name(String prefix) {
         return new Header1_1Name(prefix);
@@ -306,6 +321,9 @@
 
     /**
      * Create a name object for a SOAP1.2 Header.
+     *
+     * @param prefix prefix
+     * @return Header Name
      */
     public static NameImpl createHeader1_2Name(String prefix) {
         return new Header1_2Name(prefix);
@@ -313,6 +331,9 @@
 
     /**
      * Create a name object for a SOAP1.1 Body.
+     *
+     * @param prefix prefix
+     * @return Body Name
      */
     public static NameImpl createBody1_1Name(String prefix) {
         return new Body1_1Name(prefix);
@@ -320,6 +341,9 @@
 
     /**
      * Create a name object for a SOAP1.2 Body.
+     *
+     * @param prefix prefix
+     * @return Body Name
      */
     public static NameImpl createBody1_2Name(String prefix) {
         return new Body1_2Name(prefix);
@@ -327,20 +351,29 @@
 
     /**
      * Create a name object for a SOAP1.1 Fault.
+     *
+     * @param prefix prefix
+     * @return Fault Name
      */
     public static NameImpl createFault1_1Name(String prefix) {
         return new Fault1_1Name(prefix);
     }
 
     /**
-      * Create a name object for a SOAP1.2 NotUnderstood element.
-      */
+     * Create a name object for a SOAP1.2 NotUnderstood element.
+     *
+     * @param prefix prefix
+     * @return NotUnderstood Name
+     */
     public static NameImpl createNotUnderstood1_2Name(String prefix) {
         return new NotUnderstood1_2Name(prefix);
     }
 
     /**
      * Create a name object for a SOAP1.2 Upgrade element.
+     *
+     * @param prefix prefix
+     * @return Upgrade Name
      */
     public static NameImpl createUpgrade1_2Name(String prefix) {
         return new Upgrade1_2Name(prefix);
@@ -348,6 +381,9 @@
 
     /**
      * Create a name object for a SOAP1.2 SupportedEnvelope Upgrade element.
+     *
+     * @param prefix prefix
+     * @return Supported Envelope Name
      */
     public static NameImpl createSupportedEnvelope1_2Name(String prefix) {
         return new SupportedEnvelope1_2Name(prefix);
@@ -358,6 +394,8 @@
      * Fault, Reason or Detail.
      *
      * @param localName Local Name of element
+     * @param prefix prefix
+     * @return Fault Name
      */
     public static NameImpl createFault1_2Name(
         String localName,
@@ -369,6 +407,8 @@
      * Create a name object for a SOAP1.2 Fault/Code or Subcode.
      *
      * @param localName Either "Code" or "Subcode"
+     * @param prefix prefix
+     * @return CodeSubcode Name
      */
     public static NameImpl createCodeSubcode1_2Name(
         String prefix,
@@ -378,6 +418,8 @@
 
     /**
      * Create a name object for a SOAP1.1 Fault Detail.
+     *
+     * @return Detail Name
      */
     public static NameImpl createDetail1_1Name() {
         return new Detail1_1Name();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Body1_1Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Body1_1Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,12 +38,17 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.BodyImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class Body1_1Impl extends BodyImpl {
     public Body1_1Impl(SOAPDocumentImpl ownerDocument, String prefix) {
             super(ownerDocument, NameImpl.createBody1_1Name(prefix));
     }
 
+    public Body1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     public SOAPFault addSOAP12Fault(QName faultCode, String faultReason, Locale locale) {
         // log message here
         throw new UnsupportedOperationException("Not supported in SOAP 1.1");
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Detail1_1Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Detail1_1Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.DetailImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class Detail1_1Impl extends DetailImpl {
 
@@ -45,6 +46,11 @@
     public Detail1_1Impl(SOAPDocumentImpl ownerDoc) {
         super(ownerDoc, NameImpl.createDetail1_1Name());
     }
+
+    public Detail1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected DetailEntry createDetailEntry(Name name) {
         return new DetailEntry1_1Impl(
             (SOAPDocumentImpl) getOwnerDocument(),
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Envelope1_1Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Envelope1_1Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class Envelope1_1Impl extends EnvelopeImpl {
 
@@ -52,6 +53,11 @@
             createHeader,
             createBody);
     }
+
+    public Envelope1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getBodyName(String prefix) {
         return NameImpl.createBody1_1Name(prefix);
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
+import org.w3c.dom.Element;
 
 
 public class Fault1_1Impl extends FaultImpl {
@@ -59,6 +60,10 @@
        super(ownerDocument, NameImpl.createFault1_1Name(prefix));
     }
 
+    public Fault1_1Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getDetailName() {
         return NameImpl.createDetail1_1Name();
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.Element;
 
 public class Header1_1Impl extends HeaderImpl {
 
@@ -51,6 +52,10 @@
             super(ownerDocument, NameImpl.createHeader1_1Name(prefix));
     }
 
+    public Header1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getNotUnderstoodName() {
         log.log(
             Level.SEVERE,
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.*;
 
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@@ -52,6 +53,10 @@
             super(ownerDocument, NameImpl.createBody1_2Name(prefix));
     }
 
+    public Body1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getFaultName(String name) {
         return NameImpl.createFault1_2Name(name, null);
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.DetailImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class Detail1_2Impl extends DetailImpl {
 
@@ -54,6 +55,10 @@
         super(ownerDocument, NameImpl.createSOAP12Name("Detail"));
     }
 
+    public Detail1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected DetailEntry createDetailEntry(Name name) {
         return new DetailEntry1_2Impl(
             ((SOAPDocument) getOwnerDocument()).getDocument(),
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
 import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
+import org.w3c.dom.Element;
 
 public class Envelope1_2Impl extends EnvelopeImpl {
 
@@ -50,6 +51,10 @@
         super(ownerDoc, NameImpl.createEnvelope1_2Name(prefix));
     }
 
+    public Envelope1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     public Envelope1_2Impl(
         SOAPDocumentImpl ownerDoc,
         String prefix,
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.*;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.Element;
 
 
 public class Fault1_2Impl extends FaultImpl {
@@ -68,6 +69,10 @@
         super(ownerDocument, NameImpl.createFault1_2Name(null, prefix));
     }
 
+    public Fault1_2Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getDetailName() {
         return NameImpl.createSOAP12Name("Detail", getPrefix());
     }
@@ -521,7 +526,7 @@
             }
         }
         if (element instanceof Detail1_2Impl) {
-            ElementImpl importedElement = (ElementImpl) importElement(element);
+            Element importedElement = importElement(element);
             addNode(importedElement);
             return convertToSoapElement(importedElement);
         } else
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import org.w3c.dom.Element;
 
 
 public class Header1_2Impl extends HeaderImpl {
@@ -54,6 +55,10 @@
         super(ownerDocument, NameImpl.createHeader1_2Name(prefix));
     }
 
+    public Header1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected NameImpl getNotUnderstoodName() {
         return NameImpl.createNotUnderstood1_2Name(null);
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/Base64.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/Base64.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
  * This class is used by XML Schema binary format validation
  *
  * @author Jeffrey Rodriguez
- * @version
  */
 public final class Base64 {
 
@@ -173,7 +172,7 @@
     /**
      * Decodes Base64 data into octects
      *
-     * @param binaryData Byte array containing Base64 data
+     * @param base64Data Byte array containing Base64 data
      * @return Array containind decoded data.
      */
     public byte[] decode( byte[] base64Data ) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ByteOutputStream.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ByteOutputStream.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
  * <li>doesn't do synchronization
  * <li>allows access to the raw buffer
  * <li>almost no parameter check
+ * </ol>
  */
 public final class ByteOutputStream extends OutputStream {
     /**
@@ -64,6 +65,9 @@
 
     /**
      * Copies all the bytes from this input into this buffer.
+     *
+     * @param in input stream.
+     * @exception IOException in case of an I/O error.
      */
     public void write(InputStream in) throws IOException {
         if (in instanceof ByteArrayInputStream) {
@@ -84,6 +88,7 @@
         }
     }
 
+    @Override
     public void write(int b) {
         ensureCapacity(1);
         buf[count] = (byte) b;
@@ -102,18 +107,22 @@
         }
     }
 
+    @Override
     public void write(byte[] b, int off, int len) {
         ensureCapacity(len);
         System.arraycopy(b, off, buf, count, len);
         count += len;
     }
 
+    @Override
     public void write(byte[] b) {
         write(b, 0, b.length);
     }
 
     /**
      * Writes a string as ASCII string.
+     *
+     * @param s string to write.
      */
     public void writeAsAscii(String s) {
         int len = s.length();
@@ -138,9 +147,12 @@
      * Evil buffer reallocation method.
      * Don't use it unless you absolutely have to.
      *
+     * @return byte array
+     *
      * @deprecated
      *      because this is evil!
      */
+    @Deprecated
     public byte toByteArray()[] {
         byte[] newbuf = new byte[count];
         System.arraycopy(buf, 0, newbuf, 0, count);
@@ -162,10 +174,12 @@
      * @return String translated from the buffer's contents.
      * @since JDK1.1
      */
+    @Override
     public String toString() {
         return new String(buf, 0, count);
     }
 
+    @Override
     public void close() {
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/JaxmURI.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/JaxmURI.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,9 @@
 * string and fragment) that may constitute a URI.
 * <p>
 * Parsing of a URI specification is done according to the URI
-* syntax described in <a href="http://www.ietf.org/rfc/rfc2396.txt?number=2396">RFC 2396</a>.
-* Every URI consists of a scheme, followed by a colon (':'), followed by a scheme-specific
+* syntax described in <a href="http://www.ietf.org/rfc/rfc2396.txt?number=2396">
+* RFC 2396</a>. Every URI consists
+* of a scheme, followed by a colon (':'), followed by a scheme-specific
 * part. For URIs that follow the "generic URI" syntax, the scheme-
 * specific part begins with two slashes ("//") and may be followed
 * by an authority segment (comprised of user information, host, and
@@ -60,8 +61,6 @@
 * default port for a specific scheme). Rather, it only knows the
 * grammar and basic set of operations that can be applied to a URI.
 *
-* @version
-*
 **********************************************************************/
  public class JaxmURI implements Serializable {
 
@@ -1106,6 +1105,7 @@
   * @return true if p_test is a URI with all values equal to this
   *         URI, false otherwise
   */
+  @Override
   public boolean equals(Object p_test) {
     if (p_test instanceof JaxmURI) {
       JaxmURI testURI = (JaxmURI) p_test;
@@ -1134,6 +1134,7 @@
     return false;
   }
 
+  @Override
   public int hashCode() {
           // No members safe to use, just default to a constant.
           return 153214;
@@ -1144,6 +1145,7 @@
   *
   * @return the URI string specification
   */
+  @Override
   public String toString() {
     StringBuilder uriSpecString = new StringBuilder();
 
@@ -1173,6 +1175,8 @@
   * A scheme is conformant if it starts with an alphanumeric, and
   * contains only alphanumerics, '+','-' and '.'.
   *
+  * @param p_scheme scheme name
+  *
   * @return true if the scheme is conformant, false otherwise
   */
   public static boolean isConformantSchemeName(String p_scheme) {
@@ -1202,7 +1206,9 @@
   * IPv4 address consists of four decimal digit groups separated by a
   * '.'. A hostname consists of domain labels (each of which must
   * begin and end with an alphanumeric but may contain '-') separated
-  & by a '.'. See RFC 2396 Section 3.2.2.
+  * by a '.'. See RFC 2396 Section 3.2.2.
+  *
+  * @param p_address address
   *
   * @return true if the string is a syntactically valid IPv4 address
   *              or hostname
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ParseUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ParseUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,10 @@
      * Returns a new String constructed from the specified String by replacing
      * the URL escape sequences and UTF8 encoding with the characters they
      * represent.
+     *
+     * @param s string
+     *
+     * @return decoded string
      */
     public static String decode(String s) {
         StringBuilder sb = new StringBuilder();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ParserPool.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/ParserPool.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,7 @@
 
     public ParserPool(int capacity) {
         queue = new ArrayBlockingQueue<SAXParser>(capacity);
-        //factory = SAXParserFactory.newInstance();
-        factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl();
+        factory = SAXParserFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", SAAJUtil.getSystemClassLoader());
         factory.setNamespaceAware(true);
         for (int i = 0; i < capacity; i++) {
            try {
@@ -79,30 +78,7 @@
 
     public void returnParser(SAXParser saxParser) {
         saxParser.reset();
-        resetSaxParser(saxParser);
         put(saxParser);
     }
 
-
-    /**
-     * SAAJ Issue 46 :https://saaj.dev.java.net/issues/show_bug.cgi?id=46
-     * Xerces does not provide a way to reset the SymbolTable
-     * So we are trying to reset it using the proprietary code below.
-     * Temporary Until the bug : https://jaxp.dev.java.net/issues/show_bug.cgi?id=59
-     * is fixed.
-     * @param parser the parser from the pool whose Symbol Table needs to be reset.
-     */
-     private void resetSaxParser(SAXParser parser) {
-        try {
-            //Object obj = parser.getProperty("http://apache.org/xml/properties/internal/symbol-table");
-            com.sun.org.apache.xerces.internal.util.SymbolTable table = new com.sun.org.apache.xerces.internal.util.SymbolTable();
-            parser.setProperty("http://apache.org/xml/properties/internal/symbol-table", table);
-            //obj = parser.getProperty("http://apache.org/xml/properties/internal/symbol-table");
-        } catch (SAXNotRecognizedException ex) {
-            //nothing to do
-        } catch (SAXNotSupportedException ex) {
-            //nothing to do
-        }
-    }
-
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/SAAJUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/SAAJUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package com.sun.xml.internal.messaging.saaj.util;
 
 import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  *
@@ -48,4 +50,13 @@
             return null;
         }
     }
+
+    public static ClassLoader getSystemClassLoader() {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                return ClassLoader.getSystemClassLoader();
+            }
+        });
+    }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/transform/EfficientStreamingTransformer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/transform/EfficientStreamingTransformer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,11 +107,13 @@
         }
     }
 
+    @Override
     public void clearParameters() {
         if (m_realTransformer != null)
             m_realTransformer.clearParameters();
     }
 
+    @Override
     public javax.xml.transform.ErrorListener getErrorListener() {
         try {
             materialize();
@@ -122,6 +124,7 @@
         return null;
     }
 
+    @Override
     public java.util.Properties getOutputProperties() {
         try {
             materialize();
@@ -132,6 +135,7 @@
         return null;
     }
 
+    @Override
     public String getOutputProperty(String str)
         throws java.lang.IllegalArgumentException {
         try {
@@ -143,6 +147,7 @@
         return null;
     }
 
+    @Override
     public Object getParameter(String str) {
         try {
             materialize();
@@ -153,6 +158,7 @@
         return null;
     }
 
+    @Override
     public javax.xml.transform.URIResolver getURIResolver() {
         try {
             materialize();
@@ -163,6 +169,7 @@
         return null;
     }
 
+    @Override
     public void setErrorListener(
         javax.xml.transform.ErrorListener errorListener)
         throws java.lang.IllegalArgumentException {
@@ -174,6 +181,7 @@
         }
     }
 
+    @Override
     public void setOutputProperties(java.util.Properties properties)
         throws java.lang.IllegalArgumentException {
         try {
@@ -184,6 +192,7 @@
         }
     }
 
+    @Override
     public void setOutputProperty(String str, String str1)
         throws java.lang.IllegalArgumentException {
         try {
@@ -194,6 +203,7 @@
         }
     }
 
+    @Override
     public void setParameter(String str, Object obj) {
         try {
             materialize();
@@ -203,6 +213,7 @@
         }
     }
 
+    @Override
     public void setURIResolver(javax.xml.transform.URIResolver uRIResolver) {
         try {
             materialize();
@@ -272,6 +283,7 @@
 
     //------------------------------------------------------------------------
 
+    @Override
     public void transform(
         javax.xml.transform.Source source,
         javax.xml.transform.Result result)
@@ -409,6 +421,8 @@
      * Return Transformer instance for this thread, allocating a new one if
      * necessary. Note that this method does not clear global parameters,
      * properties or any other data set on a previously used transformer.
+     *
+     * @return Transformer instance
      */
     public static Transformer newTransformer() {
         //CR : 6813167
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SAAJMessageHeaders.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SAAJMessageHeaders.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,8 @@
 import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 
+import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
+import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
 import com.sun.xml.internal.ws.api.SOAPVersion;
 import com.sun.xml.internal.ws.api.WSBinding;
 import com.sun.xml.internal.ws.api.message.Header;
@@ -234,11 +236,12 @@
         if (soapHeader == null) {
             return null;
         }
+        SOAPDocumentImpl soapDocument = ((HeaderImpl)soapHeader).getSoapDocument();
         SOAPHeaderElement headerElem = find(nsUri, localName);
         if (headerElem == null) {
             return null;
         }
-        headerElem = (SOAPHeaderElement) soapHeader.removeChild(headerElem);
+        headerElem = (SOAPHeaderElement) soapDocument.find(soapHeader.removeChild(headerElem));
 
         //it might have been a nonSAAJHeader - remove from that map
         removeNonSAAJHeader(headerElem);
@@ -330,7 +333,7 @@
 
     private void addNonSAAJHeader(SOAPHeaderElement headerElem, Header header) {
         if (nonSAAJHeaders == null) {
-            nonSAAJHeaders = new HashMap<SOAPHeaderElement, Header>();
+            nonSAAJHeaders = new HashMap<>();
         }
         nonSAAJHeaders.put(headerElem, header);
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +68,7 @@
                             Class<?> cls = Class.forName(SAFE_THREAD_NAME);
                             Constructor<?> ctr = cls.getConstructor(Runnable.class);
                             return new SunMiscThreadFactory(ctr);
-                        } catch (ClassNotFoundException ignored) {
-                        } catch (NoSuchMethodException ignored) {
-                        }
+                        } catch (ClassNotFoundException | NoSuchMethodException ignored) {}
                         return new LegacyThreadFactory();
                     }
                 }
@@ -90,7 +88,9 @@
             try {
                 return ctr.newInstance(null, r, "toBeReplaced", 0, false);
             } catch (ReflectiveOperationException x) {
-                throw new InternalError(x);
+                InternalError ie = new InternalError(x.getMessage());
+                ie.initCause(ie);
+                throw ie;
             }
         }
     }
@@ -99,7 +99,7 @@
     private static class SunMiscThreadFactory implements ThreadFactory {
         final Constructor<?> ctr;
         SunMiscThreadFactory(Constructor<?> ctr) { this.ctr = ctr; }
-        @Override public Thread newThread(Runnable r) {
+        @Override public Thread newThread(final Runnable r) {
             return AccessController.doPrivileged(
                     new PrivilegedAction<Thread>() {
                         @Override
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/MethodUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/MethodUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 import java.util.logging.Logger;
 
 /**
- * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * Utility class to invoke com.sun.xml.internal.ws.util.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
  * to java.lang,reflect.Method.invoke()
  *
  * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too!
@@ -39,43 +39,17 @@
 class MethodUtil {
 
     private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
-    private static final Method INVOKE_METHOD;
-
-    static {
-        Method method;
-        try {
-            Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
-            method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
-            }
-        } catch (Throwable t) {
-            method = null;
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
-            }
-        }
-        INVOKE_METHOD = method;
-    }
 
     static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
-        if (INVOKE_METHOD != null) {
-            // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
-            }
-            try {
-                return INVOKE_METHOD.invoke(null, method, target, args);
-            } catch (InvocationTargetException ite) {
-                // unwrap invocation exception added by reflection code ...
-                throw unwrapException(ite);
-            }
-        } else {
-            // other then Oracle JDK ...
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
-            }
-            return method.invoke(target, args);
+        // com.sun.xml.internal.ws.util.MethodUtil.invoke(method, owner, args)
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.log(Level.FINE, "Invoking method using com.sun.xml.internal.ws.util.MethodUtil");
+        }
+        try {
+            return com.sun.xml.internal.ws.util.MethodUtil.invoke(method, target, args);
+        } catch (InvocationTargetException ite) {
+            // unwrap invocation exception added by reflection code ...
+            throw unwrapException(ite);
         }
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +26,9 @@
 package com.sun.xml.internal.ws.api.server;
 
 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
+import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
 import com.sun.xml.internal.ws.server.ServerRtException;
 import com.sun.xml.internal.ws.streaming.TidyXMLStreamReader;
-import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -42,7 +42,7 @@
  * SPI that provides the source of {@link SDDocument}.
  *
  * <p>
- * This abstract class could be implemented by appliations, or one of the
+ * This abstract class could be implemented by applications, or one of the
  * {@link #create} methods can be used.
  *
  * @author Kohsuke Kawaguchi
@@ -85,28 +85,38 @@
 
     /**
      * System ID of this document.
+     * @return
      */
     public abstract URL getSystemId();
 
+    public static SDDocumentSource create(final Class<?> implClass, final String url) {
+        return create(url, implClass);
+    }
+
     /**
      * Creates {@link SDDocumentSource} from an URL.
+     * @param url
+     * @return
      */
     public static SDDocumentSource create(final URL url) {
         return new SDDocumentSource() {
             private final URL systemId = url;
 
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException {
                 InputStream is = url.openStream();
                 return new TidyXMLStreamReader(
                     xif.createXMLStreamReader(systemId.toExternalForm(),is), is);
             }
 
+            @Override
             public XMLStreamReader read() throws IOException, XMLStreamException {
                 InputStream is = url.openStream();
                 return new TidyXMLStreamReader(
                    XMLStreamReaderFactory.create(systemId.toExternalForm(),is,false), is);
             }
 
+            @Override
             public URL getSystemId() {
                 return systemId;
             }
@@ -120,19 +130,22 @@
      * @param resolvingClass class used to read resource
      * @param path resource path
      */
-    public static SDDocumentSource create(final Class resolvingClass, final String path) {
+    private static SDDocumentSource create(final String path, final Class<?> resolvingClass) {
         return new SDDocumentSource() {
 
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException {
                 InputStream is = inputStream();
                 return new TidyXMLStreamReader(xif.createXMLStreamReader(path,is), is);
             }
 
+            @Override
             public XMLStreamReader read() throws IOException, XMLStreamException {
                 InputStream is = inputStream();
                 return new TidyXMLStreamReader(XMLStreamReaderFactory.create(path,is,false), is);
             }
 
+            @Override
             public URL getSystemId() {
                 try {
                     return new URL("file://" + path);
@@ -157,17 +170,23 @@
 
     /**
      * Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
+     * @param systemId
+     * @param xsb
+     * @return
      */
     public static SDDocumentSource create(final URL systemId, final XMLStreamBuffer xsb) {
         return new SDDocumentSource() {
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws XMLStreamException {
                 return xsb.readAsXMLStreamReader();
             }
 
+            @Override
             public XMLStreamReader read() throws XMLStreamException {
                 return xsb.readAsXMLStreamReader();
             }
 
+            @Override
             public URL getSystemId() {
                 return systemId;
             }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.xml.internal.ws.api.streaming;
 
+import com.sun.xml.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.properties	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/binding/BindingImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/binding/BindingImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
     //This is reset when ever Binding.setHandlerChain() or SOAPBinding.setRoles() is called.
     private HandlerConfiguration handlerConfig;
     private final Set<QName> addedHeaders = new HashSet<QName>();
-    private final Set<QName> knownHeaders = new HashSet<QName>();
+    private final Set<QName> knownHeaders = Collections.synchronizedSet(new HashSet<QName>());
     private final Set<QName> unmodKnownHeaders = Collections.unmodifiableSet(knownHeaders);
     private final BindingID bindingId;
     // Features that are set(enabled/disabled) on the binding
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/binding/SOAPBindingImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/binding/SOAPBindingImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 import javax.xml.ws.soap.MTOMFeature;
 import javax.xml.ws.soap.SOAPBinding;
 import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 /**
  * @author WS Development Team
@@ -57,6 +59,7 @@
 
     private Set<QName> portKnownHeaders = Collections.emptySet();
     private Set<QName> bindingUnderstoodHeaders = new HashSet<QName>();
+    private final Lock lock = new ReentrantLock();
 
     /**
      * Use {@link BindingImpl#create(BindingID)} to create this.
@@ -95,7 +98,13 @@
      * @param headers SOAP header names
      */
     public void setPortKnownHeaders(@NotNull Set<QName> headers) {
-        this.portKnownHeaders = headers;
+
+        try{
+          lock.lock();
+          this.portKnownHeaders = headers;
+                } finally {
+                lock.unlock();
+        }
     }
 
     /**
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 import java.util.logging.Logger;
 
 /**
- * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * Utility class to invoke com.sun.xml.internal.ws.util.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
  * to java.lang,reflect.Method.invoke()
  * <p/>
  * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too!
@@ -39,43 +39,17 @@
 class MethodUtil {
 
     private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
-    private static final Method INVOKE_METHOD;
-
-    static {
-        Method method;
-        try {
-            Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
-            method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
-            }
-        } catch (Throwable t) {
-            method = null;
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
-            }
-        }
-        INVOKE_METHOD = method;
-    }
 
     static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
-        if (INVOKE_METHOD != null) {
-            // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
-            }
-            try {
-                return INVOKE_METHOD.invoke(null, method, target, args);
-            } catch (InvocationTargetException ite) {
-                // unwrap invocation exception added by reflection code ...
-                throw unwrapException(ite);
-            }
-        } else {
-            // other then Oracle JDK ...
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
-            }
-            return method.invoke(target, args);
+        // com.sun.xml.internal.ws.util.MethodUtil.invoke(method, owner, args)
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.log(Level.FINE, "Invoking method using com.sun.xml.internal.ws.util.MethodUtil");
+        }
+        try {
+            return com.sun.xml.internal.ws.util.MethodUtil.invoke(method, target, args);
+        } catch (InvocationTargetException ite) {
+            // unwrap invocation exception added by reflection code ...
+            throw unwrapException(ite);
         }
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.xml.internal.ws.commons.xmlutil;
 
+import com.sun.xml.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.properties	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/developer/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/developer/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.xml.internal.ws.developer;
 
+import com.sun.xml.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/Injector.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/Injector.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +25,16 @@
 
 package com.sun.xml.internal.ws.model;
 
+import java.lang.reflect.Field;
 import javax.xml.ws.WebServiceException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -44,31 +48,68 @@
 
     private static final Logger LOGGER = Logger.getLogger(Injector.class.getName());
 
-    private static final Method defineClass;
-    private static final Method resolveClass;
-    private static final Method getPackage;
-    private static final Method definePackage;
+    private static Method defineClass;
+    private static Method resolveClass;
+    private static Method getPackage;
+    private static Method definePackage;
+    private static Object U;
 
     static {
-        Method[] m = AccessController.doPrivileged(
-                new PrivilegedAction<Method[]>() {
+        try {
+            Method[] m = AccessController.doPrivileged(
+                    new PrivilegedAction<Method[]>() {
+                @Override
+                public Method[] run() {
+                    return new Method[]{
+                        getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
+                        getMethod(ClassLoader.class, "resolveClass", Class.class),
+                        getMethod(ClassLoader.class, "getPackage", String.class),
+                        getMethod(ClassLoader.class, "definePackage",
+                            String.class, String.class, String.class, String.class,
+                            String.class, String.class, String.class, URL.class)
+                    };
+                }
+            }
+            );
+            defineClass = m[0];
+            resolveClass = m[1];
+            getPackage = m[2];
+            definePackage = m[3];
+
+        } catch (Throwable t) {
+            try {
+                U = AccessController.doPrivileged(new PrivilegedExceptionAction() {
                     @Override
-                    public Method[] run() {
-                        return new Method[]{
-                                getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
-                                getMethod(ClassLoader.class, "resolveClass", Class.class),
-                                getMethod(ClassLoader.class, "getPackage", String.class),
-                                getMethod(ClassLoader.class, "definePackage",
-                                        String.class, String.class, String.class, String.class,
-                                        String.class, String.class, String.class, URL.class)
-                        };
+                    public Object run() throws Exception {
+                        Class u = Class.forName("sun.misc.Unsafe");
+                        Field theUnsafe = u.getDeclaredField("theUnsafe");
+                        theUnsafe.setAccessible(true);
+                        return theUnsafe.get(null);
                     }
-                }
-        );
-        defineClass = m[0];
-        resolveClass = m[1];
-        getPackage = m[2];
-        definePackage = m[3];
+                });
+                defineClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+                    @Override
+                    public Method run() throws Exception {
+                        try {
+                            return U.getClass().getMethod("defineClass",
+                                    new Class[]{String.class,
+                                        byte[].class,
+                                        Integer.TYPE,
+                                        Integer.TYPE,
+                                        ClassLoader.class,
+                                        ProtectionDomain.class});
+                        } catch (NoSuchMethodException | SecurityException ex) {
+                            throw ex;
+                        }
+                    }
+                });
+            } catch (SecurityException | PrivilegedActionException ex) {
+                Logger.getLogger(Injector.class.getName()).log(Level.SEVERE, null, ex);
+                WebServiceException we = new WebServiceException(ex);
+                we.addSuppressed(t);
+                throw we;
+            }
+        }
     }
 
     private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) {
@@ -91,24 +132,26 @@
             // nothing to do
         }
         try {
+            if (definePackage == null) {
+                return (Class) defineClass.invoke(U, className.replace('/', '.'), image, 0, image.length, cl, Injector.class.getProtectionDomain());
+            }
             int packIndex = className.lastIndexOf('.');
             if (packIndex != -1) {
                 String pkgname = className.substring(0, packIndex);
                 // Check if package already loaded.
-                Package pkg = (Package)getPackage.invoke(cl, pkgname);
+                Package pkg = (Package) getPackage.invoke(cl, pkgname);
                 if (pkg == null) {
                     definePackage.invoke(cl, pkgname, null, null, null, null, null, null, null);
                 }
             }
 
-            Class c = (Class)defineClass.invoke(cl,className.replace('/','.'),image,0,image.length);
+            Class c = (Class) defineClass.invoke(cl, className.replace('/', '.'), image, 0, image.length);
             resolveClass.invoke(cl, c);
             return c;
-        } catch (IllegalAccessException e) {
-            LOGGER.log(Level.FINE,"Unable to inject "+className,e);
-            throw new WebServiceException(e);
-        } catch (InvocationTargetException e) {
-            LOGGER.log(Level.FINE,"Unable to inject "+className,e);
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, "Unable to inject " + className, e);
+            }
             throw new WebServiceException(e);
         }
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -346,7 +346,6 @@
     }
 
     private boolean noWrapperGen() {
-        if (Runtime.version().major() >= 9) return true;
         Object o = config.properties().get(SuppressDocLitWrapperGeneration);
         return (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/SOAPSEIModel.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/SOAPSEIModel.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,8 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 /**
  * Creates SOAP specific RuntimeModel
@@ -41,6 +43,8 @@
  */
 public class SOAPSEIModel extends AbstractSEIModelImpl {
 
+        private final Lock lock = new ReentrantLock();
+
     public SOAPSEIModel(WebServiceFeatureList features) {
         super(features);
     }
@@ -72,15 +76,22 @@
 
     public Set<QName> getKnownHeaders() {
         Set<QName> headers = new HashSet<QName>();
-        for (JavaMethodImpl method : getJavaMethods()) {
-            // fill in request headers
-            Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
-            fillHeaders(params, headers, Mode.IN);
+
+        try{
+                lock.lock();
+            for (JavaMethodImpl method : getJavaMethods()) {
+             // fill in request headers
+             Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
+             fillHeaders(params, headers, Mode.IN);
 
             // fill in response headers
-            params = method.getResponseParameters().iterator();
-            fillHeaders(params, headers, Mode.OUT);
-        }
+             params = method.getResponseParameters().iterator();
+             fillHeaders(params, headers, Mode.OUT);
+                          }
+        }finally
+        {
+                lock.unlock();
+         }
         return headers;
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,49 +31,22 @@
 import java.util.logging.Logger;
 
 /**
- * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * Utility class to invoke com.sun.xml.internal.ws.policy.util.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
  * to java.lang,reflect.Method.invoke()
  */
 class MethodUtil {
 
     private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
-    private static final Method INVOKE_METHOD;
-
-    static {
-        Method method;
-        try {
-            Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
-            method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
-            }
-        } catch (Throwable t) {
-            method = null;
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
-            }
-        }
-        INVOKE_METHOD = method;
-    }
 
     static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
-        if (INVOKE_METHOD != null) {
-            // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
-            }
-            try {
-                return INVOKE_METHOD.invoke(null, method, target, args);
-            } catch (InvocationTargetException ite) {
-                // unwrap invocation exception added by reflection code ...
-                throw unwrapException(ite);
-            }
-        } else {
-            // other then Oracle JDK ...
-            if (LOGGER.isLoggable(Level.FINE)) {
-                LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
-            }
-            return method.invoke(target, args);
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.log(Level.FINE, "Invoking method using com.sun.xml.internal.ws.policy.util.MethodUtil");
+        }
+        try {
+            return com.sun.xml.internal.ws.policy.util.MethodUtil.invoke(method, target, args);
+        } catch (InvocationTargetException ite) {
+            // unwrap invocation exception added by reflection code ...
+            throw unwrapException(ite);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/policy/util/MethodUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.ws.policy.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.PrivilegedExceptionAction;
+import java.security.SecureClassLoader;
+import java.util.Arrays;
+
+/*
+ * This copies from sun.reflect.misc.MethodUtil to implement the trampoline
+ * code such that when a Method is invoked, it will be called through
+ * the trampoline that is defined by this MethodUtil class loader.
+ */
+class Trampoline {
+    static {
+        if (Trampoline.class.getClassLoader() == null) {
+            throw new Error(
+                    "Trampoline must not be defined by the bootstrap classloader");
+        }
+    }
+
+    private static void ensureInvocableMethod(Method m)
+            throws InvocationTargetException {
+        Class<?> clazz = m.getDeclaringClass();
+        if (clazz.equals(AccessController.class) ||
+                clazz.equals(Method.class) ||
+                clazz.getName().startsWith("java.lang.invoke."))
+            throw new InvocationTargetException(
+                    new UnsupportedOperationException("invocation not supported"));
+    }
+
+    private static Object invoke(Method m, Object obj, Object[] params)
+            throws InvocationTargetException, IllegalAccessException {
+        ensureInvocableMethod(m);
+        return m.invoke(obj, params);
+    }
+}
+
+/*
+ * Create a trampoline class.
+ */
+public final class MethodUtil extends SecureClassLoader {
+    private static final String WS_UTIL_POLICY_PKG = "com.sun.xml.internal.ws.policy.util.";
+    private static final String TRAMPOLINE = WS_UTIL_POLICY_PKG + "Trampoline";
+    private static final Method bounce = getTrampoline();
+    private static final int DEFAULT_BUFFER_SIZE = 8192;
+    private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8;
+
+
+    private MethodUtil() {
+        super();
+    }
+
+    /*
+     * Bounce through the trampoline.
+     */
+    public static Object invoke(Method m, Object obj, Object[] params)
+            throws InvocationTargetException, IllegalAccessException {
+        try {
+            return bounce.invoke(null, m, obj, params);
+        } catch (InvocationTargetException ie) {
+            Throwable t = ie.getCause();
+
+            if (t instanceof InvocationTargetException) {
+                throw (InvocationTargetException) t;
+            } else if (t instanceof IllegalAccessException) {
+                throw (IllegalAccessException) t;
+            } else if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            } else if (t instanceof Error) {
+                throw (Error) t;
+            } else {
+                throw new Error("Unexpected invocation error", t);
+            }
+        } catch (IllegalAccessException iae) {
+            // this can't happen
+            throw new Error("Unexpected invocation error", iae);
+        }
+    }
+
+    private static Method getTrampoline() {
+        try {
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Method>() {
+                        public Method run() throws Exception {
+                            Class<?> t = getTrampolineClass();
+                            Method b = t.getDeclaredMethod("invoke",
+                                    Method.class, Object.class, Object[].class);
+                            b.setAccessible(true);
+                            return b;
+                        }
+                    });
+        } catch (Exception e) {
+            throw new InternalError("bouncer cannot be found", e);
+        }
+    }
+
+
+    protected synchronized Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException {
+        // First, check if the class has already been loaded
+        checkPackageAccess(name);
+        Class<?> c = findLoadedClass(name);
+        if (c == null) {
+            try {
+                c = findClass(name);
+            } catch (ClassNotFoundException e) {
+                // Fall through ...
+            }
+            if (c == null) {
+                c = getParent().loadClass(name);
+            }
+        }
+        if (resolve) {
+            resolveClass(c);
+        }
+        return c;
+    }
+
+
+    protected Class<?> findClass(final String name)
+            throws ClassNotFoundException {
+        if (!name.startsWith(WS_UTIL_POLICY_PKG)) {
+            throw new ClassNotFoundException(name);
+        }
+        String path = "/".concat(name.replace('.', '/').concat(".class"));
+        try (InputStream in = MethodUtil.class.getResourceAsStream(path)) {
+            byte[] b = readAllBytes(in);
+            return defineClass(name, b);
+        } catch (IOException e) {
+            throw new ClassNotFoundException(name, e);
+        }
+    }
+
+    /**
+     * JDK9 {@link InputStream#readAllBytes()} substitution.
+     */
+    private byte[] readAllBytes(InputStream in) throws IOException {
+        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+        int capacity = buf.length;
+        int nread = 0;
+        int n;
+        for (; ; ) {
+            // read to EOF which may read more or less than initial buffer size
+            while ((n = in.read(buf, nread, capacity - nread)) > 0)
+                nread += n;
+
+            // if the last call to read returned -1, then we're done
+            if (n < 0)
+                break;
+
+            // need to allocate a larger buffer
+            if (capacity <= MAX_BUFFER_SIZE - capacity) {
+                capacity = capacity << 1;
+            } else {
+                if (capacity == MAX_BUFFER_SIZE)
+                    throw new OutOfMemoryError("Required array size too large");
+                capacity = MAX_BUFFER_SIZE;
+            }
+            buf = Arrays.copyOf(buf, capacity);
+        }
+        return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+    }
+
+
+    /*
+     * Define the proxy classes
+     */
+    private Class<?> defineClass(String name, byte[] b) throws IOException {
+        CodeSource cs = new CodeSource(null, (java.security.cert.Certificate[]) null);
+        if (!name.equals(TRAMPOLINE)) {
+            throw new IOException("MethodUtil: bad name " + name);
+        }
+        return defineClass(name, b, 0, b.length, cs);
+    }
+
+    protected PermissionCollection getPermissions(CodeSource codesource) {
+        PermissionCollection perms = super.getPermissions(codesource);
+        perms.add(new AllPermission());
+        return perms;
+    }
+
+    private static Class<?> getTrampolineClass() {
+        try {
+            return Class.forName(TRAMPOLINE, true, new MethodUtil());
+        } catch (ClassNotFoundException e) {
+        }
+        return null;
+    }
+
+    /**
+     * Checks package access on the given classname.
+     * This method is typically called when the Class instance is not
+     * available and the caller attempts to load a class on behalf
+     * the true caller (application).
+     */
+    private static void checkPackageAccess(String name) {
+        SecurityManager s = System.getSecurityManager();
+        if (s != null) {
+            String cname = name.replace('/', '.');
+            if (cname.startsWith("[")) {
+                int b = cname.lastIndexOf('[') + 2;
+                if (b > 1 && b < cname.length()) {
+                    cname = cname.substring(b);
+                }
+            }
+            int i = cname.lastIndexOf('.');
+            if (i != -1) {
+                s.checkPackageAccess(cname.substring(0, i));
+            }
+        }
+    }
+
+    /**
+     * Checks package access on the given class.
+     * <p>
+     * If it is a {@link Proxy#isProxyClass(Class)} that implements
+     * a non-public interface (i.e. may be in a non-restricted package),
+     * also check the package access on the proxy interfaces.
+     */
+    private static void checkPackageAccess(Class<?> clazz) {
+        checkPackageAccess(clazz.getName());
+        if (isNonPublicProxyClass(clazz)) {
+            checkProxyPackageAccess(clazz);
+        }
+    }
+
+    // Note that bytecode instrumentation tools may exclude 'sun.*'
+    // classes but not generated proxy classes and so keep it in com.sun.*
+    private static final String PROXY_PACKAGE = "com.sun.proxy";
+
+    /**
+     * Test if the given class is a proxy class that implements
+     * non-public interface.  Such proxy class may be in a non-restricted
+     * package that bypasses checkPackageAccess.
+     */
+    private static boolean isNonPublicProxyClass(Class<?> cls) {
+        String name = cls.getName();
+        int i = name.lastIndexOf('.');
+        String pkg = (i != -1) ? name.substring(0, i) : "";
+        return Proxy.isProxyClass(cls) && !pkg.startsWith(PROXY_PACKAGE);
+    }
+
+    /**
+     * Check package access on the proxy interfaces that the given proxy class
+     * implements.
+     *
+     * @param clazz Proxy class object
+     */
+    private static void checkProxyPackageAccess(Class<?> clazz) {
+        SecurityManager s = System.getSecurityManager();
+        if (s != null) {
+            // check proxy interfaces if the given class is a proxy class
+            if (Proxy.isProxyClass(clazz)) {
+                for (Class<?> intf : clazz.getInterfaces()) {
+                    checkPackageAccess(intf);
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/resources/ContextClassloaderLocal.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/resources/ContextClassloaderLocalMessages.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.ws.resources;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.annotation.Generated;
+import com.sun.istack.internal.localization.Localizable;
+import com.sun.istack.internal.localization.LocalizableMessageFactory;
+import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
+import com.sun.istack.internal.localization.Localizer;
+
+
+/**
+ * Defines string formatting method for each constant in the resource file
+ *
+ */
+@Generated("com.sun.istack.internal.maven.ResourceGenMojo")
+public final class ContextClassloaderLocalMessages {
+
+    private final static String BUNDLE_NAME = "com.sun.xml.internal.ws.resources.ContextClassloaderLocal";
+    private final static LocalizableMessageFactory MESSAGE_FACTORY = new LocalizableMessageFactory(BUNDLE_NAME, new ContextClassloaderLocalMessages.BundleSupplier());
+    private final static Localizer LOCALIZER = new Localizer();
+
+    public static Localizable localizableFAILED_TO_CREATE_NEW_INSTANCE(Object arg0) {
+        return MESSAGE_FACTORY.getMessage("FAILED_TO_CREATE_NEW_INSTANCE", arg0);
+    }
+
+    /**
+     * Failed to create new instance of {0}
+     *
+     */
+    public static String FAILED_TO_CREATE_NEW_INSTANCE(Object arg0) {
+        return LOCALIZER.localize(localizableFAILED_TO_CREATE_NEW_INSTANCE(arg0));
+    }
+
+    private static class BundleSupplier
+        implements ResourceBundleSupplier
+    {
+
+
+        public ResourceBundle getResourceBundle(Locale locale) {
+            return ResourceBundle.getBundle(BUNDLE_NAME, locale);
+        }
+
+    }
+
+}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.xml.internal.ws.spi;
 
+import com.sun.xml.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.properties	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/EndpointImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/EndpointImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,13 +69,11 @@
 
 /**
  * Implements {@link Endpoint}.
- * <p/>
- * <p/>
+ *
  * This class accumulates the information necessary to create
  * {@link WSEndpoint}, and then when {@link #publish} method
  * is called it will be created.
- * <p/>
- * <p/>
+ *
  * This object also allows accumulated information to be retrieved.
  *
  * @author Jitendra Kotamraju
@@ -205,14 +203,17 @@
         invoker = null;
     }
 
+    @Override
     public Binding getBinding() {
         return binding;
     }
 
+    @Override
     public Object getImplementor() {
         return implementor;
     }
 
+    @Override
     public void publish(String address) {
         canPublish();
         URL url;
@@ -232,6 +233,7 @@
         ((HttpEndpoint) actualEndpoint).publish(address);
     }
 
+    @Override
     public void publish(Object serverContext) {
         canPublish();
         if (!com.sun.net.httpserver.HttpContext.class.isAssignableFrom(serverContext.getClass())) {
@@ -241,12 +243,14 @@
         ((HttpEndpoint) actualEndpoint).publish(serverContext);
     }
 
+    @Override
     public void publish(HttpContext serverContext) {
         canPublish();
         createEndpoint(serverContext.getPath());
         ((HttpEndpoint) actualEndpoint).publish(serverContext);
     }
 
+    @Override
     public void stop() {
         if (isPublished()) {
             ((HttpEndpoint) actualEndpoint).stop();
@@ -255,14 +259,17 @@
         }
     }
 
+    @Override
     public boolean isPublished() {
         return actualEndpoint != null;
     }
 
+    @Override
     public List<Source> getMetadata() {
         return metadata;
     }
 
+    @Override
     public void setMetadata(java.util.List<Source> metadata) {
         if (isPublished()) {
             throw new IllegalStateException("Cannot set Metadata. Endpoint is already published");
@@ -270,20 +277,24 @@
         this.metadata = metadata;
     }
 
+    @Override
     public Executor getExecutor() {
         return executor;
     }
 
+    @Override
     public void setExecutor(Executor executor) {
         this.executor = executor;
     }
 
+    @Override
     public Map<String, Object> getProperties() {
-        return new HashMap<String, Object>(properties);
+        return new HashMap<>(properties);
     }
 
+    @Override
     public void setProperties(Map<String, Object> map) {
-        this.properties = new HashMap<String, Object>(map);
+        this.properties = new HashMap<>(map);
     }
 
     /*
@@ -335,7 +346,7 @@
      * reuse the Source object multiple times.
      */
     private List<SDDocumentSource> buildDocList() {
-        List<SDDocumentSource> r = new ArrayList<SDDocumentSource>();
+        List<SDDocumentSource> r = new ArrayList<>();
 
         if (metadata != null) {
             for (Source source : metadata) {
@@ -344,14 +355,8 @@
                     String systemId = source.getSystemId();
 
                     r.add(SDDocumentSource.create(new URL(systemId), xsbr.getXMLStreamBuffer()));
-                } catch (TransformerException te) {
-                    throw new ServerRtException("server.rt.err", te);
-                } catch (IOException te) {
+                } catch (TransformerException | IOException | SAXException | ParserConfigurationException te) {
                     throw new ServerRtException("server.rt.err", te);
-                } catch (SAXException e) {
-                    throw new ServerRtException("server.rt.err", e);
-                } catch (ParserConfigurationException e) {
-                    throw new ServerRtException("server.rt.err", e);
                 }
             }
         }
@@ -367,11 +372,6 @@
         EndpointFactory.verifyImplementorClass(implClass, metadataReader);
         String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
         if (wsdlLocation != null) {
-            ClassLoader cl = implClass.getClassLoader();
-            URL url = cl.getResource(wsdlLocation);
-            if (url != null) {
-                return SDDocumentSource.create(url);
-            }
             return SDDocumentSource.create(implClass, wsdlLocation);
         }
         return null;
@@ -388,10 +388,12 @@
         }
     }
 
+    @Override
     public EndpointReference getEndpointReference(Element...referenceParameters) {
         return getEndpointReference(W3CEndpointReference.class, referenceParameters);
     }
 
+    @Override
     public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) {
         if (!isPublished()) {
             throw new WebServiceException("Endpoint is not published yet");
@@ -458,13 +460,12 @@
         public void start(@NotNull WSWebServiceContext wsc, @NotNull WSEndpoint endpoint) {
             try {
                 spiInvoker.inject(wsc);
-            } catch (IllegalAccessException e) {
-                throw new WebServiceException(e);
-            } catch (InvocationTargetException e) {
+            } catch (IllegalAccessException | InvocationTargetException e) {
                 throw new WebServiceException(e);
             }
         }
 
+        @Override
         public Object invoke(@NotNull Packet p, @NotNull Method m, @NotNull Object... args) throws InvocationTargetException, IllegalAccessException {
             return spiInvoker.invoke(m, args);
         }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +37,8 @@
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.Optional;
 
 
 /**
@@ -49,10 +49,10 @@
 final class ServerMgr {
 
     private static final ServerMgr serverMgr = new ServerMgr();
-    private static final Logger logger =
+    private static final Logger LOGGER =
         Logger.getLogger(
             com.sun.xml.internal.ws.util.Constants.LoggingDomain + ".server.http");
-    private final Map<InetSocketAddress,ServerState> servers = new HashMap<InetSocketAddress,ServerState>();
+    private final Map<InetSocketAddress,ServerState> servers = new HashMap<>();
 
     private ServerMgr() {}
 
@@ -83,25 +83,26 @@
             synchronized(servers) {
                 state = servers.get(inetAddress);
                 if (state == null) {
-                    final int finalPortNum = port;
-                    Optional<ServerState> stateOpt =
-                               servers.values()
-                                       .stream()
-                                       .filter(s -> s.getServer()
-                                                     .getAddress()
-                                                     .getPort() == finalPortNum)
-                                       .findAny();
-
-                    if (inetAddress.getAddress().isAnyLocalAddress() &&
-                        stateOpt.isPresent()) {
-                        state = stateOpt.get();
+                    ServerState free = null;
+                    for (ServerState ss : servers.values()) {
+                        if (port == ss.getServer().getAddress().getPort()) {
+                            free = ss;
+                            break;
+                        }
+                    }
+                    if (inetAddress.getAddress().isAnyLocalAddress() && free != null) {
+                        state = free;
                     } else {
-                        logger.fine("Creating new HTTP Server at "+inetAddress);
+                        if (LOGGER.isLoggable(Level.FINE)) {
+                            LOGGER.fine("Creating new HTTP Server at "+inetAddress);
+                        }
                         // Creates server with default socket backlog
                         server = HttpServer.create(inetAddress, 0);
                         server.setExecutor(Executors.newCachedThreadPool());
                         String path = url.toURI().getPath();
-                        logger.fine("Creating HTTP Context at = "+path);
+                        if (LOGGER.isLoggable(Level.FINE)) {
+                            LOGGER.fine("Creating HTTP Context at = "+path);
+                        }
                         HttpContext context = server.createContext(path);
                         server.start();
 
@@ -110,7 +111,9 @@
                         // or IP: 0.0.0.0 - which is used to monitor network traffic from any valid IP address
                         inetAddress = server.getAddress();
 
-                        logger.fine("HTTP server started = "+inetAddress);
+                        if (LOGGER.isLoggable(Level.FINE)) {
+                            LOGGER.fine("HTTP server started = "+inetAddress);
+                        }
                         state = new ServerState(server, path);
                         servers.put(inetAddress, state);
                         return context;
@@ -121,11 +124,15 @@
 
             if (state.getPaths().contains(url.getPath())) {
               String err = "Context with URL path "+url.getPath()+ " already exists on the server "+server.getAddress();
-              logger.fine(err);
+              if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.fine(err);
+              }
               throw new IllegalArgumentException(err);
             }
 
-            logger.fine("Creating HTTP Context at = "+url.getPath());
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.fine("Creating HTTP Context at = "+url.getPath());
+            }
             HttpContext context = server.createContext(url.getPath());
             state.oneMoreContext(url.getPath());
             return context;
@@ -157,7 +164,7 @@
     private static final class ServerState {
         private final HttpServer server;
         private int instances;
-        private Set<String> paths = new HashSet<String>();
+        private final Set<String> paths = new HashSet<>();
 
         ServerState(HttpServer server, String path) {
             this.server = server;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/MethodUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.ws.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.PrivilegedExceptionAction;
+import java.security.SecureClassLoader;
+import java.util.Arrays;
+
+/*
+ * This copies from sun.reflect.misc.MethodUtil to implement the trampoline
+ * code such that when a Method is invoked, it will be called through
+ * the trampoline that is defined by this MethodUtil class loader.
+ */
+class Trampoline {
+    static {
+        if (Trampoline.class.getClassLoader() == null) {
+            throw new Error(
+                    "Trampoline must not be defined by the bootstrap classloader");
+        }
+    }
+
+    private static void ensureInvocableMethod(Method m)
+            throws InvocationTargetException {
+        Class<?> clazz = m.getDeclaringClass();
+        if (clazz.equals(AccessController.class) ||
+                clazz.equals(Method.class) ||
+                clazz.getName().startsWith("java.lang.invoke."))
+            throw new InvocationTargetException(
+                    new UnsupportedOperationException("invocation not supported"));
+    }
+
+    private static Object invoke(Method m, Object obj, Object[] params)
+            throws InvocationTargetException, IllegalAccessException {
+        ensureInvocableMethod(m);
+        return m.invoke(obj, params);
+    }
+}
+
+/*
+ * Create a trampoline class.
+ */
+public final class MethodUtil extends SecureClassLoader {
+    private static final String WS_UTIL_PKG = "com.sun.xml.internal.ws.util.";
+    private static final String TRAMPOLINE = WS_UTIL_PKG + "Trampoline";
+    private static final Method bounce = getTrampoline();
+    private static final int DEFAULT_BUFFER_SIZE = 8192;
+    private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8;
+
+
+    private MethodUtil() {
+        super();
+    }
+
+    /*
+     * Bounce through the trampoline.
+     */
+    public static Object invoke(Method m, Object obj, Object[] params)
+            throws InvocationTargetException, IllegalAccessException {
+        try {
+            return bounce.invoke(null, m, obj, params);
+        } catch (InvocationTargetException ie) {
+            Throwable t = ie.getCause();
+
+            if (t instanceof InvocationTargetException) {
+                throw (InvocationTargetException) t;
+            } else if (t instanceof IllegalAccessException) {
+                throw (IllegalAccessException) t;
+            } else if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            } else if (t instanceof Error) {
+                throw (Error) t;
+            } else {
+                throw new Error("Unexpected invocation error", t);
+            }
+        } catch (IllegalAccessException iae) {
+            // this can't happen
+            throw new Error("Unexpected invocation error", iae);
+        }
+    }
+
+    private static Method getTrampoline() {
+        try {
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Method>() {
+                        public Method run() throws Exception {
+                            Class<?> t = getTrampolineClass();
+                            Method b = t.getDeclaredMethod("invoke",
+                                    Method.class, Object.class, Object[].class);
+                            b.setAccessible(true);
+                            return b;
+                        }
+                    });
+        } catch (Exception e) {
+            throw new InternalError("bouncer cannot be found", e);
+        }
+    }
+
+
+    protected synchronized Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException {
+        // First, check if the class has already been loaded
+        checkPackageAccess(name);
+        Class<?> c = findLoadedClass(name);
+        if (c == null) {
+            try {
+                c = findClass(name);
+            } catch (ClassNotFoundException e) {
+                // Fall through ...
+            }
+            if (c == null) {
+                c = getParent().loadClass(name);
+            }
+        }
+        if (resolve) {
+            resolveClass(c);
+        }
+        return c;
+    }
+
+
+    protected Class<?> findClass(final String name)
+            throws ClassNotFoundException {
+        if (!name.startsWith(WS_UTIL_PKG)) {
+            throw new ClassNotFoundException(name);
+        }
+        String path = "/".concat(name.replace('.', '/').concat(".class"));
+        try (InputStream in = MethodUtil.class.getResourceAsStream(path)) {
+            byte[] b = readAllBytes(in);
+            return defineClass(name, b);
+        } catch (IOException e) {
+            throw new ClassNotFoundException(name, e);
+        }
+    }
+
+    /**
+     * JDK9 {@link InputStream#readAllBytes()} substitution.
+     */
+    private byte[] readAllBytes(InputStream in) throws IOException {
+        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+        int capacity = buf.length;
+        int nread = 0;
+        int n;
+        for (; ; ) {
+            // read to EOF which may read more or less than initial buffer size
+            while ((n = in.read(buf, nread, capacity - nread)) > 0)
+                nread += n;
+
+            // if the last call to read returned -1, then we're done
+            if (n < 0)
+                break;
+
+            // need to allocate a larger buffer
+            if (capacity <= MAX_BUFFER_SIZE - capacity) {
+                capacity = capacity << 1;
+            } else {
+                if (capacity == MAX_BUFFER_SIZE)
+                    throw new OutOfMemoryError("Required array size too large");
+                capacity = MAX_BUFFER_SIZE;
+            }
+            buf = Arrays.copyOf(buf, capacity);
+        }
+        return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+    }
+
+
+    /*
+     * Define the proxy classes
+     */
+    private Class<?> defineClass(String name, byte[] b) throws IOException {
+        CodeSource cs = new CodeSource(null, (java.security.cert.Certificate[]) null);
+        if (!name.equals(TRAMPOLINE)) {
+            throw new IOException("MethodUtil: bad name " + name);
+        }
+        return defineClass(name, b, 0, b.length, cs);
+    }
+
+    protected PermissionCollection getPermissions(CodeSource codesource) {
+        PermissionCollection perms = super.getPermissions(codesource);
+        perms.add(new AllPermission());
+        return perms;
+    }
+
+    private static Class<?> getTrampolineClass() {
+        try {
+            return Class.forName(TRAMPOLINE, true, new MethodUtil());
+        } catch (ClassNotFoundException e) {
+        }
+        return null;
+    }
+
+    /**
+     * Checks package access on the given classname.
+     * This method is typically called when the Class instance is not
+     * available and the caller attempts to load a class on behalf
+     * the true caller (application).
+     */
+    private static void checkPackageAccess(String name) {
+        SecurityManager s = System.getSecurityManager();
+        if (s != null) {
+            String cname = name.replace('/', '.');
+            if (cname.startsWith("[")) {
+                int b = cname.lastIndexOf('[') + 2;
+                if (b > 1 && b < cname.length()) {
+                    cname = cname.substring(b);
+                }
+            }
+            int i = cname.lastIndexOf('.');
+            if (i != -1) {
+                s.checkPackageAccess(cname.substring(0, i));
+            }
+        }
+    }
+
+    /**
+     * Checks package access on the given class.
+     * <p>
+     * If it is a {@link Proxy#isProxyClass(Class)} that implements
+     * a non-public interface (i.e. may be in a non-restricted package),
+     * also check the package access on the proxy interfaces.
+     */
+    private static void checkPackageAccess(Class<?> clazz) {
+        checkPackageAccess(clazz.getName());
+        if (isNonPublicProxyClass(clazz)) {
+            checkProxyPackageAccess(clazz);
+        }
+    }
+
+    // Note that bytecode instrumentation tools may exclude 'sun.*'
+    // classes but not generated proxy classes and so keep it in com.sun.*
+    private static final String PROXY_PACKAGE = "com.sun.proxy";
+
+    /**
+     * Test if the given class is a proxy class that implements
+     * non-public interface.  Such proxy class may be in a non-restricted
+     * package that bypasses checkPackageAccess.
+     */
+    private static boolean isNonPublicProxyClass(Class<?> cls) {
+        String name = cls.getName();
+        int i = name.lastIndexOf('.');
+        String pkg = (i != -1) ? name.substring(0, i) : "";
+        return Proxy.isProxyClass(cls) && !pkg.startsWith(PROXY_PACKAGE);
+    }
+
+    /**
+     * Check package access on the proxy interfaces that the given proxy class
+     * implements.
+     *
+     * @param clazz Proxy class object
+     */
+    private static void checkProxyPackageAccess(Class<?> clazz) {
+        SecurityManager s = System.getSecurityManager();
+        if (s != null) {
+            // check proxy interfaces if the given class is a proxy class
+            if (Proxy.isProxyClass(clazz)) {
+                for (Class<?> intf : clazz.getInterfaces()) {
+                    checkPackageAccess(intf);
+                }
+            }
+        }
+    }
+}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,4 +26,4 @@
 build-id=2.3.0-SNAPSHOT
 build-version=JAX-WS RI 2.3.0-SNAPSHOT
 major-version=2.3.0
-svn-revision=5c2c1fd2f2ab3b5c7cea25f79aa49e54cb84b7cc
+svn-revision=e8c5e9697d9b27d83ff35d767939b2f55e667621
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.xml.internal.ws.util.xml;
 
+import com.sun.xml.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.properties	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlCatalogUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.ws.util.xml;
+
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.server.ServerRtException;
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.ws.WebServiceException;
+import org.xml.sax.EntityResolver;
+
+/**
+ *
+ * @author lukas
+ */
+public class XmlCatalogUtil {
+
+    // Cache CatalogFeatures instance for future usages.
+    // Resolve feature is set to "continue" value for backward compatibility.
+    private static final CatalogFeatures CATALOG_FEATURES
+            = CatalogFeatures.builder().with(Feature.RESOLVE, "continue").build();
+
+    /**
+     * Gets an EntityResolver using XML catalog
+     *
+     * @param catalogUrl
+     * @return
+     */
+    public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
+        ArrayList<URL> urlsArray = new ArrayList<>();
+        EntityResolver er;
+        if (catalogUrl != null) {
+            urlsArray.add(catalogUrl);
+        }
+        try {
+            er = createCatalogResolver(urlsArray);
+        } catch (Exception e) {
+            throw new ServerRtException("server.rt.err", e);
+        }
+        return er;
+    }
+
+    /**
+     * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
+     *
+     * @return
+     */
+    public static EntityResolver createDefaultCatalogResolver() {
+        EntityResolver er;
+        try {
+            /**
+             * Gets a URLs for catalog defined at META-INF/jaxws-catalog.xml
+             */
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            Enumeration<URL> catalogEnum;
+            if (cl == null) {
+                catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
+            } else {
+                catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
+            }
+            er = createCatalogResolver(Collections.list(catalogEnum));
+        } catch (Exception e) {
+            throw new WebServiceException(e);
+        }
+
+        return er;
+    }
+
+    /**
+     * Instantiate catalog resolver using new catalog API (javax.xml.catalog.*)
+     * added in JDK9. Usage of new API removes dependency on internal API
+     * (com.sun.org.apache.xml.internal) for modular runtime.
+     */
+    private static EntityResolver createCatalogResolver(ArrayList<URL> urls) throws Exception {
+        // Prepare array of catalog URIs
+        URI[] uris = urls.stream()
+                             .map(u -> URI.create(u.toExternalForm()))
+                             .toArray(URI[]::new);
+
+        //Create CatalogResolver with new JDK9+ API
+        return (EntityResolver) CatalogManager.catalogResolver(CATALOG_FEATURES, uris);
+    }
+
+}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,30 +26,21 @@
 package com.sun.xml.internal.ws.util.xml;
 
 import com.sun.istack.internal.Nullable;
-import com.sun.xml.internal.ws.server.ServerRtException;
 import com.sun.xml.internal.ws.util.ByteArrayBuffer;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.lang.reflect.Method;
-import java.net.URI;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.stream.Collectors;
 import javax.xml.XMLConstants;
-import javax.xml.catalog.CatalogFeatures;
-import javax.xml.catalog.CatalogFeatures.Feature;
-import javax.xml.catalog.CatalogManager;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -65,7 +56,6 @@
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.SchemaFactory;
-import javax.xml.ws.WebServiceException;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
 import org.w3c.dom.Attr;
@@ -78,6 +68,8 @@
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 
@@ -184,7 +176,7 @@
     }
 
     public static List<String> parseTokenList(String tokenList) {
-        List<String> result = new ArrayList<String>();
+        List<String> result = new ArrayList<>();
         StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
         while (tokenizer.hasMoreTokens()) {
             result.add(tokenizer.nextToken());
@@ -247,6 +239,7 @@
 
     /**
      * Creates a new identity transformer.
+     * @return
      */
     public static Transformer newTransformer() {
         try {
@@ -258,9 +251,17 @@
 
     /**
      * Performs identity transformation.
+     * @param <T>
+     * @param src
+     * @param result
+     * @return
+     * @throws javax.xml.transform.TransformerException
+     * @throws java.io.IOException
+     * @throws org.xml.sax.SAXException
+     * @throws javax.xml.parsers.ParserConfigurationException
      */
-    public static <T extends Result>
-    T identityTransform(Source src, T result) throws TransformerException, SAXException, ParserConfigurationException, IOException {
+    public static <T extends Result> T identityTransform(Source src, T result)
+            throws TransformerException, SAXException, ParserConfigurationException, IOException {
         if (src instanceof StreamSource) {
             // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing
             // is not turned on by default
@@ -286,69 +287,26 @@
         return is;
     }
 
-    /*
-    * Gets an EntityResolver using XML catalog
-    */
-     public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
-        ArrayList<URL> urlsArray = new ArrayList<URL>();
-        EntityResolver er;
-        if (catalogUrl != null) {
-            urlsArray.add(catalogUrl);
-        }
-        try {
-            er = createCatalogResolver(urlsArray);
-        } catch (Exception e) {
-            throw new ServerRtException("server.rt.err",e);
-        }
-        return er;
+    /**
+     * Gets an EntityResolver using XML catalog
+     *
+     * @param catalogUrl
+     * @return
+     */
+    public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
+        return XmlCatalogUtil.createEntityResolver(catalogUrl);
     }
 
     /**
      * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
+     *
+     * @return
      */
     public static EntityResolver createDefaultCatalogResolver() {
-        EntityResolver er;
-        try {
-            /**
-             * Gets a URLs for catalog defined at META-INF/jaxws-catalog.xml
-             */
-            ClassLoader cl = Thread.currentThread().getContextClassLoader();
-            Enumeration<URL> catalogEnum;
-            if (cl == null) {
-                catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
-            } else {
-                catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
-            }
-            er = createCatalogResolver(Collections.list(catalogEnum));
-        } catch (Exception e) {
-            throw new WebServiceException(e);
-        }
-
-        return er;
+        return XmlCatalogUtil.createDefaultCatalogResolver();
     }
 
     /**
-     * Instantiate catalog resolver using new catalog API (javax.xml.catalog.*)
-     * added in JDK9. Usage of new API removes dependency on internal API
-     * (com.sun.org.apache.xml.internal) for modular runtime.
-     */
-    private static EntityResolver createCatalogResolver(ArrayList<URL> urls) throws Exception {
-        // Prepare array of catalog URIs
-        URI[] uris = urls.stream()
-                             .map(u -> URI.create(u.toExternalForm()))
-                             .toArray(URI[]::new);
-
-        //Create CatalogResolver with new JDK9+ API
-        return (EntityResolver) CatalogManager.catalogResolver(catalogFeatures, uris);
-    }
-
-    // Cache CatalogFeatures instance for future usages.
-    // Resolve feature is set to "continue" value for backward compatibility.
-    private static CatalogFeatures catalogFeatures = CatalogFeatures.builder()
-                                                    .with(Feature.RESOLVE, "continue")
-                                                    .build();
-
-    /**
      * {@link ErrorHandler} that always treat the error as fatal.
      */
     public static final ErrorHandler DRACONIAN_ERROR_HANDLER = new ErrorHandler() {
@@ -391,7 +349,7 @@
         SAXParserFactory factory = SAXParserFactory.newInstance();
         try {
             factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
-        } catch (Exception e) {
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
             LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
         }
         return factory;
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/soap/FactoryFinder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/soap/FactoryFinder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -245,10 +245,14 @@
         return null;
     }
 
-    private static String getSystemProperty(String property) {
+    private static String getSystemProperty(final String property) {
         logger.log(Level.FINE, "Checking system property {0}", property);
-        String value = AccessController.doPrivileged(
-                (PrivilegedAction<String>) () -> System.getProperty(property));
+        String value = AccessController.doPrivileged(new PrivilegedAction<String>() {
+            @Override
+            public String run() {
+                return System.getProperty(property);
+            }
+        });
         logFound(value);
         return value;
     }
--- a/jaxws/src/java.xml.ws/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,6 +26,8 @@
 /**
  * Defines the Java API for XML-Based Web Services (JAX-WS), and
  * the Web Services Metadata API.
+ *
+ * @since 9
  */
 module java.xml.ws {
     requires transitive java.activation;
@@ -36,6 +38,7 @@
     requires java.logging;
     requires java.management;
     requires jdk.httpserver;
+    requires jdk.unsupported;
 
     uses javax.xml.ws.spi.Provider;
     uses javax.xml.soap.MessageFactory;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JJavaName.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JJavaName.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,8 @@
      *      ("my_children","MyChildren","myChildren", and "MY-CHILDREN", "CODE003-children" respectively)
      *      <p>
      *      Although this method only works for English words, it handles non-English
-     *      words gracefully (by just returning it as-is.) For example, "&#x65E5;&#x672C;&#x8A9E;"
-     *      will be returned as-is without modified, not "&#x65E5;&#x672C;&#x8A9E;s"
+     *      words gracefully (by just returning it as-is.) For example, "{@literal &#x65E5;&#x672C;&#x8A9E;}"
+     *      will be returned as-is without modified, not "{@literal &#x65E5;&#x672C;&#x8A9E;s}"
      *      <p>
      *      This method doesn't handle suffixes very well. For example, passing
      *      "person56" will return "person56s", not "people56".
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JModuleDirective.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JModuleDirective.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
      */
     @Override
     public int hashCode() {
-        return 97 * (Integer.hashCode(getType().ordinal() + 1)) + name.hashCode();
+        return 97 * (Integer.valueOf(getType().ordinal() + 1)).hashCode() + name.hashCode();
     }
 
     /**
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  *
  * <p>
  * Note that this class doesn't escape other Unicode characters
- * that are typically unsafe. For example, &#x611B; (A kanji
+ * that are typically unsafe. For example, {@literal &#x611B;} (A kanji
  * that means "love") can be considered as unsafe because
  * javac with English Windows cannot accept this character in the
  * source code.
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/istack/internal/tools/DefaultAuthenticator.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/istack/internal/tools/DefaultAuthenticator.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.Authenticator;
 import java.net.Authenticator.RequestorType;
 import java.net.MalformedURLException;
@@ -42,6 +43,8 @@
 import java.net.URLEncoder;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
@@ -56,11 +59,12 @@
  */
 public class DefaultAuthenticator extends Authenticator {
 
+    private static final Logger LOGGER = Logger.getLogger(DefaultAuthenticator.class.getName());
     private static DefaultAuthenticator instance;
     private static Authenticator systemAuthenticator = getCurrentAuthenticator();
     private String proxyUser;
     private String proxyPasswd;
-    private final List<AuthInfo> authInfo = new ArrayList<AuthInfo>();
+    private final List<AuthInfo> authInfo = new ArrayList<>();
     private static int counter = 0;
 
     DefaultAuthenticator() {
@@ -145,10 +149,7 @@
                 fi = new FileInputStream(f);
                 is = new InputStreamReader(fi, "UTF-8");
                 in = new BufferedReader(is);
-            } catch (UnsupportedEncodingException e) {
-                listener.onError(e, locator);
-                return;
-            } catch (FileNotFoundException e) {
+            } catch (UnsupportedEncodingException | FileNotFoundException e) {
                 listener.onError(e, locator);
                 return;
             }
@@ -170,7 +171,7 @@
                 }
             } catch (IOException e) {
                 listener.onError(e, locator);
-                Logger.getLogger(DefaultAuthenticator.class.getName()).log(Level.SEVERE, e.getMessage(), e);
+                LOGGER.log(Level.SEVERE, e.getMessage(), e);
             }
         } finally {
             try {
@@ -184,7 +185,7 @@
                     fi.close();
                 }
             } catch (IOException ex) {
-                Logger.getLogger(DefaultAuthenticator.class.getName()).log(Level.SEVERE, null, ex);
+                LOGGER.log(Level.SEVERE, null, ex);
             }
         }
     }
@@ -225,6 +226,29 @@
     }
 
     static Authenticator getCurrentAuthenticator() {
+        try {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<Authenticator>() {
+                @Override
+                public Authenticator run() throws Exception {
+                    Method method = Authenticator.class.getMethod("getDefault");
+                    return (Authenticator) method.invoke(null);
+                }
+
+            });
+        } catch (PrivilegedActionException pae) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, null, pae);
+            }
+            Exception ex = pae.getException();
+            if (!(ex instanceof NoSuchMethodException)) {
+                // if Authenticator.getDefault has not been found,
+                // we likely didn't get through sec, so return null
+                // and don't care about JDK version we're on
+                return null;
+            }
+            // or we're on JDK <9, so let's continue the old way...
+        }
+
         final Field f = getTheAuthenticator();
         if (f == null) {
             return null;
@@ -239,7 +263,7 @@
                 }
             });
             return (Authenticator) f.get(null);
-        } catch (Exception ex) {
+        } catch (IllegalAccessException | IllegalArgumentException ex) {
             return null;
         } finally {
             AccessController.doPrivileged(new PrivilegedAction<Void>() {
@@ -255,7 +279,7 @@
     private static Field getTheAuthenticator() {
         try {
             return Authenticator.class.getDeclaredField("theAuthenticator");
-        } catch (Exception ex) {
+        } catch (NoSuchFieldException | SecurityException ex) {
             return null;
         }
     }
@@ -277,7 +301,7 @@
         @Override
         public void onError(Exception e, Locator loc) {
             System.err.println(getLocationString(loc) + ": " + e.getMessage());
-            Logger.getLogger(DefaultAuthenticator.class.getName()).log(Level.SEVERE, e.getMessage(), e);
+            LOGGER.log(Level.SEVERE, e.getMessage(), e);
         }
 
         private String getLocationString(Locator l) {
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/istack/internal/tools/SecureLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/istack/internal/tools/SecureLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
 
 package com.sun.istack.internal.tools;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 /**
  * Class defined for safe calls of getClassLoader methods of any kind (context/system/class
  * classloader. This MUST be package private and defined in every package which
@@ -37,9 +40,10 @@
         if (System.getSecurityManager() == null) {
             return Thread.currentThread().getContextClassLoader();
         } else {
-            return (ClassLoader) java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                        public java.lang.Object run() {
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<ClassLoader>() {
+                        @Override
+                        public ClassLoader run() {
                             return Thread.currentThread().getContextClassLoader();
                         }
                     });
@@ -50,9 +54,10 @@
         if (System.getSecurityManager() == null) {
             return c.getClassLoader();
         } else {
-            return (ClassLoader) java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                        public java.lang.Object run() {
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<ClassLoader>() {
+                        @Override
+                        public ClassLoader run() {
                             return c.getClassLoader();
                         }
                     });
@@ -63,9 +68,10 @@
         if (System.getSecurityManager() == null) {
             return ClassLoader.getSystemClassLoader();
         } else {
-            return (ClassLoader) java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                        public java.lang.Object run() {
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<ClassLoader>() {
+                        @Override
+                        public ClassLoader run() {
                             return ClassLoader.getSystemClassLoader();
                         }
                     });
@@ -76,9 +82,10 @@
         if (System.getSecurityManager() == null) {
             return cl.getParent();
         } else {
-            return (ClassLoader) java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                        public java.lang.Object run() {
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<ClassLoader>() {
+                        @Override
+                        public ClassLoader run() {
                             return cl.getParent();
                         }
                     });
@@ -89,9 +96,10 @@
         if (System.getSecurityManager() == null) {
             Thread.currentThread().setContextClassLoader(cl);
         } else {
-            java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                        public java.lang.Object run() {
+            AccessController.doPrivileged(
+                    new PrivilegedAction<ClassLoader>() {
+                        @Override
+                        public ClassLoader run() {
                             Thread.currentThread().setContextClassLoader(cl);
                             return null;
                         }
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,10 +30,10 @@
     Non-existent directory: {0}
 
 VERSION = \
-        schemagen 2.3.0-SNAPSHOT
+        schemagen 2.3.0-b170215.1712
 
 FULLVERSION = \
-        schemagen full version "2.3.0-SNAPSHOT"
+        schemagen full version "2.3.0-b170215.1712"
 
 USAGE = \
 Usage: schemagen [-options ...] <java files> \n\
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = schemagen vollst\u00E4ndige Version "2.3.0-SNAPSHOT"
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.3.0-b170215.1712"
 
 USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = versi\u00F3n completa de schemagen "2.3.0-SNAPSHOT"
+FULLVERSION = versi\u00F3n completa de schemagen "2.3.0-b170215.1712"
 
 USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = version compl\u00E8te de schemagen "2.3.0-SNAPSHOT"
+FULLVERSION = version compl\u00E8te de schemagen "2.3.0-b170215.1712"
 
 USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = versione completa schemagen "2.3.0-SNAPSHOT"
+FULLVERSION = versione completa schemagen "2.3.0-b170215.1712"
 
 USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.3.0-SNAPSHOT"
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.3.0-b170215.1712"
 
 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.3.0-SNAPSHOT"
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.3.0-b170215.1712"
 
 USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
 
-VERSION = gera\u00E7\u00E3o do esquema 2.3.0-SNAPSHOT
+VERSION = gera\u00E7\u00E3o do esquema 2.3.0-b170215.1712
 
-FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.3.0-SNAPSHOT"
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.3.0-b170215.1712"
 
 USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-b170215.1712"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
 
-VERSION = schemagen 2.3.0-SNAPSHOT
+VERSION = schemagen 2.3.0-b170215.1712
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-b170215.1712"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Annotation Processing related code.
+ *
+ *  This package hosts a driver that runs annotation processing for java-to-schema processing,
+ *  and additional implementations that deal primarily with AP.
+ */
+package com.sun.tools.internal.jxc.ap;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-    <body>
-    Annotation Processing related code.
-
-    This package hosts a driver that runs annotation processing for java-to-schema processing,
-    and additional implementations that deal primarily with AP.
-    </body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/CatalogUtil.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.internal.xjc;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.catalog.CatalogManager;
+import org.xml.sax.EntityResolver;
+
+/**
+ *
+ * @author lukas
+ */
+final class CatalogUtil {
+
+    // Cache CatalogFeatures instance for future usages.
+    // Resolve feature is set to "continue" value for backward compatibility.
+    private static final CatalogFeatures CATALOG_FEATURES = CatalogFeatures.builder()
+                                                    .with(Feature.RESOLVE, "continue")
+                                                    .build();
+
+    static EntityResolver getCatalog(EntityResolver entityResolver, File catalogFile, ArrayList<URI> catalogUrls) throws IOException {
+        return CatalogManager.catalogResolver(
+                CATALOG_FEATURES, catalogUrls.stream().toArray(URI[]::new));
+    }
+}
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -173,20 +173,20 @@
 Driver.FailedToGenerateCode = \
         Failed to produce code.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
 Driver.FilePrologComment = \
-        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-SNAPSHOT \n\
+        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170215.1712 \n\
         See <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\
         Any modifications to this file will be lost upon recompilation of the source schema. \n\
         Generated on: {0} \n
 
 Driver.Version = \
-        xjc 2.3.0-SNAPSHOT
+        xjc 2.3.0-b170215.1712
 
 Driver.FullVersion = \
-        xjc full version "2.3.0-SNAPSHOT"
+        xjc full version "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-SNAPSHOT generiert \nSiehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170215.1712 generiert \nSiehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = xjc vollst\u00E4ndige Version "2.3.0-SNAPSHOT"
+Driver.FullVersion = xjc vollst\u00E4ndige Version "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.3.0-SNAPSHOT \nVisite <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.3.0-b170215.1712 \nVisite <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = versi\u00F3n completa de xjc "2.3.0-SNAPSHOT"
+Driver.FullVersion = versi\u00F3n completa de xjc "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -131,14 +131,14 @@
 
 Driver.FailedToGenerateCode = Echec de la production du code.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.3.0-SNAPSHOT \nVoir <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.3.0-b170215.1712 \nVoir <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = version compl\u00E8te xjc "2.3.0-SNAPSHOT"
+Driver.FullVersion = version compl\u00E8te xjc "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = Produzione del codice non riuscita.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.3.0-SNAPSHOT \nVedere <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.3.0-b170215.1712 \nVedere <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = versione completa xjc "2.3.0-SNAPSHOT"
+Driver.FullVersion = versione completa xjc "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.3.0-SNAPSHOT\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="https://jaxb.java.net/">https://jaxb.java.net/</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.3.0-b170215.1712\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="https://jaxb.java.net/">https://jaxb.java.net/</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.3.0-SNAPSHOT"
+Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.3.0-SNAPSHOT \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="https://jaxb.java.net/">https://jaxb.java.net/</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.3.0-b170215.1712 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="https://jaxb.java.net/">https://jaxb.java.net/</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
 
-Driver.Version = XJC 2.3.0-SNAPSHOT
+Driver.Version = XJC 2.3.0-b170215.1712
 
-Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.3.0-SNAPSHOT"
+Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.3.0-SNAPSHOT \nConsulte <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.3.0-b170215.1712 \nConsulte <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = vers\u00E3o completa de xjc "2.3.0-SNAPSHOT"
+Driver.FullVersion = vers\u00E3o completa de xjc "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -131,14 +131,14 @@
 
 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.3.0-SNAPSHOT \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.3.0-b170215.1712 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,14 +127,14 @@
 
 Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
 
-# DO NOT localize the 2.3.0-SNAPSHOT string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-SNAPSHOT \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
+# DO NOT localize the 2.3.0-b170215.1712 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170215.1712 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
 
-Driver.Version = xjc 2.3.0-SNAPSHOT
+Driver.Version = xjc 2.3.0-b170215.1712
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.3.0-b170215.1712"
 
-Driver.BuildID = 2.3.0-SNAPSHOT
+Driver.BuildID = 2.3.0-b170215.1712
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/Options.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/Options.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,27 @@
 
 package com.sun.tools.internal.xjc;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.Set;
+
 import com.sun.codemodel.internal.CodeWriter;
 import com.sun.codemodel.internal.JPackage;
 import com.sun.codemodel.internal.JResourceFile;
@@ -37,40 +58,16 @@
 import com.sun.tools.internal.xjc.model.Model;
 import com.sun.tools.internal.xjc.reader.Util;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Locale;
-import java.util.ServiceLoader;
-import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.xml.catalog.CatalogFeatures;
-import javax.xml.catalog.CatalogFeatures.Feature;
-import javax.xml.catalog.CatalogManager;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
 
 /**
  * Global options.
@@ -181,7 +178,7 @@
     public File targetDir = new File(".");
 
     /**
-     * Actually stores {@link CatalogResolver}, but the field
+     * On JDK 8 an odler stores {@code CatalogResolver}, but the field
      * type is made to {@link EntityResolver} so that XJC can be
      * used even if resolver.jar is not available in the classpath.
      */
@@ -208,9 +205,9 @@
     /**
      * Input schema files as a list of {@link InputSource}s.
      */
-    private final List<InputSource> grammars = new ArrayList<InputSource>();
+    private final List<InputSource> grammars = new ArrayList<>();
 
-    private final List<InputSource> bindFiles = new ArrayList<InputSource>();
+    private final List<InputSource> bindFiles = new ArrayList<>();
 
     // Proxy setting.
     private String proxyHost = null;
@@ -220,7 +217,7 @@
     /**
      * {@link Plugin}s that are enabled in this compilation.
      */
-    public final List<Plugin> activePlugins = new ArrayList<Plugin>();
+    public final List<Plugin> activePlugins = new ArrayList<>();
 
     /**
      * All discovered {@link Plugin}s.
@@ -233,7 +230,7 @@
     /**
      * Set of URIs that plug-ins recognize as extension bindings.
      */
-    public final Set<String> pluginURIs = new HashSet<String>();
+    public final Set<String> pluginURIs = new HashSet<>();
 
     /**
      * This allocator has the final say on deciding the class name.
@@ -357,6 +354,7 @@
      * A plugins are enumerated when this method is called for the first time,
      * by taking {@link #classpaths} into account. That means
      * "-cp plugin.jar" has to come before you specify options to enable it.
+     * @return
      */
     public List<Plugin> getAllPlugins() {
         if(allPlugins==null) {
@@ -375,13 +373,15 @@
         this.schemaLanguage = _schemaLanguage;
     }
 
-    /** Input schema files. */
+    /** Input schema files.
+     * @return  */
     public InputSource[] getGrammars() {
         return grammars.toArray(new InputSource[grammars.size()]);
     }
 
     /**
      * Adds a new input schema.
+     * @param is
      */
     public void addGrammar( InputSource is ) {
         grammars.add(absolutize(is));
@@ -402,6 +402,7 @@
 
     /**
      * Recursively scan directories and add all XSD files in it.
+     * @param dir
      */
     public void addGrammarRecursive( File dir ) {
         addRecursive(dir,".xsd",grammars);
@@ -432,13 +433,15 @@
         return is;
     }
 
-    /** Input external binding files. */
+    /** Input external binding files.
+     * @return  */
     public InputSource[] getBindFiles() {
         return bindFiles.toArray(new InputSource[bindFiles.size()]);
     }
 
     /**
      * Adds a new binding file.
+     * @param is
      */
     public void addBindFile( InputSource is ) {
         bindFiles.add(absolutize(is));
@@ -446,6 +449,7 @@
 
     /**
      * Adds a new binding file.
+     * @param bindFile
      */
     public void addBindFile( File bindFile ) {
         bindFiles.add(fileToInputSource(bindFile));
@@ -453,15 +457,18 @@
 
     /**
      * Recursively scan directories and add all ".xjb" files in it.
+     * @param dir
      */
     public void addBindFileRecursive( File dir ) {
         addRecursive(dir,".xjb",bindFiles);
     }
 
-    public final List<URL> classpaths = new ArrayList<URL>();
+    public final List<URL> classpaths = new ArrayList<>();
     /**
      * Gets a classLoader that can load classes specified via the
      * -classpath option.
+     * @param parent
+     * @return
      */
     public ClassLoader getUserClassLoader( ClassLoader parent ) {
         if (classpaths.isEmpty())
@@ -482,6 +489,8 @@
      * Parses an option {@code args[i]} and return
      * the number of tokens consumed.
      *
+     * @param args
+     * @param i
      * @return
      *      0 if the argument is not understood. Returning 0
      *      will let the caller report an error.
@@ -610,10 +619,8 @@
                     Messages.format(Messages.NO_SUCH_FILE,file));
             }
 
-            try {
-                BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
+            try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"))) {
                 parseProxy(in.readLine());
-                in.close();
             } catch (IOException e) {
                 throw new BadCommandLineException(
                     Messages.format(Messages.FAILED_TO_PARSE,file,e.getMessage()),e);
@@ -639,7 +646,9 @@
             return 2;
         }
         if( args[i].equals("-catalog") ) {
-            // use javax.xml.catalog to resolve external entities.
+            // use Sun's "XML Entity and URI Resolvers" by Norman Walsh
+            // to resolve external entities.
+            // https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html
 
             File catalogFile = new File(requireArgument("-catalog",args,++i));
             try {
@@ -652,6 +661,7 @@
         }
         if( args[i].equals("-Xtest-class-name-allocator") ) {
             classNameAllocator = new ClassNameAllocator() {
+                @Override
                 public String assignClassName(String packageName, String className) {
                     System.out.printf("assignClassName(%s,%s)\n",packageName,className);
                     return className+"_Type";
@@ -736,6 +746,11 @@
 
     /**
      * Obtains an operand and reports an error if it's not there.
+     * @param optionName
+     * @param args
+     * @param i
+     * @return
+     * @throws com.sun.tools.internal.xjc.BadCommandLineException
      */
     public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException {
         if (i == args.length || args[i].startsWith("-")) {
@@ -773,34 +788,27 @@
         }
     }
 
-    /**
-     * Adds a new catalog file.
-     */
-    public void addCatalog(File catalogFile) throws IOException {
-        URI newUrl = catalogFile.toURI();
-        if (!catalogUrls.contains(newUrl)) {
-            catalogUrls.add(newUrl);
-        }
-        try {
-            entityResolver = CatalogManager.catalogResolver(catalogFeatures,
-                                catalogUrls.stream().toArray(URI[]::new));
-        } catch (Exception ex) {
-            entityResolver = null;
-        }
-    }
-
     // Since javax.xml.catalog is unmodifiable we need to track catalog
     // URLs added and create new catalog each time addCatalog is called
     private final ArrayList<URI> catalogUrls = new ArrayList<>();
 
-    // Cache CatalogFeatures instance for future usages.
-    // Resolve feature is set to "continue" value for backward compatibility.
-    private static CatalogFeatures catalogFeatures = CatalogFeatures.builder()
-                                                    .with(Feature.RESOLVE, "continue")
-                                                    .build();
+    /**
+     * Adds a new catalog file.Use created or existed resolver to parse new catalog file.
+     * @param catalogFile
+     * @throws java.io.IOException
+     */
+    public void addCatalog(File catalogFile) throws IOException {
+        URI newUri = catalogFile.toURI();
+        if (!catalogUrls.contains(newUri)) {
+            catalogUrls.add(newUri);
+        }
+        entityResolver = CatalogUtil.getCatalog(entityResolver, catalogFile, catalogUrls);
+    }
+
     /**
      * Parses arguments and fill fields of this object.
      *
+     * @param args
      * @exception BadCommandLineException
      *      thrown when there's a problem in the command-line arguments
      */
@@ -861,6 +869,8 @@
 
     /**
      * Finds the {@code META-INF/sun-jaxb.episode} file to add as a binding customization.
+     * @param jar
+     * @throws com.sun.tools.internal.xjc.BadCommandLineException
      */
     public void scanEpisodeFile(File jar) throws BadCommandLineException {
         try {
@@ -879,6 +889,7 @@
 
     /**
      * Guesses the schema language.
+     * @return
      */
     public Language guessSchemaLanguage() {
 
@@ -899,6 +910,8 @@
 
     /**
      * Creates a configured CodeWriter that produces files into the specified directory.
+     * @return
+     * @throws java.io.IOException
      */
     public CodeWriter createCodeWriter() throws IOException {
         return createCodeWriter(new FileCodeWriter( targetDir, readOnly, encoding ));
@@ -906,6 +919,8 @@
 
     /**
      * Creates a configured CodeWriter that produces files into the specified directory.
+     * @param core
+     * @return
      */
     public CodeWriter createCodeWriter( CodeWriter core ) {
         if(noFileHeader)
@@ -915,8 +930,8 @@
     }
 
     /**
-     * Gets the string suitable to be used as the prolog comment baked into artifacts.
-     * This is the string like "This file was generated by the JAXB RI on YYYY/mm/dd..."
+     * Gets the string suitable to be used as the prolog comment baked into artifacts.This is the string like "This file was generated by the JAXB RI on YYYY/mm/dd..."
+     * @return
      */
     public String getPrologComment() {
         // generate format syntax: <date> 'at' <time>
@@ -943,7 +958,7 @@
      * create one instance for each class name found inside this file.
      */
     private <T> List<T> findServices( Class<T> clazz) {
-        final List<T> result = new ArrayList<T>();
+        final List<T> result = new ArrayList<>();
         final boolean debug = getDebugPropertyValue();
         try {
             // TCCL allows user plugins to be loaded even if xjc is in jdk
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/SchemaCache.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/SchemaCache.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,9 @@
                         schema = schemaFactory.newSchema(source);
 
                     } catch (IOException | SAXException e) {
-                        throw new InternalError(e);
+                        InternalError ie = new InternalError(e.getMessage());
+                        ie.initCause(e);
+                        throw ie;
                     } finally {
                         if (resourceResolver != null) resourceResolver.closeStreams();
                     }
@@ -221,5 +223,3 @@
     public void setCertifiedText(boolean certifiedText) {
     }
 }
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * implementation of the XJC API for schema to java.
+ */
+package com.sun.tools.internal.xjc.api.impl.s2j;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-implementation of the XJC API for schema to java.
-</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * API for programmatic invocation of XJC and schemagen.
+ *
+ * <p>
+ * This package provides a way to invoke XJC from within another program. The primary target of this API is the JAX-WS
+ * RI, but we hope that this API would be useful for other integration purposes as well.
+ *
+ * <h2>Getting Started: Using XJC</h2>
+ * <p>
+ * To invoke XJC, a typical client would do something like this:
+ * <pre>
+ *    SchemaCompiler sc = XJC.createSchemaCompiler();
+ *    sc.parseSchema(new InputSource(schema1Url.toExternalForm()));
+ *    sc.parseSchema(new InputSource(schema2Url.toExternalForm()));
+ *    ...
+ *    S2JModel model = sc.bind();
+ * </pre>
+ * <p>
+ * The bind operation causes XJC to do the bulk of the work, such as figuring out what classes to generate, what
+ * methods/fields to generate, etc. The obtained model contains useful introspective information about how the binding
+ * was performed (such as the mapping between XML types and generated Java classes)
+ *
+ * <p>
+ * Once the model is obtained, generate the code into the file system as follows:
+ * <pre>
+ *   JCodeModel cm = model.generateCode( null, ... );
+ *   cm.build(new FileCodeWriter(outputDir));
+ * </pre>
+ *
+ * <h2>Implementation Note</h2>
+ * <p>
+ * This package shouldn't contain any implementation code.
+ */
+package com.sun.tools.internal.xjc.api;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-API for programmatic invocation of XJC and schemagen.
-
-<p>
-This package provides a way to invoke XJC from within another program.
-The primary target of this API is the JAX-WS RI, but we hope that
-this API would be useful for other integration purposes as well.
-
-<h2>Getting Started: Using XJC</h2>
-<p>
-To invoke XJC, a typical client would do something like this:
-<pre>
-    SchemaCompiler sc = XJC.createSchemaCompiler();
-    sc.parseSchema(new InputSource(schema1Url.toExternalForm()));
-    sc.parseSchema(new InputSource(schema2Url.toExternalForm()));
-    ...
-    S2JModel model = sc.bind();
-</pre>
-<p>
-The bind operation causes XJC to do the bulk of the work, such as
-figuring out what classes to generate, what methods/fields to generate, etc.
-The obtained model contains useful introspective information about
-how the binding was performed (such as the mapping between XML types
-and generated Java classes)
-
-<p>
-Once the model is obtained, generate the code into the file system as follows:
-<pre>
-    JCodeModel cm = model.generateCode( null, ... );
-    cm.build(new FileCodeWriter(outputDir));
-</pre>
-
-
-<h2>Implementation Note</h2>
-<p>
-This package shouldn't contain any implementation code.
-</body></html> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * FieldRenderer and its implementation classes.
+ * Unless you are deriving from these classes to define your own custom renderer,
+ * you shouldn't be using these classes directly. Use the outline package.
+ */
+package com.sun.tools.internal.xjc.generator.bean.field;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<body><p>
-FieldRenderer and its implementation classes.
-Unless you are deriving from these classes to define your own custom renderer,
-you shouldn't be using these classes directly. Use the outline package.
-</p></body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * <p>
+ * Compile-time representation of Java type system.
+ *
+ * <p>
+ * These classes are used as TypeT and ClassDeclT of the model parameterization. This implementaion is designed to be
+ * capable of representing pre-existing classes (such as java.lang.String) as well as the generated classes (represented
+ * as JDefinedClass.)
+ *
+ * <h2>Handling of Primitive Types</h2>
+ * <p>
+ * Primitive types have two forms (int and Integer), and this complicates the binding process. For this reason, inside
+ * the front end, we always use the boxed types. We'll use the unboxed form only in the back end when we know the field
+ * doesn't need to represent the null value.
+ */
+package com.sun.tools.internal.xjc.model.nav;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  <p>
-    Compile-time representation of Java type system.
-
-  <p>
-    These classes are used as TypeT and ClassDeclT of the model parameterization.
-    This implementaion is designed to be capable of representing pre-existing classes
-    (such as java.lang.String) as well as the generated classes (represented as JDefinedClass.)
-
-  <h2>Handling of Primitive Types</h2>
-  <p>
-    Primitive types have two forms (int and Integer), and this complicates the binding process.
-    For this reason, inside the front end, we always use the boxed types. We'll use the unboxed
-    form only in the back end when we know the field doesn't need to represent the null value.
-</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Provides the outline of the generated Java source code so that
+ * additional processing (such as adding more annotations) can be
+ * done on the generated code.
+ *
+ * <p>
+ * Code generation phase builds an outline little by little, while each step is using the outline built by the prior
+ * steps.
+ */
+package com.sun.tools.internal.xjc.outline;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  Provides the outline of the generated Java source code so that
-  additional processings (such as adding more annotations) can be
-  done on the generated code.
-
-  <p>
-  Code generation phase builds an outline little by little, while
-  each step is using the outline built by the prior steps.
-</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Object Model that represents DTD binding information.
+ */
+package com.sun.tools.internal.xjc.reader.dtd.bindinfo;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<body><p>Object Model that represents DTD binding information.</p></body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/gbind/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Binary expressions are left-associative. IOW, ((A,B),C) instead of (A,(B,C)).
+ */
+package com.sun.tools.internal.xjc.reader.gbind;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/gbind/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-
-
-<body>
-    Binary expressions are left-associative. IOW, ((A,B),C) instead of (A,(B,C))
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * internalization of external binding files and &lt;jaxb:bindings&gt; customizations.
+ */
+package com.sun.tools.internal.xjc.reader.internalizer;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<body><p>internalization of external binding files and &lt;jaxb:bindings> customizations.</p></body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Front-end that reads schema(s) and produce BGM.
+ */
+package com.sun.tools.internal.xjc.reader;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<body><p>Front-end that reads schema(s) and produce BGM.</p></body>
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Object Model that represents customization declarations.
+ * <a href="http://relaxngcc.sourceforge.net/">RelaxNGCC</a> is used to parse
+ * XML syntax into this representation, and the other parts of XJC will use
+ * this object model.
+ */
 @XmlSchema(elementFormDefault = QUALIFIED, namespace=Const.JAXB_NSURI)
 package com.sun.tools.internal.xjc.reader.xmlschema.bindinfo;
 
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<body>
-Object Model that represents customization declarations.
-
-<p>
-	<a href="http://relaxngcc.sourceforge.net/">RelaxNGCC</a> is used to parse
-	XML syntax into this representation, and the other parts of XJC will use
-	this object model.
-</p>
-</body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/runtime/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/**
+ * Code generated into the user's packages in certain compilation mode.
+ */
+package com.sun.tools.internal.xjc.runtime;
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/runtime/package.html	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html><body>
-
-
-  Code generated into the user's packages in certain compilation mode.
-
-</body></html>
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/ElementDecl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/ElementDecl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
         this.substHead = _substHead;
         this.substDisallowed = _substDisallowed;
         this.substExcluded = _substExcluded;
-        this.idConstraints = Collections.unmodifiableList((List<? extends XSIdentityConstraint>)idConstraints);
+        this.idConstraints = (List<XSIdentityConstraint>) Collections.unmodifiableList((List<? extends XSIdentityConstraint>)idConstraints);
 
         for (IdentityConstraintImpl idc : idConstraints)
             idc.setParent(this);
@@ -80,42 +80,52 @@
     }
 
     private XmlString defaultValue;
+    @Override
     public XmlString getDefaultValue() { return defaultValue; }
 
     private XmlString fixedValue;
+    @Override
     public XmlString getFixedValue() { return fixedValue; }
 
     private boolean nillable;
+    @Override
     public boolean isNillable() { return nillable; }
 
     private boolean _abstract;
+    @Override
     public boolean isAbstract() { return _abstract; }
 
     private Ref.Type type;
+    @Override
     public XSType getType() { return type.getType(); }
 
     private Ref.Element substHead;
+    @Override
     public XSElementDecl getSubstAffiliation() {
         if(substHead==null)     return null;
         return substHead.get();
     }
 
     private int substDisallowed;
+    @Override
     public boolean isSubstitutionDisallowed( int method ) {
         return (substDisallowed&method)!=0;
     }
 
     private int substExcluded;
+    @Override
     public boolean isSubstitutionExcluded( int method ) {
         return (substExcluded&method)!=0;
     }
 
     private final List<XSIdentityConstraint> idConstraints;
+    @Override
     public List<XSIdentityConstraint> getIdentityConstraints() {
         return idConstraints;
     }
 
     private Boolean form;
+    @Override
     public Boolean getForm() {
         return form;
     }
@@ -124,6 +134,7 @@
     /**
      * @deprecated
      */
+    @Override
     public XSElementDecl[] listSubstitutables() {
         Set<? extends XSElementDecl> s = getSubstitutables();
         return s.toArray(new XSElementDecl[s.size()]);
@@ -135,6 +146,7 @@
     /** Unmodifieable view of {@link #substitutables}. */
     private Set<XSElementDecl> substitutablesView = null;
 
+    @Override
     public Set<? extends XSElementDecl> getSubstitutables() {
         if( substitutables==null ) {
             // if the field is null by the time this method
@@ -194,42 +206,57 @@
         }
     }
 
+    @Override
     public boolean canBeSubstitutedBy(XSElementDecl e) {
         return getSubstitutables().contains(e);
     }
 
+    @Override
     public boolean isWildcard()                 { return false; }
+    @Override
     public boolean isModelGroupDecl()           { return false; }
+    @Override
     public boolean isModelGroup()               { return false; }
+    @Override
     public boolean isElementDecl()              { return true; }
 
+    @Override
     public XSWildcard asWildcard()              { return null; }
+    @Override
     public XSModelGroupDecl asModelGroupDecl()  { return null; }
+    @Override
     public XSModelGroup asModelGroup()          { return null; }
+    @Override
     public XSElementDecl asElementDecl()        { return this; }
 
 
 
 
+    @Override
     public void visit( XSVisitor visitor ) {
         visitor.elementDecl(this);
     }
+    @Override
     public void visit( XSTermVisitor visitor ) {
         visitor.elementDecl(this);
     }
+    @Override
     public Object apply( XSTermFunction function ) {
         return function.elementDecl(this);
     }
 
+    @Override
     public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
         return function.elementDecl(this,param);
     }
 
+    @Override
     public Object apply( XSFunction function ) {
         return function.elementDecl(this);
     }
 
 
     // Ref.Term implementation
+    @Override
     public XSTerm getTerm() { return this; }
 }
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/IdentityConstraintImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/IdentityConstraintImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,17 +59,19 @@
         this.name = name;
         this.selector = selector;
         selector.setParent(this);
-        this.fields = Collections.unmodifiableList((List<? extends XSXPath>)fields);
+        this.fields = (List<XSXPath>) Collections.unmodifiableList((List<? extends XSXPath>)fields);
         for( XPathImpl xp : fields )
             xp.setParent(this);
         this.refer = refer;
     }
 
 
+    @Override
     public void visit(XSVisitor visitor) {
         visitor.identityConstraint(this);
     }
 
+    @Override
     public <T> T apply(XSFunction<T> function) {
         return function.identityConstraint(this);
     }
@@ -79,30 +81,37 @@
         parent.getOwnerSchema().addIdentityConstraint(this);
     }
 
+    @Override
     public XSElementDecl getParent() {
         return parent;
     }
 
+    @Override
     public String getName() {
         return name;
     }
 
+    @Override
     public String getTargetNamespace() {
         return getParent().getTargetNamespace();
     }
 
+    @Override
     public short getCategory() {
         return category;
     }
 
+    @Override
     public XSXPath getSelector() {
         return selector;
     }
 
+    @Override
     public List<XSXPath> getFields() {
         return fields;
     }
 
+    @Override
     public XSIdentityConstraint getReferencedKey() {
         if(category==KEYREF)
             return refer.get();
@@ -110,6 +119,7 @@
             throw new IllegalStateException("not a keyref");
     }
 
+    @Override
     public XSIdentityConstraint get() {
         return this;
     }
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/parser/NGCCRuntimeEx.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/parser/NGCCRuntimeEx.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
 import com.sun.xml.internal.xsom.impl.Const;
 import com.sun.xml.internal.xsom.impl.parser.state.NGCCRuntime;
 import com.sun.xml.internal.xsom.impl.parser.state.Schema;
-import com.sun.xml.internal.xsom.impl.util.Uri;
 import com.sun.xml.internal.xsom.parser.AnnotationParser;
 import com.sun.xml.internal.org.relaxng.datatype.ValidationContext;
 import org.xml.sax.Attributes;
@@ -48,8 +47,10 @@
 
 import java.io.IOException;
 import java.net.URI;
+import java.net.URL;
 import java.text.MessageFormat;
 import java.util.Stack;
+import java.util.regex.Pattern;
 
 /**
  * NGCCRuntime extended with various utility methods for
@@ -150,12 +151,15 @@
 
 
     /* registers a patcher that will run after all the parsing has finished. */
+    @Override
     public void addPatcher( Patch patcher ) {
         parser.patcherManager.addPatcher(patcher);
     }
+    @Override
     public void addErrorChecker( Patch patcher ) {
         parser.patcherManager.addErrorChecker(patcher);
     }
+    @Override
     public void reportError( String msg, Locator loc ) throws SAXException {
         parser.patcherManager.reportError(msg,loc);
     }
@@ -188,8 +192,15 @@
             EntityResolver er = parser.getEntityResolver();
             String systemId = null;
 
-            if (relativeUri!=null)
-                systemId = Uri.resolve(baseUri,relativeUri);
+            if (relativeUri!=null) {
+                if (isAbsolute(relativeUri)) {
+                    systemId = relativeUri;
+                }
+                if (baseUri == null || !isAbsolute(baseUri)) {
+                    throw new IOException("Unable to resolve relative URI " + relativeUri + " because base URI is not absolute: " + baseUri);
+                }
+                systemId = new URL(new URL(baseUri), relativeUri).toString();
+            }
 
             if (er!=null) {
                 InputSource is = er.resolveEntity(namespaceURI,systemId);
@@ -217,7 +228,21 @@
         }
     }
 
-    /** Includes the specified schema. */
+    private static final Pattern P = Pattern.compile(".*[/#?].*");
+
+    private static boolean isAbsolute(String uri) {
+        int i = uri.indexOf(':');
+        if (i < 0) {
+            return false;
+        }
+        return !P.matcher(uri.substring(0, i)).matches();
+    }
+
+    /**
+     * Includes the specified schema.
+     *
+     * @param schemaLocation
+     * @throws org.xml.sax.SAXException */
     public void includeSchema( String schemaLocation ) throws SAXException {
         NGCCRuntimeEx runtime = new NGCCRuntimeEx(parser,chameleonMode,this);
         runtime.currentSchema = this.currentSchema;
@@ -235,7 +260,12 @@
             true, currentSchema.getTargetNamespace(), getLocator() );
     }
 
-    /** Imports the specified schema. */
+    /**
+     * Imports the specified schema.
+     *
+     * @param ns
+     * @param schemaLocation
+     * @throws org.xml.sax.SAXException */
     public void importSchema( String ns, String schemaLocation ) throws SAXException {
         NGCCRuntimeEx newRuntime = new NGCCRuntimeEx(parser,false,this);
         InputSource source = resolveRelativeURL(ns,schemaLocation);
@@ -317,9 +347,13 @@
     /**
      * Parses the specified entity.
      *
+     * @param source
      * @param importLocation
      *      The source location of the import/include statement.
      *      Used for reporting errors.
+     * @param includeMode
+     * @param expectedNamespace
+     * @throws org.xml.sax.SAXException
      */
     public void parseEntity( InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation )
             throws SAXException {
@@ -342,6 +376,8 @@
 
     /**
      * Creates a new instance of annotation parser.
+     *
+     * @return Annotation parser
      */
     public AnnotationParser createAnnotationParser() {
         if(parser.getAnnotationParserFactory()==null)
@@ -351,14 +387,19 @@
     }
 
     /**
-     * Gets the element name that contains the annotation element.
-     * This method works correctly only when called by the annotation handler.
+     * Gets the element name that contains the annotation element.This method works correctly only when called by the annotation handler.
+     *
+     * @return Element name
      */
     public String getAnnotationContextElementName() {
         return elementNames.get( elementNames.size()-2 );
     }
 
-    /** Creates a copy of the current locator object. */
+    /**
+     * Creates a copy of the current locator object.
+     *
+     * @return Locator copy
+     */
     public Locator copyLocator() {
         return new LocatorImpl(getLocator());
     }
@@ -397,6 +438,7 @@
             this.uri = _uri;
         }
 
+        @Override
         public String resolveNamespacePrefix(String p) {
             if(p.equals(prefix))    return uri;
             if(previous==null)      return null;
@@ -408,14 +450,20 @@
         private final Context previous;
 
         // XSDLib don't use those methods, so we cut a corner here.
+        @Override
         public String getBaseUri() { return null; }
+        @Override
         public boolean isNotation(String arg0) { return false; }
+        @Override
         public boolean isUnparsedEntity(String arg0) { return false; }
     }
 
     private Context currentContext=null;
 
-    /** Returns an immutable snapshot of the current context. */
+    /** Returns an immutable snapshot of the current context.
+     *
+     * @return Snapshot of current context
+     */
     public ValidationContext createValidationContext() {
         return currentContext;
     }
@@ -446,6 +494,7 @@
      * Parses UName under the given context.
      * @param qname Attribute name.
      * @return New {@link UName} instance based on attribute name.
+     * @throws org.xml.sax.SAXException
      */
     public UName parseUName(final String qname ) throws SAXException {
         int idx = qname.indexOf(':');
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/util/Uri.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
-Copyright (c) 2001, 2002 Thai Open Source Software Center Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-    Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
-    Neither the name of the Thai Open Source Software Center Ltd nor
-    the names of its contributors may be used to endorse or promote
-    products derived from this software without specific prior written
-    permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-// @@3RD PARTY CODE@@
-
-package com.sun.xml.internal.xsom.impl.util;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-
-public class Uri {
-  private static String utf8 = "UTF-8";
-
-  public static boolean isValid(String s) {
-    return isValidPercent(s) && isValidFragment(s) && isValidScheme(s);
-  }
-
-  private static final String HEX_DIGITS = "0123456789abcdef";
-
-  public static String escapeDisallowedChars(String s) {
-    StringBuffer buf = null;
-    int len = s.length();
-    int done = 0;
-    for (;;) {
-      int i = done;
-      for (;;) {
-        if (i == len) {
-          if (done == 0)
-            return s;
-          break;
-        }
-        if (isExcluded(s.charAt(i)))
-          break;
-        i++;
-      }
-      if (buf == null)
-        buf = new StringBuffer();
-      if (i > done) {
-        buf.append(s.substring(done, i));
-        done = i;
-      }
-      if (i == len)
-        break;
-      for (i++; i < len && isExcluded(s.charAt(i)); i++)
-        ;
-      String tem = s.substring(done, i);
-      byte[] bytes;
-      try {
-        bytes = tem.getBytes(utf8);
-      }
-      catch (UnsupportedEncodingException e) {
-        utf8 = "UTF8";
-        try {
-          bytes = tem.getBytes(utf8);
-        }
-        catch (UnsupportedEncodingException e2) {
-          // Give up
-          return s;
-        }
-      }
-      for (int j = 0; j < bytes.length; j++) {
-        buf.append('%');
-        buf.append(HEX_DIGITS.charAt((bytes[j] & 0xFF) >> 4));
-        buf.append(HEX_DIGITS.charAt(bytes[j] & 0xF));
-      }
-      done = i;
-    }
-    return buf.toString();
-  }
-
-  private static String excluded = "<>\"{}|\\^`";
-
-  private static boolean isExcluded(char c) {
-    return c <= 0x20 || c >= 0x7F || excluded.indexOf(c) >= 0;
-  }
-
-  private static boolean isAlpha(char c) {
-    return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
-  }
-
-  private static boolean isHexDigit(char c) {
-    return ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || isDigit(c);
-  }
-
-  private static boolean isDigit(char c) {
-    return '0' <= c && c <= '9';
-  }
-
-  private static boolean isSchemeChar(char c) {
-    return isAlpha(c) || isDigit(c) || c == '+' || c == '-' || c =='.';
-  }
-
-  private static boolean isValidPercent(String s) {
-    int len = s.length();
-    for (int i = 0; i < len; i++)
-      if (s.charAt(i) == '%') {
-        if (i + 2 >= len)
-          return false;
-        else if (!isHexDigit(s.charAt(i + 1))
-             || !isHexDigit(s.charAt(i + 2)))
-          return false;
-      }
-    return true;
-  }
-
-  private static boolean isValidFragment(String s) {
-    int i = s.indexOf('#');
-    return i < 0 || s.indexOf('#', i + 1) < 0;
-  }
-
-  private static boolean isValidScheme(String s) {
-    if (!isAbsolute(s))
-      return true;
-    int i = s.indexOf(':');
-    if (i == 0
-    || i + 1 == s.length()
-    || !isAlpha(s.charAt(0)))
-      return false;
-    while (--i > 0)
-      if (!isSchemeChar(s.charAt(i)))
-    return false;
-    return true;
-  }
-
-    public static String resolve(String baseUri, String uriReference) throws IOException {
-        if (isAbsolute(uriReference))
-            return uriReference;
-
-        if(baseUri==null)
-            throw new IOException("Unable to resolve relative URI "+uriReference+" without a base URI");
-
-        if(!isAbsolute(baseUri))
-            throw new IOException("Unable to resolve relative URI "+uriReference+" because base URI is not absolute: "+baseUri);
-
-        return new URL(new URL(baseUri), uriReference).toString();
-    }
-
-    public static boolean hasFragmentId(String uri) {
-    return uri.indexOf('#') >= 0;
-  }
-
-  public static boolean isAbsolute(String uri) {
-    int i = uri.indexOf(':');
-    if (i < 0)
-      return false;
-    while (--i >= 0) {
-      switch (uri.charAt(i)) {
-      case '#':
-      case '/':
-      case '?':
-    return false;
-      }
-    }
-    return true;
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ContextClassloaderLocal.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ContextClassloaderLocalMessages.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.internal.ws.resources;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import com.sun.istack.internal.localization.Localizable;
+import com.sun.istack.internal.localization.LocalizableMessageFactory;
+import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
+import com.sun.istack.internal.localization.Localizer;
+
+
+/**
+ * Defines string formatting method for each constant in the resource file
+ *
+ */
+public final class ContextClassloaderLocalMessages {
+
+    private final static String BUNDLE_NAME = "com.sun.tools.internal.ws.resources.ContextClassloaderLocal";
+    private final static LocalizableMessageFactory MESSAGE_FACTORY = new LocalizableMessageFactory(BUNDLE_NAME, new ContextClassloaderLocalMessages.BundleSupplier());
+    private final static Localizer LOCALIZER = new Localizer();
+
+    public static Localizable localizableFAILED_TO_CREATE_NEW_INSTANCE(Object arg0) {
+        return MESSAGE_FACTORY.getMessage("FAILED_TO_CREATE_NEW_INSTANCE", arg0);
+    }
+
+    /**
+     * Failed to create new instance of {0}
+     *
+     */
+    public static String FAILED_TO_CREATE_NEW_INSTANCE(Object arg0) {
+        return LOCALIZER.localize(localizableFAILED_TO_CREATE_NEW_INSTANCE(arg0));
+    }
+
+    private static class BundleSupplier
+        implements ResourceBundleSupplier
+    {
+
+
+        public ResourceBundle getResourceBundle(Locale locale) {
+            return ResourceBundle.getBundle(BUNDLE_NAME, locale);
+        }
+
+    }
+
+}
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
 # 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,4 +26,4 @@
 build-id=2.3.0-SNAPSHOT
 build-version=JAX-WS RI 2.3.0-SNAPSHOT
 major-version=2.3.0
-svn-revision=5c2c1fd2f2ab3b5c7cea25f79aa49e54cb84b7cc
+svn-revision=e8c5e9697d9b27d83ff35d767939b2f55e667621
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,12 +144,9 @@
     public boolean buildModel(String endpoint, Listener listener) throws BadCommandLineException {
         final ErrorReceiverFilter errReceiver = new ErrorReceiverFilter(listener);
 
-        List<String> args = new ArrayList<String>(6 + (options.nocompile ? 1 : 0)
+        List<String> args = new ArrayList<>(6 + (options.nocompile ? 1 : 0)
                 + (options.encoding != null ? 2 : 0));
 
-        args.add("--add-modules");
-        args.add("java.xml.ws");
-
         args.add("-d");
         args.add(options.destDir.getAbsolutePath());
         args.add("-classpath");
@@ -163,8 +160,27 @@
             args.add("-encoding");
             args.add(options.encoding);
         }
+
+        boolean addModules = true;
         if (options.javacOptions != null) {
-            args.addAll(options.getJavacOptions(args, listener));
+            List<String> javacOptions = options.getJavacOptions(args, listener);
+            for (int i = 0; i < javacOptions.size(); i++) {
+                String opt = javacOptions.get(i);
+                if ("-source".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                    addModules = false;
+                }
+                if ("-target".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                    addModules = false;
+                }
+                if ("--release".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                    addModules = false;
+                }
+                args.add(opt);
+            }
+        }
+        if (addModules) {
+            args.add("--add-modules");
+            args.add("java.xml.ws");
         }
 
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
@@ -227,7 +243,7 @@
             com.sun.xml.internal.ws.db.DatabindingImpl rt = (com.sun.xml.internal.ws.db.DatabindingImpl) fac.createRuntime(config);
 
             final File[] wsdlFileName = new File[1]; // used to capture the generated WSDL file.
-            final Map<String, File> schemaFiles = new HashMap<String, File>();
+            final Map<String, File> schemaFiles = new HashMap<>();
 
             WSDLGenInfo wsdlGenInfo = new WSDLGenInfo();
             wsdlGenInfo.setSecureXmlProcessingDisabled(disableXmlSecurity);
@@ -299,7 +315,7 @@
     }
 
     private List<File> getExternalFiles(List<String> exts) {
-        List<File> files = new ArrayList<File>();
+        List<File> files = new ArrayList<>();
         for (String ext : exts) {
             // first try absolute path ...
             File file = new File(ext);
@@ -341,6 +357,10 @@
         }
     }
 
+    private float getVersion(String s) {
+        return Float.parseFloat(s);
+    }
+
     /**
      * "Namespace" for code needed to generate the report file.
      */
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -246,7 +246,7 @@
     }
 
     private void deleteGeneratedFiles() {
-        Set<File> trackedRootPackages = new HashSet<File>();
+        Set<File> trackedRootPackages = new HashSet<>();
 
         if (options.clientjar != null) {
             //remove all non-java artifacts as they will packaged in jar.
@@ -282,7 +282,7 @@
 
     private void addClassesToGeneratedFiles() throws IOException {
         Iterable<File> generatedFiles = options.getGeneratedFiles();
-        final List<File> trackedClassFiles = new ArrayList<File>();
+        final List<File> trackedClassFiles = new ArrayList<>();
         for(File f: generatedFiles) {
             if(f.getName().endsWith(".java")) {
                 String relativeDir = DirectoryUtil.getRelativePathfromCommonBase(f.getParentFile(),options.sourceDir);
@@ -504,7 +504,7 @@
     }
 
     protected boolean compileGeneratedClasses(ErrorReceiver receiver, WsimportListener listener){
-        List<String> sourceFiles = new ArrayList<String>();
+        List<String> sourceFiles = new ArrayList<>();
 
         for (File f : options.getGeneratedFiles()) {
             if (f.exists() && f.getName().endsWith(".java")) {
@@ -515,10 +515,7 @@
         if (sourceFiles.size() > 0) {
             String classDir = options.destDir.getAbsolutePath();
             String classpathString = createClasspathString();
-            List<String> args = new ArrayList<String>();
-
-            args.add("--add-modules");
-            args.add("java.xml.ws");
+            List<String> args = new ArrayList<>();
 
             args.add("-d");
             args.add(classDir);
@@ -534,8 +531,26 @@
                 args.add(options.encoding);
             }
 
+            boolean addModules = true;
             if (options.javacOptions != null) {
-                args.addAll(options.getJavacOptions(args, listener));
+                List<String> javacOptions = options.getJavacOptions(args, listener);
+                for (int i = 0; i < javacOptions.size(); i++) {
+                    String opt = javacOptions.get(i);
+                    if ("-source".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                        addModules = false;
+                    }
+                    if ("-target".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                        addModules = false;
+                    }
+                    if ("--release".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) {
+                        addModules = false;
+                    }
+                    args.add(opt);
+                }
+            }
+            if (addModules) {
+                args.add("--add-modules");
+                args.add("java.xml.ws");
             }
 
             for (int i = 0; i < sourceFiles.size(); ++i) {
@@ -572,4 +587,8 @@
         System.out.println(WscompileMessages.WSIMPORT_USAGE_EXTENSIONS());
         System.out.println(WscompileMessages.WSIMPORT_USAGE_EXAMPLES());
     }
+
+    private float getVersion(String s) {
+        return Float.parseFloat(s);
+    }
 }
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +25,10 @@
 
 package com.sun.tools.internal.ws.wsdl.parser;
 
+import com.sun.tools.internal.ws.resources.ContextClassloaderLocalMessages;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
 import java.util.WeakHashMap;
 
 /**
@@ -36,9 +36,7 @@
  */
 abstract class ContextClassloaderLocal<V> {
 
-    private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
-
-    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
+    private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<>();
 
     public V get() throws Error {
         ClassLoader tccl = getContextClassLoader();
@@ -60,26 +58,21 @@
         try {
             return initialValue();
         } catch (Exception e) {
-            throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+            throw new Error(ContextClassloaderLocalMessages.FAILED_TO_CREATE_NEW_INSTANCE(getClass().getName()), e);
         }
     }
 
-    private static String format(String property, Object... args) {
-        String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
-        return MessageFormat.format(text, args);
-    }
-
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader cl = null;
-                        try {
-                            cl = Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return cl;
-                    }
-                });
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                ClassLoader cl = null;
+                try {
+                    cl = Thread.currentThread().getContextClassLoader();
+                } catch (SecurityException ex) {
+                }
+                return cl;
+            }
+        });
     }
 }
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.properties	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
--- a/jdk/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -396,6 +396,7 @@
 d27bab22ff62823902d93d1d35ca397cfd50d059 jdk-9+151
 a20f2cf90762673e1bc4980fd6597e70a2578045 jdk-9+152
 1c4411322327aea3f91011ec3977a12a05b09629 jdk-9+153
+f2325d80b37c2817e15039bf64189a08e29c6d39 jdk-10+0
 c97e7a8b8da062b9070df442f9cf308e10845fb7 jdk-9+154
 e170c858888e83d5c0994504599b6ed7a1fb0cfc jdk-9+155
 7d64e541a6c04c714bcad4c8b553db912f827cd5 jdk-9+156
--- a/jdk/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/jdk/make/launcher/Launcher-java.base.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/make/launcher/Launcher-java.base.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -71,102 +71,37 @@
 
 ################################################################################
 
-BUILD_JEXEC :=
-BUILD_JEXEC_SRC :=
-BUILD_JEXEC_INC :=
-BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
-
-#
-# UNHANDLED:
-# - COMPILE_APPROACH = normal
-#
-
-#
-# jdk/make/java/Makefile
-#
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
-    BUILD_JEXEC := 1
-  endif
-endif
-
 ifeq ($(OPENJDK_TARGET_OS), linux)
-  BUILD_JEXEC := 1
-endif # OPENJDK_TARGET_OS
-
-#
-# jdk/make/java/jexec/Makefile
-#
-ifeq ($(BUILD_JEXEC), 1)
-
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-  else ifeq ($(OPENJDK_TARGET_OS), macosx)
-    BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
-  else
-    BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/launcher
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), linux)
-    BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
-    BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/java.base/share/native/libjli
-  endif
-endif
-
-#
-# Note that the two Makefile's seems to contradict each other,
-# and that src/macosx/bin/jexec.c seems unused
-#
-ifneq ($(BUILD_JEXEC_SRC), )
-  $(eval $(call SetupNativeCompilation,BUILD_JEXEC, \
-      SRC := $(BUILD_JEXEC_SRC), \
+  $(eval $(call SetupNativeCompilation, BUILD_JEXEC, \
+      SRC := $(JDK_TOPDIR)/src/$(MODULE)/unix/native/launcher, \
       INCLUDE_FILES := jexec.c, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKEXE) \
-          $(BUILD_JEXEC_INC), \
+          -I$(JDK_TOPDIR)/src/$(MODULE)/share/native/libjli, \
       CFLAGS_linux := -fPIC, \
       CFLAGS_solaris := -KPIC, \
       LDFLAGS := $(LDFLAGS_JDKEXE), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
-      OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
-      PROGRAM := jexec))
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      PROGRAM := jexec, \
+  ))
 
   TARGETS += $(BUILD_JEXEC)
 endif
 
 ################################################################################
 
-BUILD_JSPAWNHELPER :=
-BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/jspawnhelper
-JSPAWNHELPER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/unix/native/libjava
-BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
-LINK_JSPAWNHELPER_OBJECTS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o
-BUILD_JSPAWNHELPER_LDFLAGS :=
-
 ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
-  BUILD_JSPAWNHELPER := 1
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
-endif
-
-ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
-  BUILD_JSPAWNHELPER_LDFLAGS += $(COMPILER_TARGET_BITS_FLAG)64
-endif
-
-ifeq ($(BUILD_JSPAWNHELPER), 1)
-  $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
-      SRC := $(BUILD_JSPAWNHELPER_SRC), \
-      INCLUDE_FILES := jspawnhelper.c, \
+  $(eval $(call SetupNativeCompilation, BUILD_JSPAWNHELPER, \
+      SRC := $(JDK_TOPDIR)/src/$(MODULE)/unix/native/jspawnhelper, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKEXE) $(JSPAWNHELPER_CFLAGS), \
-      LDFLAGS := $(LDFLAGS_JDKEXE) $(BUILD_JSPAWNHELPER_LDFLAGS), \
-      LIBS := $(LINK_JSPAWNHELPER_OBJECTS), \
+      CFLAGS := $(CFLAGS_JDKEXE) -I$(JDK_TOPDIR)/src/$(MODULE)/unix/native/libjava, \
+      EXTRA_OBJECT_FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o, \
+      LDFLAGS := $(LDFLAGS_JDKEXE), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jspawnhelper, \
-      OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
-      PROGRAM := jspawnhelper))
-
-  $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      PROGRAM := jspawnhelper, \
+  ))
 
   TARGETS += $(BUILD_JSPAWNHELPER)
 endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/aix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.ch;
+
+import java.nio.channels.spi.AsynchronousChannelProvider;
+
+/**
+ * Creates this platform's default AsynchronousChannelProvider
+ */
+
+public class DefaultAsynchronousChannelProvider {
+
+    /**
+     * Prevent instantiation.
+     */
+    private DefaultAsynchronousChannelProvider() { }
+
+    /**
+     * Returns the default AsynchronousChannelProvider.
+     */
+    public static AsynchronousChannelProvider create() {
+        return new AixAsynchronousChannelProvider();
+    }
+}
--- a/jdk/src/java.base/aix/classes/sun/nio/ch/DefaultSelectorProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/aix/classes/sun/nio/ch/DefaultSelectorProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
      * Returns the default SelectorProvider.
      */
     public static SelectorProvider create() {
-        return new sun.nio.ch.PollSelectorProvider();
+        return new PollSelectorProvider();
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/linux/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.ch;
+
+import java.nio.channels.spi.AsynchronousChannelProvider;
+
+/**
+ * Creates this platform's default AsynchronousChannelProvider
+ */
+
+public class DefaultAsynchronousChannelProvider {
+
+    /**
+     * Prevent instantiation.
+     */
+    private DefaultAsynchronousChannelProvider() { }
+
+    /**
+     * Returns the default AsynchronousChannelProvider.
+     */
+    public static AsynchronousChannelProvider create() {
+        return new LinuxAsynchronousChannelProvider();
+    }
+}
--- a/jdk/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
      * Returns the default SelectorProvider.
      */
     public static SelectorProvider create() {
-        return new sun.nio.ch.EPollSelectorProvider();
+        return new EPollSelectorProvider();
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/macosx/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.ch;
+
+import java.nio.channels.spi.AsynchronousChannelProvider;
+
+/**
+ * Creates this platform's default AsynchronousChannelProvider
+ */
+
+public class DefaultAsynchronousChannelProvider {
+
+    /**
+     * Prevent instantiation.
+     */
+    private DefaultAsynchronousChannelProvider() { }
+
+    /**
+     * Returns the default AsynchronousChannelProvider.
+     */
+    public static AsynchronousChannelProvider create() {
+        return new BsdAsynchronousChannelProvider();
+    }
+}
--- a/jdk/src/java.base/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/macosx/classes/sun/nio/ch/DefaultSelectorProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
      * Returns the default SelectorProvider.
      */
     public static SelectorProvider create() {
-        return new sun.nio.ch.KQueueSelectorProvider();
+        return new KQueueSelectorProvider();
     }
-
 }
--- a/jdk/src/java.base/macosx/native/launcher/jexec.c	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * jexec for J2SE
- *
- * jexec is used by the system to allow execution of JAR files.
- *    Essentially jexec needs to run java and
- *    needs to be a native ISA executable (not a shell script), although
- *    this native ISA executable requirement was a mistake that will be fixed.
- *    (<ISA> is sparc or i386 or amd64).
- *
- *    When you execute a jar file, jexec is executed by the system as follows:
- *      /usr/java/jre/lib/<ISA>/jexec -jar JARFILENAME
- *    so this just needs to be turned into:
- *      /usr/java/jre/bin/java -jar JARFILENAME
- *
- * Solaris systems (new 7's and all 8's) will be looking for jexec at:
- *      /usr/java/jre/lib/<ISA>/jexec
- * Older systems may need to add this to their /etc/system file:
- *      set javaexec:jexec="/usr/java/jre/lib/<ISA>/jexec"
- *     and reboot the machine for this to work.
- *
- * This source should be compiled as:
- *      cc -o jexec jexec.c
- *
- * And jexec should be placed at the following location of the installation:
- *      <INSTALLATIONDIR>/jre/lib/<ISA>/jexec  (for Solaris)
- *      <INSTALLATIONDIR>/lib/jexec            (for Linux)
- *
- * NOTE: Unless <INSTALLATIONDIR> is the "default" JDK on the system
- *       (i.e. /usr/java -> <INSTALLATIONDIR>), this jexec will not be
- *       found.  The 1.2 java is only the default on Solaris 8 and
- *       on systems where the 1.2 packages were installed and no 1.1
- *       java was found.
- *
- * NOTE: You must use 1.2 jar to build your jar files. The system
- *       doesn't seem to pick up 1.1 jar files.
- *
- * NOTE: We don't need to set LD_LIBRARY_PATH here, even though we
- *       are running the actual java binary because the java binary will
- *       look for it's libraries through it's own runpath, which uses
- *       $ORIGIN.
- *
- * NOTE: This jexec should NOT have any special .so library needs because
- *       it appears that this executable will NOT get the $ORIGIN of jexec
- *       but the $ORIGIN of the jar file being executed. Be careful to keep
- *       this program simple and with no .so dependencies.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-
-static const int CRAZY_EXEC = ENOEXEC;
-static const int BAD_MAGIC  = ENOEXEC;
-
-static const char * BAD_EXEC_MSG     = "jexec failed";
-static const char * CRAZY_EXEC_MSG   = "missing args";
-static const char * MISSING_JAVA_MSG = "can't locate java";
-static const char * UNKNOWN_ERROR    = "unknown error";
-
-/* Define a constant that represents the number of directories to pop off the
- * current location to find the java binary */
-static const int RELATIVE_DEPTH = 3;
-
-/* path to java after popping */
-static const char * BIN_PATH = "/bin/java";
-
-/* flag used when running JAR files */
-static const char * JAR_FLAG = "-jar";
-
-int main(int argc, const char * argv[]);
-void errorExit(int error, const char * message);
-int getJavaPath(const char * path, char * buf, int depth);
-
-/*
- * This is the main entry point.  This program (jexec) will attempt to execute
- * a JAR file by finding the Java program (java), relative to its own location.
- * The exact location of the Java program depends on the platform, i.e.
- *
- *      <INSTALLATIONDIR>/jre/lib/<ISA>/jexec  (for Solaris)
- *      <INSTALLATIONDIR>/lib/jexec            (for Linux JDK)
- *
- * Once the Java program is found, this program copies any remaining arguments
- * into another array, which is then used to exec the Java program.
- *
- * On Linux this program does some additional steps.  When copying the array of
- * args, it is necessary to insert the "-jar" flag between arg[0], the program
- * name, and the original arg[1], which is presumed to be a path to a JAR file.
- * It is also necessary to verify that the original arg[1] really is a JAR file.
- * (These steps are unnecessary on Solaris because they are taken care of by
- * the kernel.)
- */
-int main(int argc, const char * argv[]) {
-    /* We need to exec the original arguments using java, instead of jexec.
-     * Also, for Linux, it is necessary to add the "-jar" argument between
-     * the new arg[0], and the old arg[1].  To do this we will create a new
-     * args array. */
-    char          java[PATH_MAX + 1];    /* path to java binary  */
-    const char ** nargv = NULL;          /* new args array       */
-    int           nargc = 0;             /* new args array count */
-    int           argi  = 0;             /* index into old array */
-
-    /* Make sure we have something to work with */
-    if ((argc < 1) || (argv == NULL)) {
-        /* Shouldn't happen... */
-        errorExit(CRAZY_EXEC, CRAZY_EXEC_MSG);
-    }
-
-    /* Get the path to the java binary, which is in a known position relative
-     * to our current position, which is in argv[0]. */
-    if (getJavaPath(argv[argi++], java, RELATIVE_DEPTH) != 0) {
-        errorExit(errno, MISSING_JAVA_MSG);
-    }
-
-    nargv = (const char **) malloc((argc + 2) * (sizeof (const char *)));
-    nargv[nargc++] = java;
-
-    if (argc >= 2) {
-        const char * jarfile = argv[argi++];
-        const char * message = NULL;
-
-        /* the next argument is the path to the JAR file */
-        nargv[nargc++] = jarfile;
-    }
-
-    /* finally copy any remaining arguments */
-    while (argi < argc) {
-        nargv[nargc++] = argv[argi++];
-    }
-
-    /* finally add one last terminating null */
-    nargv[nargc++] = NULL;
-
-    /* It's time to exec the java binary with the new arguments.  It
-     * is possible that we've reached this point without actually
-     * having a JAR file argument (i.e. if argc < 2), but we still
-     * want to exec the java binary, since that will take care of
-     * displaying the correct usage. */
-    execv(java, (char * const *) nargv);
-
-    /* If the exec worked, this process would have been replaced
-     * by the new process.  So any code reached beyond this point
-     * implies an error in the exec. */
-    free(nargv);
-    errorExit(errno, BAD_EXEC_MSG);
-    return 0; // keep the compiler happy
-}
-
-
-/*
- * Exit the application by setting errno, and writing a message.
- *
- * Parameters:
- *     error   - errno is set to this value, and it is used to exit.
- *     message - the message to write.
- */
-void errorExit(int error, const char * message) {
-    if (error != 0) {
-        errno = error;
-        perror((message != NULL) ? message : UNKNOWN_ERROR);
-    }
-
-    exit((error == 0) ? 0 : 1);
-}
-
-
-/*
- * Get the path to the java binary that should be relative to the current path.
- *
- * Parameters:
- *     path  - the input path that the java binary that should be relative to.
- *     buf   - a buffer of size PATH_MAX or greater that the java path is
- *             copied to.
- *     depth - the number of names to trim off the current path, including the
- *             name of this program.
- *
- * Returns:
- *     This function returns 0 on success; otherwise it returns the value of
- *     errno.
- */
-int getJavaPath(const char * path, char * buf, int depth) {
-    int result = 0;
-
-    /* Get the full path to this program.  Depending on whether this is Solaris
-     * or Linux, this will be something like,
-     *
-     *     <FOO>/jre/lib/<ISA>/jexec  (for Solaris)
-     *     <FOO>/lib/jexec            (for Linux)
-     */
-    if (realpath(path, buf) != NULL) {
-        int count = 0;
-
-        /* Pop off the filename, and then subdirectories for each level of
-         * depth */
-        for (count = 0; count < depth; count++) {
-            *(strrchr(buf, '/')) = '\0';
-        }
-
-        /* Append the relative location of java, creating something like,
-         *
-         *     <FOO>/jre/bin/java  (for Solaris)
-         *     <FOO>/bin/java      (for Linux)
-         */
-        strcat(buf, BIN_PATH);
-    }
-    else {
-        /* Failed to get the path */
-        result = errno;
-    }
-
-    return (result);
-}
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Mon Mar 13 19:58:52 2017 +0000
@@ -534,6 +534,8 @@
      * @param x object for which the hashCode is to be calculated
      * @return  the hashCode
      * @since   1.1
+     * @see Object#hashCode
+     * @see java.util.Objects#hashCode(Object)
      */
     @HotSpotIntrinsicCandidate
     public static native int identityHashCode(Object x);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Mon Mar 13 19:58:52 2017 +0000
@@ -98,21 +98,17 @@
                                         Object constraint,
                                         NamedFunction getTargetFn) {
         // No pre-action needed.
-        return makeReinvokerForm(target, whichCache, constraint, null, true, getTargetFn, null);
+        return makeReinvokerForm(target, whichCache, constraint, true, getTargetFn, null);
     }
     /** Create a LF which simply reinvokes a target of the given basic type. */
     static LambdaForm makeReinvokerForm(MethodHandle target,
                                         int whichCache,
                                         Object constraint,
-                                        String debugString,
                                         boolean forceInline,
                                         NamedFunction getTargetFn,
                                         NamedFunction preActionFn) {
         MethodType mtype = target.type().basicType();
         Kind kind = whichKind(whichCache);
-        if (debugString == null) {
-            debugString = kind.defaultLambdaName;
-        }
         boolean customized = (whichCache < 0 ||
                 mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY);
         boolean hasPreAction = (preActionFn != null);
@@ -144,7 +140,7 @@
             targetArgs[0] = names[NEXT_MH];  // overwrite this MH with next MH
             names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs);
         }
-        form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline, kind);
+        form = new LambdaForm(ARG_LIMIT, names, forceInline, kind);
         if (!customized) {
             form = mtype.form().setCachedLambdaForm(whichCache, form);
         }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Mon Mar 13 19:58:52 2017 +0000
@@ -242,8 +242,7 @@
             result = NEW_OBJ;
         }
         names[LINKER_CALL] = new Name(linker, outArgs);
-        String lambdaName = kind.defaultLambdaName + "_" + shortenSignature(basicTypeSignature(mtype));
-        LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result, kind);
+        LambdaForm lform = new LambdaForm(ARG_LIMIT, names, result, kind);
 
         // This is a tricky bit of code.  Don't send it through the LF interpreter.
         lform.compileToBytecode();
@@ -696,22 +695,33 @@
         if (needsCast && isGetter)
             names[POST_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[LINKER_CALL]);
         for (Name n : names)  assert(n != null);
-        // add some detail to the lambdaForm debugname,
-        // significant only for debugging
-        StringBuilder nameBuilder = new StringBuilder(kind.methodName);
-        if (isStatic) {
-            nameBuilder.append("Static");
-        } else {
-            nameBuilder.append("Field");
-        }
-        if (needsCast)  nameBuilder.append("Cast");
-        if (needsInit)  nameBuilder.append("Init");
+
+        LambdaForm form;
         if (needsCast || needsInit) {
             // can't use the pre-generated form when casting and/or initializing
-            return new LambdaForm(nameBuilder.toString(), ARG_LIMIT, names, RESULT);
+            form = new LambdaForm(ARG_LIMIT, names, RESULT);
         } else {
-            return new LambdaForm(nameBuilder.toString(), ARG_LIMIT, names, RESULT, kind);
+            form = new LambdaForm(ARG_LIMIT, names, RESULT, kind);
         }
+
+        if (LambdaForm.debugNames()) {
+            // add some detail to the lambdaForm debugname,
+            // significant only for debugging
+            StringBuilder nameBuilder = new StringBuilder(kind.methodName);
+            if (isStatic) {
+                nameBuilder.append("Static");
+            } else {
+                nameBuilder.append("Field");
+            }
+            if (needsCast) {
+                nameBuilder.append("Cast");
+            }
+            if (needsInit) {
+                nameBuilder.append("Init");
+            }
+            LambdaForm.associateWithDebugName(form, nameBuilder.toString());
+        }
+        return form;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Mon Mar 13 19:58:52 2017 +0000
@@ -130,7 +130,7 @@
 
     /** For generating customized code for a single LambdaForm. */
     private InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
-        this(className, form.debugName, form, invokerType);
+        this(className, form.lambdaName(), form, invokerType);
     }
 
     /** For generating customized code for a single LambdaForm. */
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Mon Mar 13 19:58:52 2017 +0000
@@ -132,7 +132,7 @@
         MethodType mtype = targetType;
         MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
 
-        LambdaForm lform = varHandleMethodInvokerHandleForm(ak.methodName(), mtype, isExact);
+        LambdaForm lform = varHandleMethodInvokerHandleForm(ak, mtype, isExact);
         VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
         MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
 
@@ -325,9 +325,9 @@
         }
         names[LINKER_CALL] = new Name(outCallType, outArgs);
         if (customized) {
-            lform = new LambdaForm(kind.defaultLambdaName, INARG_LIMIT, names);
+            lform = new LambdaForm(INARG_LIMIT, names);
         } else {
-            lform = new LambdaForm(kind.defaultLambdaName, INARG_LIMIT, names, kind);
+            lform = new LambdaForm(INARG_LIMIT, names, kind);
         }
         if (isLinker)
             lform.compileToBytecode();  // JVM needs a real methodOop
@@ -337,11 +337,10 @@
     }
 
 
-    static MemberName varHandleInvokeLinkerMethod(String name,
-                                                  MethodType mtype) {
+    static MemberName varHandleInvokeLinkerMethod(VarHandle.AccessMode ak, MethodType mtype) {
         LambdaForm lform;
         if (mtype.parameterSlotCount() <= MethodType.MAX_MH_ARITY - MH_LINKER_ARG_APPENDED) {
-            lform = varHandleMethodGenericLinkerHandleForm(name, mtype);
+            lform = varHandleMethodGenericLinkerHandleForm(ak, mtype);
         } else {
             // TODO
             throw newInternalError("Unsupported parameter slot count " + mtype.parameterSlotCount());
@@ -349,7 +348,8 @@
         return lform.vmentry;
     }
 
-    private static LambdaForm varHandleMethodGenericLinkerHandleForm(String name, MethodType mtype) {
+    private static LambdaForm varHandleMethodGenericLinkerHandleForm(VarHandle.AccessMode ak,
+            MethodType mtype) {
         // TODO Cache form?
 
         final int THIS_VH      = 0;
@@ -383,14 +383,18 @@
         MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class)
                 .basicType();
         names[LINKER_CALL] = new Name(outCallType, outArgs);
-        LambdaForm lform = new LambdaForm(name + ":VarHandle_invoke_MT_" + shortenSignature(basicTypeSignature(mtype)),
-                                          ARG_LIMIT + 1, names);
-
+        LambdaForm lform = new LambdaForm(ARG_LIMIT + 1, names, VARHANDLE_LINKER);
+        if (LambdaForm.debugNames()) {
+            String name = ak.methodName() + ":VarHandle_invoke_MT_" +
+                    shortenSignature(basicTypeSignature(mtype));
+            LambdaForm.associateWithDebugName(lform, name);
+        }
         lform.compileToBytecode();
         return lform;
     }
 
-    private static LambdaForm varHandleMethodInvokerHandleForm(String name, MethodType mtype, boolean isExact) {
+    private static LambdaForm varHandleMethodInvokerHandleForm(VarHandle.AccessMode ak,
+            MethodType mtype, boolean isExact) {
         // TODO Cache form?
 
         final int THIS_MH      = 0;
@@ -429,10 +433,14 @@
         MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class)
                 .basicType();
         names[LINKER_CALL] = new Name(outCallType, outArgs);
-        String debugName = isExact ? ":VarHandle_exactInvoker" : ":VarHandle_invoker";
-        LambdaForm lform = new LambdaForm(name + debugName + shortenSignature(basicTypeSignature(mtype)),
-                                          ARG_LIMIT, names);
-
+        Kind kind = isExact ? VARHANDLE_EXACT_INVOKER : VARHANDLE_INVOKER;
+        LambdaForm lform = new LambdaForm(ARG_LIMIT, names, kind);
+        if (LambdaForm.debugNames()) {
+            String name = ak.methodName() +
+                    (isExact ? ":VarHandle_exactInvoker_" : ":VarHandle_invoker_") +
+                    shortenSignature(basicTypeSignature(mtype));
+            LambdaForm.associateWithDebugName(lform, name);
+        }
         lform.prepare();
         return lform;
     }
@@ -543,7 +551,8 @@
         System.arraycopy(outArgs, 0, outArgs, PREPEND_COUNT, outArgs.length - PREPEND_COUNT);
         outArgs[PREPEND_MH] = names[CALL_MH];
         names[LINKER_CALL] = new Name(mtype, outArgs);
-        lform = new LambdaForm((skipCallSite ? "linkToTargetMethod" : "linkToCallSite"), INARG_LIMIT, names);
+        lform = new LambdaForm(INARG_LIMIT, names,
+                (skipCallSite ? LINK_TO_TARGET_METHOD : LINK_TO_CALL_SITE));
         lform.compileToBytecode();  // JVM needs a real methodOop
         lform = mtype.form().setCachedLambdaForm(which, lform);
         return lform;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,6 @@
     final boolean forceInline;
     final MethodHandle customized;
     @Stable final Name[] names;
-    final String debugName;
     final Kind kind;
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
@@ -268,7 +267,7 @@
     }
 
     enum Kind {
-        GENERIC(""),
+        GENERIC("invoke"),
         ZERO("zero"),
         IDENTITY("identity"),
         BOUND_REINVOKER("BMH.reinvoke"),
@@ -278,6 +277,8 @@
         EXACT_INVOKER("MH.exactInvoker"),
         GENERIC_LINKER("MH.invoke_MT"),
         GENERIC_INVOKER("MH.invoker"),
+        LINK_TO_TARGET_METHOD("linkToTargetMethod"),
+        LINK_TO_CALL_SITE("linkToCallSite"),
         DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual"),
         DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial"),
         DIRECT_INVOKE_STATIC("DMH.invokeStatic"),
@@ -319,7 +320,18 @@
         GET_DOUBLE("getDouble"),
         PUT_DOUBLE("putDouble"),
         GET_DOUBLE_VOLATILE("getDoubleVolatile"),
-        PUT_DOUBLE_VOLATILE("putDoubleVolatile");
+        PUT_DOUBLE_VOLATILE("putDoubleVolatile"),
+        TRY_FINALLY("tryFinally"),
+        COLLECT("collect"),
+        CONVERT("convert"),
+        SPREAD("spread"),
+        LOOP("loop"),
+        FIELD("field"),
+        GUARD("guard"),
+        GUARD_WITH_CATCH("guardWithCatch"),
+        VARHANDLE_EXACT_INVOKER("VH.exactInvoker"),
+        VARHANDLE_INVOKER("VH.invoker"),
+        VARHANDLE_LINKER("VH.invoke_MT");
 
         final String defaultLambdaName;
         final String methodName;
@@ -335,25 +347,20 @@
         }
     }
 
-    LambdaForm(String debugName,
-               int arity, Name[] names, int result) {
-        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
+    LambdaForm(int arity, Name[] names, int result) {
+        this(arity, names, result, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, int result, Kind kind) {
-        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, kind);
+    LambdaForm(int arity, Name[] names, int result, Kind kind) {
+        this(arity, names, result, /*forceInline=*/true, /*customized=*/null, kind);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
-        this(debugName, arity, names, result, forceInline, customized, Kind.GENERIC);
+    LambdaForm(int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
+        this(arity, names, result, forceInline, customized, Kind.GENERIC);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, int result, boolean forceInline, MethodHandle customized, Kind kind) {
+    LambdaForm(int arity, Name[] names, int result, boolean forceInline, MethodHandle customized, Kind kind) {
         assert(namesOK(arity, names));
         this.arity = arity;
         this.result = fixResult(result, names);
         this.names = names.clone();
-        this.debugName = fixDebugName(debugName);
         this.forceInline = forceInline;
         this.customized = customized;
         this.kind = kind;
@@ -364,31 +371,23 @@
             compileToBytecode();
         }
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names) {
-        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
+    LambdaForm(int arity, Name[] names) {
+        this(arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, Kind kind) {
-        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, kind);
+    LambdaForm(int arity, Name[] names, Kind kind) {
+        this(arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, kind);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, boolean forceInline) {
-        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
+    LambdaForm(int arity, Name[] names, boolean forceInline) {
+        this(arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
     }
-    LambdaForm(String debugName,
-               int arity, Name[] names, boolean forceInline, Kind kind) {
-        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, kind);
+    LambdaForm(int arity, Name[] names, boolean forceInline, Kind kind) {
+        this(arity, names, LAST_RESULT, forceInline, /*customized=*/null, kind);
     }
-    LambdaForm(String debugName,
-               Name[] formals, Name[] temps, Name result) {
-        this(debugName,
-             formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
+    LambdaForm(Name[] formals, Name[] temps, Name result) {
+        this(formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
     }
-    LambdaForm(String debugName,
-               Name[] formals, Name[] temps, Name result, boolean forceInline) {
-        this(debugName,
-             formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*customized=*/null);
+    LambdaForm(Name[] formals, Name[] temps, Name result, boolean forceInline) {
+        this(formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*customized=*/null);
     }
 
     private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
@@ -408,10 +407,9 @@
         this.arity = mt.parameterCount();
         this.result = (mt.returnType() == void.class || mt.returnType() == Void.class) ? -1 : arity;
         this.names = buildEmptyNames(arity, mt, result == -1);
-        this.debugName = "LF.zero";
         this.forceInline = true;
         this.customized = null;
-        this.kind = Kind.GENERIC;
+        this.kind = Kind.ZERO;
         assert(nameRefsAreLegal());
         assert(isEmpty());
         String sig = null;
@@ -436,36 +434,46 @@
         return result;
     }
 
-    private static String fixDebugName(String debugName) {
-        if (DEBUG_NAME_COUNTERS != null) {
-            int under = debugName.indexOf('_');
-            int length = debugName.length();
-            if (under < 0)  under = length;
-            String debugNameStem = debugName.substring(0, under);
-            Integer ctr;
-            synchronized (DEBUG_NAME_COUNTERS) {
-                ctr = DEBUG_NAME_COUNTERS.get(debugNameStem);
-                if (ctr == null)  ctr = 0;
-                DEBUG_NAME_COUNTERS.put(debugNameStem, ctr+1);
+    static boolean debugNames() {
+        return DEBUG_NAME_COUNTERS != null;
+    }
+
+    static void associateWithDebugName(LambdaForm form, String name) {
+        assert (debugNames());
+        synchronized (DEBUG_NAMES) {
+            DEBUG_NAMES.put(form, name);
+        }
+    }
+
+    String lambdaName() {
+        if (DEBUG_NAMES != null) {
+            synchronized (DEBUG_NAMES) {
+                String name = DEBUG_NAMES.get(this);
+                if (name == null) {
+                    name = generateDebugName();
+                }
+                return name;
             }
-            StringBuilder buf = new StringBuilder(debugNameStem);
-            buf.append('_');
-            int leadingZero = buf.length();
-            buf.append((int) ctr);
-            for (int i = buf.length() - leadingZero; i < 3; i++)
-                buf.insert(leadingZero, '0');
-            if (under < length) {
-                ++under;    // skip "_"
-                while (under < length && Character.isDigit(debugName.charAt(under))) {
-                    ++under;
-                }
-                if (under < length && debugName.charAt(under) == '_')  ++under;
-                if (under < length)
-                    buf.append('_').append(debugName, under, length);
-            }
-            return buf.toString();
         }
-        return debugName;
+        return kind.defaultLambdaName;
+    }
+
+    private String generateDebugName() {
+        assert (debugNames());
+        String debugNameStem = kind.defaultLambdaName;
+        Integer ctr = DEBUG_NAME_COUNTERS.getOrDefault(debugNameStem, 0);
+        DEBUG_NAME_COUNTERS.put(debugNameStem, ctr + 1);
+        StringBuilder buf = new StringBuilder(debugNameStem);
+        int leadingZero = buf.length();
+        buf.append((int) ctr);
+        for (int i = buf.length() - leadingZero; i < 3; i++) {
+            buf.insert(leadingZero, '0');
+        }
+        buf.append('_');
+        buf.append(basicTypeSignature());
+        String name = buf.toString();
+        associateWithDebugName(this, name);
+        return name;
     }
 
     private static boolean namesOK(int arity, Name[] names) {
@@ -482,7 +490,7 @@
 
     /** Customize LambdaForm for a particular MethodHandle */
     LambdaForm customize(MethodHandle mh) {
-        LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh, kind);
+        LambdaForm customForm = new LambdaForm(arity, names, result, forceInline, mh, kind);
         if (COMPILE_THRESHOLD >= 0 && isCompiled) {
             // If shared LambdaForm has been compiled, compile customized version as well.
             customForm.compileToBytecode();
@@ -1030,7 +1038,8 @@
     }
 
     public String toString() {
-        StringBuilder buf = new StringBuilder(debugName+"=Lambda(");
+        String lambdaName = lambdaName();
+        StringBuilder buf = new StringBuilder(lambdaName + "=Lambda(");
         for (int i = 0; i < names.length; i++) {
             if (i == arity)  buf.append(")=>{");
             Name n = names[i];
@@ -1742,7 +1751,7 @@
         // bootstrap dependency on this method in case we're interpreting LFs
         if (isVoid) {
             Name[] idNames = new Name[] { argument(0, L_TYPE) };
-            idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT, Kind.IDENTITY);
+            idForm = new LambdaForm(1, idNames, VOID_RESULT, Kind.IDENTITY);
             idForm.compileToBytecode();
             idFun = new NamedFunction(idMem, SimpleMethodHandle.make(idMem.getInvocationType(), idForm));
 
@@ -1750,14 +1759,14 @@
             zeFun = idFun;
         } else {
             Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) };
-            idForm = new LambdaForm(idMem.getName(), 2, idNames, 1, Kind.IDENTITY);
+            idForm = new LambdaForm(2, idNames, 1, Kind.IDENTITY);
             idForm.compileToBytecode();
             idFun = new NamedFunction(idMem, MethodHandleImpl.makeIntrinsic(
                     idMem.getInvocationType(), idForm, MethodHandleImpl.Intrinsic.IDENTITY));
 
             Object zeValue = Wrapper.forBasicType(btChar).zero();
             Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) };
-            zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1, Kind.ZERO);
+            zeForm = new LambdaForm(1, zeNames, 1, Kind.ZERO);
             zeForm.compileToBytecode();
             zeFun = new NamedFunction(zeMem, MethodHandleImpl.makeIntrinsic(
                     zeMem.getInvocationType(), zeForm, MethodHandleImpl.Intrinsic.ZERO));
@@ -1805,11 +1814,15 @@
     }
 
     private static final HashMap<String,Integer> DEBUG_NAME_COUNTERS;
+    private static final HashMap<LambdaForm,String> DEBUG_NAMES;
     static {
-        if (debugEnabled())
+        if (debugEnabled()) {
             DEBUG_NAME_COUNTERS = new HashMap<>();
-        else
+            DEBUG_NAMES = new HashMap<>();
+        } else {
             DEBUG_NAME_COUNTERS = null;
+            DEBUG_NAMES = null;
+        }
     }
 
     static {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -40,7 +40,6 @@
     private byte flags;
     private int firstChange;
     private Name resultName;
-    private String debugName;
     private ArrayList<Name> dups;
 
     private static final int F_TRANS = 0x10, F_OWNED = 0x03;
@@ -50,15 +49,15 @@
         setNames(lf.names);
         int result = lf.result;
         if (result == LAST_RESULT)  result = length - 1;
-        if (result >= 0 && lf.names[result].type != V_TYPE)
+        if (result >= 0 && lf.names[result].type != V_TYPE) {
             resultName = lf.names[result];
-        debugName = lf.debugName;
+        }
         assert(lf.nameRefsAreLegal());
     }
 
     private LambdaForm lambdaForm() {
         assert(!inTrans());  // need endEdit call to tidy things up
-        return new LambdaForm(debugName, arity, nameArray(), resultIndex());
+        return new LambdaForm(arity, nameArray(), resultIndex());
     }
 
     Name name(int i) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Mon Mar 13 19:58:52 2017 +0000
@@ -915,7 +915,7 @@
             }
         }
 
-        form = new LambdaForm(lambdaForm.debugName, arity2, names2, result2);
+        form = new LambdaForm(arity2, names2, result2);
         return putInCache(key, form);
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -399,7 +399,7 @@
             assert(RETURN_CONV == names.length-1);
         }
 
-        LambdaForm form = new LambdaForm("convert", lambdaType.parameterCount(), names, RESULT);
+        LambdaForm form = new LambdaForm(lambdaType.parameterCount(), names, RESULT, Kind.CONVERT);
         return SimpleMethodHandle.make(srcType, form);
     }
 
@@ -608,7 +608,7 @@
         }
         names[names.length - 1] = new Name(target, (Object[]) targetArgs);
 
-        LambdaForm form = new LambdaForm("spread", lambdaType.parameterCount(), names);
+        LambdaForm form = new LambdaForm(lambdaType.parameterCount(), names, Kind.SPREAD);
         return SimpleMethodHandle.make(srcType, form);
     }
 
@@ -676,7 +676,7 @@
         assert(inputArgPos + chunk == collectNamePos);  // use of rest of input args also
         names[targetNamePos] = new Name(target, (Object[]) targetArgs);
 
-        LambdaForm form = new LambdaForm("collect", lambdaType.parameterCount(), names);
+        LambdaForm form = new LambdaForm(lambdaType.parameterCount(), names, Kind.COLLECT);
         return SimpleMethodHandle.make(srcType, form);
     }
 
@@ -774,7 +774,7 @@
             @Override
             public LambdaForm apply(MethodHandle target) {
                 return DelegatingMethodHandle.makeReinvokerForm(target,
-                                   MethodTypeForm.LF_DELEGATE_BLOCK_INLINING, CountingWrapper.class, "reinvoker.dontInline", false,
+                                   MethodTypeForm.LF_DELEGATE_BLOCK_INLINING, CountingWrapper.class, false,
                                    DelegatingMethodHandle.NF_getTarget, CountingWrapper.NF_maybeStopCounting);
             }
         };
@@ -943,7 +943,7 @@
         invokeArgs[0] = names[SELECT_ALT];
         names[CALL_TARGET] = new Name(basicType, invokeArgs);
 
-        lform = new LambdaForm("guard", lambdaType.parameterCount(), names, /*forceInline=*/true);
+        lform = new LambdaForm(lambdaType.parameterCount(), names, /*forceInline=*/true, Kind.GUARD);
 
         return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
     }
@@ -1019,7 +1019,7 @@
         Object[] unboxArgs  = new Object[] {names[GET_UNBOX_RESULT], names[TRY_CATCH]};
         names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
 
-        lform = new LambdaForm("guardWithCatch", lambdaType.parameterCount(), names);
+        lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.GUARD_WITH_CATCH);
 
         return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
     }
@@ -1886,7 +1886,7 @@
             names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
 
             lform = basicType.form().setCachedLambdaForm(MethodTypeForm.LF_LOOP,
-                    new LambdaForm("loop", lambdaType.parameterCount(), names));
+                    new LambdaForm(lambdaType.parameterCount(), names, Kind.LOOP));
         }
 
         // BOXED_ARGS is the index into the names array where the loop idiom starts
@@ -2120,7 +2120,7 @@
         Object[] unboxArgs  = new Object[] {names[GET_UNBOX_RESULT], names[TRY_FINALLY]};
         names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
 
-        lform = new LambdaForm("tryFinally", lambdaType.parameterCount(), names);
+        lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.TRY_FINALLY);
 
         return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_TF, lform);
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Mon Mar 13 19:58:52 2017 +0000
@@ -420,7 +420,7 @@
                                                              MethodType mtype,
                                                              Object[] appendixResult) {
         // Get the signature method type
-        MethodType sigType = mtype.basicType();
+        final MethodType sigType = mtype.basicType();
 
         // Get the access kind from the method name
         VarHandle.AccessMode ak;
@@ -430,32 +430,37 @@
             throw MethodHandleStatics.newInternalError(e);
         }
 
-        // If not polymorphic in the return type, such as the compareAndSet
-        // methods that return boolean
-        if (ak.at.isMonomorphicInReturnType) {
-            if (ak.at.returnType != mtype.returnType()) {
-                // The caller contains a different return type than that
-                // defined by the method
-                throw newNoSuchMethodErrorOnVarHandle(name, mtype);
-            }
-            // Adjust the return type of the signature method type
-            sigType = sigType.changeReturnType(ak.at.returnType);
-        }
-
-        // Get the guard method type for linking
-        MethodType guardType = sigType
-                // VarHandle at start
-                .insertParameterTypes(0, VarHandle.class)
-                // Access descriptor at end
-                .appendParameterTypes(VarHandle.AccessDescriptor.class);
-
         // Create the appendix descriptor constant
         VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
         appendixResult[0] = ad;
 
         if (MethodHandleStatics.VAR_HANDLE_GUARDS) {
+            // If not polymorphic in the return type, such as the compareAndSet
+            // methods that return boolean
+            Class<?> guardReturnType = sigType.returnType();
+            if (ak.at.isMonomorphicInReturnType) {
+                if (ak.at.returnType != mtype.returnType()) {
+                    // The caller contains a different return type than that
+                    // defined by the method
+                    throw newNoSuchMethodErrorOnVarHandle(name, mtype);
+                }
+                // Adjust the return type of the signature method type
+                guardReturnType = ak.at.returnType;
+            }
+
+            // Get the guard method type for linking
+            final Class<?>[] guardParams = new Class<?>[sigType.parameterCount() + 2];
+            // VarHandle at start
+            guardParams[0] = VarHandle.class;
+            for (int i = 0; i < sigType.parameterCount(); i++) {
+                guardParams[i + 1] = sigType.parameterType(i);
+            }
+            // Access descriptor at end
+            guardParams[guardParams.length - 1] = VarHandle.AccessDescriptor.class;
+            MethodType guardType = MethodType.makeImpl(guardReturnType, guardParams, true);
+
             MemberName linker = new MemberName(
-                    VarHandleGuards.class, "guard_" + getVarHandleMethodSignature(sigType),
+                    VarHandleGuards.class, getVarHandleGuardMethodName(guardType),
                     guardType, REF_invokeStatic);
 
             linker = MemberName.getFactory().resolveOrNull(REF_invokeStatic, linker,
@@ -466,16 +471,18 @@
             // Fall back to lambda form linkage if guard method is not available
             // TODO Optionally log fallback ?
         }
-        return Invokers.varHandleInvokeLinkerMethod(name, mtype);
+        return Invokers.varHandleInvokeLinkerMethod(ak, mtype);
     }
-    static String getVarHandleMethodSignature(MethodType mt) {
-        StringBuilder sb = new StringBuilder(mt.parameterCount() + 2);
+    static String getVarHandleGuardMethodName(MethodType guardType) {
+        String prefix = "guard_";
+        StringBuilder sb = new StringBuilder(prefix.length() + guardType.parameterCount());
 
-        for (int i = 0; i < mt.parameterCount(); i++) {
-            Class<?> pt = mt.parameterType(i);
+        sb.append(prefix);
+        for (int i = 1; i < guardType.parameterCount() - 1; i++) {
+            Class<?> pt = guardType.parameterType(i);
             sb.append(getCharType(pt));
         }
-        sb.append('_').append(getCharType(mt.returnType()));
+        sb.append('_').append(getCharType(guardType.returnType()));
         return sb.toString();
     }
     static char getCharType(Class<?> pt) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.ch;
+
+import java.nio.channels.spi.AsynchronousChannelProvider;
+
+/**
+ * Creates this platform's default AsynchronousChannelProvider
+ */
+
+public class DefaultAsynchronousChannelProvider {
+
+    /**
+     * Prevent instantiation.
+     */
+    private DefaultAsynchronousChannelProvider() { }
+
+    /**
+     * Returns the default AsynchronousChannelProvider.
+     */
+    public static AsynchronousChannelProvider create() {
+        return new SolarisAsynchronousChannelProvider();
+    }
+}
--- a/jdk/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
      * Returns the default SelectorProvider.
      */
     public static SelectorProvider create() {
-        return new sun.nio.ch.DevPollSelectorProvider();
+        return new DevPollSelectorProvider();
     }
-
 }
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.ch;
-
-import java.nio.channels.spi.AsynchronousChannelProvider;
-import sun.security.action.GetPropertyAction;
-
-/**
- * Creates this platform's default asynchronous channel provider
- */
-
-public class DefaultAsynchronousChannelProvider {
-
-    /**
-     * Prevent instantiation.
-     */
-    private DefaultAsynchronousChannelProvider() { }
-
-    @SuppressWarnings("unchecked")
-    private static AsynchronousChannelProvider createProvider(String cn) {
-        Class<AsynchronousChannelProvider> c;
-        try {
-            c = (Class<AsynchronousChannelProvider>)Class.forName(cn);
-        } catch (ClassNotFoundException x) {
-            throw new AssertionError(x);
-        }
-        try {
-            @SuppressWarnings("deprecation")
-            AsynchronousChannelProvider result = c.newInstance();
-            return result;
-        } catch (IllegalAccessException | InstantiationException x) {
-            throw new AssertionError(x);
-        }
-
-    }
-
-    /**
-     * Returns the default AsynchronousChannelProvider.
-     */
-    public static AsynchronousChannelProvider create() {
-        String osname = GetPropertyAction.privilegedGetProperty("os.name");
-        if (osname.equals("SunOS"))
-            return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
-        if (osname.equals("Linux"))
-            return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
-        if (osname.contains("OS X"))
-            return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
-        if (osname.equals("AIX"))
-            return createProvider("sun.nio.ch.AixAsynchronousChannelProvider");
-        throw new InternalError("platform not recognized");
-    }
-}
--- a/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -46,7 +46,13 @@
 #define NI_MAXHOST 1025
 #endif
 
-/************************************************************************
+#define SET_NONBLOCKING(fd) {       \
+    int flags = fcntl(fd, F_GETFL); \
+    flags |= O_NONBLOCK;            \
+    fcntl(fd, F_SETFL, flags);      \
+}
+
+/*
  * Inet4AddressImpl
  */
 
@@ -57,35 +63,26 @@
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
-    char hostname[NI_MAXHOST+1];
+    char hostname[NI_MAXHOST + 1];
 
     hostname[0] = '\0';
-    if (gethostname(hostname, NI_MAXHOST)) {
-        /* Something went wrong, maybe networking is not setup? */
+    if (gethostname(hostname, NI_MAXHOST) != 0) {
         strcpy(hostname, "localhost");
     } else {
+        // try to resolve hostname via nameservice
+        // if it is known but getnameinfo fails, hostname will still be the
+        // value from gethostname
         struct addrinfo hints, *res;
-        int error;
 
+        // make sure string is null-terminated
         hostname[NI_MAXHOST] = '\0';
         memset(&hints, 0, sizeof(hints));
         hints.ai_flags = AI_CANONNAME;
         hints.ai_family = AF_INET;
 
-        error = getaddrinfo(hostname, NULL, &hints, &res);
-
-        if (error == 0) {/* host is known to name service */
-            getnameinfo(res->ai_addr,
-                        res->ai_addrlen,
-                        hostname,
-                        NI_MAXHOST,
-                        NULL,
-                        0,
-                        NI_NAMEREQD);
-
-            /* if getnameinfo fails hostname is still the value
-               from gethostname */
-
+        if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
+            getnameinfo(res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST,
+                        NULL, 0, NI_NAMEREQD);
             freeaddrinfo(res);
         }
     }
@@ -93,89 +90,70 @@
 }
 
 /*
- * Find an internet address for a given hostname.  Note that this
+ * Find an internet address for a given hostname. Note that this
  * code only works for addresses of type INET. The translation
  * of %d.%d.%d.%d to an address (int) occurs in java now, so the
- * String "host" shouldn't *ever* be a %d.%d.%d.%d string
+ * String "host" shouldn't be a %d.%d.%d.%d string. The only
+ * exception should be when any of the %d are out of range and
+ * we fallback to a lookup.
  *
  * Class:     java_net_Inet4AddressImpl
  * Method:    lookupAllHostAddr
  * Signature: (Ljava/lang/String;)[[B
  */
-
 JNIEXPORT jobjectArray JNICALL
 Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
-                                                jstring host) {
+                                                 jstring host) {
+    jobjectArray ret = NULL;
     const char *hostname;
-    jobjectArray ret = 0;
-    int retLen = 0;
     int error = 0;
-    struct addrinfo hints, *res, *resNew = NULL;
+    struct addrinfo hints, *res = NULL, *resNew = NULL, *last = NULL,
+        *iterator;
 
     initInetAddressIDs(env);
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
 
     if (IS_NULL(host)) {
-        JNU_ThrowNullPointerException(env, "host is null");
-        return 0;
+        JNU_ThrowNullPointerException(env, "host argument is null");
+        return NULL;
     }
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
-    /* Try once, with our static buffer. */
+    // try once, with our static buffer
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_CANONNAME;
     hints.ai_family = AF_INET;
 
-#ifdef __solaris__
-    /*
-     * Workaround for Solaris bug 4160367 - if a hostname contains a
-     * white space then 0.0.0.0 is returned
-     */
-    if (isspace((unsigned char)hostname[0])) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
-                        (char *)hostname);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
-    }
-#endif
-
     error = getaddrinfo(hostname, NULL, &hints, &res);
 
-#ifdef MACOSX
     if (error) {
+#if defined(MACOSX)
         // If getaddrinfo fails try getifaddrs, see bug 8170910.
         ret = lookupIfLocalhost(env, hostname, JNI_FALSE);
         if (ret != NULL || (*env)->ExceptionCheck(env)) {
-            JNU_ReleaseStringPlatformChars(env, host, hostname);
-            return ret;
+            goto cleanupAndReturn;
         }
-    }
 #endif
-
-    if (error) {
-        /* report error */
+        // report error
         NET_ThrowUnknownHostExceptionWithGaiError(env, hostname, error);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
+        goto cleanupAndReturn;
     } else {
         int i = 0;
-        struct addrinfo *itr, *last = NULL, *iterator = res;
-
+        iterator = res;
         while (iterator != NULL) {
-            // remove the duplicate one
+            // skip duplicates
             int skip = 0;
-            itr = resNew;
-            while (itr != NULL) {
+            struct addrinfo *iteratorNew = resNew;
+            while (iteratorNew != NULL) {
                 struct sockaddr_in *addr1, *addr2;
                 addr1 = (struct sockaddr_in *)iterator->ai_addr;
-                addr2 = (struct sockaddr_in *)itr->ai_addr;
-                if (addr1->sin_addr.s_addr ==
-                    addr2->sin_addr.s_addr) {
+                addr2 = (struct sockaddr_in *)iteratorNew->ai_addr;
+                if (addr1->sin_addr.s_addr == addr2->sin_addr.s_addr) {
                     skip = 1;
                     break;
                 }
-                itr = itr->ai_next;
+                iteratorNew = iteratorNew->ai_next;
             }
 
             if (!skip) {
@@ -199,44 +177,37 @@
             iterator = iterator->ai_next;
         }
 
-        retLen = i;
-        iterator = resNew;
-
-        ret = (*env)->NewObjectArray(env, retLen, ia_class, NULL);
-
+        // allocate array - at this point i contains the number of addresses
+        ret = (*env)->NewObjectArray(env, i, ia_class, NULL);
         if (IS_NULL(ret)) {
-            /* we may have memory to free at the end of this */
             goto cleanupAndReturn;
         }
 
         i = 0;
+        iterator = resNew;
         while (iterator != NULL) {
             jobject iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (IS_NULL(iaObj)) {
                 ret = NULL;
                 goto cleanupAndReturn;
             }
-            setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+            setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in *)
+                                (iterator->ai_addr))->sin_addr.s_addr));
             setInetAddress_hostName(env, iaObj, host);
             (*env)->SetObjectArrayElement(env, ret, i++, iaObj);
             iterator = iterator->ai_next;
         }
     }
-
 cleanupAndReturn:
-    {
-        struct addrinfo *iterator, *tmp;
-        iterator = resNew;
-        while (iterator != NULL) {
-            tmp = iterator;
-            iterator = iterator->ai_next;
-            free(tmp);
-        }
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
+    JNU_ReleaseStringPlatformChars(env, host, hostname);
+    while (resNew != NULL) {
+        last = resNew;
+        resNew = resNew->ai_next;
+        free(last);
     }
-
-    freeaddrinfo(res);
-
+    if (res != NULL) {
+        freeaddrinfo(res);
+    }
     return ret;
 }
 
@@ -244,164 +215,243 @@
  * Class:     java_net_Inet4AddressImpl
  * Method:    getHostByAddr
  * Signature: (I)Ljava/lang/String;
+ *
+ * Theoretically the UnknownHostException could be enriched with gai error
+ * information. But as it is silently ignored anyway, there's no need for this.
+ * It's only important that either a valid hostname is returned or an
+ * UnknownHostException is thrown.
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
-                                            jbyteArray addrArray) {
+                                             jbyteArray addrArray) {
     jstring ret = NULL;
+    char host[NI_MAXHOST + 1];
+    jbyte caddr[4];
+    jint addr;
+    struct sockaddr_in sa;
 
-    char host[NI_MAXHOST+1];
-    int error = 0;
-    int len = 0;
-    jbyte caddr[4];
-
-    struct sockaddr_in him4;
-    struct sockaddr *sa;
-
-    jint addr;
+    // construct a sockaddr_in structure
+    memset((char *)&sa, 0, sizeof(struct sockaddr_in));
     (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-    addr = ((caddr[0]<<24) & 0xff000000);
-    addr |= ((caddr[1] <<16) & 0xff0000);
-    addr |= ((caddr[2] <<8) & 0xff00);
+    addr = ((caddr[0] << 24) & 0xff000000);
+    addr |= ((caddr[1] << 16) & 0xff0000);
+    addr |= ((caddr[2] << 8) & 0xff00);
     addr |= (caddr[3] & 0xff);
-    memset((void *) &him4, 0, sizeof(him4));
-    him4.sin_addr.s_addr = htonl(addr);
-    him4.sin_family = AF_INET;
-    sa = (struct sockaddr *) &him4;
-    len = sizeof(him4);
+    sa.sin_addr.s_addr = htonl(addr);
+    sa.sin_family = AF_INET;
 
-    error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
-
-    if (!error) {
+    if (getnameinfo((struct sockaddr *)&sa, sizeof(struct sockaddr_in),
+                    host, NI_MAXHOST, NULL, 0, NI_NAMEREQD)) {
+        JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+    } else {
         ret = (*env)->NewStringUTF(env, host);
-    }
-
-    if (ret == NULL) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL);
+        if (ret == NULL) {
+            JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+        }
     }
 
     return ret;
 }
 
-#define SET_NONBLOCKING(fd) {           \
-        int flags = fcntl(fd, F_GETFL); \
-        flags |= O_NONBLOCK;            \
-        fcntl(fd, F_SETFL, flags);      \
+/**
+ * ping implementation using tcp port 7 (echo)
+ */
+static jboolean
+tcp_ping4(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout,
+          jint ttl)
+{
+    jint fd;
+    int connect_rv = -1;
+
+    // open a TCP socket
+    fd = socket(AF_INET, SOCK_STREAM, 0);
+    if (fd == -1) {
+        // note: if you run out of fds, you may not be able to load
+        // the exception class, and get a NoClassDefFoundError instead.
+        NET_ThrowNew(env, errno, "Can't create socket");
+        return JNI_FALSE;
+    }
+
+    // set TTL
+    if (ttl > 0) {
+        setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
+    }
+
+    // A network interface was specified, so let's bind to it.
+    if (netif != NULL) {
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in)) < 0) {
+            NET_ThrowNew(env, errno, "Can't bind socket");
+            close(fd);
+            return JNI_FALSE;
+        }
+    }
+
+    // Make the socket non blocking so we can use select/poll.
+    SET_NONBLOCKING(fd);
+
+    sa->sa4.sin_port = htons(7); // echo port
+    connect_rv = NET_Connect(fd, &sa->sa, sizeof(struct sockaddr_in));
+
+    // connection established or refused immediately, either way it means
+    // we were able to reach the host!
+    if (connect_rv == 0 || errno == ECONNREFUSED) {
+        close(fd);
+        return JNI_TRUE;
+    }
+
+    switch (errno) {
+    case ENETUNREACH:   // Network Unreachable
+    case EAFNOSUPPORT:  // Address Family not supported
+    case EADDRNOTAVAIL: // address is not available on the remote machine
+#if defined(__linux__) || defined(_AIX)
+        // On some Linux versions, when a socket is bound to the loopback
+        // interface, connect will fail and errno will be set to EINVAL
+        // or EHOSTUNREACH.  When that happens, don't throw an exception,
+        // just return false.
+    case EINVAL:
+    case EHOSTUNREACH:  // No route to host
+#endif
+        close(fd);
+        return JNI_FALSE;
+    case EINPROGRESS:   // this is expected as we'll probably have to wait
+        break;
+    default:
+        NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
+                                     "connect failed");
+        close(fd);
+        return JNI_FALSE;
+    }
+
+    timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
+    if (timeout >= 0) {
+        // connection has been established, check for error condition
+        socklen_t optlen = (socklen_t)sizeof(connect_rv);
+        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
+                       &optlen) <0)
+        {
+            connect_rv = errno;
+        }
+        if (connect_rv == 0 || connect_rv == ECONNREFUSED) {
+            close(fd);
+            return JNI_TRUE;
+        }
+    }
+    close(fd);
+    return JNI_FALSE;
 }
 
 /**
  * ping implementation.
- * Send a ICMP_ECHO_REQUEST packet every second until either the timeout
- * expires or a answer is received.
- * Returns true is an ECHO_REPLY is received, otherwise, false.
+ * Send an ICMP_ECHO_REQUEST packet every second until either the timeout
+ * expires or an answer is received.
+ * Returns true if an ECHO_REPLY is received, false otherwise.
  */
 static jboolean
-ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
-      struct sockaddr_in* netif, jint ttl) {
-    jint size;
-    jint n, hlen1, icmplen;
+ping4(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif,
+      jint timeout, jint ttl)
+{
+    jint n, size = 60 * 1024, hlen, tmout2, seq = 1;
     socklen_t len;
-    char sendbuf[1500];
-    char recvbuf[1500];
+    unsigned char sendbuf[1500], recvbuf[1500];
     struct icmp *icmp;
     struct ip *ip;
     struct sockaddr_in sa_recv;
     jchar pid;
-    jint tmout2, seq = 1;
     struct timeval tv;
-    size_t plen;
+    size_t plen = ICMP_ADVLENMIN + sizeof(tv);
 
-    /* icmp_id is a 16 bit data type, therefore down cast the pid */
-    pid = (jchar)getpid();
-    size = 60*1024;
     setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
-    /*
-     * sets the ttl (max number of hops)
-     */
+
+    // sets the ttl (max number of hops)
     if (ttl > 0) {
-      setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
+        setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
     }
-    /*
-     * a specific interface was specified, so let's bind the socket
-     * to that interface to ensure the requests are sent only through it.
-     */
+
+    // a specific interface was specified, so let's bind the socket
+    // to that interface to ensure the requests are sent only through it.
     if (netif != NULL) {
-      if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in)) < 0) {
-        NET_ThrowNew(env, errno, "Can't bind socket");
-        close(fd);
-        return JNI_FALSE;
-      }
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in)) < 0) {
+            NET_ThrowNew(env, errno, "Can't bind socket");
+            close(fd);
+            return JNI_FALSE;
+        }
     }
-    /*
-     * Make the socket non blocking so we can use select
-     */
+
+    // icmp_id is a 16 bit data type, therefore down cast the pid
+    pid = (jchar)getpid();
+
+    // Make the socket non blocking so we can use select
     SET_NONBLOCKING(fd);
     do {
-      /*
-       * create the ICMP request
-       */
-      icmp = (struct icmp *) sendbuf;
-      icmp->icmp_type = ICMP_ECHO;
-      icmp->icmp_code = 0;
-      icmp->icmp_id = htons(pid);
-      icmp->icmp_seq = htons(seq);
-      seq++;
-      gettimeofday(&tv, NULL);
-      memcpy(icmp->icmp_data, &tv, sizeof(tv));
-      plen = ICMP_ADVLENMIN + sizeof(tv);
-      icmp->icmp_cksum = 0;
-      icmp->icmp_cksum = in_cksum((u_short *)icmp, plen);
-      /*
-       * send it
-       */
-      n = sendto(fd, sendbuf, plen, 0, (struct sockaddr *)him,
-                 sizeof(struct sockaddr));
-      if (n < 0 && errno != EINPROGRESS ) {
-#ifdef __linux__
-        if (errno != EINVAL && errno != EHOSTUNREACH)
-          /*
-           * On some Linux versions, when a socket is bound to the loopback
-           * interface, sendto will fail and errno will be set to
-           * EINVAL or EHOSTUNREACH. When that happens, don't throw an
-           * exception, just return false.
-           */
-#endif /*__linux__ */
-          NET_ThrowNew(env, errno, "Can't send ICMP packet");
-        close(fd);
-        return JNI_FALSE;
-      }
+        // create the ICMP request
+        icmp = (struct icmp *)sendbuf;
+        icmp->icmp_type = ICMP_ECHO;
+        icmp->icmp_code = 0;
+        // let's tag the ECHO packet with our pid so we can identify it
+        icmp->icmp_id = htons(pid);
+        icmp->icmp_seq = htons(seq);
+        seq++;
+        gettimeofday(&tv, NULL);
+        memcpy(icmp->icmp_data, &tv, sizeof(tv));
+        icmp->icmp_cksum = 0;
+        // manually calculate checksum
+        icmp->icmp_cksum = in_cksum((u_short *)icmp, plen);
+        // send it
+        n = sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in));
+        if (n < 0 && errno != EINPROGRESS) {
+#if defined(__linux__)
+            /*
+             * On some Linux versions, when a socket is bound to the loopback
+             * interface, sendto will fail and errno will be set to
+             * EINVAL or EHOSTUNREACH. When that happens, don't throw an
+             * exception, just return false.
+             */
+            if (errno != EINVAL && errno != EHOSTUNREACH) {
+                NET_ThrowNew(env, errno, "Can't send ICMP packet");
+            }
+#else
+            NET_ThrowNew(env, errno, "Can't send ICMP packet");
+#endif
+            close(fd);
+            return JNI_FALSE;
+        }
 
-      tmout2 = timeout > 1000 ? 1000 : timeout;
-      do {
-        tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
-        if (tmout2 >= 0) {
-          len = sizeof(sa_recv);
-          n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0, (struct sockaddr *)&sa_recv, &len);
-          ip = (struct ip*) recvbuf;
-          hlen1 = (ip->ip_hl) << 2;
-          icmp = (struct icmp *) (recvbuf + hlen1);
-          icmplen = n - hlen1;
-          /*
-           * We did receive something, but is it what we were expecting?
-           * I.E.: A ICMP_ECHOREPLY packet with the proper PID.
-           */
-          if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY
-               && (ntohs(icmp->icmp_id) == pid)) {
-            if ((him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) {
-              close(fd);
-              return JNI_TRUE;
+        tmout2 = timeout > 1000 ? 1000 : timeout;
+        do {
+            tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
+            if (tmout2 >= 0) {
+                len = sizeof(sa_recv);
+                n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0,
+                             (struct sockaddr *)&sa_recv, &len);
+                // check if we received enough data
+                if (n < (jint)sizeof(struct ip)) {
+                    continue;
+                }
+                ip = (struct ip *)recvbuf;
+                hlen = ((jint)(unsigned int)(ip->ip_hl)) << 2;
+                // check if we received enough data
+                if (n < (jint)(hlen + sizeof(struct icmp))) {
+                    continue;
+                }
+                icmp = (struct icmp *)(recvbuf + hlen);
+                // We did receive something, but is it what we were expecting?
+                // I.E.: An ICMP_ECHO_REPLY packet with the proper PID and
+                //       from the host that we are trying to determine is reachable.
+                if (icmp->icmp_type == ICMP_ECHOREPLY &&
+                    (ntohs(icmp->icmp_id) == pid))
+                {
+                    if (sa->sa4.sin_addr.s_addr == sa_recv.sin_addr.s_addr) {
+                        close(fd);
+                        return JNI_TRUE;
+                    } else if (sa->sa4.sin_addr.s_addr == 0) {
+                        close(fd);
+                        return JNI_TRUE;
+                    }
+                }
             }
-
-            if (him->sin_addr.s_addr == 0) {
-              close(fd);
-              return JNI_TRUE;
-            }
-         }
-
-        }
-      } while (tmout2 > 0);
-      timeout -= 1000;
-    } while (timeout >0);
+        } while (tmout2 > 0);
+        timeout -= 1000;
+    } while (timeout > 0);
     close(fd);
     return JNI_FALSE;
 }
@@ -413,149 +463,51 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this,
-                                           jbyteArray addrArray,
-                                           jint timeout,
-                                           jbyteArray ifArray,
-                                           jint ttl) {
-    jint addr;
+                                            jbyteArray addrArray, jint timeout,
+                                            jbyteArray ifArray, jint ttl)
+{
     jbyte caddr[4];
-    jint fd;
-    struct sockaddr_in him;
-    struct sockaddr_in* netif = NULL;
-    struct sockaddr_in inf;
-    int len = 0;
-    int connect_rv = -1;
-    int sz;
+    jint addr = 0, sz, fd;
+    SOCKETADDRESS sa, inf, *netif = NULL;
 
-    memset((char *) caddr, 0, sizeof(caddr));
-    memset((char *) &him, 0, sizeof(him));
-    memset((char *) &inf, 0, sizeof(inf));
+    // check if address array size is 4 (IPv4 address)
     sz = (*env)->GetArrayLength(env, addrArray);
     if (sz != 4) {
       return JNI_FALSE;
     }
+
+    // convert IP address from byte array to integer
+    memset((char *)caddr, 0, sizeof(caddr));
     (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-    addr = ((caddr[0]<<24) & 0xff000000);
-    addr |= ((caddr[1] <<16) & 0xff0000);
-    addr |= ((caddr[2] <<8) & 0xff00);
+    addr = ((caddr[0] << 24) & 0xff000000);
+    addr |= ((caddr[1] << 16) & 0xff0000);
+    addr |= ((caddr[2] << 8) & 0xff00);
     addr |= (caddr[3] & 0xff);
-    addr = htonl(addr);
-    him.sin_addr.s_addr = addr;
-    him.sin_family = AF_INET;
-    len = sizeof(him);
-    /*
-     * If a network interface was specified, let's create the address
-     * for it.
-     */
-    if (!(IS_NULL(ifArray))) {
-      memset((char *) caddr, 0, sizeof(caddr));
-      (*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
-      addr = ((caddr[0]<<24) & 0xff000000);
-      addr |= ((caddr[1] <<16) & 0xff0000);
-      addr |= ((caddr[2] <<8) & 0xff00);
-      addr |= (caddr[3] & 0xff);
-      addr = htonl(addr);
-      inf.sin_addr.s_addr = addr;
-      inf.sin_family = AF_INET;
-      inf.sin_port = 0;
-      netif = &inf;
-    }
+    memset((char *)&sa, 0, sizeof(SOCKETADDRESS));
+    sa.sa4.sin_addr.s_addr = htonl(addr);
+    sa.sa4.sin_family = AF_INET;
 
-    /*
-     * Let's try to create a RAW socket to send ICMP packets
-     * This usually requires "root" privileges, so it's likely to fail.
-     */
-    fd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-    if (fd != -1) {
-      /*
-       * It didn't fail, so we can use ICMP_ECHO requests.
-       */
-      return ping4(env, fd, &him, timeout, netif, ttl);
-    }
-
-    /*
-     * Can't create a raw socket, so let's try a TCP socket
-     */
-    fd = socket(AF_INET, SOCK_STREAM, 0);
-    if (fd == -1) {
-        /* note: if you run out of fds, you may not be able to load
-         * the exception class, and get a NoClassDefFoundError
-         * instead.
-         */
-        NET_ThrowNew(env, errno, "Can't create socket");
-        return JNI_FALSE;
-    }
-    if (ttl > 0) {
-      setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
+    // If a network interface was specified, let's convert its address as well.
+    if (!(IS_NULL(ifArray))) {
+        memset((char *)caddr, 0, sizeof(caddr));
+        (*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
+        addr = ((caddr[0] << 24) & 0xff000000);
+        addr |= ((caddr[1] << 16) & 0xff0000);
+        addr |= ((caddr[2] << 8) & 0xff00);
+        addr |= (caddr[3] & 0xff);
+        memset((char *)&inf, 0, sizeof(SOCKETADDRESS));
+        inf.sa4.sin_addr.s_addr = htonl(addr);
+        inf.sa4.sin_family = AF_INET;
+        netif = &inf;
     }
 
-    /*
-     * A network interface was specified, so let's bind to it.
-     */
-    if (netif != NULL) {
-      if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in)) < 0) {
-        NET_ThrowNew(env, errno, "Can't bind socket");
-        close(fd);
-        return JNI_FALSE;
-      }
-    }
-
-    /*
-     * Make the socket non blocking so we can use select/poll.
-     */
-    SET_NONBLOCKING(fd);
-
-    him.sin_port = htons(7);    /* Echo */
-    connect_rv = NET_Connect(fd, (struct sockaddr *)&him, len);
-
-    /**
-     * connection established or refused immediately, either way it means
-     * we were able to reach the host!
-     */
-    if (connect_rv == 0 || errno == ECONNREFUSED) {
-        close(fd);
-        return JNI_TRUE;
+    // Let's try to create a RAW socket to send ICMP packets.
+    // This usually requires "root" privileges, so it's likely to fail.
+    fd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+    if (fd == -1) {
+        return tcp_ping4(env, &sa, netif, timeout, ttl);
     } else {
-        socklen_t optlen = (socklen_t)sizeof(connect_rv);
-
-        switch (errno) {
-        case ENETUNREACH: /* Network Unreachable */
-        case EAFNOSUPPORT: /* Address Family not supported */
-        case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#if defined(__linux__) || defined(_AIX)
-        case EINVAL:
-        case EHOSTUNREACH: /* No route to host */
-          /*
-           * On some Linux versions, when a socket is bound to the loopback
-           * interface, connect will fail and errno will be set to EINVAL
-           * or EHOSTUNREACH.  When that happens, don't throw an exception,
-           * just return false.
-           */
-#endif /* __linux__ */
-          close(fd);
-          return JNI_FALSE;
-        }
-
-        if (errno != EINPROGRESS) {
-          NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
-                                       "connect failed");
-          close(fd);
-          return JNI_FALSE;
-        }
-
-        timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
-        if (timeout >= 0) {
-          /* has connection been established? */
-          if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
-                         &optlen) <0) {
-            connect_rv = errno;
-          }
-          if (connect_rv == 0 || connect_rv == ECONNREFUSED) {
-            close(fd);
-            return JNI_TRUE;
-          }
-        }
-        close(fd);
-        return JNI_FALSE;
+        // It didn't fail, so we can use ICMP_ECHO requests.
+        return ping4(env, fd, &sa, netif, timeout, ttl);
     }
 }
--- a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -38,17 +38,22 @@
 
 #include "net_util.h"
 
+#include "java_net_InetAddress.h"
 #include "java_net_Inet4AddressImpl.h"
 #include "java_net_Inet6AddressImpl.h"
-#include "java_net_InetAddress.h"
 
 /* the initial size of our hostent buffers */
 #ifndef NI_MAXHOST
 #define NI_MAXHOST 1025
 #endif
 
+#define SET_NONBLOCKING(fd) {       \
+    int flags = fcntl(fd, F_GETFL); \
+    flags |= O_NONBLOCK;            \
+    fcntl(fd, F_SETFL, flags);      \
+}
 
-/************************************************************************
+/*
  * Inet6AddressImpl
  */
 
@@ -59,58 +64,40 @@
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
-    int ret;
-    char hostname[NI_MAXHOST+1];
+    char hostname[NI_MAXHOST + 1];
 
     hostname[0] = '\0';
-    ret = gethostname(hostname, NI_MAXHOST);
-    if (ret == -1) {
-        /* Something went wrong, maybe networking is not setup? */
+    if (gethostname(hostname, NI_MAXHOST) != 0) {
         strcpy(hostname, "localhost");
-    } else {
-        // ensure null-terminated
-        hostname[NI_MAXHOST] = '\0';
-    }
-
 #if defined(__solaris__)
-    if (ret == 0) {
-        /* Solaris doesn't want to give us a fully qualified domain name.
-         * We do a reverse lookup to try and get one.  This works
-         * if DNS occurs before NIS in /etc/resolv.conf, but fails
-         * if NIS comes first (it still gets only a partial name).
-         * We use thread-safe system calls.
-         */
-        struct addrinfo  hints, *res;
-        int error;
+    } else {
+        // try to resolve hostname via nameservice
+        // if it is known but getnameinfo fails, hostname will still be the
+        // value from gethostname
+        struct addrinfo hints, *res;
 
+        // make sure string is null-terminated
+        hostname[NI_MAXHOST] = '\0';
         memset(&hints, 0, sizeof(hints));
         hints.ai_flags = AI_CANONNAME;
         hints.ai_family = AF_UNSPEC;
 
-        error = getaddrinfo(hostname, NULL, &hints, &res);
-
-        if (error == 0) {
-            /* host is known to name service */
-            error = getnameinfo(res->ai_addr,
-                                res->ai_addrlen,
-                                hostname,
-                                NI_MAXHOST,
-                                NULL,
-                                0,
-                                NI_NAMEREQD);
-
-            /* if getnameinfo fails hostname is still the value
-               from gethostname */
-
+        if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
+            getnameinfo(res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST,
+                        NULL, 0, NI_NAMEREQD);
             freeaddrinfo(res);
         }
     }
+#else
+    } else {
+        // make sure string is null-terminated
+        hostname[NI_MAXHOST] = '\0';
+    }
 #endif
-
     return (*env)->NewStringUTF(env, hostname);
 }
 
-#ifdef MACOSX
+#if defined(MACOSX)
 /* also called from Inet4AddressImpl.c */
 __private_extern__ jobjectArray
 lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
@@ -163,7 +150,7 @@
     struct ifaddrs *iter = ifa;
     while (iter) {
         int family = iter->ifa_addr->sa_family;
-        if (iter->ifa_name[0] != '\0'  &&  iter->ifa_addr)
+        if (iter->ifa_name[0] != '\0' && iter->ifa_addr)
         {
             jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
             if (family == AF_INET) {
@@ -172,9 +159,7 @@
             } else if (family == AF_INET6 && includeV6) {
                 addrs6++;
                 if (isLoopback) numV6Loopbacks++;
-            } else {
-                /* We don't care e.g. AF_LINK */
-            }
+            } // else we don't care, e.g. AF_LINK
         }
         iter = iter->ifa_next;
     }
@@ -205,9 +190,9 @@
         jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
         int family = iter->ifa_addr->sa_family;
 
-        if (iter->ifa_name[0] != '\0'  &&  iter->ifa_addr
-            && (family == AF_INET || (family == AF_INET6 && includeV6))
-            && (!isLoopback || includeLoopback))
+        if (iter->ifa_name[0] != '\0' && iter->ifa_addr &&
+            (family == AF_INET || (family == AF_INET6 && includeV6)) &&
+            (!isLoopback || includeLoopback))
         {
             int port;
             int index = (family == AF_INET) ? i++ : j++;
@@ -234,93 +219,65 @@
 #endif
 
 /*
- * Find an internet address for a given hostname.  Note that this
- * code only works for addresses of type INET. The translation
- * of %d.%d.%d.%d to an address (int) occurs in java now, so the
- * String "host" shouldn't *ever* be a %d.%d.%d.%d string
- *
  * Class:     java_net_Inet6AddressImpl
  * Method:    lookupAllHostAddr
  * Signature: (Ljava/lang/String;)[[B
  */
-
 JNIEXPORT jobjectArray JNICALL
 Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
-                                                jstring host) {
+                                                 jstring host) {
+    jobjectArray ret = NULL;
     const char *hostname;
-    jobjectArray ret = 0;
-    int retLen = 0;
-
-    int getaddrinfo_error=0;
-    struct addrinfo hints, *res, *resNew = NULL;
+    int error = 0;
+    struct addrinfo hints, *res = NULL, *resNew = NULL, *last = NULL,
+        *iterator;
 
     initInetAddressIDs(env);
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
 
     if (IS_NULL(host)) {
-        JNU_ThrowNullPointerException(env, "host is null");
-        return 0;
+        JNU_ThrowNullPointerException(env, "host argument is null");
+        return NULL;
     }
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
-    /* Try once, with our static buffer. */
+    // try once, with our static buffer
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_CANONNAME;
     hints.ai_family = AF_UNSPEC;
 
-#ifdef __solaris__
-    /*
-     * Workaround for Solaris bug 4160367 - if a hostname contains a
-     * white space then 0.0.0.0 is returned
-     */
-    if (isspace((unsigned char)hostname[0])) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
-                        hostname);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
-    }
-#endif
+    error = getaddrinfo(hostname, NULL, &hints, &res);
 
-    getaddrinfo_error = getaddrinfo(hostname, NULL, &hints, &res);
-
-#ifdef MACOSX
-    if (getaddrinfo_error) {
-        /*
-         * If getaddrinfo fails looking up the local machine, attempt to get the
-         * address from getifaddrs. This ensures we get an IPv6 address for the
-         * local machine.
-         */
+    if (error) {
+#if defined(MACOSX)
+        // if getaddrinfo fails try getifaddrs
         ret = lookupIfLocalhost(env, hostname, JNI_TRUE);
         if (ret != NULL || (*env)->ExceptionCheck(env)) {
-            JNU_ReleaseStringPlatformChars(env, host, hostname);
-            return ret;
+            goto cleanupAndReturn;
         }
-    }
 #endif
-
-    if (getaddrinfo_error) {
-        /* report error */
-        NET_ThrowUnknownHostExceptionWithGaiError(
-            env, hostname, getaddrinfo_error);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
+        // report error
+        NET_ThrowUnknownHostExceptionWithGaiError(env, hostname, error);
+        goto cleanupAndReturn;
     } else {
-        int i = 0, addressPreference = -1;
-        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
-        struct addrinfo *itr, *last = NULL, *iterator = res;
+        int i = 0, inetCount = 0, inet6Count = 0, inetIndex = 0,
+            inet6Index = 0, originalIndex = 0;
+        int addressPreference =
+            (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);;
+        iterator = res;
         while (iterator != NULL) {
+            // skip duplicates
             int skip = 0;
-            itr = resNew;
-            while (itr != NULL) {
-                if (iterator->ai_family == itr->ai_family &&
-                    iterator->ai_addrlen == itr->ai_addrlen) {
-                    if (itr->ai_family == AF_INET) { /* AF_INET */
+            struct addrinfo *iteratorNew = resNew;
+            while (iteratorNew != NULL) {
+                if (iterator->ai_family == iteratorNew->ai_family &&
+                    iterator->ai_addrlen == iteratorNew->ai_addrlen) {
+                    if (iteratorNew->ai_family == AF_INET) { /* AF_INET */
                         struct sockaddr_in *addr1, *addr2;
                         addr1 = (struct sockaddr_in *)iterator->ai_addr;
-                        addr2 = (struct sockaddr_in *)itr->ai_addr;
-                        if (addr1->sin_addr.s_addr ==
-                            addr2->sin_addr.s_addr) {
+                        addr2 = (struct sockaddr_in *)iteratorNew->ai_addr;
+                        if (addr1->sin_addr.s_addr == addr2->sin_addr.s_addr) {
                             skip = 1;
                             break;
                         }
@@ -328,7 +285,7 @@
                         int t;
                         struct sockaddr_in6 *addr1, *addr2;
                         addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
-                        addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+                        addr2 = (struct sockaddr_in6 *)iteratorNew->ai_addr;
 
                         for (t = 0; t < 16; t++) {
                             if (addr1->sin6_addr.s6_addr[t] !=
@@ -337,7 +294,7 @@
                             }
                         }
                         if (t < 16) {
-                            itr = itr->ai_next;
+                            iteratorNew = iteratorNew->ai_next;
                             continue;
                         } else {
                             skip = 1;
@@ -346,16 +303,16 @@
                     }
                 } else if (iterator->ai_family != AF_INET &&
                            iterator->ai_family != AF_INET6) {
-                    /* we can't handle other family types */
+                    // we can't handle other family types
                     skip = 1;
                     break;
                 }
-                itr = itr->ai_next;
+                iteratorNew = iteratorNew->ai_next;
             }
 
             if (!skip) {
                 struct addrinfo *next
-                    = (struct addrinfo*) malloc(sizeof(struct addrinfo));
+                    = (struct addrinfo *)malloc(sizeof(struct addrinfo));
                 if (!next) {
                     JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
@@ -371,39 +328,33 @@
                 last = next;
                 i++;
                 if (iterator->ai_family == AF_INET) {
-                    inetCount ++;
+                    inetCount++;
                 } else if (iterator->ai_family == AF_INET6) {
-                    inet6Count ++;
+                    inet6Count++;
                 }
             }
             iterator = iterator->ai_next;
         }
-        retLen = i;
-        iterator = resNew;
 
-        ret = (*env)->NewObjectArray(env, retLen, ia_class, NULL);
-
+        // allocate array - at this point i contains the number of addresses
+        ret = (*env)->NewObjectArray(env, i, ia_class, NULL);
         if (IS_NULL(ret)) {
             /* we may have memory to free at the end of this */
             goto cleanupAndReturn;
         }
 
-        addressPreference = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
-
         if (addressPreference == java_net_InetAddress_PREFER_IPV6_VALUE) {
-            /* AF_INET addresses will be offset by inet6Count */
             inetIndex = inet6Count;
             inet6Index = 0;
         } else if (addressPreference == java_net_InetAddress_PREFER_IPV4_VALUE) {
-            /* AF_INET6 addresses will be offset by inetCount */
             inetIndex = 0;
             inet6Index = inetCount;
         } else if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
             inetIndex = inet6Index = originalIndex = 0;
         }
 
+        iterator = resNew;
         while (iterator != NULL) {
-            jboolean ret1;
             if (iterator->ai_family == AF_INET) {
                 jobject iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
                 if (IS_NULL(iaObj)) {
@@ -416,7 +367,7 @@
                 inetIndex++;
             } else if (iterator->ai_family == AF_INET6) {
                 jint scope = 0;
-
+                jboolean ret1;
                 jobject iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
                 if (IS_NULL(iaObj)) {
                     ret = NULL;
@@ -427,9 +378,8 @@
                     ret = NULL;
                     goto cleanupAndReturn;
                 }
-
-                scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
-                if (scope != 0) { /* zero is default value, no need to set */
+                scope = ((struct sockaddr_in6 *)iterator->ai_addr)->sin6_scope_id;
+                if (scope != 0) { // zero is default value, no need to set
                     setInet6Address_scopeid(env, iaObj, scope);
                 }
                 setInetAddress_hostName(env, iaObj, host);
@@ -443,21 +393,16 @@
             iterator = iterator->ai_next;
         }
     }
-
- cleanupAndReturn:
-    {
-      struct addrinfo *iterator, *tmp;
-        iterator = resNew;
-        while (iterator != NULL) {
-            tmp = iterator;
-            iterator = iterator->ai_next;
-            free(tmp);
-        }
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
+cleanupAndReturn:
+    JNU_ReleaseStringPlatformChars(env, host, hostname);
+    while (resNew != NULL) {
+        last = resNew;
+        resNew = resNew->ai_next;
+        free(last);
     }
-
-    freeaddrinfo(res);
-
+    if (res != NULL) {
+        freeaddrinfo(res);
+    }
     return ret;
 }
 
@@ -465,171 +410,252 @@
  * Class:     java_net_Inet6AddressImpl
  * Method:    getHostByAddr
  * Signature: (I)Ljava/lang/String;
+ *
+ * Theoretically the UnknownHostException could be enriched with gai error
+ * information. But as it is silently ignored anyway, there's no need for this.
+ * It's only important that either a valid hostname is returned or an
+ * UnknownHostException is thrown.
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
-                                            jbyteArray addrArray) {
-
+                                             jbyteArray addrArray) {
     jstring ret = NULL;
-
-    char host[NI_MAXHOST+1];
-    int error = 0;
+    char host[NI_MAXHOST + 1];
     int len = 0;
     jbyte caddr[16];
+    SOCKETADDRESS sa;
 
-    struct sockaddr_in him4;
-    struct sockaddr_in6 him6;
-    struct sockaddr *sa;
+    memset((void *)&sa, 0, sizeof(SOCKETADDRESS));
 
-    /*
-     * For IPv4 addresses construct a sockaddr_in structure.
-     */
+    // construct a sockaddr_in structure (AF_INET or AF_INET6)
     if ((*env)->GetArrayLength(env, addrArray) == 4) {
         jint addr;
         (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-        addr = ((caddr[0]<<24) & 0xff000000);
-        addr |= ((caddr[1] <<16) & 0xff0000);
-        addr |= ((caddr[2] <<8) & 0xff00);
+        addr = ((caddr[0] << 24) & 0xff000000);
+        addr |= ((caddr[1] << 16) & 0xff0000);
+        addr |= ((caddr[2] << 8) & 0xff00);
         addr |= (caddr[3] & 0xff);
-        memset((void *) &him4, 0, sizeof(him4));
-        him4.sin_addr.s_addr = htonl(addr);
-        him4.sin_family = AF_INET;
-        sa = (struct sockaddr *)&him4;
-        len = sizeof(him4);
+        sa.sa4.sin_addr.s_addr = htonl(addr);
+        sa.sa4.sin_family = AF_INET;
+        len = sizeof(struct sockaddr_in);
     } else {
-        /*
-         * For IPv6 address construct a sockaddr_in6 structure.
-         */
         (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
-        memset((void *)&him6, 0, sizeof(him6));
-        memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr));
-        him6.sin6_family = AF_INET6;
-        sa = (struct sockaddr *)&him6;
-        len = sizeof(him6);
+        memcpy((void *)&sa.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+        sa.sa6.sin6_family = AF_INET6;
+        len = sizeof(struct sockaddr_in6);
     }
 
-    error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
-
-    if (!error) {
+    if (getnameinfo(&sa.sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD)) {
+        JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+    } else {
         ret = (*env)->NewStringUTF(env, host);
-        CHECK_NULL_RETURN(ret, NULL);
-    }
-
-    if (ret == NULL) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL);
+        if (ret == NULL) {
+            JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+        }
     }
 
     return ret;
 }
 
-#define SET_NONBLOCKING(fd) {           \
-        int flags = fcntl(fd, F_GETFL); \
-        flags |= O_NONBLOCK;            \
-        fcntl(fd, F_SETFL, flags);      \
+/**
+ * ping implementation using tcp port 7 (echo)
+ */
+static jboolean
+tcp_ping6(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout,
+          jint ttl)
+{
+    jint fd;
+    int connect_rv = -1;
+
+    // open a TCP socket
+    fd = socket(AF_INET6, SOCK_STREAM, 0);
+    if (fd == -1) {
+        // note: if you run out of fds, you may not be able to load
+        // the exception class, and get a NoClassDefFoundError instead.
+        NET_ThrowNew(env, errno, "Can't create socket");
+        return JNI_FALSE;
+    }
+
+    // set TTL
+    if (ttl > 0) {
+        setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl));
+    }
+
+    // A network interface was specified, so let's bind to it.
+    if (netif != NULL) {
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in6)) <0) {
+            NET_ThrowNew(env, errno, "Can't bind socket");
+            close(fd);
+            return JNI_FALSE;
+        }
+    }
+
+    // Make the socket non blocking so we can use select/poll.
+    SET_NONBLOCKING(fd);
+
+    sa->sa6.sin6_port = htons(7); // echo port
+    connect_rv = NET_Connect(fd, &sa->sa, sizeof(struct sockaddr_in6));
+
+    // connection established or refused immediately, either way it means
+    // we were able to reach the host!
+    if (connect_rv == 0 || errno == ECONNREFUSED) {
+        close(fd);
+        return JNI_TRUE;
+    }
+
+    switch (errno) {
+    case ENETUNREACH:   // Network Unreachable
+    case EAFNOSUPPORT:  // Address Family not supported
+    case EADDRNOTAVAIL: // address is not available on the remote machine
+#if defined(__linux__) || defined(_AIX)
+        // On some Linux versions, when a socket is bound to the loopback
+        // interface, connect will fail and errno will be set to EINVAL
+        // or EHOSTUNREACH.  When that happens, don't throw an exception,
+        // just return false.
+    case EINVAL:
+    case EHOSTUNREACH:  // No route to host
+#endif
+        close(fd);
+        return JNI_FALSE;
+    case EINPROGRESS:   // this is expected as we'll probably have to wait
+        break;
+    default:
+        NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
+                                     "connect failed");
+        close(fd);
+        return JNI_FALSE;
+    }
+
+    timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
+    if (timeout >= 0) {
+        // connection has been established, check for error condition
+        socklen_t optlen = (socklen_t)sizeof(connect_rv);
+        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
+                       &optlen) <0)
+        {
+            connect_rv = errno;
+        }
+        if (connect_rv == 0 || connect_rv == ECONNREFUSED) {
+            close(fd);
+            return JNI_TRUE;
+        }
+    }
+    close(fd);
+    return JNI_FALSE;
 }
 
+/**
+ * ping implementation.
+ * Send an ICMP_ECHO_REQUEST packet every second until either the timeout
+ * expires or an answer is received.
+ * Returns true if an ECHO_REPLY is received, false otherwise.
+ */
 static jboolean
-ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
-      struct sockaddr_in6* netif, jint ttl) {
-    jint size;
-    jint n;
+ping6(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif,
+      jint timeout, jint ttl)
+{
+    jint n, size = 60 * 1024, tmout2, seq = 1;
     socklen_t len;
-    char sendbuf[1500];
-    unsigned char recvbuf[1500];
+    unsigned char sendbuf[1500], recvbuf[1500];
     struct icmp6_hdr *icmp6;
     struct sockaddr_in6 sa_recv;
-    jbyte *caddr, *recv_caddr;
     jchar pid;
-    jint tmout2, seq = 1;
     struct timeval tv;
-    size_t plen;
+    size_t plen = sizeof(struct icmp6_hdr) + sizeof(tv);
 
-#ifdef __linux__
-    {
-    int csum_offset;
+#if defined(__linux__)
     /**
      * For some strange reason, the linux kernel won't calculate the
      * checksum of ICMPv6 packets unless you set this socket option
      */
-    csum_offset = 2;
+    int csum_offset = 2;
     setsockopt(fd, SOL_RAW, IPV6_CHECKSUM, &csum_offset, sizeof(int));
-    }
 #endif
 
-    caddr = (jbyte *)&(him->sin6_addr);
+    setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
 
-    /* icmp_id is a 16 bit data type, therefore down cast the pid */
-    pid = (jchar)getpid();
-    size = 60*1024;
-    setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
+    // sets the ttl (max number of hops)
     if (ttl > 0) {
-      setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl));
+        setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl));
     }
+
+    // a specific interface was specified, so let's bind the socket
+    // to that interface to ensure the requests are sent only through it.
     if (netif != NULL) {
-      if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) <0) {
-        NET_ThrowNew(env, errno, "Can't bind socket");
-        close(fd);
-        return JNI_FALSE;
-      }
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in6)) <0) {
+            NET_ThrowNew(env, errno, "Can't bind socket");
+            close(fd);
+            return JNI_FALSE;
+        }
     }
+
+    // icmp_id is a 16 bit data type, therefore down cast the pid
+    pid = (jchar)getpid();
+
+    // Make the socket non blocking so we can use select
     SET_NONBLOCKING(fd);
-
     do {
-      icmp6 = (struct icmp6_hdr *) sendbuf;
-      icmp6->icmp6_type = ICMP6_ECHO_REQUEST;
-      icmp6->icmp6_code = 0;
-      /* let's tag the ECHO packet with our pid so we can identify it */
-      icmp6->icmp6_id = htons(pid);
-      icmp6->icmp6_seq = htons(seq);
-      seq++;
-      icmp6->icmp6_cksum = 0;
-      gettimeofday(&tv, NULL);
-      memcpy(sendbuf + sizeof(struct icmp6_hdr), &tv, sizeof(tv));
-      plen = sizeof(struct icmp6_hdr) + sizeof(tv);
-      n = sendto(fd, sendbuf, plen, 0, (struct sockaddr*) him, sizeof(struct sockaddr_in6));
-      if (n < 0 && errno != EINPROGRESS) {
-#ifdef __linux__
-        if (errno != EINVAL && errno != EHOSTUNREACH)
-          /*
-           * On some Linux versions, when a socket is  bound to the
-           * loopback interface, sendto will fail and errno will be
-           * set to EINVAL or EHOSTUNREACH.
-           * When that happens, don't throw an exception, just return false.
-           */
-#endif /*__linux__ */
-        NET_ThrowNew(env, errno, "Can't send ICMP packet");
-        close(fd);
-        return JNI_FALSE;
-      }
+        // create the ICMP request
+        icmp6 = (struct icmp6_hdr *)sendbuf;
+        icmp6->icmp6_type = ICMP6_ECHO_REQUEST;
+        icmp6->icmp6_code = 0;
+        // let's tag the ECHO packet with our pid so we can identify it
+        icmp6->icmp6_id = htons(pid);
+        icmp6->icmp6_seq = htons(seq);
+        seq++;
+        gettimeofday(&tv, NULL);
+        memcpy(sendbuf + sizeof(struct icmp6_hdr), &tv, sizeof(tv));
+        icmp6->icmp6_cksum = 0;
+        // send it
+        n = sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in6));
+        if (n < 0 && errno != EINPROGRESS) {
+#if defined(__linux__)
+            /*
+             * On some Linux versions, when a socket is bound to the loopback
+             * interface, sendto will fail and errno will be set to
+             * EINVAL or EHOSTUNREACH. When that happens, don't throw an
+             * exception, just return false.
+             */
+            if (errno != EINVAL && errno != EHOSTUNREACH) {
+                NET_ThrowNew(env, errno, "Can't send ICMP packet");
+            }
+#else
+            NET_ThrowNew(env, errno, "Can't send ICMP packet");
+#endif
+            close(fd);
+            return JNI_FALSE;
+        }
 
-      tmout2 = timeout > 1000 ? 1000 : timeout;
-      do {
-        tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
-
-        if (tmout2 >= 0) {
-          len = sizeof(sa_recv);
-          n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0, (struct sockaddr*) &sa_recv, &len);
-          icmp6 = (struct icmp6_hdr *) (recvbuf);
-          recv_caddr = (jbyte *)&(sa_recv.sin6_addr);
-          /*
-           * We did receive something, but is it what we were expecting?
-           * I.E.: An ICMP6_ECHO_REPLY packet with the proper PID and
-           *       from the host that we are trying to determine is reachable.
-           */
-          if (n >= 8 && icmp6->icmp6_type == ICMP6_ECHO_REPLY &&
-              (ntohs(icmp6->icmp6_id) == pid)) {
-            if (NET_IsEqual(caddr, recv_caddr)) {
-              close(fd);
-              return JNI_TRUE;
+        tmout2 = timeout > 1000 ? 1000 : timeout;
+        do {
+            tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
+            if (tmout2 >= 0) {
+                len = sizeof(sa_recv);
+                n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0,
+                             (struct sockaddr *)&sa_recv, &len);
+                // check if we received enough data
+                if (n < (jint)sizeof(struct icmp6_hdr)) {
+                    continue;
+                }
+                icmp6 = (struct icmp6_hdr *)recvbuf;
+                // We did receive something, but is it what we were expecting?
+                // I.E.: An ICMP6_ECHO_REPLY packet with the proper PID and
+                //       from the host that we are trying to determine is reachable.
+                if (icmp6->icmp6_type == ICMP6_ECHO_REPLY &&
+                    (ntohs(icmp6->icmp6_id) == pid))
+                {
+                    if (NET_IsEqual((jbyte *)&sa->sa6.sin6_addr,
+                                    (jbyte *)&sa_recv.sin6_addr)) {
+                        close(fd);
+                        return JNI_TRUE;
+                    } else if (NET_IsZeroAddr((jbyte *)&sa->sa6.sin6_addr)) {
+                        close(fd);
+                        return JNI_TRUE;
+                    }
+                }
             }
-            if (NET_IsZeroAddr(caddr)) {
-              close(fd);
-              return JNI_TRUE;
-            }
-          }
-        }
-      } while (tmout2 > 0);
-      timeout -= 1000;
+        } while (tmout2 > 0);
+        timeout -= 1000;
     } while (timeout > 0);
     close(fd);
     return JNI_FALSE;
@@ -642,157 +668,61 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
-                                           jbyteArray addrArray,
-                                           jint scope,
-                                           jint timeout,
-                                           jbyteArray ifArray,
-                                           jint ttl, jint if_scope) {
+                                            jbyteArray addrArray, jint scope,
+                                            jint timeout, jbyteArray ifArray,
+                                            jint ttl, jint if_scope)
+{
     jbyte caddr[16];
-    jint fd, sz;
-    struct sockaddr_in6 him6;
-    struct sockaddr_in6 inf6;
-    struct sockaddr_in6* netif = NULL;
-    int len = 0;
-    int connect_rv = -1;
+    jint sz, fd;
+    SOCKETADDRESS sa, inf, *netif = NULL;
 
-    /*
-     * If IPv6 is not enable, then we can't reach an IPv6 address, can we?
-     */
+    // If IPv6 is not enabled, then we can't reach an IPv6 address, can we?
+    // Actually, we probably shouldn't even get here.
     if (!ipv6_available()) {
-      return JNI_FALSE;
-    }
-    /*
-     * If it's an IPv4 address, ICMP won't work with IPv4 mapped address,
-     * therefore, let's delegate to the Inet4Address method.
-     */
-    sz = (*env)->GetArrayLength(env, addrArray);
-    if (sz == 4) {
-      return Java_java_net_Inet4AddressImpl_isReachable0(env, this,
-                                                         addrArray,
-                                                         timeout,
-                                                         ifArray, ttl);
+        return JNI_FALSE;
     }
 
-    memset((void *) caddr, 0, 16);
-    memset((void *) &him6, 0, sizeof(him6));
-    (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
-    memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
-    him6.sin6_family = AF_INET6;
-#ifdef __linux__
-    if (scope > 0)
-      him6.sin6_scope_id = scope;
-    else
-      him6.sin6_scope_id = getDefaultIPv6Interface( &(him6.sin6_addr));
-    len = sizeof(struct sockaddr_in6);
-#else
-    if (scope > 0)
-      him6.sin6_scope_id = scope;
-    len = sizeof(struct sockaddr_in6);
-#endif
-    /*
-     * If a network interface was specified, let's create the address
-     * for it.
-     */
-    if (!(IS_NULL(ifArray))) {
-      memset((void *) caddr, 0, 16);
-      memset((void *) &inf6, 0, sizeof(inf6));
-      (*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr);
-      memcpy((void *)&(inf6.sin6_addr), caddr, sizeof(struct in6_addr) );
-      inf6.sin6_family = AF_INET6;
-      inf6.sin6_scope_id = if_scope;
-      netif = &inf6;
-    }
-    /*
-     * If we can create a RAW socket, then when can use the ICMP ECHO_REQUEST
-     * otherwise we'll try a tcp socket to the Echo port (7).
-     * Note that this is empiric, and not connecting could mean it's blocked
-     * or the echo service has been disabled.
-     */
-
-    fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
-
-    if (fd != -1) { /* Good to go, let's do a ping */
-        return ping6(env, fd, &him6, timeout, netif, ttl);
+    // If it's an IPv4 address, ICMP won't work with IPv4 mapped address,
+    // therefore, let's delegate to the Inet4Address method.
+    sz = (*env)->GetArrayLength(env, addrArray);
+    if (sz == 4) {
+        return Java_java_net_Inet4AddressImpl_isReachable0(env, this,
+                                                           addrArray, timeout,
+                                                           ifArray, ttl);
     }
 
-    /* No good, let's fall back on TCP */
-    fd = socket(AF_INET6, SOCK_STREAM, 0);
-    if (fd == -1) {
-        /* note: if you run out of fds, you may not be able to load
-         * the exception class, and get a NoClassDefFoundError
-         * instead.
-         */
-        NET_ThrowNew(env, errno, "Can't create socket");
-        return JNI_FALSE;
-    }
-    if (ttl > 0) {
-      setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl));
+    // load address to SOCKETADDRESS
+    memset((char *)caddr, 0, 16);
+    (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
+    memset((char *)&sa, 0, sizeof(SOCKETADDRESS));
+    memcpy((void *)&sa.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+    sa.sa6.sin6_family = AF_INET6;
+    if (scope > 0) {
+        sa.sa6.sin6_scope_id = scope;
+#if defined(__linux__)
+    } else {
+        sa.sa6.sin6_scope_id = getDefaultIPv6Interface(&sa.sa6.sin6_addr);
+#endif
     }
 
-    /*
-     * A network interface was specified, so let's bind to it.
-     */
-    if (netif != NULL) {
-      if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) <0) {
-        NET_ThrowNew(env, errno, "Can't bind socket");
-        close(fd);
-        return JNI_FALSE;
-      }
+    // load network interface address to SOCKETADDRESS, if specified
+    if (!(IS_NULL(ifArray))) {
+        memset((char *)caddr, 0, 16);
+        (*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr);
+        memset((char *)&inf, 0, sizeof(SOCKETADDRESS));
+        memcpy((void *)&inf.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+        inf.sa6.sin6_family = AF_INET6;
+        inf.sa6.sin6_scope_id = if_scope;
+        netif = &inf;
     }
-    SET_NONBLOCKING(fd);
-
-    him6.sin6_port = htons((short) 7); /* Echo port */
-    connect_rv = NET_Connect(fd, (struct sockaddr *)&him6, len);
-
-    /**
-     * connection established or refused immediately, either way it means
-     * we were able to reach the host!
-     */
-    if (connect_rv == 0 || errno == ECONNREFUSED) {
-        close(fd);
-        return JNI_TRUE;
-    } else {
-        socklen_t optlen = (socklen_t)sizeof(connect_rv);
 
-        switch (errno) {
-        case ENETUNREACH: /* Network Unreachable */
-        case EAFNOSUPPORT: /* Address Family not supported */
-        case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#if defined(__linux__) || defined(_AIX)
-        case EINVAL:
-        case EHOSTUNREACH: /* No route to host */
-          /*
-           * On some Linux versions, when  a socket is bound to the
-           * loopback interface, connect will fail and errno will
-           * be set to EINVAL or EHOSTUNREACH.  When that happens,
-           * don't throw an exception, just return false.
-           */
-#endif /* __linux__ */
-          close(fd);
-          return JNI_FALSE;
-        }
-
-        if (errno != EINPROGRESS) {
-            NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
-                                         "connect failed");
-            close(fd);
-            return JNI_FALSE;
-        }
-
-        timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
-
-        if (timeout >= 0) {
-          /* has connection been established */
-          if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
-                         &optlen) <0) {
-            connect_rv = errno;
-          }
-          if (connect_rv == 0 || connect_rv == ECONNREFUSED) {
-            close(fd);
-            return JNI_TRUE;
-          }
-        }
-        close(fd);
-        return JNI_FALSE;
+    // Let's try to create a RAW socket to send ICMP packets.
+    // This usually requires "root" privileges, so it's likely to fail.
+    fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+    if (fd == -1) {
+        return tcp_ping6(env, &sa, netif, timeout, ttl);
+    } else {
+        // It didn't fail, so we can use ICMP_ECHO requests.
+        return ping6(env, fd, &sa, netif, timeout, ttl);
     }
 }
--- a/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,29 +90,16 @@
 #if defined(__solaris__)
     rv = connect(fd, 0, 0);
 #else
-    int len;
     SOCKETADDRESS sa;
+    socklen_t len = isIPv6 ? sizeof(struct sockaddr_in6) :
+                             sizeof(struct sockaddr_in);
 
     memset(&sa, 0, sizeof(sa));
-
-#ifdef AF_INET6
-    if (isIPv6) {
 #if defined(_ALLBSD_SOURCE)
-        sa.sa6.sin6_family = AF_INET6;
+    sa.sa.sa_family = isIPv6 ? AF_INET6 : AF_INET;
 #else
-        sa.sa6.sin6_family = AF_UNSPEC;
+    sa.sa.sa_family = AF_UNSPEC;
 #endif
-        len = sizeof(struct sockaddr_in6);
-    } else
-#endif
-    {
-#if defined(_ALLBSD_SOURCE)
-        sa.sa4.sin_family = AF_INET;
-#else
-        sa.sa4.sin_family = AF_UNSPEC;
-#endif
-        len = sizeof(struct sockaddr_in);
-    }
 
     rv = connect(fd, &sa.sa, len);
 
@@ -126,8 +113,9 @@
      */
     if (rv < 0 && errno == EAFNOSUPPORT)
         rv = errno = 0;
-#endif
-#endif
+#endif // defined(_ALLBSD_SOURCE) || defined(_AIX)
+
+#endif // defined(__solaris__)
 
     if (rv < 0)
         handleSocketError(env, errno);
--- a/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,14 +37,8 @@
 
 #include "sun_nio_ch_InheritedChannel.h"
 
-static int matchFamily(struct sockaddr *sa) {
-    int family = sa->sa_family;
-#ifdef AF_INET6
-    if (ipv6_available()) {
-        return (family == AF_INET6);
-    }
-#endif
-    return (family == AF_INET);
+static int matchFamily(SOCKETADDRESS *sa) {
+    return (sa->sa.sa_family == (ipv6_available() ? AF_INET6 : AF_INET));
 }
 
 JNIEXPORT void JNICALL
@@ -63,7 +57,7 @@
     jint remote_port;
 
     if (getpeername(fd, &sa.sa, &len) == 0) {
-        if (matchFamily(&sa.sa)) {
+        if (matchFamily(&sa)) {
             remote_ia = NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
         }
     }
@@ -71,7 +65,6 @@
     return remote_ia;
 }
 
-
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
 {
@@ -80,7 +73,7 @@
     jint remote_port = -1;
 
     if (getpeername(fd, &sa.sa, &len) == 0) {
-        if (matchFamily(&sa.sa)) {
+        if (matchFamily(&sa)) {
             NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
         }
     }
@@ -92,7 +85,7 @@
 Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd)
 {
     int sotype;
-    socklen_t arglen=sizeof(sotype);
+    socklen_t arglen = sizeof(sotype);
     if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) == 0) {
         if (sotype == SOCK_STREAM)
             return sun_nio_ch_InheritedChannel_SOCK_STREAM;
@@ -123,7 +116,7 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_InheritedChannel_open0(JNIEnv *env, jclass cla, jstring path, jint oflag)
 {
-    const char* str;
+    const char *str;
     int oflag_actual;
 
     /* convert to OS specific value */
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,23 +101,21 @@
  * Copy IPv6 group, interface index, and IPv6 source address
  * into group_source_req structure.
  */
-#ifdef AF_INET6
 static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
-                               jbyteArray source, struct group_source_req* req)
+                               jbyteArray source, struct group_source_req *req)
 {
     struct sockaddr_in6* sin6;
 
     req->gsr_interface = (uint32_t)index;
 
-    sin6 = (struct sockaddr_in6*)&(req->gsr_group);
+    sin6 = (struct sockaddr_in6 *)&(req->gsr_group);
     sin6->sin6_family = AF_INET6;
-    COPY_INET6_ADDRESS(env, group, (jbyte*)&(sin6->sin6_addr));
+    COPY_INET6_ADDRESS(env, group, (jbyte *)&(sin6->sin6_addr));
 
-    sin6 = (struct sockaddr_in6*)&(req->gsr_source);
+    sin6 = (struct sockaddr_in6 *)&(req->gsr_source);
     sin6->sin6_family = AF_INET6;
-    COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
+    COPY_INET6_ADDRESS(env, source, (jbyte *)&(sin6->sin6_addr));
 }
-#endif
 
 #ifdef _AIX
 
@@ -199,18 +197,13 @@
 {
     int fd;
     int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
-#ifdef AF_INET6
     int domain = (ipv6_available() && preferIPv6) ? AF_INET6 : AF_INET;
-#else
-    int domain = AF_INET;
-#endif
 
     fd = socket(domain, type, 0);
     if (fd < 0) {
         return handleSocketError(env, errno);
     }
 
-#ifdef AF_INET6
     /* Disable IPV6_V6ONLY to ensure dual-socket support */
     if (domain == AF_INET6) {
         int arg = 0;
@@ -223,7 +216,6 @@
             return -1;
         }
     }
-#endif
 
     if (reuse) {
         int arg = 1;
@@ -250,9 +242,7 @@
             return -1;
         }
     }
-#endif
 
-#if defined(__linux__) && defined(AF_INET6)
     /* By default, Linux uses the route default */
     if (domain == AF_INET6 && type == SOCK_DGRAM) {
         int arg = 1;
@@ -569,7 +559,6 @@
 Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
                                 jbyteArray group, jint index, jbyteArray source)
 {
-#ifdef AF_INET6
     struct ipv6_mreq mreq6;
     struct group_source_req req;
     int opt, n, optlen;
@@ -600,21 +589,16 @@
         handleSocketError(env, errno);
     }
     return 0;
-#else
-    JNU_ThrowInternalError(env, "Should not get here");
-    return IOS_THROWN;
-#endif  /* AF_INET6 */
 }
 
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
                                     jbyteArray group, jint index, jbyteArray source)
 {
-#ifdef AF_INET6
-  #ifdef __APPLE__
+#ifdef __APPLE__
     /* no IPv6 exclude-mode filtering for now */
     return IOS_UNAVAILABLE;
-  #else
+#else
     struct group_source_req req;
     int n;
     int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
@@ -629,10 +613,6 @@
         handleSocketError(env, errno);
     }
     return 0;
-  #endif
-#else
-    JNU_ThrowInternalError(env, "Should not get here");
-    return IOS_THROWN;
 #endif
 }
 
--- a/jdk/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -30,60 +30,6 @@
 #include "java_net_Inet4AddressImpl.h"
 
 /*
- * Returns true if hostname is in dotted IP address format. Note that this
- * function performs a syntax check only. For each octet it just checks that
- * the octet is at most 3 digits.
- */
-jboolean isDottedIPAddress(const char *hostname, unsigned int *addrp) {
-    char *c = (char *)hostname;
-    int octets = 0;
-    unsigned int cur = 0;
-    int digit_cnt = 0;
-
-    while (*c) {
-        if (*c == '.') {
-            if (digit_cnt == 0) {
-                return JNI_FALSE;
-            } else {
-                if (octets < 4) {
-                    addrp[octets++] = cur;
-                    cur = 0;
-                    digit_cnt = 0;
-                } else {
-                    return JNI_FALSE;
-                }
-            }
-            c++;
-            continue;
-        }
-
-        if ((*c < '0') || (*c > '9')) {
-            return JNI_FALSE;
-        }
-
-        digit_cnt++;
-        if (digit_cnt > 3) {
-            return JNI_FALSE;
-        }
-
-        /* don't check if current octet > 255 */
-        cur = cur*10 + (*c - '0');
-
-        /* Move onto next character and check for EOF */
-        c++;
-        if (*c == '\0') {
-            if (octets < 4) {
-                addrp[octets++] = cur;
-            } else {
-                return JNI_FALSE;
-            }
-        }
-    }
-
-    return (jboolean)(octets == 4);
-}
-
-/*
  * Inet4AddressImpl
  */
 
@@ -93,17 +39,17 @@
  * Signature: ()Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL
-Java_java_net_Inet4AddressImpl_getLocalHostName (JNIEnv *env, jobject this) {
+Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
     char hostname[256];
 
-    if (gethostname(hostname, sizeof hostname) == -1) {
+    if (gethostname(hostname, sizeof(hostname)) == -1) {
         strcpy(hostname, "localhost");
     }
     return JNU_NewStringPlatform(env, hostname);
 }
 
 /*
- * Find an internet address for a given hostname.  Not this this
+ * Find an internet address for a given hostname. Note that this
  * code only works for addresses of type INET. The translation
  * of %d.%d.%d.%d to an address (int) occurs in java now, so the
  * String "host" shouldn't be a %d.%d.%d.%d string. The only
@@ -120,7 +66,6 @@
     jobjectArray ret = NULL;
     const char *hostname;
     int error = 0;
-    unsigned int addr[4];
     struct addrinfo hints, *res = NULL, *resNew = NULL, *last = NULL,
         *iterator;
 
@@ -134,57 +79,6 @@
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
-    /*
-     * The NT/2000 resolver tolerates a space in front of localhost. This
-     * is not consistent with other implementations of gethostbyname.
-     * In addition we must do a white space check on Solaris to avoid a
-     * bug whereby 0.0.0.0 is returned if any host name has a white space.
-     */
-    if (isspace(hostname[0])) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname);
-        goto cleanupAndReturn;
-    }
-
-    /*
-     * If the format is x.x.x.x then don't use gethostbyname as Windows
-     * is unable to handle octets which are out of range.
-     */
-    if (isDottedIPAddress(hostname, &addr[0])) {
-        unsigned int address;
-        jobject iaObj;
-
-        /*
-         * Are any of the octets out of range?
-         */
-        if (addr[0] > 255 || addr[1] > 255 || addr[2] > 255 || addr[3] > 255) {
-            JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname);
-            goto cleanupAndReturn;
-        }
-
-        /*
-         * Return an byte array with the populated address.
-         */
-        address = (addr[3] << 24) & 0xff000000;
-        address |= (addr[2] << 16) & 0xff0000;
-        address |= (addr[1] << 8) & 0xff00;
-        address |= addr[0];
-
-        ret = (*env)->NewObjectArray(env, 1, ia_class, NULL);
-
-        if (IS_NULL(ret)) {
-            goto cleanupAndReturn;
-        }
-
-        iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
-        if (IS_NULL(iaObj)) {
-            ret = NULL;
-            goto cleanupAndReturn;
-        }
-        setInetAddress_addr(env, iaObj, ntohl(address));
-        (*env)->SetObjectArrayElement(env, ret, 0, iaObj);
-        goto cleanupAndReturn;
-    }
-
     // try once, with our static buffer
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_CANONNAME;
@@ -193,6 +87,7 @@
     error = getaddrinfo(hostname, NULL, &hints, &res);
 
     if (error) {
+        // report error
         NET_ThrowByNameWithLastError(env, "java/net/UnknownHostException",
                                      hostname);
         goto cleanupAndReturn;
@@ -311,145 +206,86 @@
     return ret;
 }
 
+/**
+ * ping implementation using tcp port 7 (echo)
+ */
 static jboolean
-tcp_ping4(JNIEnv *env,
-          jbyteArray addrArray,
-          jint timeout,
-          jbyteArray ifArray,
+tcp_ping4(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout,
           jint ttl)
 {
-    jint addr;
-    jbyte caddr[4];
     jint fd;
-    struct sockaddr_in him;
-    struct sockaddr_in* netif = NULL;
-    struct sockaddr_in inf;
-    int len = 0;
+    int connect_rv = -1;
     WSAEVENT hEvent;
-    int connect_rv = -1;
-    int sz;
 
-    /**
-     * Convert IP address from byte array to integer
-     */
-    sz = (*env)->GetArrayLength(env, addrArray);
-    if (sz != 4) {
-        return JNI_FALSE;
-    }
-    memset((char *) &him, 0, sizeof(him));
-    memset((char *) caddr, 0, sizeof(caddr));
-    (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-    addr = ((caddr[0]<<24) & 0xff000000);
-    addr |= ((caddr[1] <<16) & 0xff0000);
-    addr |= ((caddr[2] <<8) & 0xff00);
-    addr |= (caddr[3] & 0xff);
-    addr = htonl(addr);
-    /**
-     * Socket address
-     */
-    him.sin_addr.s_addr = addr;
-    him.sin_family = AF_INET;
-    len = sizeof(him);
-
-    /**
-     * If a network interface was specified, let's convert its address
-     * as well.
-     */
-    if (!(IS_NULL(ifArray))) {
-        memset((char *) caddr, 0, sizeof(caddr));
-        (*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
-        addr = ((caddr[0]<<24) & 0xff000000);
-        addr |= ((caddr[1] <<16) & 0xff0000);
-        addr |= ((caddr[2] <<8) & 0xff00);
-        addr |= (caddr[3] & 0xff);
-        addr = htonl(addr);
-        inf.sin_addr.s_addr = addr;
-        inf.sin_family = AF_INET;
-        inf.sin_port = 0;
-        netif = &inf;
-    }
-
-    /*
-     * Can't create a raw socket, so let's try a TCP socket
-     */
+    // open a TCP socket
     fd = NET_Socket(AF_INET, SOCK_STREAM, 0);
-    if (fd == -1) {
-        /* note: if you run out of fds, you may not be able to load
-         * the exception class, and get a NoClassDefFoundError
-         * instead.
-         */
+    if (fd == SOCKET_ERROR) {
+        // note: if you run out of fds, you may not be able to load
+        // the exception class, and get a NoClassDefFoundError instead.
         NET_ThrowNew(env, WSAGetLastError(), "Can't create socket");
         return JNI_FALSE;
     }
+
+    // set TTL
     if (ttl > 0) {
         setsockopt(fd, IPPROTO_IP, IP_TTL, (const char *)&ttl, sizeof(ttl));
     }
-    /*
-     * A network interface was specified, so let's bind to it.
-     */
+
+    // A network interface was specified, so let's bind to it.
     if (netif != NULL) {
-        if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in)) < 0) {
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in)) < 0) {
             NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket");
             closesocket(fd);
             return JNI_FALSE;
         }
     }
 
-    /*
-     * Make the socket non blocking so we can use select/poll.
-     */
+    // Make the socket non blocking so we can use select/poll.
     hEvent = WSACreateEvent();
     WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
 
-    /* no need to use NET_Connect as non-blocking */
-    him.sin_port = htons(7);    /* Echo */
-    connect_rv = connect(fd, (struct sockaddr *)&him, len);
+    sa->sa4.sin_port = htons(7); // echo port
+    connect_rv = connect(fd, &sa->sa, sizeof(struct sockaddr_in));
 
-    /**
-     * connection established or refused immediately, either way it means
-     * we were able to reach the host!
-     */
+    // connection established or refused immediately, either way it means
+    // we were able to reach the host!
     if (connect_rv == 0 || WSAGetLastError() == WSAECONNREFUSED) {
         WSACloseEvent(hEvent);
         closesocket(fd);
         return JNI_TRUE;
-    } else {
-        int optlen;
+    }
 
-        switch (WSAGetLastError()) {
-        case WSAEHOSTUNREACH:   /* Host Unreachable */
-        case WSAENETUNREACH:    /* Network Unreachable */
-        case WSAENETDOWN:       /* Network is down */
-        case WSAEPFNOSUPPORT:   /* Protocol Family unsupported */
-            WSACloseEvent(hEvent);
-            closesocket(fd);
-            return JNI_FALSE;
+    switch (WSAGetLastError()) {
+    case WSAEHOSTUNREACH:   // Host Unreachable
+    case WSAENETUNREACH:    // Network Unreachable
+    case WSAENETDOWN:       // Network is down
+    case WSAEPFNOSUPPORT:   // Protocol Family unsupported
+        WSACloseEvent(hEvent);
+        closesocket(fd);
+        return JNI_FALSE;
+    case WSAEWOULDBLOCK:    // this is expected as we'll probably have to wait
+        break;
+    default:
+        NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
+                                     "connect failed");
+        WSACloseEvent(hEvent);
+        closesocket(fd);
+        return JNI_FALSE;
+    }
+
+    timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
+    if (timeout >= 0) {
+        // connection has been established, check for error condition
+        int optlen = sizeof(connect_rv);
+        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&connect_rv,
+                       &optlen) < 0)
+        {
+            connect_rv = WSAGetLastError();
         }
-
-        if (WSAGetLastError() != WSAEWOULDBLOCK) {
-            NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
-                                         "connect failed");
+        if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
             WSACloseEvent(hEvent);
             closesocket(fd);
-            return JNI_FALSE;
-        }
-
-        timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
-
-        /* has connection been established */
-
-        if (timeout >= 0) {
-            optlen = sizeof(connect_rv);
-            if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
-                           &optlen) <0) {
-                connect_rv = WSAGetLastError();
-            }
-
-            if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
-                WSACloseEvent(hEvent);
-                closesocket(fd);
-                return JNI_TRUE;
-            }
+            return JNI_TRUE;
         }
     }
     WSACloseEvent(hEvent);
@@ -464,21 +300,17 @@
  * Returns true is an ECHO_REPLY is received, otherwise, false.
  */
 static jboolean
-ping4(JNIEnv *env,
-      unsigned long src_addr,
-      unsigned long dest_addr,
-      jint timeout,
-      HANDLE hIcmpFile)
+ping4(JNIEnv *env, HANDLE hIcmpFile, SOCKETADDRESS *sa,
+      SOCKETADDRESS *netif, jint timeout)
 {
-    // See https://msdn.microsoft.com/en-us/library/aa366050%28VS.85%29.aspx
-
     DWORD dwRetVal = 0;
     char SendData[32] = {0};
     LPVOID ReplyBuffer = NULL;
     DWORD ReplySize = 0;
     jboolean ret = JNI_FALSE;
 
-    // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366051%28v=vs.85%29.aspx
+    // See https://msdn.microsoft.com/en-us/library/aa366050%28VS.85%29.aspx
+    // or 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
@@ -487,16 +319,16 @@
                                           // to also hold 8 more bytes of data
                                           // (the size of an ICMP error message)
 
-    ReplyBuffer = (VOID*) malloc(ReplySize);
+    ReplyBuffer = (VOID *)malloc(ReplySize);
     if (ReplyBuffer == NULL) {
         IcmpCloseHandle(hIcmpFile);
         NET_ThrowNew(env, WSAGetLastError(), "Unable to allocate memory");
         return JNI_FALSE;
     }
 
-    if (src_addr == 0) {
+    if (netif == NULL) {
         dwRetVal = IcmpSendEcho(hIcmpFile,  // HANDLE IcmpHandle,
-                                dest_addr,  // IPAddr DestinationAddress,
+                                sa->sa4.sin_addr.s_addr, // IPAddr DestinationAddress,
                                 SendData,   // LPVOID RequestData,
                                 sizeof(SendData),   // WORD RequestSize,
                                 NULL,       // PIP_OPTION_INFORMATION RequestOptions,
@@ -506,20 +338,20 @@
                                 // seem to have an undocumented minimum
                                 // timeout of 1000ms below which the
                                 // api behaves inconsistently.
-                                (timeout < 1000) ? 1000 : timeout);   // DWORD Timeout
+                                (timeout < 1000) ? 1000 : timeout); // DWORD Timeout
     } else {
         dwRetVal = IcmpSendEcho2Ex(hIcmpFile,  // HANDLE IcmpHandle,
                                    NULL,       // HANDLE Event
                                    NULL,       // PIO_APC_ROUTINE ApcRoutine
                                    NULL,       // ApcContext
-                                   src_addr,   // IPAddr SourceAddress,
-                                   dest_addr,  // IPAddr DestinationAddress,
+                                   netif->sa4.sin_addr.s_addr, // IPAddr SourceAddress,
+                                   sa->sa4.sin_addr.s_addr, // IPAddr DestinationAddress,
                                    SendData,   // LPVOID RequestData,
-                                   sizeof(SendData),   // WORD RequestSize,
+                                   sizeof(SendData), // WORD RequestSize,
                                    NULL,       // PIP_OPTION_INFORMATION RequestOptions,
                                    ReplyBuffer,// LPVOID ReplyBuffer,
                                    ReplySize,  // DWORD ReplySize,
-                                   (timeout < 1000) ? 1000 : timeout);   // DWORD Timeout
+                                   (timeout < 1000) ? 1000 : timeout); // DWORD Timeout
     }
 
     if (dwRetVal == 0) { // if the call failed
@@ -544,8 +376,8 @@
                 break;
             default:
                 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-                        NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                        (LPTSTR)&buf, 0, NULL);
+                              NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                              (LPTSTR)&buf, 0, NULL);
                 NET_ThrowNew(env, err, buf);
                 LocalFree(buf);
                 break;
@@ -558,8 +390,8 @@
         // 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)
+        if (pEchoReply->Status == IP_SUCCESS &&
+            (int)pEchoReply->RoundTripTime <= timeout)
         {
             ret = JNI_TRUE;
         }
@@ -578,57 +410,58 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this,
-                                           jbyteArray addrArray,
-                                           jint timeout,
-                                           jbyteArray ifArray,
-                                           jint ttl) {
-    jint src_addr = 0;
-    jint dest_addr = 0;
+                                            jbyteArray addrArray, jint timeout,
+                                            jbyteArray ifArray, jint ttl)
+{
     jbyte caddr[4];
-    int sz;
+    jint addr = 0, sz;
+    SOCKETADDRESS sa, inf, *netif = NULL;
     HANDLE hIcmpFile;
 
-    /**
-     * Convert IP address from byte array to integer
-     */
+    // check if address array size is 4 (IPv4 address)
     sz = (*env)->GetArrayLength(env, addrArray);
     if (sz != 4) {
       return JNI_FALSE;
     }
-    memset((char *) caddr, 0, sizeof(caddr));
+
+    // convert IP address from byte array to integer
+    memset((char *)caddr, 0, sizeof(caddr));
     (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-    dest_addr = ((caddr[0]<<24) & 0xff000000);
-    dest_addr |= ((caddr[1] <<16) & 0xff0000);
-    dest_addr |= ((caddr[2] <<8) & 0xff00);
-    dest_addr |= (caddr[3] & 0xff);
-    dest_addr = htonl(dest_addr);
+    addr = ((caddr[0] << 24) & 0xff000000);
+    addr |= ((caddr[1] << 16) & 0xff0000);
+    addr |= ((caddr[2] << 8) & 0xff00);
+    addr |= (caddr[3] & 0xff);
+    memset((char *)&sa, 0, sizeof(SOCKETADDRESS));
+    sa.sa4.sin_addr.s_addr = htonl(addr);
+    sa.sa4.sin_family = AF_INET;
 
-    /**
-     * If a network interface was specified, let's convert its address
-     * as well.
-     */
+    // If a network interface was specified, let's convert its address as well.
     if (!(IS_NULL(ifArray))) {
-        memset((char *) caddr, 0, sizeof(caddr));
+        memset((char *)caddr, 0, sizeof(caddr));
         (*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
-        src_addr = ((caddr[0]<<24) & 0xff000000);
-        src_addr |= ((caddr[1] <<16) & 0xff0000);
-        src_addr |= ((caddr[2] <<8) & 0xff00);
-        src_addr |= (caddr[3] & 0xff);
-        src_addr = htonl(src_addr);
+        addr = ((caddr[0] << 24) & 0xff000000);
+        addr |= ((caddr[1] << 16) & 0xff0000);
+        addr |= ((caddr[2] << 8) & 0xff00);
+        addr |= (caddr[3] & 0xff);
+        memset((char *)&inf, 0, sizeof(SOCKETADDRESS));
+        inf.sa4.sin_addr.s_addr = htonl(addr);
+        inf.sa4.sin_family = AF_INET;
+        netif = &inf;
     }
 
+    // Let's try to create an ICMP handle.
     hIcmpFile = IcmpCreateFile();
     if (hIcmpFile == INVALID_HANDLE_VALUE) {
         int err = WSAGetLastError();
         if (err == ERROR_ACCESS_DENIED) {
             // fall back to TCP echo if access is denied to ICMP
-            return tcp_ping4(env, addrArray, timeout, ifArray, ttl);
+            return tcp_ping4(env, &sa, netif, timeout, ttl);
         } else {
             NET_ThrowNew(env, err, "Unable to create ICMP file handle");
             return JNI_FALSE;
         }
     } else {
-        return ping4(env, src_addr, dest_addr, timeout, hIcmpFile);
+        // It didn't fail, so we can use ICMP.
+        return ping4(env, hIcmpFile, &sa, netif, timeout);
     }
 }
-
--- a/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Mon Mar 13 19:58:52 2017 +0000
@@ -40,41 +40,40 @@
  * Signature: ()Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL
-Java_java_net_Inet6AddressImpl_getLocalHostName (JNIEnv *env, jobject this) {
-    char hostname [256];
+Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
+    char hostname[256];
 
-    if (gethostname (hostname, sizeof (hostname)) == -1) {
-        strcpy (hostname, "localhost");
+    if (gethostname(hostname, sizeof(hostname)) == -1) {
+        strcpy(hostname, "localhost");
     }
-    return JNU_NewStringPlatform (env, hostname);
+    return JNU_NewStringPlatform(env, hostname);
 }
 
+/*
+ * Class:     java_net_Inet6AddressImpl
+ * Method:    lookupAllHostAddr
+ * Signature: (Ljava/lang/String;)[[B
+ */
 JNIEXPORT jobjectArray JNICALL
 Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
-                                                jstring host) {
+                                                 jstring host) {
+    jobjectArray ret = NULL;
     const char *hostname;
-    jobjectArray ret = 0;
-    int retLen = 0;
-    jboolean preferIPv6Address;
-
-    int error=0;
-    struct addrinfo hints, *res = NULL, *resNew = NULL;
+    int error = 0;
+    struct addrinfo hints, *res = NULL, *resNew = NULL, *last = NULL,
+        *iterator;
 
     initInetAddressIDs(env);
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
 
     if (IS_NULL(host)) {
-        JNU_ThrowNullPointerException(env, "host is null");
-        return 0;
+        JNU_ThrowNullPointerException(env, "host argument is null");
+        return NULL;
     }
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
-    /* get the address preference */
-    preferIPv6Address
-        = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
-
-    /* Try once, with our static buffer. */
+    // try once, with our static buffer
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_CANONNAME;
     hints.ai_family = AF_UNSPEC;
@@ -82,35 +81,28 @@
     error = getaddrinfo(hostname, NULL, &hints, &res);
 
     if (error) {
-        if (WSAGetLastError() == WSATRY_AGAIN) {
-            NET_ThrowByNameWithLastError(env,
-                                         JNU_JAVANETPKG "UnknownHostException",
-                                         hostname);
-            JNU_ReleaseStringPlatformChars(env, host, hostname);
-            return NULL;
-        } else {
-            /* report error */
-            JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
-                            (char *)hostname);
-            JNU_ReleaseStringPlatformChars(env, host, hostname);
-            return NULL;
-        }
+        // report error
+        NET_ThrowByNameWithLastError(env, "java/net/UnknownHostException",
+                                     hostname);
+        goto cleanupAndReturn;
     } else {
-        int i = 0;
-        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
-        struct addrinfo *itr, *last, *iterator = res;
+        int i = 0, inetCount = 0, inet6Count = 0, inetIndex = 0,
+            inet6Index = 0, originalIndex = 0;
+        int addressPreference =
+            (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
+        iterator = res;
         while (iterator != NULL) {
+            // skip duplicates
             int skip = 0;
-            itr = resNew;
-            while (itr != NULL) {
-                if (iterator->ai_family == itr->ai_family &&
-                    iterator->ai_addrlen == itr->ai_addrlen) {
-                    if (itr->ai_family == AF_INET) { /* AF_INET */
+            struct addrinfo *iteratorNew = resNew;
+            while (iteratorNew != NULL) {
+                if (iterator->ai_family == iteratorNew->ai_family &&
+                    iterator->ai_addrlen == iteratorNew->ai_addrlen) {
+                    if (iteratorNew->ai_family == AF_INET) { /* AF_INET */
                         struct sockaddr_in *addr1, *addr2;
                         addr1 = (struct sockaddr_in *)iterator->ai_addr;
-                        addr2 = (struct sockaddr_in *)itr->ai_addr;
-                        if (addr1->sin_addr.s_addr ==
-                            addr2->sin_addr.s_addr) {
+                        addr2 = (struct sockaddr_in *)iteratorNew->ai_addr;
+                        if (addr1->sin_addr.s_addr == addr2->sin_addr.s_addr) {
                             skip = 1;
                             break;
                         }
@@ -118,7 +110,7 @@
                         int t;
                         struct sockaddr_in6 *addr1, *addr2;
                         addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
-                        addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+                        addr2 = (struct sockaddr_in6 *)iteratorNew->ai_addr;
 
                         for (t = 0; t < 16; t++) {
                             if (addr1->sin6_addr.s6_addr[t] !=
@@ -127,7 +119,7 @@
                             }
                         }
                         if (t < 16) {
-                            itr = itr->ai_next;
+                            iteratorNew = iteratorNew->ai_next;
                             continue;
                         } else {
                             skip = 1;
@@ -136,16 +128,16 @@
                     }
                 } else if (iterator->ai_family != AF_INET &&
                            iterator->ai_family != AF_INET6) {
-                    /* we can't handle other family types */
+                    // we can't handle other family types
                     skip = 1;
                     break;
                 }
-                itr = itr->ai_next;
+                iteratorNew = iteratorNew->ai_next;
             }
 
             if (!skip) {
                 struct addrinfo *next
-                    = (struct addrinfo*) malloc(sizeof(struct addrinfo));
+                    = (struct addrinfo *)malloc(sizeof(struct addrinfo));
                 if (!next) {
                     JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
@@ -161,87 +153,81 @@
                 last = next;
                 i++;
                 if (iterator->ai_family == AF_INET) {
-                    inetCount ++;
+                    inetCount++;
                 } else if (iterator->ai_family == AF_INET6) {
-                    inet6Count ++;
+                    inet6Count++;
                 }
             }
             iterator = iterator->ai_next;
         }
-        retLen = i;
-        iterator = resNew;
-        i = 0;
-        ret = (*env)->NewObjectArray(env, retLen, ia_class, NULL);
 
+        // allocate array - at this point i contains the number of addresses
+        ret = (*env)->NewObjectArray(env, i, ia_class, NULL);
         if (IS_NULL(ret)) {
             /* we may have memory to free at the end of this */
             goto cleanupAndReturn;
         }
 
-        if (preferIPv6Address == java_net_InetAddress_PREFER_IPV6_VALUE) {
+        if (addressPreference == java_net_InetAddress_PREFER_IPV6_VALUE) {
             inetIndex = inet6Count;
             inet6Index = 0;
-        } else if (preferIPv6Address == java_net_InetAddress_PREFER_IPV4_VALUE) {
+        } else if (addressPreference == java_net_InetAddress_PREFER_IPV4_VALUE) {
             inetIndex = 0;
             inet6Index = inetCount;
-        } else if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+        } else if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
             inetIndex = inet6Index = originalIndex = 0;
         }
 
+        iterator = resNew;
         while (iterator != NULL) {
             if (iterator->ai_family == AF_INET) {
-              jobject iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
-              if (IS_NULL(iaObj)) {
-                ret = NULL;
-                goto cleanupAndReturn;
-              }
-              setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
-              setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
-              inetIndex ++;
+                jobject iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
+                if (IS_NULL(iaObj)) {
+                    ret = NULL;
+                    goto cleanupAndReturn;
+                }
+                setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+                setInetAddress_hostName(env, iaObj, host);
+                (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
+                inetIndex++;
             } else if (iterator->ai_family == AF_INET6) {
-              jint scope = 0;
-              jboolean ret1;
-              jobject iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
-              if (IS_NULL(iaObj)) {
-                ret = NULL;
-                goto cleanupAndReturn;
-              }
-              ret1 = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
-              if (ret1 == JNI_FALSE) {
-                ret = NULL;
-                goto cleanupAndReturn;
-              }
-              scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
-              if (scope != 0) { /* zero is default value, no need to set */
-                setInet6Address_scopeid(env, iaObj, scope);
-              }
-              setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
-              inet6Index ++;
+                jint scope = 0;
+                jboolean ret1;
+                jobject iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
+                if (IS_NULL(iaObj)) {
+                    ret = NULL;
+                    goto cleanupAndReturn;
+                }
+                ret1 = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
+                if (ret1 == JNI_FALSE) {
+                    ret = NULL;
+                    goto cleanupAndReturn;
+                }
+                scope = ((struct sockaddr_in6 *)iterator->ai_addr)->sin6_scope_id;
+                if (scope != 0) { // zero is default value, no need to set
+                    setInet6Address_scopeid(env, iaObj, scope);
+                }
+                setInetAddress_hostName(env, iaObj, host);
+                (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
+                inet6Index++;
             }
-            if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+            if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
                 originalIndex++;
                 inetIndex = inet6Index = 0;
             }
             iterator = iterator->ai_next;
         }
     }
-
 cleanupAndReturn:
-    {
-        struct addrinfo *iterator, *tmp;
-        iterator = resNew;
-        while (iterator != NULL) {
-            tmp = iterator;
-            iterator = iterator->ai_next;
-            free(tmp);
-        }
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
+    JNU_ReleaseStringPlatformChars(env, host, hostname);
+    while (resNew != NULL) {
+        last = resNew;
+        resNew = resNew->ai_next;
+        free(last);
     }
-
-    freeaddrinfo(res);
-
+    if (res != NULL) {
+        freeaddrinfo(res);
+    }
     return ret;
 }
 
@@ -249,57 +235,48 @@
  * Class:     java_net_Inet6AddressImpl
  * Method:    getHostByAddr
  * Signature: (I)Ljava/lang/String;
+ *
+ * Theoretically the UnknownHostException could be enriched with gai error
+ * information. But as it is silently ignored anyway, there's no need for this.
+ * It's only important that either a valid hostname is returned or an
+ * UnknownHostException is thrown.
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
-                                            jbyteArray addrArray) {
+                                             jbyteArray addrArray) {
     jstring ret = NULL;
-
-    char host[NI_MAXHOST+1];
-    int error = 0;
+    char host[NI_MAXHOST + 1];
     int len = 0;
     jbyte caddr[16];
+    SOCKETADDRESS sa;
 
-    struct sockaddr_in him4;
-    struct sockaddr_in6 him6;
-    struct sockaddr *sa;
+    memset((void *)&sa, 0, sizeof(SOCKETADDRESS));
 
-    /*
-     * For IPv4 addresses construct a sockaddr_in structure.
-     */
+    // construct a sockaddr_in structure (AF_INET or AF_INET6)
     if ((*env)->GetArrayLength(env, addrArray) == 4) {
         jint addr;
         (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-        addr = ((caddr[0]<<24) & 0xff000000);
-        addr |= ((caddr[1] <<16) & 0xff0000);
-        addr |= ((caddr[2] <<8) & 0xff00);
+        addr = ((caddr[0] << 24) & 0xff000000);
+        addr |= ((caddr[1] << 16) & 0xff0000);
+        addr |= ((caddr[2] << 8) & 0xff00);
         addr |= (caddr[3] & 0xff);
-        memset((char *) &him4, 0, sizeof(him4));
-        him4.sin_addr.s_addr = htonl(addr);
-        him4.sin_family = AF_INET;
-        sa = (struct sockaddr *) &him4;
-        len = sizeof(him4);
+        sa.sa4.sin_addr.s_addr = htonl(addr);
+        sa.sa4.sin_family = AF_INET;
+        len = sizeof(struct sockaddr_in);
     } else {
-        /*
-         * For IPv6 address construct a sockaddr_in6 structure.
-         */
         (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
-        memset((char *) &him6, 0, sizeof(him6));
-        memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
-        him6.sin6_family = AF_INET6;
-        sa = (struct sockaddr *) &him6 ;
-        len = sizeof(him6) ;
+        memcpy((void *)&sa.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+        sa.sa6.sin6_family = AF_INET6;
+        len = sizeof(struct sockaddr_in6);
     }
 
-    error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
-
-    if (!error) {
+    if (getnameinfo(&sa.sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD)) {
+        JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+    } else {
         ret = (*env)->NewStringUTF(env, host);
-        CHECK_NULL_RETURN(ret, NULL);
-    }
-
-    if (ret == NULL) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL);
+        if (ret == NULL) {
+            JNU_ThrowByName(env, "java/net/UnknownHostException", NULL);
+        }
     }
 
     return ret;
@@ -309,99 +286,82 @@
  * ping implementation using tcp port 7 (echo)
  */
 static jboolean
-tcp_ping6(JNIEnv *env,
-          jint timeout,
-          jint ttl,
-          struct sockaddr_in6 him6,
-          struct sockaddr_in6* netif,
-          int len)
+tcp_ping6(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout,
+          jint ttl)
 {
     jint fd;
+    int connect_rv = -1;
     WSAEVENT hEvent;
-    int connect_rv = -1;
 
+    // open a TCP socket
     fd = NET_Socket(AF_INET6, SOCK_STREAM, 0);
     if (fd == SOCKET_ERROR) {
-        /* note: if you run out of fds, you may not be able to load
-         * the exception class, and get a NoClassDefFoundError
-         * instead.
-         */
-        NET_ThrowNew(env, errno, "Can't create socket");
+        // note: if you run out of fds, you may not be able to load
+        // the exception class, and get a NoClassDefFoundError instead.
+        NET_ThrowNew(env, WSAGetLastError(), "Can't create socket");
         return JNI_FALSE;
     }
 
-    /**
-     * A TTL was specified, let's set the socket option.
-     */
+    // set TTL
     if (ttl > 0) {
-      setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char *)&ttl, sizeof(ttl));
+        setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char *)&ttl, sizeof(ttl));
     }
 
-    /**
-     * A network interface was specified, let's bind to it.
-     */
+    // A network interface was specified, so let's bind to it.
     if (netif != NULL) {
-      if (NET_Bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) < 0) {
-        NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket to interface");
-        closesocket(fd);
-        return JNI_FALSE;
-      }
+        if (bind(fd, &netif->sa, sizeof(struct sockaddr_in6)) < 0) {
+            NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket to interface");
+            closesocket(fd);
+            return JNI_FALSE;
+        }
     }
 
-    /**
-     * Make the socket non blocking.
-     */
+    // Make the socket non blocking so we can use select/poll.
     hEvent = WSACreateEvent();
     WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
 
-    /* no need to use NET_Connect as non-blocking */
-    him6.sin6_port = htons((short) 7); /* Echo port */
-    connect_rv = connect(fd, (struct sockaddr *)&him6, len);
+    sa->sa6.sin6_port = htons(7); // echo port
+    connect_rv = connect(fd, &sa->sa, sizeof(struct sockaddr_in6));
 
-    /**
-     * connection established or refused immediately, either way it means
-     * we were able to reach the host!
-     */
+    // connection established or refused immediately, either way it means
+    // we were able to reach the host!
     if (connect_rv == 0 || WSAGetLastError() == WSAECONNREFUSED) {
         WSACloseEvent(hEvent);
         closesocket(fd);
         return JNI_TRUE;
-    } else {
-        int optlen;
-
-        switch (WSAGetLastError()) {
-        case WSAEHOSTUNREACH:   /* Host Unreachable */
-        case WSAENETUNREACH:    /* Network Unreachable */
-        case WSAENETDOWN:       /* Network is down */
-        case WSAEPFNOSUPPORT:   /* Protocol Family unsupported */
-          WSACloseEvent(hEvent);
-          closesocket(fd);
-          return JNI_FALSE;
-        }
+    }
 
-        if (WSAGetLastError() != WSAEWOULDBLOCK) {
-            NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
-                                         "connect failed");
-            WSACloseEvent(hEvent);
-            closesocket(fd);
-            return JNI_FALSE;
-        }
-
-        timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
+    switch (WSAGetLastError()) {
+    case WSAEHOSTUNREACH:   // Host Unreachable
+    case WSAENETUNREACH:    // Network Unreachable
+    case WSAENETDOWN:       // Network is down
+    case WSAEPFNOSUPPORT:   // Protocol Family unsupported
+        WSACloseEvent(hEvent);
+        closesocket(fd);
+        return JNI_FALSE;
+    case WSAEWOULDBLOCK:    // this is expected as we'll probably have to wait
+        break;
+    default:
+        NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
+                                     "connect failed");
+        WSACloseEvent(hEvent);
+        closesocket(fd);
+        return JNI_FALSE;
+    }
 
-        if (timeout >= 0) {
-          /* has connection been established? */
-          optlen = sizeof(connect_rv);
-          if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
-                         &optlen) <0) {
+    timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
+    if (timeout >= 0) {
+        // connection has been established, check for error condition
+        int optlen = sizeof(connect_rv);
+        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&connect_rv,
+                       &optlen) < 0)
+        {
             connect_rv = WSAGetLastError();
-          }
-
-          if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
+        }
+        if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
             WSACloseEvent(hEvent);
             closesocket(fd);
             return JNI_TRUE;
-          }
         }
     }
     WSACloseEvent(hEvent);
@@ -416,21 +376,18 @@
  * Returns true is an ECHO_REPLY is received, otherwise, false.
  */
 static jboolean
-ping6(JNIEnv *env,
-      struct sockaddr_in6* src,
-      struct sockaddr_in6* dest,
-      jint timeout,
-      HANDLE hIcmpFile)
+ping6(JNIEnv *env, HANDLE hIcmpFile, SOCKETADDRESS *sa,
+      SOCKETADDRESS *netif, jint timeout)
 {
     DWORD dwRetVal = 0;
     char SendData[32] = {0};
     LPVOID ReplyBuffer = NULL;
     DWORD ReplySize = 0;
     IP_OPTION_INFORMATION ipInfo = {255, 0, 0, 0, NULL};
-    struct sockaddr_in6 sa6Source;
+    SOCKETADDRESS dftNetif;
 
     ReplySize = sizeof(ICMPV6_ECHO_REPLY) + sizeof(SendData);
-    ReplyBuffer = (VOID*) malloc(ReplySize);
+    ReplyBuffer = (VOID *)malloc(ReplySize);
     if (ReplyBuffer == NULL) {
         IcmpCloseHandle(hIcmpFile);
         NET_ThrowNew(env, WSAGetLastError(), "Unable to allocate memory");
@@ -438,17 +395,20 @@
     }
 
     //define local source information
-    sa6Source.sin6_addr = in6addr_any;
-    sa6Source.sin6_family = AF_INET6;
-    sa6Source.sin6_flowinfo = 0;
-    sa6Source.sin6_port = 0;
+    if (netif == NULL) {
+        dftNetif.sa6.sin6_addr = in6addr_any;
+        dftNetif.sa6.sin6_family = AF_INET6;
+        dftNetif.sa6.sin6_flowinfo = 0;
+        dftNetif.sa6.sin6_port = 0;
+        netif = &dftNetif;
+    }
 
     dwRetVal = Icmp6SendEcho2(hIcmpFile,    // HANDLE IcmpHandle,
                               NULL,         // HANDLE Event,
                               NULL,         // PIO_APC_ROUTINE ApcRoutine,
                               NULL,         // PVOID ApcContext,
-                              &sa6Source,   // struct sockaddr_in6 *SourceAddress,
-                              dest,         // struct sockaddr_in6 *DestinationAddress,
+                              &netif->sa6,  // struct sockaddr_in6 *SourceAddress,
+                              &sa->sa6,     // struct sockaddr_in6 *DestinationAddress,
                               SendData,     // LPVOID RequestData,
                               sizeof(SendData), // WORD RequestSize,
                               &ipInfo,      // PIP_OPTION_INFORMATION RequestOptions,
@@ -459,11 +419,10 @@
     free(ReplyBuffer);
     IcmpCloseHandle(hIcmpFile);
 
-
-    if (dwRetVal != 0) {
+    if (dwRetVal == 0) { // if the call failed
+        return JNI_FALSE;
+    } else {
         return JNI_TRUE;
-    } else {
-        return JNI_FALSE;
     }
 }
 
@@ -474,75 +433,64 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
-                                           jbyteArray addrArray,
-                                           jint scope,
-                                           jint timeout,
-                                           jbyteArray ifArray,
-                                           jint ttl, jint if_scope) {
+                                            jbyteArray addrArray, jint scope,
+                                            jint timeout, jbyteArray ifArray,
+                                            jint ttl, jint if_scope)
+{
     jbyte caddr[16];
     jint sz;
-    struct sockaddr_in6 him6;
-    struct sockaddr_in6* netif = NULL;
-    struct sockaddr_in6 inf6;
-    int len = 0;
+    SOCKETADDRESS sa, inf, *netif = NULL;
     HANDLE hIcmpFile;
 
-    /*
-     * If IPv6 is not enable, then we can't reach an IPv6 address, can we?
-     * Actually, we probably shouldn't even get here.
-     */
+    // If IPv6 is not enabled, then we can't reach an IPv6 address, can we?
+    // Actually, we probably shouldn't even get here.
     if (!ipv6_available()) {
-      return JNI_FALSE;
+        return JNI_FALSE;
     }
-    /*
-     * If it's an IPv4 address, ICMP won't work with IPv4 mapped address,
-     * therefore, let's delegate to the Inet4Address method.
-     */
+
+    // If it's an IPv4 address, ICMP won't work with IPv4 mapped address,
+    // therefore, let's delegate to the Inet4Address method.
     sz = (*env)->GetArrayLength(env, addrArray);
     if (sz == 4) {
-      return Java_java_net_Inet4AddressImpl_isReachable0(env, this,
-                                                         addrArray,
-                                                         timeout,
-                                                         ifArray, ttl);
+        return Java_java_net_Inet4AddressImpl_isReachable0(env, this,
+                                                           addrArray, timeout,
+                                                           ifArray, ttl);
     }
 
-    memset((char *) caddr, 0, 16);
-    memset((char *) &him6, 0, sizeof(him6));
+    // load address to SOCKETADDRESS
+    memset((char *)caddr, 0, 16);
     (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
-    memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
-    him6.sin6_family = AF_INET6;
+    memset((char *)&sa, 0, sizeof(SOCKETADDRESS));
+    memcpy((void *)&sa.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+    sa.sa6.sin6_family = AF_INET6;
     if (scope > 0) {
-      him6.sin6_scope_id = scope;
-    }
-    len = sizeof(struct sockaddr_in6);
-
-    /**
-     * A network interface was specified, let's convert the address
-     */
-    if (!(IS_NULL(ifArray))) {
-      memset((char *) caddr, 0, 16);
-      memset((char *) &inf6, 0, sizeof(inf6));
-      (*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr);
-      memcpy((void *)&(inf6.sin6_addr), caddr, sizeof(struct in6_addr) );
-      inf6.sin6_family = AF_INET6;
-      inf6.sin6_port = 0;
-      inf6.sin6_scope_id = if_scope;
-      netif = &inf6;
+        sa.sa6.sin6_scope_id = scope;
     }
 
+    // load network interface address to SOCKETADDRESS, if specified
+    if (!(IS_NULL(ifArray))) {
+        memset((char *)caddr, 0, 16);
+        (*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr);
+        memset((char *)&inf, 0, sizeof(SOCKETADDRESS));
+        memcpy((void *)&inf.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
+        inf.sa6.sin6_family = AF_INET6;
+        inf.sa6.sin6_scope_id = if_scope;
+        netif = &inf;
+    }
+
+    // Let's try to create an ICMP handle.
     hIcmpFile = Icmp6CreateFile();
     if (hIcmpFile == INVALID_HANDLE_VALUE) {
         int err = WSAGetLastError();
         if (err == ERROR_ACCESS_DENIED) {
             // fall back to TCP echo if access is denied to ICMP
-            return tcp_ping6(env, timeout, ttl, him6, netif, len);
+            return tcp_ping6(env, &sa, netif, timeout, ttl);
         } else {
             NET_ThrowNew(env, err, "Unable to create ICMP file handle");
             return JNI_FALSE;
         }
     } else {
-        return ping6(env, netif, &him6, timeout, hIcmpFile);
+        // It didn't fail, so we can use ICMP.
+        return ping6(env, hIcmpFile, &sa, netif, timeout);
     }
-
-    return JNI_FALSE;
 }
--- a/jdk/src/java.base/windows/native/libnio/ch/Net.c	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/src/java.base/windows/native/libnio/ch/Net.c	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,13 +50,13 @@
 
 #endif  /* MCAST_BLOCK_SOURCE */
 
-typedef struct my_ip_mreq_source {
+struct my_ip_mreq_source {
     IN_ADDR imr_multiaddr;
     IN_ADDR imr_sourceaddr;
     IN_ADDR imr_interface;
 };
 
-typedef struct my_group_source_req {
+struct my_group_source_req {
     ULONG gsr_interface;
     SOCKADDR_STORAGE gsr_group;
     SOCKADDR_STORAGE gsr_source;
--- a/jdk/test/ProblemList.txt	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/ProblemList.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -266,6 +266,11 @@
 
 tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java       8169971 windows-x64
 
+tools/jar/multiRelease/RuntimeTest.java                         8173905 generic-all
+
+tools/schemagen/MultiReleaseJarTest.java                        8174692 generic-all
+tools/wsgen/MultiReleaseJarTest.java                            8174692 generic-all
+
 ############################################################################
 
 # jdk_jdi
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@
             ProcessBuilder pb = ProcessTools.
                 createJavaProcessBuilder(
                     "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED",
-                    "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
+                    "-XX:+UseConcMarkSweepGC",  // this will cause MaxNewSize to be FLAG_SET_ERGO
                     "-XX:+UseCodeAging",
                     "-XX:+UseCerealGC",         // Should be ignored.
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
@@ -109,7 +109,7 @@
             // Set through j.l.m
             checkOrigin("HeapDumpOnOutOfMemoryError", Origin.MANAGEMENT);
             // Should be set by the VM, when we set UseConcMarkSweepGC
-            checkOrigin("UseParNewGC", Origin.ERGONOMIC);
+            checkOrigin("MaxNewSize", Origin.ERGONOMIC);
             // Set using attach
             checkOrigin("HeapDumpPath", Origin.ATTACH_ON_DEMAND);
         }
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -82,9 +82,9 @@
                 throw new Error("Unexpected error: Lambda form of the method handle is null");
             }
 
-            String debugName = (String)DEBUG_NAME.get(lambdaForm);
-            if (debugName != null && debugName.startsWith("identity_")) {
-                // Ignore identity_* LambdaForms.
+            String kind = KIND_FIELD.get(lambdaForm).toString();
+            if (kind.equals("IDENTITY")) {
+                // Ignore identity LambdaForms.
                 return;
             }
 
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Mon Mar 13 19:58:52 2017 +0000
@@ -51,7 +51,7 @@
      * used to get a lambda form from a method handle.
      */
     protected static final Method INTERNAL_FORM;
-    protected static final Field DEBUG_NAME;
+    protected static final Field KIND_FIELD;
     protected static final Field REF_FIELD;
     private static final List<GarbageCollectorMXBean> gcInfo;
 
@@ -64,8 +64,8 @@
             INTERNAL_FORM = MethodHandle.class.getDeclaredMethod("internalForm");
             INTERNAL_FORM.setAccessible(true);
 
-            DEBUG_NAME = Class.forName("java.lang.invoke.LambdaForm").getDeclaredField("debugName");
-            DEBUG_NAME.setAccessible(true);
+            KIND_FIELD = Class.forName("java.lang.invoke.LambdaForm").getDeclaredField("kind");
+            KIND_FIELD.setAccessible(true);
 
             REF_FIELD = Reference.class.getDeclaredField("referent");
             REF_FIELD.setAccessible(true);
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
  * @run main/timeout=600 LowMemoryTest
  * @requires vm.gc == "null"
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
- * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
  */
 
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -53,12 +53,12 @@
 # Run test with each GC configuration
 # 
 # Notes: To ensure that metaspace fills up we disable class unloading.
-# Also we set the max metaspace to 8MB - otherwise the test takes too
+# Also we set the max metaspace to 16MB - otherwise the test takes too
 # long to run. 
 
 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseSerialGC LowMemoryTest2
 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParallelGC LowMemoryTest2
-go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC LowMemoryTest2
+go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseConcMarkSweepGC LowMemoryTest2
 
 # Test class metaspace - might hit MaxMetaspaceSize instead if
 # UseCompressedClassPointers is off or if 32 bit.
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
  * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
  * @run main ResetPeakMemoryUsage
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
- * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
  */
 
--- a/jdk/test/java/lang/module/MultiReleaseJarTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/lang/module/MultiReleaseJarTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/test/java/security/Provider/ProviderVersionCheck.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/java/security/Provider/ProviderVersionCheck.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
 
         for (Provider p: Security.getProviders()) {
             System.out.print(p.getName() + " ");
-            if (p.getVersion() != 9.0d) {
+            if (p.getVersion() != 10.0d) {
                 System.out.println("failed. " + "Version received was " +
                         p.getVersion());
                 failure = true;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/Cipher/ExampleVectors/CheckExampleVectors.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8006259
+ * @summary Test several modes of operation using vectors from SP 800-38A
+ * @modules java.xml.bind
+ * @run main CheckExampleVectors
+ */
+
+import java.io.*;
+import java.security.*;
+import java.util.*;
+import java.util.function.*;
+import javax.xml.bind.DatatypeConverter;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+
+public class CheckExampleVectors {
+
+    private enum Mode {
+        ECB,
+        CBC,
+        CFB1,
+        CFB8,
+        CFB128,
+        OFB,
+        CTR
+    }
+
+    private enum Operation {
+        Encrypt,
+        Decrypt
+    }
+
+    private static class Block {
+        private byte[] input;
+        private byte[] output;
+
+        public Block() {
+
+        }
+        public Block(String settings) {
+            String[] settingsParts = settings.split(",");
+            input = stringToBytes(settingsParts[0]);
+            output = stringToBytes(settingsParts[1]);
+        }
+        public byte[] getInput() {
+            return input;
+        }
+        public byte[] getOutput() {
+            return output;
+        }
+    }
+
+    private static class TestVector {
+        private Mode mode;
+        private Operation operation;
+        private byte[] key;
+        private byte[] iv;
+        private List<Block> blocks = new ArrayList<Block>();
+
+        public TestVector(String settings) {
+            String[] settingsParts = settings.split(",");
+            mode = Mode.valueOf(settingsParts[0]);
+            operation = Operation.valueOf(settingsParts[1]);
+            key = stringToBytes(settingsParts[2]);
+            if (settingsParts.length > 3) {
+                iv = stringToBytes(settingsParts[3]);
+            }
+        }
+
+        public Mode getMode() {
+            return mode;
+        }
+        public Operation getOperation() {
+            return operation;
+        }
+        public byte[] getKey() {
+            return key;
+        }
+        public byte[] getIv() {
+            return iv;
+        }
+        public void addBlock (Block b) {
+            blocks.add(b);
+        }
+        public Iterable<Block> getBlocks() {
+            return blocks;
+        }
+    }
+
+    private static final String VECTOR_FILE_NAME = "NIST_800_38A_vectors.txt";
+    private static final Mode[] REQUIRED_MODES = {Mode.ECB, Mode.CBC, Mode.CTR};
+    private static Set<Mode> supportedModes = new HashSet<Mode>();
+
+    public static void main(String[] args) throws Exception {
+        checkAllProviders();
+        checkSupportedModes();
+    }
+
+    private static byte[] stringToBytes(String v) {
+        if (v.equals("")) {
+            return null;
+        }
+        return DatatypeConverter.parseBase64Binary(v);
+    }
+
+    private static String toModeString(Mode mode) {
+        return mode.toString();
+    }
+
+    private static int toCipherOperation(Operation op) {
+        switch (op) {
+            case Encrypt:
+                return Cipher.ENCRYPT_MODE;
+            case Decrypt:
+                return Cipher.DECRYPT_MODE;
+        }
+
+        throw new RuntimeException("Unknown operation: " + op);
+    }
+
+    private static void log(String str) {
+        System.out.println(str);
+    }
+
+    private static void checkVector(String providerName, TestVector test) {
+
+        String modeString = toModeString(test.getMode());
+        String cipherString = "AES" + "/" + modeString + "/" + "NoPadding";
+        log("checking: " + cipherString + " on " + providerName);
+        try {
+            Cipher cipher = Cipher.getInstance(cipherString, providerName);
+            SecretKeySpec key = new SecretKeySpec(test.getKey(), "AES");
+            if (test.getIv() != null) {
+                IvParameterSpec iv = new IvParameterSpec(test.getIv());
+                cipher.init(toCipherOperation(test.getOperation()), key, iv);
+            }
+            else {
+                cipher.init(toCipherOperation(test.getOperation()), key);
+            }
+            int blockIndex = 0;
+            for (Block curBlock : test.getBlocks()) {
+                byte[] blockOutput = cipher.update(curBlock.getInput());
+                byte[] expectedBlockOutput = curBlock.getOutput();
+                if (!Arrays.equals(blockOutput, expectedBlockOutput)) {
+                    throw new RuntimeException("Blocks do not match at index "
+                        + blockIndex);
+                }
+                blockIndex++;
+            }
+            log("success");
+            supportedModes.add(test.getMode());
+        } catch (NoSuchAlgorithmException ex) {
+            log("algorithm not supported");
+        } catch (NoSuchProviderException | NoSuchPaddingException
+            | InvalidKeyException | InvalidAlgorithmParameterException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static boolean isComment(String line) {
+        return (line != null) && line.startsWith("//");
+    }
+
+    private static TestVector readVector(BufferedReader in) throws IOException {
+        String line;
+        while (isComment(line = in.readLine())) {
+            // skip comment lines
+        }
+        if (line == null || line.isEmpty()) {
+            return null;
+        }
+
+        TestVector newVector = new TestVector(line);
+        String numBlocksStr = in.readLine();
+        int numBlocks = Integer.parseInt(numBlocksStr);
+        for (int i = 0; i < numBlocks; i++) {
+            Block newBlock = new Block(in.readLine());
+            newVector.addBlock(newBlock);
+        }
+
+        return newVector;
+    }
+
+    private static void checkAllProviders() throws IOException {
+        File dataFile = new File(System.getProperty("test.src", "."),
+                                 VECTOR_FILE_NAME);
+        BufferedReader in = new BufferedReader(new FileReader(dataFile));
+        List<TestVector> allTests = new ArrayList<>();
+        TestVector newTest;
+        while ((newTest = readVector(in)) != null) {
+            allTests.add(newTest);
+        }
+
+        for (Provider provider : Security.getProviders()) {
+            checkProvider(provider.getName(), allTests);
+        }
+    }
+
+    private static void checkProvider(String providerName,
+                                      List<TestVector> allVectors)
+        throws IOException {
+
+        for (TestVector curVector : allVectors) {
+            checkVector(providerName, curVector);
+        }
+    }
+
+    /*
+     *  This method helps ensure that the test is working properly by
+     *  verifying that the test was able to check the test vectors for
+     *  some of the modes of operation.
+     */
+    private static void checkSupportedModes() {
+        for (Mode curMode : REQUIRED_MODES) {
+            if (!supportedModes.contains(curMode)) {
+                throw new RuntimeException(
+                    "Mode not supported by any provider: " + curMode);
+            }
+        }
+
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/Cipher/ExampleVectors/NIST_800_38A_vectors.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,418 @@
+// Example vectors from NIST Special Publication 800-38A
+// Recommentation for Block Cipher Modes of Operation
+//
+// format for each vector entry is as follows:
+// mode,encrypt/decrypt,key,initialization vector
+// number of blocks
+// (for each block) input,output
+// All key, IV, input, and output values are encoded in Base64
+//
+ECB,Encrypt,K34VFiiu0qar9xWICc9PPA==,
+4
+a8G+4i5An5bpPX4Rc5MXKg==,Otd7tA16NmConsrzJGbvlw==
+ri2KVx4DrJyet2+sRa+OUQ==,9dPVhQO5aZ3nhYlalv26rw==
+MMgcRqNc5BHl+8EZGgpS7w==,Q7HNf1mOziOIGwDj7QMGiA==
+9p8kRd9PmxetK0F75mw3EA==,ewx4XiforT+CIyBxBHJd1A==
+ECB,Decrypt,K34VFiiu0qar9xWICc9PPA==,
+4
+Otd7tA16NmConsrzJGbvlw==,a8G+4i5An5bpPX4Rc5MXKg==
+9dPVhQO5aZ3nhYlalv26rw==,ri2KVx4DrJyet2+sRa+OUQ==
+Q7HNf1mOziOIGwDj7QMGiA==,MMgcRqNc5BHl+8EZGgpS7w==
+ewx4XiforT+CIyBxBHJd1A==,9p8kRd9PmxetK0F75mw3EA==
+ECB,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,
+4
+a8G+4i5An5bpPX4Rc5MXKg==,vTNPHW5F8l/3EqIUVx+lzA==
+ri2KVx4DrJyet2+sRa+OUQ==,l0EEhG0K0613NOyz7O5O7w==
+MMgcRqNc5BHl+8EZGgpS7w==,73r9InDi5grc4LovrOZETg==
+9p8kRd9PmxetK0F75mw3EA==,mktBunONbHL7FmkWA8GODg==
+ECB,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,
+4
+vTNPHW5F8l/3EqIUVx+lzA==,a8G+4i5An5bpPX4Rc5MXKg==
+l0EEhG0K0613NOyz7O5O7w==,ri2KVx4DrJyet2+sRa+OUQ==
+73r9InDi5grc4LovrOZETg==,MMgcRqNc5BHl+8EZGgpS7w==
+mktBunONbHL7FmkWA8GODg==,9p8kRd9PmxetK0F75mw3EA==
+ECB,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,
+4
+a8G+4i5An5bpPX4Rc5MXKg==,8+7RvbXSoDwGS1p+PbGB+A==
+ri2KVx4DrJyet2+sRa+OUQ==,WRzLENQQ7SbcW6dKMTYocA==
+MMgcRqNc5BHl+8EZGgpS7w==,tu0huZym9PnxU+exvq/tHQ==
+9p8kRd9PmxetK0F75mw3EA==,IzBLejn58/8GfY2PniTsxw==
+ECB,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,
+4
+8+7RvbXSoDwGS1p+PbGB+A==,a8G+4i5An5bpPX4Rc5MXKg==
+WRzLENQQ7SbcW6dKMTYocA==,ri2KVx4DrJyet2+sRa+OUQ==
+tu0huZym9PnxU+exvq/tHQ==,MMgcRqNc5BHl+8EZGgpS7w==
+IzBLejn58/8GfY2PniTsxw==,9p8kRd9PmxetK0F75mw3EA==
+CBC,Encrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,dkmrrIEZskbO6Y6bEukZfQ==
+ri2KVx4DrJyet2+sRa+OUQ==,UIbLm1ByGe6V2xE6kXZ4sg==
+MMgcRqNc5BHl+8EZGgpS7w==,c77WuOPBdDtxFuaeIiKVFg==
+9p8kRd9PmxetK0F75mw3EA==,P/HKoWgfrAkSDsowdYbhpw==
+CBC,Decrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+dkmrrIEZskbO6Y6bEukZfQ==,a8G+4i5An5bpPX4Rc5MXKg==
+UIbLm1ByGe6V2xE6kXZ4sg==,ri2KVx4DrJyet2+sRa+OUQ==
+c77WuOPBdDtxFuaeIiKVFg==,MMgcRqNc5BHl+8EZGgpS7w==
+P/HKoWgfrAkSDsowdYbhpw==,9p8kRd9PmxetK0F75mw3EA==
+CBC,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,TwIdskO8Yz1xeBg6n6Bx6A==
+ri2KVx4DrJyet2+sRa+OUQ==,tNmtqa197fTl5zh2P2kUWg==
+MMgcRqNc5BHl+8EZGgpS7w==,VxskIBL7euB/qbqsPfEC4A==
+9p8kRd9PmxetK0F75mw3EA==,CLDieYhZiIHZIKnmT1YVzQ==
+CBC,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+TwIdskO8Yz1xeBg6n6Bx6A==,a8G+4i5An5bpPX4Rc5MXKg==
+tNmtqa197fTl5zh2P2kUWg==,ri2KVx4DrJyet2+sRa+OUQ==
+VxskIBL7euB/qbqsPfEC4A==,MMgcRqNc5BHl+8EZGgpS7w==
+CLDieYhZiIHZIKnmT1YVzQ==,9p8kRd9PmxetK0F75mw3EA==
+CBC,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,9YxMBNbl8bp3nqv7X3v71g==
+ri2KVx4DrJyet2+sRa+OUQ==,nPxOln7bgI1nn3d7xnAsfQ==
+MMgcRqNc5BHl+8EZGgpS7w==,OfIzaanZus+lMOJjBCMUYQ==
+9p8kRd9PmxetK0F75mw3EA==,susF4sOb6fzabBkHjGqdGw==
+CBC,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+9YxMBNbl8bp3nqv7X3v71g==,a8G+4i5An5bpPX4Rc5MXKg==
+nPxOln7bgI1nn3d7xnAsfQ==,ri2KVx4DrJyet2+sRa+OUQ==
+OfIzaanZus+lMOJjBCMUYQ==,MMgcRqNc5BHl+8EZGgpS7w==
+susF4sOb6fzabBkHjGqdGw==,9p8kRd9PmxetK0F75mw3EA==
+CFB1,Encrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+16
+AA==,AA==
+AQ==,AQ==
+AQ==,AQ==
+AA==,AA==
+AQ==,AQ==
+AA==,AA==
+AQ==,AQ==
+AQ==,AA==
+AQ==,AQ==
+AQ==,AA==
+AA==,AQ==
+AA==,AQ==
+AA==,AA==
+AA==,AA==
+AA==,AQ==
+AQ==,AQ==
+CFB1,Decrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+16
+AA==,AA==
+AQ==,AQ==
+AQ==,AQ==
+AA==,AA==
+AQ==,AQ==
+AA==,AA==
+AA==,AQ==
+AA==,AQ==
+AQ==,AQ==
+AA==,AQ==
+AQ==,AA==
+AQ==,AA==
+AA==,AA==
+AA==,AA==
+AQ==,AA==
+AQ==,AQ==
+CFB1,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+16
+AA==,AQ==
+AQ==,AA==
+AQ==,AA==
+AA==,AQ==
+AQ==,AA==
+AA==,AA==
+AQ==,AQ==
+AQ==,AQ==
+AQ==,AA==
+AQ==,AQ==
+AA==,AA==
+AA==,AQ==
+AA==,AQ==
+AA==,AA==
+AA==,AA==
+AQ==,AQ==
+CFB1,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+16
+AQ==,AA==
+AA==,AQ==
+AA==,AQ==
+AQ==,AA==
+AA==,AQ==
+AA==,AA==
+AQ==,AQ==
+AQ==,AQ==
+AA==,AQ==
+AQ==,AQ==
+AA==,AA==
+AQ==,AA==
+AQ==,AA==
+AA==,AA==
+AA==,AA==
+AQ==,AQ==
+CFB1,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+16
+AA==,AQ==
+AQ==,AA==
+AQ==,AA==
+AA==,AQ==
+AQ==,AA==
+AA==,AA==
+AQ==,AA==
+AQ==,AA==
+AQ==,AA==
+AQ==,AA==
+AA==,AQ==
+AA==,AA==
+AA==,AQ==
+AA==,AA==
+AA==,AA==
+AQ==,AQ==
+CFB1,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+16
+AQ==,AA==
+AA==,AQ==
+AA==,AQ==
+AQ==,AA==
+AA==,AQ==
+AA==,AA==
+AA==,AQ==
+AA==,AQ==
+AA==,AQ==
+AA==,AQ==
+AQ==,AA==
+AA==,AA==
+AQ==,AA==
+AA==,AA==
+AA==,AA==
+AQ==,AQ==
+CFB8,Encrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+18
+aw==,Ow==
+wQ==,eQ==
+vg==,Qg==
+4g==,TA==
+Lg==,nA==
+QA==,DQ==
+nw==,1A==
+lg==,Ng==
+6Q==,ug==
+PQ==,zg==
+fg==,ng==
+EQ==,Dg==
+cw==,1A==
+kw==,WA==
+Fw==,ag==
+Kg==,Tw==
+rg==,Mg==
+LQ==,uQ==
+CFB8,Decrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+18
+Ow==,aw==
+eQ==,wQ==
+Qg==,vg==
+TA==,4g==
+nA==,Lg==
+DQ==,QA==
+1A==,nw==
+Ng==,lg==
+ug==,6Q==
+zg==,PQ==
+ng==,fg==
+Dg==,EQ==
+1A==,cw==
+WA==,kw==
+ag==,Fw==
+Tw==,Kg==
+Mg==,rg==
+uQ==,LQ==
+CFB8,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+18
+aw==,zQ==
+wQ==,og==
+vg==,Ug==
+4g==,Hg==
+Lg==,8A==
+QA==,qQ==
+nw==,BQ==
+lg==,yg==
+6Q==,RA==
+PQ==,zQ==
+fg==,BQ==
+EQ==,fA==
+cw==,vw==
+kw==,DQ==
+Fw==,Rw==
+Kg==,oA==
+rg==,Zw==
+LQ==,ig==
+CFB8,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+18
+zQ==,aw==
+og==,wQ==
+Ug==,vg==
+Hg==,4g==
+8A==,Lg==
+qQ==,QA==
+BQ==,nw==
+yg==,lg==
+RA==,6Q==
+zQ==,PQ==
+BQ==,fg==
+fA==,EQ==
+vw==,cw==
+DQ==,kw==
+Rw==,Fw==
+oA==,Kg==
+Zw==,rg==
+ig==,LQ==
+CFB8,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+18
+aw==,3A==
+wQ==,Hw==
+vg==,Gg==
+4g==,hQ==
+Lg==,IA==
+QA==,pg==
+nw==,TQ==
+lg==,tQ==
+6Q==,Xw==
+PQ==,zA==
+fg==,ig==
+EQ==,xQ==
+cw==,VA==
+kw==,hA==
+Fw==,Tg==
+Kg==,iA==
+rg==,lw==
+LQ==,AA==
+CFB8,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+18
+3A==,aw==
+Hw==,wQ==
+Gg==,vg==
+hQ==,4g==
+IA==,Lg==
+pg==,QA==
+TQ==,nw==
+tQ==,lg==
+Xw==,6Q==
+zA==,PQ==
+ig==,fg==
+xQ==,EQ==
+VA==,cw==
+hA==,kw==
+Tg==,Fw==
+iA==,Kg==
+lw==,rg==
+AA==,LQ==
+CFB128,Encrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,Oz/ZLrctrSAzNEn46Dz7Sg==
+ri2KVx4DrJyet2+sRa+OUQ==,yKZFN6CzqT/N482tnxzliw==
+MMgcRqNc5BHl+8EZGgpS7w==,JnUfZ6PLsUCxgIzxh6T03w==
+9p8kRd9PmxetK0F75mw3EA==,wEsFNXxdHA7qxMZvn/fy5g==
+CFB128,Decrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+Oz/ZLrctrSAzNEn46Dz7Sg==,a8G+4i5An5bpPX4Rc5MXKg==
+yKZFN6CzqT/N482tnxzliw==,ri2KVx4DrJyet2+sRa+OUQ==
+JnUfZ6PLsUCxgIzxh6T03w==,MMgcRqNc5BHl+8EZGgpS7w==
+wEsFNXxdHA7qxMZvn/fy5g==,9p8kRd9PmxetK0F75mw3EA==
+CFB128,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,zcgNb93xjKs0wlkJyZpBdA==
+ri2KVx4DrJyet2+sRa+OUQ==,Z85/f4EXNiGWGitwFx09eg==
+MMgcRqNc5BHl+8EZGgpS7w==,Lh6KHdWbiLHI5g/tHvrEyQ==
+9p8kRd9PmxetK0F75mw3EA==,wF+fnKmDT6BCro+6WEsJ/w==
+CFB128,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+zcgNb93xjKs0wlkJyZpBdA==,a8G+4i5An5bpPX4Rc5MXKg==
+Z85/f4EXNiGWGitwFx09eg==,ri2KVx4DrJyet2+sRa+OUQ==
+Lh6KHdWbiLHI5g/tHvrEyQ==,MMgcRqNc5BHl+8EZGgpS7w==
+wF+fnKmDT6BCro+6WEsJ/w==,9p8kRd9PmxetK0F75mw3EA==
+CFB128,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,3H6Ev9p5Fkt+zYSGmF04YA==
+ri2KVx4DrJyet2+sRa+OUQ==,Of/tFDsoscgyETxjMeVAew==
+MMgcRqNc5BHl+8EZGgpS7w==,3xATJBXlS5KhPtCoJnri+Q==
+9p8kRd9PmxetK0F75mw3EA==,daOFdBq5zvggMWI9VbHkcQ==
+CFB128,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+3H6Ev9p5Fkt+zYSGmF04YA==,a8G+4i5An5bpPX4Rc5MXKg==
+Of/tFDsoscgyETxjMeVAew==,ri2KVx4DrJyet2+sRa+OUQ==
+3xATJBXlS5KhPtCoJnri+Q==,MMgcRqNc5BHl+8EZGgpS7w==
+daOFdBq5zvggMWI9VbHkcQ==,9p8kRd9PmxetK0F75mw3EA==
+OFB,Encrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,Oz/ZLrctrSAzNEn46Dz7Sg==
+ri2KVx4DrJyet2+sRa+OUQ==,d4lQjRaRjwP1PFLaxU7YJQ==
+MMgcRqNc5BHl+8EZGgpS7w==,l0AFHpxf7PZDRPeoImDtzA==
+9p8kRd9PmxetK0F75mw3EA==,MExlKPZZx3hmpRDZwdauXg==
+OFB,Decrypt,K34VFiiu0qar9xWICc9PPA==,AAECAwQFBgcICQoLDA0ODw==
+4
+Oz/ZLrctrSAzNEn46Dz7Sg==,a8G+4i5An5bpPX4Rc5MXKg==
+d4lQjRaRjwP1PFLaxU7YJQ==,ri2KVx4DrJyet2+sRa+OUQ==
+l0AFHpxf7PZDRPeoImDtzA==,MMgcRqNc5BHl+8EZGgpS7w==
+MExlKPZZx3hmpRDZwdauXg==,9p8kRd9PmxetK0F75mw3EA==
+OFB,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,zcgNb93xjKs0wlkJyZpBdA==
+ri2KVx4DrJyet2+sRa+OUQ==,/MKLjUxjg3wJ6BcAwRAEAQ==
+MMgcRqNc5BHl+8EZGgpS7w==,jZqa6sD2WW9VnG1Nr1ml8g==
+9p8kRd9PmxetK0F75mw3EA==,bZ8gCFfKbD6crFJL2azJKg==
+OFB,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,AAECAwQFBgcICQoLDA0ODw==
+4
+zcgNb93xjKs0wlkJyZpBdA==,a8G+4i5An5bpPX4Rc5MXKg==
+/MKLjUxjg3wJ6BcAwRAEAQ==,ri2KVx4DrJyet2+sRa+OUQ==
+jZqa6sD2WW9VnG1Nr1ml8g==,MMgcRqNc5BHl+8EZGgpS7w==
+bZ8gCFfKbD6crFJL2azJKg==,9p8kRd9PmxetK0F75mw3EA==
+OFB,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,3H6Ev9p5Fkt+zYSGmF04YA==
+ri2KVx4DrJyet2+sRa+OUQ==,T+vcZ0DSCzrIj2rYKk+wjQ==
+MMgcRqNc5BHl+8EZGgpS7w==,catHoIbobu3znRxbupfECA==
+9p8kRd9PmxetK0F75mw3EA==,ASYUHWfze+hTj1qL50DkhA==
+OFB,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,AAECAwQFBgcICQoLDA0ODw==
+4
+3H6Ev9p5Fkt+zYSGmF04YA==,a8G+4i5An5bpPX4Rc5MXKg==
+T+vcZ0DSCzrIj2rYKk+wjQ==,ri2KVx4DrJyet2+sRa+OUQ==
+catHoIbobu3znRxbupfECA==,MMgcRqNc5BHl+8EZGgpS7w==
+ASYUHWfze+hTj1qL50DkhA==,9p8kRd9PmxetK0F75mw3EA==
+CTR,Encrypt,K34VFiiu0qar9xWICc9PPA==,8PHy8/T19vf4+fr7/P3+/w==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,h01hkbYg4yYb72hkmQ22zg==
+ri2KVx4DrJyet2+sRa+OUQ==,mAb2a3lw/f+GFxh7uf/9/w==
+MMgcRqNc5BHl+8EZGgpS7w==,WuTfPtvV015bTwkCDbA+qw==
+9p8kRd9PmxetK0F75mw3EA==,HgMd2i++A9F5IXCg8wCc7g==
+CTR,Decrypt,K34VFiiu0qar9xWICc9PPA==,8PHy8/T19vf4+fr7/P3+/w==
+4
+h01hkbYg4yYb72hkmQ22zg==,a8G+4i5An5bpPX4Rc5MXKg==
+mAb2a3lw/f+GFxh7uf/9/w==,ri2KVx4DrJyet2+sRa+OUQ==
+WuTfPtvV015bTwkCDbA+qw==,MMgcRqNc5BHl+8EZGgpS7w==
+HgMd2i++A9F5IXCg8wCc7g==,9p8kRd9PmxetK0F75mw3EA==
+CTR,Encrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,8PHy8/T19vf4+fr7/P3+/w==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,GryTJBdSHKJPKwRZ/n5uCw==
+ri2KVx4DrJyet2+sRa+OUQ==,CQM57Aqm+u/VzMLG9M6OlA==
+MMgcRqNc5BHl+8EZGgpS7w==,Hjaya9HrxnDRvR1mViCr9w==
+9p8kRd9PmxetK0F75mw3EA==,T3in9tKYCVhal9rsWMawUA==
+CTR,Decrypt,jnOw99oOZFLIEPMrgJB55WL46tJSLGt7,8PHy8/T19vf4+fr7/P3+/w==
+4
+GryTJBdSHKJPKwRZ/n5uCw==,a8G+4i5An5bpPX4Rc5MXKg==
+CQM57Aqm+u/VzMLG9M6OlA==,ri2KVx4DrJyet2+sRa+OUQ==
+Hjaya9HrxnDRvR1mViCr9w==,MMgcRqNc5BHl+8EZGgpS7w==
+T3in9tKYCVhal9rsWMawUA==,9p8kRd9PmxetK0F75mw3EA==
+CTR,Encrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,8PHy8/T19vf4+fr7/P3+/w==
+4
+a8G+4i5An5bpPX4Rc5MXKg==,YB7DE3dXiaW3p/UEu/PSKA==
+ri2KVx4DrJyet2+sRa+OUQ==,9EPjyk1itZrKhOmQysr1xQ==
+MMgcRqNc5BHl+8EZGgpS7w==,Kwkw2qI96UzocBe6LYSYjQ==
+9p8kRd9PmxetK0F75mw3EA==,38nFjbZ6raYTwt0IRXlBpg==
+CTR,Decrypt,YD3rEBXKcb4rc67whX13gR81LAc7YQjXLZgQowkU3/Q=,8PHy8/T19vf4+fr7/P3+/w==
+4
+YB7DE3dXiaW3p/UEu/PSKA==,a8G+4i5An5bpPX4Rc5MXKg==
+9EPjyk1itZrKhOmQysr1xQ==,ri2KVx4DrJyet2+sRa+OUQ==
+Kwkw2qI96UzocBe6LYSYjQ==,MMgcRqNc5BHl+8EZGgpS7w==
+38nFjbZ6raYTwt0IRXlBpg==,9p8kRd9PmxetK0F75mw3EA==
+
--- a/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,8 @@
     private static final String KEYPASS = "changeit";
     private static final String SIGNED_JAR = "Signed.jar";
     private static final String POLICY_FILE = "SignedJar.policy";
-    private static final String VERSION_MESSAGE = "I am running on version 9";
+    private static final String VERSION = "" + Runtime.version().major();
+    private static final String VERSION_MESSAGE = "I am running on version " + VERSION;
 
     public static void main(String[] args) throws Throwable {
         // compile java files in jarContent directory
--- a/langtools/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -396,5 +396,9 @@
 4f348bd05341581df84ff1510d5b3a9b5b488367 jdk-9+151
 5b6f12de6f9167a582fa2c6ac54e69c591b09e68 jdk-9+152
 03f48cd283f5dd6b7153fd7e0cf2df8582b14391 jdk-9+153
+b670e95106f5327a29e2e2c4f18ee48a8d36e481 jdk-10+0
 6a9dd3d893b0a493a3e5d8d392815b5ee76a02d9 jdk-9+154
 dfcfdb2db85f1bb434209f56ca557ea6f9830aa8 jdk-9+155
+6f91e41163bc09e9b3ec72e8d1185f39296ee5d4 jdk-9+156
+162b521af7bb097019a8afaa44e1f8069ce274eb jdk-9+157
+4eb737a8d439f49a197e8000de26c6580cb4d57b jdk-9+158
--- a/langtools/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -102,7 +102,7 @@
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ModuleFinder",
                 "moduleFinderClass", "ofMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Configuration",
-                "configurationClass", "resolveRequiresAndUsesMethod");
+                "configurationClass", "resolveAndBindMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Layer",
                 "layerClass", "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod");
         ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Module",
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
      * same set of strings as the annotation.  If the class is not so
      * annotated, an empty set is returned.
      *
-     * If the {@link ProcessingEvironment#getSourceVersion source
+     * If the {@link ProcessingEnvironment#getSourceVersion source
      * version} does not support modules, in other words if it is less
      * than or equal to {@link SourceVersion#RELEASE_8 RELEASE_8},
      * then any leading {@link Processor#getSupportedAnnotationTypes
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java	Mon Mar 13 19:58:52 2017 +0000
@@ -291,7 +291,7 @@
      * @apiNote When running in an environment which supports modules,
      * processors are encouraged to include the module prefix when
      * describing their supported annotation types. The method {@link
-     * AbstractProcessor.getSupportedAnnotationTypes
+     * AbstractProcessor#getSupportedAnnotationTypes
      * AbstractProcessor.getSupportedAnnotationTypes} provides support
      * for stripping off the module prefix when running in an
      * environment without modules.
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@
      * 1.7: diamond syntax, try-with-resources, etc.
      * 1.8: lambda expressions and default methods
      *   9: modules, small cleanups to 1.7 and 1.8 changes
+     *  10: to-be-determined changes
      */
 
     /**
@@ -150,7 +151,15 @@
      *
      * @since 9
      */
-     RELEASE_9;
+     RELEASE_9,
+
+    /**
+     * The version recognized by the Java Platform, Standard Edition
+     * 10.
+     *
+     * @since 10
+     */
+     RELEASE_10;
 
     // Note that when adding constants for newer releases, the
     // behavior of latest() and latestSupported() must be updated too.
@@ -161,7 +170,7 @@
      * @return the latest source version that can be modeled
      */
     public static SourceVersion latest() {
-        return RELEASE_9;
+        return RELEASE_10;
     }
 
     private static final SourceVersion latestSupported = getLatestSupported();
@@ -171,6 +180,8 @@
             String specVersion = System.getProperty("java.specification.version");
 
             switch (specVersion) {
+                case "10":
+                    return RELEASE_10;
                 case "9":
                 case "1.9":
                     return RELEASE_9;
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/Element.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/Element.java	Mon Mar 13 19:58:52 2017 +0000
@@ -123,6 +123,8 @@
      * @see TypeElement#getSimpleName
      * @see VariableElement#getSimpleName
      * @see ModuleElement#getSimpleName
+     * @revised 9
+     * @spec JPMS
      */
     Name getSimpleName();
 
@@ -158,6 +160,8 @@
      *
      * @return the enclosing element, or {@code null} if there is none
      * @see Elements#getPackageOf
+     * @revised 9
+     * @spec JPMS
      */
     Element getEnclosingElement();
 
@@ -193,6 +197,8 @@
      * @see Elements#getAllMembers
      * @jls 8.8.9 Default Constructor
      * @jls 8.9 Enums
+     * @revised 9
+     * @spec JPMS
      */
     List<? extends Element> getEnclosedElements();
 
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java	Mon Mar 13 19:58:52 2017 +0000
@@ -99,6 +99,7 @@
     /**
      * A module.
      * @since 9
+     * @spec JPMS
      */
      MODULE;
 
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java	Mon Mar 13 19:58:52 2017 +0000
@@ -159,6 +159,7 @@
      * @param p  a visitor-specified parameter
      * @return a visitor-specified result
      * @since 9
+     * @spec JPMS
      */
     default R visitModule(ModuleElement e, P p) {
         return visitUnknown(e, p);
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Mon Mar 13 19:58:52 2017 +0000
@@ -33,6 +33,7 @@
  *
  * @see javax.lang.model.util.Elements#getModuleOf
  * @since 9
+ * @spec JPMS
  */  // TODO: add @jls to module section
 public interface ModuleElement extends Element, QualifiedNameable {
 
@@ -104,6 +105,7 @@
      * future versions of the Java&trade; programming language.
      *
      * @since 9
+     * @spec JPMS
      */
     enum DirectiveKind {
         /** A "requires (static|transitive)* module-name" directive. */
@@ -122,6 +124,7 @@
      * Represents a "module statement" within the declaration of this module.
      *
      * @since 9
+     * @spec JPMS
      *
      */ // TODO: add jls to Module Statement
     interface Directive {
@@ -136,6 +139,7 @@
     /**
      * A dependency of a module.
      * @since 9
+     * @spec JPMS
      */
     interface RequiresDirective extends Directive {
         /**
@@ -160,6 +164,7 @@
     /**
      * An exported package of a module.
      * @since 9
+     * @spec JPMS
      */
     interface ExportsDirective extends Directive {
 
@@ -181,6 +186,7 @@
     /**
      * An opened package of a module.
      * @since 9
+     * @spec JPMS
      */
     interface OpensDirective extends Directive {
 
@@ -202,6 +208,7 @@
     /**
      * An implementation of a service provided by a module.
      * @since 9
+     * @spec JPMS
      */
     interface ProvidesDirective extends Directive {
         /**
@@ -220,6 +227,7 @@
     /**
      * A reference to a service used by a module.
      * @since 9
+     * @spec JPMS
      */
     interface UsesDirective extends Directive {
         /**
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java	Mon Mar 13 19:58:52 2017 +0000
@@ -93,6 +93,9 @@
      * source version} without modules.
      *
      * @return the enclosing module or {@code null} if no such module exists
+     *
+     * @revised 9
+     * @spec JPMS
      */
     @Override
     Element getEnclosingElement();
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java	Mon Mar 13 19:58:52 2017 +0000
@@ -157,6 +157,7 @@
      * A pseudo-type corresponding to a module element.
      * @see NoType
      * @since 9
+     * @spec JPMS
      */
     MODULE;
 
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Mon Mar 13 19:58:52 2017 +0000
@@ -136,6 +136,7 @@
      * @return the result of {@code visitUnknown}
      *
      * @since 9
+     * @spec JPMS
      */
     @Override
     public R visitModule(ModuleElement e, P p) {
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java	Mon Mar 13 19:58:52 2017 +0000
@@ -63,6 +63,7 @@
  * @see AbstractElementVisitor7
  * @see AbstractElementVisitor8
  * @since 9
+ * @spec JPMS
  */
 @SupportedSourceVersion(RELEASE_9)
 public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -189,6 +189,7 @@
      * @return a list of modules in {@code elements}
      * @param elements the elements to filter
      * @since 9
+     * @spec JPMS
      */
     public static List<ModuleElement>
             modulesIn(Iterable<? extends Element> elements) {
@@ -200,6 +201,7 @@
      * @return a set of modules in {@code elements}
      * @param elements the elements to filter
      * @since 9
+     * @spec JPMS
      */
     public static Set<ModuleElement>
             modulesIn(Set<? extends Element> elements) {
@@ -236,6 +238,7 @@
      * @return a list of {@code exports} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
+     * @spec JPMS
      */
     public static List<ExportsDirective>
             exportsIn(Iterable<? extends Directive> directives) {
@@ -258,6 +261,7 @@
      * @return a list of {@code provides} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
+     * @spec JPMS
      */
     public static List<ProvidesDirective>
             providesIn(Iterable<? extends Directive> directives) {
@@ -269,6 +273,7 @@
      * @return a list of {@code requires} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
+     * @spec JPMS
      */
     public static List<RequiresDirective>
             requiresIn(Iterable<? extends Directive> directives) {
@@ -280,6 +285,7 @@
      * @return a list of {@code uses} directives in {@code directives}
      * @param directives the directives to filter
      * @since 9
+     * @spec JPMS
      */
     public static List<UsesDirective>
             usesIn(Iterable<? extends Directive> directives) {
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java	Mon Mar 13 19:58:52 2017 +0000
@@ -75,6 +75,7 @@
  * @see ElementKindVisitor7
  * @see ElementKindVisitor8
  * @since 9
+ * @spec JPMS
  */
 @SupportedSourceVersion(RELEASE_9)
 public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java	Mon Mar 13 19:58:52 2017 +0000
@@ -88,6 +88,7 @@
  * @see ElementScanner7
  * @see ElementScanner8
  * @since 9
+ * @spec JPMS
  */
 @SupportedSourceVersion(RELEASE_9)
 public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/Elements.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/Elements.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,9 +25,12 @@
 
 package javax.lang.model.util;
 
-
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.LinkedHashSet;
 
 import javax.lang.model.AnnotatedConstruct;
 import javax.lang.model.element.*;
@@ -65,6 +68,7 @@
      * @param name  fully qualified package name, or an empty string for an unnamed package
      * @param module module relative to which the lookup should happen
      * @return the specified package, or {@code null} if it cannot be found
+     * @see #getAllPackageElements
      * @since 9
      */
     default PackageElement getPackageElement(ModuleElement module, CharSequence name) {
@@ -72,6 +76,49 @@
     }
 
     /**
+     * Returns all package elements with the given canonical name.
+     *
+     * There may be more than one package element with the same canonical
+     * name if the package elements are in different modules.
+     *
+     * @implSpec The default implementation of this method calls
+     * {@link #getAllModuleElements() getAllModuleElements} and stores
+     * the result. If the set of modules is empty, {@link
+     * #getPackageElement(CharSequence) getPackageElement(name)} is
+     * called passing through the name argument. If {@code
+     * getPackageElement(name)} is {@code null}, an empty set of
+     * package elements is returned; otherwise, a single-element set
+     * with the found package element is returned. If the set of
+     * modules is nonempty, the modules are iterated over and any
+     * non-{@code null} results of {@link
+     * #getPackageElement(ModuleElement, CharSequence)
+     * getPackageElement(module, name)} are accumulated into a
+     * set. The set is then returned.
+     *
+     * @param name  the canonical name
+     * @return the package elements, or an empty set if no package with the name can be found
+     * @see #getPackageElement(ModuleElement, CharSequence)
+     * @since 9
+     */
+    default Set<? extends PackageElement> getAllPackageElements(CharSequence name) {
+        Set<? extends ModuleElement> modules = getAllModuleElements();
+        if (modules.isEmpty()) {
+            PackageElement packageElt = getPackageElement(name);
+            return (packageElt != null) ?
+                Collections.singleton(packageElt):
+                Collections.emptySet();
+        } else {
+            Set<PackageElement> result = new LinkedHashSet<>(1); // Usually expect at most 1 result
+            for (ModuleElement module: modules) {
+                PackageElement packageElt = getPackageElement(module, name);
+                if (packageElt != null)
+                    result.add(packageElt);
+            }
+            return Collections.unmodifiableSet(result);
+        }
+    }
+
+    /**
      * Returns a type element given its canonical name if the type element is unique in the environment.
      * If running with modules, all modules in the modules graph are searched for matching
      * type elements.
@@ -90,6 +137,7 @@
      * @param name  the canonical name
      * @param module module relative to which the lookup should happen
      * @return the named type element, or {@code null} if it cannot be found
+     * @see #getAllTypeElements
      * @since 9
      */
     default TypeElement getTypeElement(ModuleElement module, CharSequence name) {
@@ -97,11 +145,54 @@
     }
 
     /**
+     * Returns all type elements with the given canonical name.
+     *
+     * There may be more than one type element with the same canonical
+     * name if the type elements are in different modules.
+     *
+     * @implSpec The default implementation of this method calls
+     * {@link #getAllModuleElements() getAllModuleElements} and stores
+     * the result. If the set of modules is empty, {@link
+     * #getTypeElement(CharSequence) getTypeElement(name)} is called
+     * passing through the name argument. If {@code
+     * getTypeElement(name)} is {@code null}, an empty set of type
+     * elements is returned; otherwise, a single-element set with the
+     * found type element is returned. If the set of modules is
+     * nonempty, the modules are iterated over and any non-{@code null}
+     * results of {@link #getTypeElement(ModuleElement,
+     * CharSequence) getTypeElement(module, name)} are accumulated
+     * into a set. The set is then returned.
+     *
+     * @param name  the canonical name
+     * @return the type elements, or an empty set if no type with the name can be found
+     * @see #getTypeElement(ModuleElement, CharSequence)
+     * @since 9
+     */
+    default Set<? extends TypeElement> getAllTypeElements(CharSequence name) {
+        Set<? extends ModuleElement> modules = getAllModuleElements();
+        if (modules.isEmpty()) {
+            TypeElement typeElt = getTypeElement(name);
+            return (typeElt != null) ?
+                Collections.singleton(typeElt):
+                Collections.emptySet();
+        } else {
+            Set<TypeElement> result = new LinkedHashSet<>(1); // Usually expect at most 1 result
+            for (ModuleElement module: modules) {
+                TypeElement typeElt = getTypeElement(module, name);
+                if (typeElt != null)
+                    result.add(typeElt);
+            }
+            return Collections.unmodifiableSet(result);
+        }
+    }
+
+    /**
      * Returns a module element given its fully qualified name.
-     * If the named module cannot be found, null is returned. One situation where a module
-     * cannot be found is if the environment does not include modules, such as
-     * an annotation processing environment configured for
-     * a {@linkplain
+     *
+     * If the named module cannot be found, {@code null} is
+     * returned. One situation where a module cannot be found is if
+     * the environment does not include modules, such as an annotation
+     * processing environment configured for a {@linkplain
      * javax.annotation.processing.ProcessingEnvironment#getSourceVersion
      * source version} without modules.
      *
@@ -110,13 +201,36 @@
      *
      * @param name  the name
      * @return the named module element, or {@code null} if it cannot be found
+     * @see #getAllModuleElements
      * @since 9
+     * @spec JPMS
      */
     default ModuleElement getModuleElement(CharSequence name) {
         return null;
     }
 
     /**
+     * Returns all module elements in the current environment.
+     *
+     * If no modules are present, an empty set is returned. One
+     * situation where no modules are present occurs when the
+     * environment does not include modules, such as an annotation
+     * processing environment configured for a {@linkplain
+     * javax.annotation.processing.ProcessingEnvironment#getSourceVersion
+     * source version} without modules.
+     *
+     * @implSpec The default implementation of this method returns
+     * an empty set.
+     *
+     * @return the known module elements, or an empty set if there are no modules
+     * @see #getModuleElement(CharSequence)
+     * @since 9
+     */
+    default Set<? extends ModuleElement> getAllModuleElements() {
+        return Collections.emptySet();
+    }
+
+    /**
      * Returns the values of an annotation's elements, including defaults.
      *
      * @see AnnotationMirror#getElementValues()
@@ -359,6 +473,7 @@
      * @param type the element being examined
      * @return the module of an element
      * @since 9
+     * @spec JPMS
      */
     default ModuleElement getModuleOf(Element type) {
         return null;
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java	Mon Mar 13 19:58:52 2017 +0000
@@ -71,6 +71,7 @@
  * @see SimpleElementVisitor7
  * @see SimpleElementVisitor8
  * @since 9
+ * @spec JPMS
  */
 @SupportedSourceVersion(RELEASE_9)
 public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
--- a/langtools/src/java.compiler/share/classes/javax/tools/DocumentationTool.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/DocumentationTool.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,20 @@
      */
     interface DocumentationTask extends Callable<Boolean> {
         /**
-         * Set the locale to be applied when formatting diagnostics and
+         * Adds root modules to be taken into account during module
+         * resolution.
+         * Invalid module names may cause either
+         * {@code IllegalArgumentException} to be thrown,
+         * or diagnostics to be reported when the task is started.
+         * @param moduleNames the names of the root modules
+         * @throws IllegalArgumentException may be thrown for some
+         *      invalid module names
+         * @throws IllegalStateException if the task has started
+         */
+        void addModules(Iterable<String> moduleNames);
+
+        /**
+         * Sets the locale to be applied when formatting diagnostics and
          * other localized data.
          *
          * @param locale the locale to apply; {@code null} means apply no
--- a/langtools/src/java.compiler/share/classes/javax/tools/ForwardingJavaFileManager.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/ForwardingJavaFileManager.java	Mon Mar 13 19:58:52 2017 +0000
@@ -165,22 +165,42 @@
         fileManager.close();
     }
 
+    /**
+     * @since 9
+     * @spec JPMS
+     */
     public Location getLocationForModule(Location location, String moduleName) throws IOException {
         return fileManager.getLocationForModule(location, moduleName);
     }
 
+    /**
+     * @since 9
+     * @spec JPMS
+     */
     public Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
         return fileManager.getLocationForModule(location, fo, pkgName);
     }
 
+    /**
+     * @since 9
+     * @spec JPMS
+     */
     public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws  IOException {
         return fileManager.getServiceLoader(location, service);
     }
 
+    /**
+     * @since 9
+     * @spec JPMS
+     */
     public String inferModuleName(Location location) throws IOException {
         return fileManager.inferModuleName(location);
     }
 
+    /**
+     * @since 9
+     * @spec JPMS
+     */
     public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
         return fileManager.listLocationsForModules(location);
     }
--- a/langtools/src/java.compiler/share/classes/javax/tools/JavaCompiler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/JavaCompiler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package javax.tools;
 
-import java.io.File;
 import java.io.Writer;
 import java.nio.charset.Charset;
 import java.util.Locale;
@@ -296,6 +295,18 @@
      * {@linkplain #setProcessors setProcessors} method.
      */
     interface CompilationTask extends Callable<Boolean> {
+        /**
+         * Adds root modules to be taken into account during module
+         * resolution.
+         * Invalid module names may cause either
+         * {@code IllegalArgumentException} to be thrown,
+         * or diagnostics to be reported when the task is started.
+         * @param moduleNames the names of the root modules
+         * @throws IllegalArgumentException may be thrown for some
+         *      invalid module names
+         * @throws IllegalStateException if the task has started
+         */
+        void addModules(Iterable<String> moduleNames);
 
         /**
          * Sets processors (for annotation processing).  This will
@@ -307,7 +318,7 @@
         void setProcessors(Iterable<? extends Processor> processors);
 
         /**
-         * Set the locale to be applied when formatting diagnostics and
+         * Sets the locale to be applied when formatting diagnostics and
          * other localized data.
          *
          * @param locale the locale to apply; {@code null} means apply no
@@ -330,6 +341,7 @@
          * in user code.
          * @throws IllegalStateException if called more than once
          */
+        @Override
         Boolean call();
     }
 }
--- a/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java	Mon Mar 13 19:58:52 2017 +0000
@@ -130,7 +130,7 @@
      * It is not possible to directly list the classes in a module-oriented
      * location. Instead, you can get a package-oriented location for any specific module
      * using methods like {@link JavaFileManager#getLocationForModule} or
-     * {@link JavaFileManager#listLocationsForModule}.
+     * {@link JavaFileManager#listLocationsForModules}.
      */
     interface Location {
         /**
@@ -165,6 +165,7 @@
          *
          * @return true if this location is expected to contain modules
          * @since 9
+         * @spec JPMS
          */
         default boolean isModuleOrientedLocation() {
             return getName().matches("\\bMODULE\\b");
@@ -472,6 +473,7 @@
      * @throws IllegalArgumentException if the location is neither an output location nor a
      * module-oriented location
      * @since 9
+     * @spec JPMS
      */ // TODO: describe failure modes
     default Location getLocationForModule(Location location, String moduleName) throws IOException {
         throw new UnsupportedOperationException();
@@ -499,6 +501,7 @@
      * @throws IllegalArgumentException if the location is neither an output location nor a
      * module-oriented location
      * @since 9
+     * @spec JPMS
      */
     default Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
         throw new UnsupportedOperationException();
@@ -522,6 +525,7 @@
      * @throws IOException if an I/O error occurred
      * @throws UnsupportedOperationException if this operation if not supported by this file manager
      * @since 9
+     * @spec JPMS
      */ // TODO: describe failure modes
     default <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws  IOException {
         throw new UnsupportedOperationException();
@@ -540,6 +544,7 @@
      * @throws UnsupportedOperationException if this operation if not supported by this file manager
      * @throws IllegalArgumentException if the location is not one known to this file manager
      * @since 9
+     * @spec JPMS
      */ // TODO: describe failure modes
     default String inferModuleName(Location location) throws IOException {
         throw new UnsupportedOperationException();
@@ -559,6 +564,7 @@
      * @throws UnsupportedOperationException if this operation if not supported by this file manager
      * @throws IllegalArgumentException if the location is not a module-oriented location
      * @since 9
+     * @spec JPMS
      */ // TODO: describe failure modes
     default Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
         throw new UnsupportedOperationException();
--- a/langtools/src/java.compiler/share/classes/javax/tools/StandardLocation.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/StandardLocation.java	Mon Mar 13 19:58:52 2017 +0000
@@ -64,6 +64,7 @@
 
     /**
      * Location to search for modules containing annotation processors.
+     * @spec JPMS
      * @since 9
      */
     ANNOTATION_PROCESSOR_MODULE_PATH,
@@ -82,27 +83,38 @@
 
     /**
      * Location to search for the source code of modules.
+     * @spec JPMS
      * @since 9
      */
     MODULE_SOURCE_PATH,
 
     /**
      * Location to search for upgradeable system modules.
+     * @spec JPMS
      * @since 9
      */
     UPGRADE_MODULE_PATH,
 
     /**
      * Location to search for system modules.
+     * @spec JPMS
      * @since 9
      */
     SYSTEM_MODULES,
 
     /**
      * Location to search for precompiled user modules.
+     * @spec JPMS
      * @since 9
      */
-    MODULE_PATH;
+    MODULE_PATH,
+
+    /**
+     * Location to search for module patches.
+     * @since 9
+     * @spec JPMS
+     */
+    PATCH_MODULE_PATH;
 
     /**
      * Returns a location object with the given name.  The following
@@ -115,6 +127,9 @@
      *
      * @param name a name
      * @return a location
+     *
+     * @revised 9
+     * @spec JPMS
      */
     public static Location locationFor(final String name) {
         if (locations.isEmpty()) {
@@ -158,6 +173,7 @@
             case UPGRADE_MODULE_PATH:
             case SYSTEM_MODULES:
             case MODULE_PATH:
+            case PATCH_MODULE_PATH:
                 return true;
             default:
                 return false;
--- a/langtools/src/java.compiler/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -29,6 +29,8 @@
   * These APIs model declarations and types of the Java programming language,
   * and define interfaces for tools such as compilers which can be invoked
   * from a program.
+  *
+  * @since 9
   */
 module java.compiler {
     exports javax.annotation.processing;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,6 +155,11 @@
     }
 
     @Override @DefinedBy(Api.COMPILER)
+    public void addModules(Iterable<String> moduleNames) {
+        throw new IllegalStateException();
+    }
+
+    @Override @DefinedBy(Api.COMPILER)
     public void setProcessors(Iterable<? extends Processor> processors) {
         throw new IllegalStateException();
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -361,7 +361,7 @@
         @Override @DefinedBy(Api.COMPILER)
         public Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
             try {
-                return clientJavaFileManager.getLocationForModule(location, fo, pkgName);
+                return clientJavaFileManager.getLocationForModule(location, unwrap(fo), pkgName);
             } catch (ClientCodeException e) {
                 throw e;
             } catch (RuntimeException | Error e) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,17 +33,12 @@
 
 import javax.annotation.processing.Processor;
 import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.TypeElement;
-import javax.lang.model.util.ElementFilter;
 import javax.tools.*;
-import javax.tools.JavaFileObject.Kind;
 
 import com.sun.source.tree.*;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.ModuleSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.comp.*;
 import com.sun.tools.javac.file.BaseFileManager;
 import com.sun.tools.javac.main.*;
@@ -82,6 +77,7 @@
     private ListBuffer<Env<AttrContext>> genList;
     private final AtomicBoolean used = new AtomicBoolean();
     private Iterable<? extends Processor> processors;
+    private ListBuffer<String> addModules = new ListBuffer<>();
 
     protected JavacTaskImpl(Context context) {
         super(context, true);
@@ -101,7 +97,7 @@
                 prepareCompiler(false);
                 if (compiler.errorCount() > 0)
                     return Main.Result.ERROR;
-                compiler.compile(args.getFileObjects(), args.getClassNames(), processors);
+                compiler.compile(args.getFileObjects(), args.getClassNames(), processors, addModules);
                 return (compiler.errorCount() > 0) ? Main.Result.ERROR : Main.Result.OK; // FIXME?
             }, Main.Result.SYSERR, Main.Result.ABNORMAL);
         } finally {
@@ -114,6 +110,18 @@
     }
 
     @Override @DefinedBy(Api.COMPILER)
+    public void addModules(Iterable<String> moduleNames) {
+        Objects.requireNonNull(moduleNames);
+        // not mt-safe
+        if (used.get())
+            throw new IllegalStateException();
+        for (String m : moduleNames) {
+            Objects.requireNonNull(m);
+            addModules.add(m);
+        }
+    }
+
+    @Override @DefinedBy(Api.COMPILER)
     public void setProcessors(Iterable<? extends Processor> processors) {
         Objects.requireNonNull(processors);
         // not mt-safe
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -418,6 +418,7 @@
 
     private Symbol attributeDocReference(TreePath path, DCReference ref) {
         Env<AttrContext> env = getAttrContext(path);
+        if (env == null) return null;
 
         Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
                 new Log.DeferredDiagnosticHandler(log);
@@ -482,7 +483,7 @@
                 paramTypes = lb.toList();
             }
 
-            ClassSymbol sym = (ClassSymbol) types.cvarUpperBound(tsym.type).tsym;
+            ClassSymbol sym = (ClassSymbol) types.skipTypeVars(tsym.type, false).tsym;
 
             Symbol msym = (memberName == sym.name)
                     ? findConstructor(sym, paramTypes)
@@ -881,6 +882,7 @@
                 case INTERFACE:
 //                    System.err.println("CLASS: " + ((JCClassDecl)tree).sym.getSimpleName());
                     env = enter.getClassEnv(((JCClassDecl)tree).sym);
+                    if (env == null) return null;
                     break;
                 case METHOD:
 //                    System.err.println("METHOD: " + ((JCMethodDecl)tree).sym.getSimpleName());
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -553,20 +553,47 @@
 
         Location classLocn = msym.classLocation;
         Location sourceLocn = msym.sourceLocation;
+        Location patchLocn = msym.patchLocation;
+        Location patchOutLocn = msym.patchOutputLocation;
 
-        if (wantClassFiles && (classLocn != null)) {
-            fillIn(p, classLocn,
-                   list(classLocn,
-                        p,
-                        packageName,
-                        classKinds));
-        }
-        if (wantSourceFiles && (sourceLocn != null)) {
-            fillIn(p, sourceLocn,
-                   list(sourceLocn,
-                        p,
-                        packageName,
-                        sourceKinds));
+        boolean prevPreferCurrent = preferCurrent;
+
+        try {
+            preferCurrent = false;
+            if (wantClassFiles && (patchOutLocn != null)) {
+                fillIn(p, patchOutLocn,
+                       list(patchOutLocn,
+                            p,
+                            packageName,
+                            classKinds));
+            }
+            if ((wantClassFiles || wantSourceFiles) && (patchLocn != null)) {
+                Set<JavaFileObject.Kind> combined = EnumSet.noneOf(JavaFileObject.Kind.class);
+                combined.addAll(classKinds);
+                combined.addAll(sourceKinds);
+                fillIn(p, patchLocn,
+                       list(patchLocn,
+                            p,
+                            packageName,
+                            combined));
+            }
+            preferCurrent = true;
+            if (wantClassFiles && (classLocn != null)) {
+                fillIn(p, classLocn,
+                       list(classLocn,
+                            p,
+                            packageName,
+                            classKinds));
+            }
+            if (wantSourceFiles && (sourceLocn != null)) {
+                fillIn(p, sourceLocn,
+                       list(sourceLocn,
+                            p,
+                            packageName,
+                            sourceKinds));
+            }
+        } finally {
+            preferCurrent = prevPreferCurrent;
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java	Mon Mar 13 19:58:52 2017 +0000
@@ -53,8 +53,8 @@
 
     /** Flags for RequiresDirective. */
     public enum RequiresFlag {
-        TRANSITIVE(0x0010),
-        STATIC_PHASE(0x0020),
+        TRANSITIVE(0x0020),
+        STATIC_PHASE(0x0040),
         SYNTHETIC(0x1000),
         MANDATED(0x8000),
         EXTRA(0x10000);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ModuleFinder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -267,6 +267,7 @@
     private List<ModuleSymbol> scanModulePath(ModuleSymbol toFind) {
         ListBuffer<ModuleSymbol> results = new ListBuffer<>();
         Map<Name, Location> namesInSet = new HashMap<>();
+        boolean multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH);
         while (moduleLocationIterator.hasNext()) {
             Set<Location> locns = (moduleLocationIterator.next());
             namesInSet.clear();
@@ -279,10 +280,29 @@
                             // module has already been found, so ignore this instance
                             continue;
                         }
+                        if (fileManager.hasLocation(StandardLocation.PATCH_MODULE_PATH) &&
+                            msym.patchLocation == null) {
+                            msym.patchLocation =
+                                    fileManager.getLocationForModule(StandardLocation.PATCH_MODULE_PATH,
+                                                                     msym.name.toString());
+                            checkModuleInfoOnLocation(msym.patchLocation, Kind.CLASS, Kind.SOURCE);
+                            if (msym.patchLocation != null &&
+                                multiModuleMode &&
+                                fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
+                                msym.patchOutputLocation =
+                                        fileManager.getLocationForModule(StandardLocation.CLASS_OUTPUT,
+                                                                         msym.name.toString());
+                                checkModuleInfoOnLocation(msym.patchOutputLocation, Kind.CLASS);
+                            }
+                        }
                         if (moduleLocationIterator.outer == StandardLocation.MODULE_SOURCE_PATH) {
-                            msym.sourceLocation = l;
-                            if (fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
-                                msym.classLocation = fileManager.getLocationForModule(StandardLocation.CLASS_OUTPUT, msym.name.toString());
+                            if (msym.patchLocation == null) {
+                                msym.sourceLocation = l;
+                                if (fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
+                                    msym.classLocation =
+                                            fileManager.getLocationForModule(StandardLocation.CLASS_OUTPUT,
+                                                                             msym.name.toString());
+                                }
                             }
                         } else {
                             msym.classLocation = l;
@@ -291,7 +311,8 @@
                             moduleLocationIterator.outer == StandardLocation.UPGRADE_MODULE_PATH) {
                             msym.flags_field |= Flags.SYSTEM_MODULE;
                         }
-                        if (toFind == msym || toFind == null) {
+                        if (toFind == null ||
+                            (toFind == msym && (msym.sourceLocation != null || msym.classLocation != null))) {
                             // Note: cannot return msym directly, because we must finish
                             // processing this set first
                             results.add(msym);
@@ -311,6 +332,21 @@
         return results.toList();
     }
 
+    private void checkModuleInfoOnLocation(Location location, Kind... kinds) throws IOException {
+        if (location == null)
+            return ;
+
+        for (Kind kind : kinds) {
+            JavaFileObject file = fileManager.getJavaFileForInput(location,
+                                                                  names.module_info.toString(),
+                                                                  kind);
+            if (file != null) {
+                log.error(Errors.LocnModuleInfoNotAllowedOnPatchPath(file));
+                return;
+            }
+        }
+    }
+
     private void findModuleInfo(ModuleSymbol msym) {
         try {
             JavaFileObject src_fo = (msym.sourceLocation == null) ? null
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,8 +70,11 @@
     /** 1.8 lambda expressions and default methods. */
     JDK1_8("1.8"),
 
-    /** 1.9 covers the to be determined language features that will be added in JDK 9. */
-    JDK1_9("1.9");
+    /** 1.9 modularity. */
+    JDK1_9("1.9"),
+
+    /** 1.10 covers the to be determined language features that will be added in JDK 10. */
+    JDK1_10("1.10");
 
     private static final Context.Key<Source> sourceKey = new Context.Key<>();
 
@@ -99,6 +102,7 @@
         tab.put("7", JDK1_7); // Make 7 an alias for 1.7
         tab.put("8", JDK1_8); // Make 8 an alias for 1.8
         tab.put("9", JDK1_9); // Make 9 an alias for 1.9
+        tab.put("10", JDK1_10); // Make 10 an alias for 1.10
     }
 
     private Source(String name) {
@@ -116,6 +120,7 @@
     }
 
     public Target requiredTarget() {
+        if (this.compareTo(JDK1_10) >= 0) return Target.JDK1_10;
         if (this.compareTo(JDK1_9) >= 0) return Target.JDK1_9;
         if (this.compareTo(JDK1_8) >= 0) return Target.JDK1_8;
         if (this.compareTo(JDK1_7) >= 0) return Target.JDK1_7;
@@ -240,6 +245,8 @@
             return RELEASE_8;
         case JDK1_9:
             return RELEASE_9;
+        case JDK1_10:
+            return RELEASE_10;
         default:
             return null;
         }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Mar 13 19:58:52 2017 +0000
@@ -908,6 +908,8 @@
         public Name version;
         public JavaFileManager.Location sourceLocation;
         public JavaFileManager.Location classLocation;
+        public JavaFileManager.Location patchLocation;
+        public JavaFileManager.Location patchOutputLocation;
 
         /** All directives, in natural order. */
         public List<com.sun.tools.javac.code.Directive> directives;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 13 19:58:52 2017 +0000
@@ -3994,10 +3994,16 @@
                         rs.methodArguments(argtypes.map(checkDeferredMap)),
                         kindName(sym.location()),
                         sym.location());
-               owntype = new MethodType(owntype.getParameterTypes(),
-                       types.erasure(owntype.getReturnType()),
-                       types.erasure(owntype.getThrownTypes()),
-                       syms.methodClass);
+                if (resultInfo.pt != Infer.anyPoly ||
+                        !owntype.hasTag(METHOD) ||
+                        !owntype.isPartial()) {
+                    //if this is not a partially inferred method type, erase return type. Otherwise,
+                    //erasure is carried out in PartiallyInferredMethodType.check().
+                    owntype = new MethodType(owntype.getParameterTypes(),
+                            types.erasure(owntype.getReturnType()),
+                            types.erasure(owntype.getThrownTypes()),
+                            syms.methodClass);
+                }
             }
 
             PolyKind pkind = (sym.type.hasTag(FORALL) &&
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,10 @@
      */
     boolean isNewClass = false;
 
+    /** Indicate if the type being visited is a service implementation
+     */
+    boolean visitingServiceImplementation = false;
+
     /** Are arguments to current function applications boxed into an array for varargs?
      */
     Resolve.MethodResolutionPhase pendingResolutionPhase = null;
@@ -127,6 +131,7 @@
         info.isAnonymousDiamond = isAnonymousDiamond;
         info.isNewClass = isNewClass;
         info.preferredTreeForDiagnostics = preferredTreeForDiagnostics;
+        info.visitingServiceImplementation = visitingServiceImplementation;
         return info;
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import javax.tools.JavaFileManager;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Kinds.KindName;
 import com.sun.tools.javac.code.Kinds.KindSelector;
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
@@ -155,6 +156,7 @@
 
     public Env<AttrContext> getClassEnv(TypeSymbol sym) {
         Env<AttrContext> localEnv = getEnv(sym);
+        if (localEnv == null) return null;
         Env<AttrContext> lintEnv = localEnv;
         while (lintEnv.info.lint == null)
             lintEnv = lintEnv.next;
@@ -400,8 +402,14 @@
             c = syms.enterClass(env.toplevel.modle, tree.name, packge);
             packge.members().enterIfAbsent(c);
             if ((tree.mods.flags & PUBLIC) != 0 && !classNameMatchesFileName(c, env)) {
+                KindName topElement = KindName.CLASS;
+                if ((tree.mods.flags & ENUM) != 0) {
+                    topElement = KindName.ENUM;
+                } else if ((tree.mods.flags & INTERFACE) != 0) {
+                    topElement = KindName.INTERFACE;
+                }
                 log.error(tree.pos(),
-                          "class.public.should.be.in.file", tree.name);
+                          "class.public.should.be.in.file", topElement, tree.name);
             }
         } else {
             if (!tree.name.isEmpty() &&
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -319,7 +319,8 @@
                  *  need to use it several times: with several targets.
                  */
                 saved_undet = inferenceContext.save();
-                if (allowGraphInference && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
+                boolean unchecked = warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED);
+                if (allowGraphInference && !unchecked) {
                     boolean shouldPropagate = shouldPropagate(getReturnType(), resultInfo, inferenceContext);
 
                     InferenceContext minContext = shouldPropagate ?
@@ -338,7 +339,10 @@
                     }
                 }
                 inferenceContext.solve(noWarnings);
-                return inferenceContext.asInstType(this).getReturnType();
+                Type ret = inferenceContext.asInstType(this).getReturnType();
+                //inline logic from Attr.checkMethod - if unchecked conversion was required, erase
+                //return type _after_ resolution
+                return unchecked ? types.erasure(ret) : ret;
             } catch (InferenceException ex) {
                 resultInfo.checkContext.report(null, ex.getDiagnostic());
                 Assert.error(); //cannot get here (the above should throw)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Mon Mar 13 19:58:52 2017 +0000
@@ -145,7 +145,7 @@
 
     public final boolean multiModuleMode;
 
-    private final String moduleOverride;
+    private final String legacyModuleOverride;
 
     private final Name java_se;
     private final Name java_;
@@ -192,7 +192,7 @@
 
         lintOptions = options.isUnset(Option.XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option);
 
-        moduleOverride = options.get(Option.XMODULE);
+        legacyModuleOverride = options.get(Option.XMODULE);
 
         multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH);
         ClassWriter classWriter = ClassWriter.instance(context);
@@ -366,9 +366,26 @@
 
                 JavaFileObject prev = log.useSource(tree.sourcefile);
                 try {
-                    Location locn = getModuleLocation(tree);
-                    if (locn != null) {
-                        Name name = names.fromString(fileManager.inferModuleName(locn));
+                    Location msplocn = getModuleLocation(tree);
+                    Location plocn = fileManager.hasLocation(StandardLocation.PATCH_MODULE_PATH) ?
+                            fileManager.getLocationForModule(StandardLocation.PATCH_MODULE_PATH,
+                                                             tree.sourcefile, getPackageName(tree)) :
+                            null;
+
+                    if (plocn != null) {
+                        Name name = names.fromString(fileManager.inferModuleName(plocn));
+                        ModuleSymbol msym = moduleFinder.findModule(name);
+                        tree.modle = msym;
+                        rootModules.add(msym);
+
+                        if (msplocn != null) {
+                            Name mspname = names.fromString(fileManager.inferModuleName(msplocn));
+                            if (name != mspname) {
+                                log.error(tree.pos(), Errors.FilePatchedAndMsp(name, mspname));
+                            }
+                        }
+                    } else if (msplocn != null) {
+                        Name name = names.fromString(fileManager.inferModuleName(msplocn));
                         ModuleSymbol msym;
                         JCModuleDecl decl = tree.getModuleDecl();
                         if (decl != null) {
@@ -383,7 +400,7 @@
                             msym = syms.enterModule(name);
                         }
                         if (msym.sourceLocation == null) {
-                            msym.sourceLocation = locn;
+                            msym.sourceLocation = msplocn;
                             if (fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
                                 msym.classLocation = fileManager.getLocationForModule(
                                         StandardLocation.CLASS_OUTPUT, msym.name.toString());
@@ -414,7 +431,9 @@
             }
             defaultModule = syms.unnamedModule;
         } else {
+            ModuleSymbol module = null;
             if (defaultModule == null) {
+                String moduleOverride = singleModuleOverride(trees);
                 switch (rootModules.size()) {
                     case 0:
                         defaultModule = moduleFinder.findSingleModule();
@@ -422,38 +441,49 @@
                             if (moduleOverride != null) {
                                 checkNoAllModulePath();
                                 defaultModule = moduleFinder.findModule(names.fromString(moduleOverride));
-                                defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
+                                if (legacyModuleOverride != null) {
+                                    defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
+                                }
+                                defaultModule.patchOutputLocation = StandardLocation.CLASS_OUTPUT;
                             } else {
                                 // Question: why not do findAllModules and initVisiblePackages here?
                                 // i.e. body of unnamedModuleCompleter
                                 defaultModule.completer = getUnnamedModuleCompleter();
+                                defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
                                 defaultModule.classLocation = StandardLocation.CLASS_PATH;
                             }
                         } else {
-                            checkSpecifiedModule(trees, Errors.ModuleInfoWithXmoduleClasspath);
+                            checkSpecifiedModule(trees, moduleOverride, Errors.ModuleInfoWithPatchedModuleClassoutput);
                             checkNoAllModulePath();
                             defaultModule.complete();
                             // Question: why not do completeModule here?
                             defaultModule.completer = sym -> completeModule((ModuleSymbol) sym);
+                            defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
                         }
                         rootModules.add(defaultModule);
                         break;
                     case 1:
-                        checkSpecifiedModule(trees, Errors.ModuleInfoWithXmoduleSourcepath);
+                        checkSpecifiedModule(trees, moduleOverride, Errors.ModuleInfoWithPatchedModuleSourcepath);
                         checkNoAllModulePath();
                         defaultModule = rootModules.iterator().next();
+                        defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
                         defaultModule.classLocation = StandardLocation.CLASS_OUTPUT;
                         break;
                     default:
                         Assert.error("too many modules");
                 }
-                defaultModule.sourceLocation = StandardLocation.SOURCE_PATH;
             } else if (rootModules.size() == 1 && defaultModule == rootModules.iterator().next()) {
                 defaultModule.complete();
                 defaultModule.completer = sym -> completeModule((ModuleSymbol) sym);
             } else {
                 Assert.check(rootModules.isEmpty());
-                rootModules.add(defaultModule);
+                String moduleOverride = singleModuleOverride(trees);
+                if (moduleOverride != null) {
+                    module = moduleFinder.findModule(names.fromString(moduleOverride));
+                } else {
+                    module = defaultModule;
+                }
+                rootModules.add(module);
             }
 
             if (defaultModule != syms.unnamedModule) {
@@ -461,12 +491,56 @@
                 syms.unnamedModule.classLocation = StandardLocation.CLASS_PATH;
             }
 
+            if (module == null) {
+                module = defaultModule;
+            }
+
             for (JCCompilationUnit tree: trees) {
-                tree.modle = defaultModule;
+                tree.modle = module;
             }
         }
     }
 
+    private String singleModuleOverride(List<JCCompilationUnit> trees) {
+        if (!fileManager.hasLocation(StandardLocation.PATCH_MODULE_PATH)) {
+            return legacyModuleOverride;
+        }
+
+        Set<String> override = new LinkedHashSet<>();
+        for (JCCompilationUnit tree : trees) {
+            JavaFileObject fo = tree.sourcefile;
+
+            try {
+                Location loc =
+                        fileManager.getLocationForModule(StandardLocation.PATCH_MODULE_PATH,
+                                                         fo, getPackageName(tree));
+
+                if (loc != null) {
+                    override.add(fileManager.inferModuleName(loc));
+                }
+            } catch (IOException ex) {
+                throw new Error(ex);
+            }
+        }
+
+        switch (override.size()) {
+            case 0: return legacyModuleOverride;
+            case 1: return override.iterator().next();
+            default:
+                log.error(Errors.TooManyPatchedModules(override));
+                return null;
+        }
+    }
+
+    private String getPackageName(JCCompilationUnit tree) {
+        if (tree.getModuleDecl() != null) {
+            return null;
+        } else {
+            JCPackageDecl pkg = tree.getPackage();
+            return (pkg == null) ? "" : TreeInfo.fullName(pkg.pid).toString();
+        }
+    }
+
     /**
      * Determine the location for the module on the module source path
      * or source output directory which contains a given CompilationUnit.
@@ -478,32 +552,23 @@
      * @throws IOException if there is a problem while searching for the module.
      */
     private Location getModuleLocation(JCCompilationUnit tree) throws IOException {
-        Name pkgName;
-        if (tree.getModuleDecl() != null) {
-            pkgName = null;
-        } else {
-            JCPackageDecl pkg = tree.getPackage();
-            pkgName = (pkg == null) ? names.empty : TreeInfo.fullName(pkg.pid);
-        }
-
+        String pkgName = getPackageName(tree);
         JavaFileObject fo = tree.sourcefile;
 
-        // For now, just check module source path.
-        // We may want to check source path as well.
         Location loc =
                 fileManager.getLocationForModule(StandardLocation.MODULE_SOURCE_PATH,
-                                                 fo, (pkgName == null) ? null : pkgName.toString());
+                                                 fo, (pkgName == null) ? null : pkgName);
         if (loc == null) {
             Location sourceOutput = fileManager.hasLocation(StandardLocation.SOURCE_OUTPUT) ?
                     StandardLocation.SOURCE_OUTPUT : StandardLocation.CLASS_OUTPUT;
             loc =
                 fileManager.getLocationForModule(sourceOutput,
-                                                 fo, (pkgName == null) ? null : pkgName.toString());
+                                                 fo, (pkgName == null) ? null : pkgName);
         }
         return loc;
     }
 
-    private void checkSpecifiedModule(List<JCCompilationUnit> trees, JCDiagnostic.Error error) {
+    private void checkSpecifiedModule(List<JCCompilationUnit> trees, String moduleOverride, JCDiagnostic.Error error) {
         if (moduleOverride != null) {
             JavaFileObject prev = log.useSource(trees.head.sourcefile);
             try {
@@ -931,8 +996,18 @@
             }
             ListBuffer<ClassSymbol> impls = new ListBuffer<>();
             for (JCExpression implName : tree.implNames) {
-                Type it = attr.attribType(implName, env, syms.objectType);
+                Type it;
+                boolean prevVisitingServiceImplementation = env.info.visitingServiceImplementation;
+                try {
+                    env.info.visitingServiceImplementation = true;
+                    it = attr.attribType(implName, env, syms.objectType);
+                } finally {
+                    env.info.visitingServiceImplementation = prevVisitingServiceImplementation;
+                }
                 ClassSymbol impl = (ClassSymbol) it.tsym;
+                if ((impl.flags_field & PUBLIC) == 0) {
+                    log.error(implName.pos(), Errors.NotDefPublic(impl, impl.location()));
+                }
                 //find provider factory:
                 MethodSymbol factory = factoryMethod(impl);
                 if (factory != null) {
@@ -1594,8 +1669,8 @@
     }
 
     public void newRound() {
+        allModules = null;
         rootModules = null;
-        allModules = null;
         warnedMissing.clear();
     }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Mar 13 19:58:52 2017 +0000
@@ -307,6 +307,11 @@
         if (env.enclMethod != null && (env.enclMethod.mods.flags & ANONCONSTR) != 0)
             return true;
 
+        if (env.info.visitingServiceImplementation &&
+            env.toplevel.modle == c.packge().modle) {
+            return true;
+        }
+
         boolean isAccessible = false;
         switch ((short)(c.flags() & AccessFlags)) {
             case PRIVATE:
@@ -389,6 +394,11 @@
         if (env.enclMethod != null && (env.enclMethod.mods.flags & ANONCONSTR) != 0)
             return true;
 
+        if (env.info.visitingServiceImplementation &&
+            env.toplevel.modle == sym.packge().modle) {
+            return true;
+        }
+
         switch ((short)(sym.flags() & AccessFlags)) {
         case PRIVATE:
             return
@@ -2094,7 +2104,7 @@
 
         for (S sym : candidates) {
             if (validate.test(sym))
-                return new InvisibleSymbolError(env, suppressError, sym);
+                return createInvisibleSymbolError(env, suppressError, sym);
         }
 
         Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
@@ -2113,7 +2123,7 @@
                     S sym = load.apply(ms, name);
 
                     if (sym != null && validate.test(sym)) {
-                        return new InvisibleSymbolError(env, suppressError, sym);
+                        return createInvisibleSymbolError(env, suppressError, sym);
                     }
                 }
             }
@@ -2122,6 +2132,21 @@
         return defaultResult;
     }
 
+    private Symbol createInvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
+        if (symbolPackageVisible(env, sym)) {
+            return new AccessError(env, null, sym);
+        } else {
+            return new InvisibleSymbolError(env, suppressError, sym);
+        }
+    }
+
+    private boolean symbolPackageVisible(Env<AttrContext> env, Symbol sym) {
+        ModuleSymbol envMod = env.toplevel.modle;
+        PackageSymbol symPack = sym.packge();
+        return envMod == symPack.modle ||
+               envMod.visiblePackages.containsKey(symPack.fullname);
+    }
+
     /**
      * Find a type declared in a scope (not inherited).  Return null
      * if none is found.
@@ -4094,8 +4119,7 @@
                             pos, "not.def.access.package.cant.access",
                         sym, sym.location(), inaccessiblePackageReason(env, sym.packge()));
                 } else if (   sym.packge() != syms.rootPackage
-                           && sym.packge().modle != env.toplevel.modle
-                           && !isAccessible(env, sym.outermostClass())) {
+                           && !symbolPackageVisible(env, sym)) {
                     return diags.create(dkind, log.currentSource(),
                             pos, "not.def.access.class.intf.cant.access.reason",
                             sym, sym.location(), sym.location().packge(),
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Mar 13 19:58:52 2017 +0000
@@ -968,7 +968,7 @@
             Collection<Path> paths = locations.getLocation(location);
             ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[paths.size()]));
             Layer bootLayer = Layer.boot();
-            Configuration cf = bootLayer.configuration().resolveRequiresAndUses(ModuleFinder.of(), finder, Collections.emptySet());
+            Configuration cf = bootLayer.configuration().resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet());
             Layer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
             return ServiceLoaderHelper.load(layer, service);
         } else {
@@ -980,7 +980,7 @@
     public Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
         checkModuleOrientedOrOutputLocation(location);
         if (!(fo instanceof PathFileObject))
-            throw new IllegalArgumentException(fo.getName());
+            return null;
         int depth = 1; // allow 1 for filename
         if (pkgName != null && !pkgName.isEmpty()) {
             depth += 1;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java	Mon Mar 13 19:58:52 2017 +0000
@@ -432,7 +432,7 @@
         /**
          * @see JavaFileManager#getLocationForModule(Location, JavaFileObject, String)
          */
-        Location getLocationForModule(Path dir) {
+        Location getLocationForModule(Path dir) throws IOException  {
             return null;
         }
 
@@ -545,7 +545,7 @@
                 l = new ModuleLocationHandler(location.getName() + "[" + name + "]",
                         name,
                         Collections.singleton(out),
-                        true, false);
+                        true);
                 moduleLocations.put(name, l);
                 pathLocations.put(out.toAbsolutePath(), l);
            }
@@ -864,29 +864,14 @@
         protected final String name;
         protected final String moduleName;
         protected final Collection<Path> searchPath;
-        protected final Collection<Path> searchPathWithOverrides;
         protected final boolean output;
 
         ModuleLocationHandler(String name, String moduleName, Collection<Path> searchPath,
-                boolean output, boolean allowOverrides) {
+                boolean output) {
             this.name = name;
             this.moduleName = moduleName;
             this.searchPath = searchPath;
             this.output = output;
-
-            if (allowOverrides && patchMap != null) {
-                SearchPath mPatch = patchMap.get(moduleName);
-                if (mPatch != null) {
-                    SearchPath sp = new SearchPath();
-                    sp.addAll(mPatch);
-                    sp.addAll(searchPath);
-                    searchPathWithOverrides = sp;
-                } else {
-                    searchPathWithOverrides = searchPath;
-                }
-            } else {
-                searchPathWithOverrides = searchPath;
-            }
         }
 
         @Override @DefinedBy(Api.COMPILER)
@@ -909,7 +894,7 @@
             // For now, we always return searchPathWithOverrides. This may differ from the
             // JVM behavior if there is a module-info.class to be found in the overriding
             // classes.
-            return searchPathWithOverrides;
+            return searchPath;
         }
 
         @Override // defined by LocationHandler
@@ -985,6 +970,11 @@
         }
 
         private void checkValidModulePathEntry(Path p) {
+            if (!Files.exists(p)) {
+                // warning may be generated later
+                return;
+            }
+
             if (Files.isDirectory(p)) {
                 // either an exploded module or a directory of modules
                 return;
@@ -1063,7 +1053,7 @@
                         String name = location.getName()
                                 + "[" + pathIndex + ":" + moduleName + "]";
                         ModuleLocationHandler l = new ModuleLocationHandler(name, moduleName,
-                                Collections.singleton(path), false, true);
+                                Collections.singleton(path), false);
                         return Collections.singleton(l);
                     } catch (ModuleNameReader.BadClassFile e) {
                         log.error(Errors.LocnBadModuleInfo(path));
@@ -1088,7 +1078,7 @@
                     String name = location.getName()
                             + "[" + pathIndex + "." + (index++) + ":" + moduleName + "]";
                     ModuleLocationHandler l = new ModuleLocationHandler(name, moduleName,
-                            Collections.singleton(modulePath), false, true);
+                            Collections.singleton(modulePath), false);
                     result.add(l);
                 }
                 return result;
@@ -1105,7 +1095,7 @@
                 String name = location.getName()
                         + "[" + pathIndex + ":" + moduleName + "]";
                 ModuleLocationHandler l = new ModuleLocationHandler(name, moduleName,
-                        Collections.singleton(modulePath), false, true);
+                        Collections.singleton(modulePath), false);
                 return Collections.singleton(l);
             }
 
@@ -1272,7 +1262,7 @@
             pathLocations = new LinkedHashMap<>();
             map.forEach((k, v) -> {
                 String name = location.getName() + "[" + k + "]";
-                ModuleLocationHandler h = new ModuleLocationHandler(name, k, v, false, false);
+                ModuleLocationHandler h = new ModuleLocationHandler(name, k, v, false);
                 moduleLocations.put(k, h);
                 v.forEach(p -> pathLocations.put(normalize(p), h));
             });
@@ -1412,6 +1402,7 @@
         private Path systemJavaHome;
         private Path modules;
         private Map<String, ModuleLocationHandler> systemModules;
+        private Map<Path, Location> pathLocations;
 
         SystemModulesLocationHandler() {
             super(StandardLocation.SYSTEM_MODULES, Option.SYSTEM);
@@ -1486,6 +1477,12 @@
         }
 
         @Override
+        Location getLocationForModule(Path dir) throws IOException {
+            initSystemModules();
+            return (pathLocations == null) ? null : pathLocations.get(dir);
+        }
+
+        @Override
         Iterable<Set<Location>> listLocationsForModules() throws IOException {
             initSystemModules();
             Set<Location> locns = new LinkedHashSet<>();
@@ -1539,18 +1536,96 @@
             }
 
             systemModules = new LinkedHashMap<>();
+            pathLocations = new LinkedHashMap<>();
             try (DirectoryStream<Path> stream = Files.newDirectoryStream(modules, Files::isDirectory)) {
                 for (Path entry : stream) {
                     String moduleName = entry.getFileName().toString();
                     String name = location.getName() + "[" + moduleName + "]";
                     ModuleLocationHandler h = new ModuleLocationHandler(name, moduleName,
-                            Collections.singleton(entry), false, true);
+                            Collections.singleton(entry), false);
                     systemModules.put(moduleName, h);
+                    pathLocations.put(normalize(entry), h);
                 }
             }
         }
     }
 
+    private class PatchModulesLocationHandler extends BasicLocationHandler {
+        private final Map<String, ModuleLocationHandler> moduleLocations = new HashMap<>();
+        private final Map<Path, Location> pathLocations = new HashMap<>();
+
+        PatchModulesLocationHandler() {
+            super(StandardLocation.PATCH_MODULE_PATH, Option.PATCH_MODULE);
+        }
+
+        @Override
+        boolean handleOption(Option option, String value) {
+            if (!options.contains(option)) {
+                return false;
+            }
+
+            // Allow an extended syntax for --patch-module consisting of a series
+            // of values separated by NULL characters. This is to facilitate
+            // supporting deferred file manager options on the command line.
+            // See Option.PATCH_MODULE for the code that composes these multiple
+            // values.
+            for (String v : value.split("\0")) {
+                int eq = v.indexOf('=');
+                if (eq > 0) {
+                    String moduleName = v.substring(0, eq);
+                    SearchPath mPatchPath = new SearchPath()
+                            .addFiles(v.substring(eq + 1));
+                    String name = location.getName() + "[" + moduleName + "]";
+                    ModuleLocationHandler h = new ModuleLocationHandler(name, moduleName, mPatchPath, false);
+                    moduleLocations.put(moduleName, h);
+                    for (Path r : mPatchPath) {
+                        pathLocations.put(normalize(r), h);
+                    }
+                } else {
+                    // Should not be able to get here;
+                    // this should be caught and handled in Option.PATCH_MODULE
+                    log.error(Errors.LocnInvalidArgForXpatch(value));
+                }
+            }
+
+            return true;
+        }
+
+        @Override
+        boolean isSet() {
+            return !moduleLocations.isEmpty();
+        }
+
+        @Override
+        Collection<Path> getPaths() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        void setPaths(Iterable<? extends Path> files) throws IOException {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        Location getLocationForModule(String name) throws IOException {
+            return moduleLocations.get(name);
+        }
+
+        @Override
+        Location getLocationForModule(Path dir) throws IOException {
+            return (pathLocations == null) ? null : pathLocations.get(dir);
+        }
+
+        @Override
+        Iterable<Set<Location>> listLocationsForModules() throws IOException {
+            Set<Location> locns = new LinkedHashSet<>();
+            for (Location l: moduleLocations.values())
+                locns.add(l);
+            return Collections.singleton(locns);
+        }
+
+    }
+
     Map<Location, LocationHandler> handlersForLocation;
     Map<Option, LocationHandler> handlersForOption;
 
@@ -1568,6 +1643,7 @@
             new OutputLocationHandler(StandardLocation.SOURCE_OUTPUT, Option.S),
             new OutputLocationHandler(StandardLocation.NATIVE_HEADER_OUTPUT, Option.H),
             new ModuleSourcePathLocationHandler(),
+            new PatchModulesLocationHandler(),
             // TODO: should UPGRADE_MODULE_PATH be merged with SYSTEM_MODULES?
             new ModulePathLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADE_MODULE_PATH),
             new ModulePathLocationHandler(StandardLocation.MODULE_PATH, Option.MODULE_PATH),
@@ -1582,51 +1658,9 @@
         }
     }
 
-    private Map<String, SearchPath> patchMap;
-
     boolean handleOption(Option option, String value) {
-        switch (option) {
-            case PATCH_MODULE:
-                if (value == null) {
-                    patchMap = null;
-                } else {
-                    // Allow an extended syntax for --patch-module consisting of a series
-                    // of values separated by NULL characters. This is to facilitate
-                    // supporting deferred file manager options on the command line.
-                    // See Option.PATCH_MODULE for the code that composes these multiple
-                    // values.
-                    for (String v : value.split("\0")) {
-                        int eq = v.indexOf('=');
-                        if (eq > 0) {
-                            String mName = v.substring(0, eq);
-                            SearchPath mPatchPath = new SearchPath()
-                                    .addFiles(v.substring(eq + 1));
-                            boolean ok = true;
-                            for (Path p : mPatchPath) {
-                                Path mi = p.resolve("module-info.class");
-                                if (Files.exists(mi)) {
-                                    log.error(Errors.LocnModuleInfoNotAllowedOnPatchPath(mi));
-                                    ok = false;
-                                }
-                            }
-                            if (ok) {
-                                if (patchMap == null) {
-                                    patchMap = new LinkedHashMap<>();
-                                }
-                                patchMap.put(mName, mPatchPath);
-                            }
-                        } else {
-                            // Should not be able to get here;
-                            // this should be caught and handled in Option.PATCH_MODULE
-                            log.error(Errors.LocnInvalidArgForXpatch(value));
-                        }
-                    }
-                }
-                return true;
-            default:
-                LocationHandler h = handlersForOption.get(option);
-                return (h == null ? false : h.handleOption(option, value));
-        }
+        LocationHandler h = handlersForOption.get(option);
+        return (h == null ? false : h.handleOption(option, value));
     }
 
     boolean hasLocation(Location location) {
@@ -1665,7 +1699,7 @@
         return (h == null ? null : h.getLocationForModule(name));
     }
 
-    Location getLocationForModule(Location location, Path dir) {
+    Location getLocationForModule(Location location, Path dir) throws IOException {
         LocationHandler h = getHandler(location);
         return (h == null ? null : h.getLocationForModule(dir));
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.jvm.Code.*;
 import com.sun.tools.javac.jvm.Items.*;
-import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.tree.EndPosTable;
 import com.sun.tools.javac.tree.JCTree.*;
 
@@ -67,10 +66,9 @@
     private final TreeMaker make;
     private final Names names;
     private final Target target;
-    private Name accessDollar;
+    private final Name accessDollar;
     private final Types types;
     private final Lower lower;
-    private final Flow flow;
     private final Annotate annotate;
     private final StringConcat concat;
 
@@ -95,7 +93,7 @@
 
     /** Constant pool, reset by genClass.
      */
-    private Pool pool;
+    private final Pool pool;
 
     protected Gen(Context context) {
         context.put(genKey, this);
@@ -113,7 +111,6 @@
         methodType = new MethodType(null, null, null, syms.methodClass);
         accessDollar = names.
             fromString("access" + target.syntheticNameChar());
-        flow = Flow.instance(context);
         lower = Lower.instance(context);
 
         Options options = Options.instance(context);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,9 @@
  *  deletion without notice.</b>
  */
 public enum Profile {
-    COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9),
-    COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9),
-    COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9),
+    COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
+    COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
+    COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
 
     DEFAULT {
         @Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
     JDK1_8("1.8", 52, 0),
 
     /** JDK 9. */
-    JDK1_9("1.9", 53, 0);
+    JDK1_9("1.9", 53, 0),
+
+    /** JDK 10, initially an alias for 9 */
+    JDK1_10("1.10", 53, 0);
 
     private static final Context.Key<Target> targetKey = new Context.Key<>();
 
@@ -91,6 +94,7 @@
         tab.put("7", JDK1_7);
         tab.put("8", JDK1_8);
         tab.put("9", JDK1_9);
+        tab.put("10", JDK1_10);
     }
 
     public final String name;
@@ -102,7 +106,7 @@
         this.minorVersion = minorVersion;
     }
 
-    public static final Target DEFAULT = JDK1_9;
+    public static final Target DEFAULT = values()[values().length - 1];
 
     public static Target lookup(String name) {
         return tab.get(name);
@@ -146,5 +150,4 @@
     public String multiReleaseValue() {
         return Integer.toString(this.ordinal() - Target.JDK1_1.ordinal() + 1);
     }
-
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java	Mon Mar 13 19:58:52 2017 +0000
@@ -598,9 +598,6 @@
                     && !fm.hasLocation(StandardLocation.CLASS_OUTPUT)) {
                 log.error(Errors.NoOutputDir);
             }
-            if (options.isSet(Option.XMODULE)) {
-                log.error(Errors.XmoduleNoModuleSourcepath);
-            }
         }
 
         if (fm.hasLocation(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH) &&
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,9 @@
 import java.io.Reader;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-
-import com.sun.tools.javac.util.ListBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * Various utility methods for processing Java tool command line arguments.
@@ -55,28 +56,80 @@
      * @throws IOException if there is a problem reading any of the @files
      */
     public static String[] parse(String[] args) throws IOException {
-        ListBuffer<String> newArgs = new ListBuffer<>();
+        List<String> newArgs = new ArrayList<>();
+        appendParsedCommandArgs(newArgs, Arrays.asList(args));
+        return newArgs.toArray(new String[newArgs.size()]);
+    }
+
+    private static void appendParsedCommandArgs(List<String> newArgs, List<String> args) throws IOException {
         for (String arg : args) {
             if (arg.length() > 1 && arg.charAt(0) == '@') {
                 arg = arg.substring(1);
                 if (arg.charAt(0) == '@') {
-                    newArgs.append(arg);
+                    newArgs.add(arg);
                 } else {
                     loadCmdFile(arg, newArgs);
                 }
             } else {
-                newArgs.append(arg);
+                newArgs.add(arg);
             }
         }
-        return newArgs.toList().toArray(new String[newArgs.length()]);
     }
 
-    private static void loadCmdFile(String name, ListBuffer<String> args) throws IOException {
+    /**
+     * Process the given environment variable and appends any Win32-style
+     * command files for the specified command line arguments and return
+     * the resulting arguments. A command file argument
+     * is of the form '@file' where 'file' is the name of the file whose
+     * contents are to be parsed for additional arguments. The contents of
+     * the command file are parsed using StreamTokenizer and the original
+     * '@file' argument replaced with the resulting tokens. Recursive command
+     * files are not supported. The '@' character itself can be quoted with
+     * the sequence '@@'.
+     * @param envVariable the env variable to process
+     * @param args the arguments that may contain @files
+     * @return the arguments, with environment variable's content and expansion of @files
+     * @throws IOException if there is a problem reading any of the @files
+     * @throws com.sun.tools.javac.main.CommandLine.UnmatchedQuote
+     */
+    public static List<String> parse(String envVariable, List<String> args)
+            throws IOException, UnmatchedQuote {
+
+        List<String> inArgs = new ArrayList<>();
+        appendParsedEnvVariables(inArgs, envVariable);
+        inArgs.addAll(args);
+        List<String> newArgs = new ArrayList<>();
+        appendParsedCommandArgs(newArgs, inArgs);
+        return newArgs;
+    }
+
+    /**
+     * Process the given environment variable and appends any Win32-style
+     * command files for the specified command line arguments and return
+     * the resulting arguments. A command file argument
+     * is of the form '@file' where 'file' is the name of the file whose
+     * contents are to be parsed for additional arguments. The contents of
+     * the command file are parsed using StreamTokenizer and the original
+     * '@file' argument replaced with the resulting tokens. Recursive command
+     * files are not supported. The '@' character itself can be quoted with
+     * the sequence '@@'.
+     * @param envVariable the env variable to process
+     * @param args the arguments that may contain @files
+     * @return the arguments, with environment variable's content and expansion of @files
+     * @throws IOException if there is a problem reading any of the @files
+     * @throws com.sun.tools.javac.main.CommandLine.UnmatchedQuote
+     */
+    public static String[] parse(String envVariable, String[] args) throws IOException, UnmatchedQuote {
+        List<String> out = parse(envVariable, Arrays.asList(args));
+        return out.toArray(new String[out.size()]);
+    }
+
+    private static void loadCmdFile(String name, List<String> args) throws IOException {
         try (Reader r = Files.newBufferedReader(Paths.get(name))) {
             Tokenizer t = new Tokenizer(r);
             String s;
             while ((s = t.nextToken()) != null) {
-                args.append(s);
+                args.add(s);
             }
         }
     }
@@ -188,4 +241,75 @@
             }
         }
     }
+
+    @SuppressWarnings("fallthrough")
+    private static void appendParsedEnvVariables(List<String> newArgs, String envVariable)
+            throws UnmatchedQuote {
+
+        if (envVariable == null) {
+            return;
+        }
+        String in = System.getenv(envVariable);
+        if (in == null || in.trim().isEmpty()) {
+            return;
+        }
+
+        final char NUL = (char)0;
+        final int len = in.length();
+
+        int pos = 0;
+        StringBuilder sb = new StringBuilder();
+        char quote = NUL;
+        char ch;
+
+        loop:
+        while (pos < len) {
+            ch = in.charAt(pos);
+            switch (ch) {
+                case '\"': case '\'':
+                    if (quote == NUL) {
+                        quote = ch;
+                    } else if (quote == ch) {
+                        quote = NUL;
+                    } else {
+                        sb.append(ch);
+                    }
+                    pos++;
+                    break;
+                case '\f': case '\n': case '\r': case '\t': case ' ':
+                    if (quote == NUL) {
+                        newArgs.add(sb.toString());
+                        sb.setLength(0);
+                        while (ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
+                            pos++;
+                            if (pos >= len) {
+                                break loop;
+                            }
+                            ch = in.charAt(pos);
+                        }
+                        break;
+                    }
+                    // fall through
+                default:
+                    sb.append(ch);
+                    pos++;
+            }
+        }
+        if (sb.length() != 0) {
+            newArgs.add(sb.toString());
+        }
+        if (quote != NUL) {
+            throw new UnmatchedQuote(envVariable);
+        }
+    }
+
+    public static class UnmatchedQuote extends Exception {
+        private static final long serialVersionUID = 0;
+
+        public final String variableName;
+
+        UnmatchedQuote(String variable) {
+            this.variableName = variable;
+        }
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Mar 13 19:58:52 2017 +0000
@@ -888,7 +888,7 @@
 
     public void compile(List<JavaFileObject> sourceFileObject)
         throws Throwable {
-        compile(sourceFileObject, List.nil(), null);
+        compile(sourceFileObject, List.nil(), null, List.nil());
     }
 
     /**
@@ -898,10 +898,13 @@
      * @param classnames class names to process for annotations
      * @param processors user provided annotation processors to bypass
      * discovery, {@code null} means that no processors were provided
+     * @param addModules additional root modules to be used during
+     * module resolution.
      */
     public void compile(Collection<JavaFileObject> sourceFileObjects,
                         Collection<String> classnames,
-                        Iterable<? extends Processor> processors)
+                        Iterable<? extends Processor> processors,
+                        Collection<String> addModules)
     {
         if (!taskListener.isEmpty()) {
             taskListener.started(new TaskEvent(TaskEvent.Kind.COMPILATION));
@@ -932,6 +935,10 @@
                 }
             }
 
+            for (String moduleName : addModules) {
+                modules.addExtraAddModules(moduleName);
+            }
+
             // These method calls must be chained to avoid memory leaks
             processAnnotations(
                 enterTrees(
@@ -1450,6 +1457,11 @@
             return;
         }
 
+        if (!modules.multiModuleMode && env.toplevel.modle != modules.getDefaultModule()) {
+            //can only generate classfiles for a single module:
+            return;
+        }
+
         if (compileStates.isDone(env, CompileState.LOWER)) {
             results.addAll(desugaredEnvs.get(env));
             return;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 import com.sun.tools.javac.file.BaseFileManager;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.main.CommandLine.UnmatchedQuote;
 import com.sun.tools.javac.platform.PlatformDescription;
 import com.sun.tools.javac.processing.AnnotationProcessingError;
 import com.sun.tools.javac.util.*;
@@ -80,6 +81,7 @@
      */
     boolean apiMode;
 
+    private static final String ENV_OPT_NAME = "JDK_JAVAC_OPTIONS";
 
     /** Result codes.
      */
@@ -201,19 +203,12 @@
             return Result.CMDERR;
         }
 
-        // prefix argv with contents of _JAVAC_OPTIONS if set
-        String envOpt = System.getenv("_JAVAC_OPTIONS");
-        if (envOpt != null && !envOpt.trim().isEmpty()) {
-            String[] envv = envOpt.split("\\s+");
-            String[] result = new String[envv.length + argv.length];
-            System.arraycopy(envv, 0, result, 0, envv.length);
-            System.arraycopy(argv, 0, result, envv.length, argv.length);
-            argv = result;
-        }
-
-        // expand @-files
+        // prefix argv with contents of environment variable and expand @-files
         try {
-            argv = CommandLine.parse(argv);
+            argv = CommandLine.parse(ENV_OPT_NAME, argv);
+        } catch (UnmatchedQuote ex) {
+            error("err.unmatched.quote", ex.variableName);
+            return Result.CMDERR;
         } catch (FileNotFoundException | NoSuchFileException e) {
             warning("err.file.not.found", e.getMessage());
             return Result.SYSERR;
@@ -304,7 +299,7 @@
         }
 
         try {
-            comp.compile(args.getFileObjects(), args.getClassNames(), null);
+            comp.compile(args.getFileObjects(), args.getClassNames(), null, List.nil());
 
             if (log.expectDiagKeys != null) {
                 if (log.expectDiagKeys.isEmpty()) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Mon Mar 13 19:58:52 2017 +0000
@@ -579,7 +579,7 @@
         }
     },
 
-    XMODULE("-Xmodule:", "opt.arg.module", "opt.module", EXTENDED, BASIC) {
+    XMODULE("-Xmodule:", "opt.arg.module", "opt.module", HIDDEN, BASIC) {
         @Override
         public void process(OptionHelper helper, String option, String arg) throws InvalidValueException {
             String prev = helper.get(XMODULE);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,7 @@
 
 package com.sun.tools.javac.model;
 
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -117,6 +118,14 @@
     }
 
     @Override @DefinedBy(Api.LANGUAGE_MODEL)
+    public Set<? extends ModuleElement> getAllModuleElements() {
+        if (allowModules)
+            return Collections.unmodifiableSet(modules.allModules());
+        else
+            return Collections.emptySet();
+    }
+
+    @Override @DefinedBy(Api.LANGUAGE_MODEL)
     public ModuleSymbol getModuleElement(CharSequence name) {
         ensureEntered("getModuleElement");
         if (modules.getDefaultModule() == syms.noModule)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,6 +90,8 @@
             } catch (IOException | ProviderNotFoundException ex) {
             }
         }
+        // Workaround until full support for --release 9 distinct from --release 10
+        SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.JDK1_9));
         SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.DEFAULT));
     }
 
@@ -108,7 +110,9 @@
 
         @Override
         public Collection<Path> getPlatformPath() {
-            if (Target.lookup(version) == Target.DEFAULT) {
+            // Comparison should be == Target.DEFAULT once --release 9
+            // is distinct from 10
+            if (Target.lookup(version).compareTo(Target.JDK1_9)  >=  0) {
                 return null;
             }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Mon Mar 13 19:58:52 2017 +0000
@@ -55,7 +55,7 @@
  * deletion without notice.</b>
  */
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_9)
+@SupportedSourceVersion(SourceVersion.RELEASE_10)
 public class PrintingProcessor extends AbstractProcessor {
     PrintWriter writer;
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -915,6 +915,10 @@
     {0} is not public in {1}; cannot be accessed from outside package
 
 # 0: symbol, 1: symbol
+compiler.err.not.def.public=\
+    {0} is not public in {1}
+
+# 0: symbol, 1: symbol
 compiler.misc.not.def.public.cant.access=\
     {0} is not public in {1}; cannot be accessed from outside package
 
@@ -1246,9 +1250,9 @@
 
 # In the following string, {0} is the name of the class in the Java source.
 # It really should be used two times..
-# 0: name
+# 0: kind name, 1: name
 compiler.err.class.public.should.be.in.file=\
-    class {0} is public, should be declared in a file named {0}.java
+    {0} {1} is public, should be declared in a file named {1}.java
 
 ## All errors which do not refer to a particular line in the source code are
 ## preceded by this string.
@@ -1292,7 +1296,7 @@
 compiler.warn.outdir.is.in.exploded.module=\
     the output directory is within an exploded module: {0}
 
-# 0: path
+# 0: file object
 compiler.err.locn.module-info.not.allowed.on.patch.path=\
     module-info.class not allowed on patch path: {0}
 
@@ -1438,7 +1442,7 @@
 
 # 0: string, 1: string, 2: string
 compiler.note.multiple.elements=\
-    Multiple elements named '{1}' in modules '{2}' were found by javax.lang.model.util.Elements.{0}.
+    Multiple elements named ''{1}'' in modules ''{2}'' were found by javax.lang.model.util.Elements.{0}.
 
 #####
 
@@ -2957,14 +2961,20 @@
 compiler.err.module.decl.sb.in.module-info.java=\
     module declarations should be in a file named module-info.java
 
-compiler.err.module-info.with.xmodule.sourcepath=\
-    illegal combination of -Xmodule and module-info on sourcepath
-
-compiler.err.module-info.with.xmodule.classpath=\
-    illegal combination of -Xmodule and module-info on classpath
-
-compiler.err.xmodule.no.module.sourcepath=\
-    illegal combination of -Xmodule and --module-source-path
+compiler.err.module-info.with.patched.module.sourcepath=\
+    compiling a module patch with module-info on sourcepath
+
+compiler.err.module-info.with.patched.module.classoutput=\
+    compiling a module patch with module-info on class output
+
+# 0: set of string
+compiler.err.too.many.patched.modules=\
+    too many patched modules ({0}), use --module-source-path
+
+# 0: name, 1: name
+compiler.err.file.patched.and.msp=\
+    file accessible from both --patch-module and --module-source-path, \
+    but belongs to a different module on each path: {0}, {1}
 
 compiler.err.processorpath.no.processormodulepath=\
     illegal combination of -processorpath and --processor-module-path
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -377,6 +377,9 @@
 javac.err.repeated.value.for.patch.module=\
     --patch-module specified more than once for {0}
 
+javac.err.unmatched.quote=\
+    unmatched quote in environment variable %s
+
 ## messages
 
 javac.msg.usage.header=\
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Mon Mar 13 19:58:52 2017 +0000
@@ -272,12 +272,12 @@
             init();
         }
 
-        public Configuration resolveRequiresAndUses(
+        public Configuration resolveAndBind(
                 ModuleFinder beforeFinder,
                 ModuleFinder afterFinder,
                 Collection<String> roots) {
             try {
-                Object result = resolveRequiresAndUsesMethod.invoke(theRealConfiguration,
+                Object result = resolveAndBindMethod.invoke(theRealConfiguration,
                                     beforeFinder.theRealModuleFinder,
                                     afterFinder.theRealModuleFinder,
                                     roots
@@ -293,7 +293,7 @@
         // -----------------------------------------------------------------------------------------
 
         private static Class<?> configurationClass = null;
-        private static Method resolveRequiresAndUsesMethod;
+        private static Method resolveAndBindMethod;
 
         static final Class<?> getConfigurationClass() {
             init();
@@ -305,7 +305,7 @@
                 try {
                     configurationClass = Class.forName("java.lang.module.Configuration", false, null);
                     Class<?> moduleFinderInterface = ModuleFinder.getModuleFinderClass();
-                    resolveRequiresAndUsesMethod = configurationClass.getDeclaredMethod("resolveRequiresAndUses",
+                    resolveAndBindMethod = configurationClass.getDeclaredMethod("resolveAndBind",
                                 moduleFinderInterface,
                                 moduleFinderInterface,
                                 Collection.class
--- a/langtools/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Mon Mar 13 19:58:52 2017 +0000
@@ -49,12 +49,15 @@
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.DeclaredType;
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.ElementFilter;
+import javax.lang.model.util.Elements;
+import javax.tools.ForwardingJavaFileManager;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
@@ -542,8 +545,13 @@
             if (type == null)
                 return null;
 
-            String binaryName = origin.getElements().getBinaryName(type).toString();
-            Pair<JavacTask, CompilationUnitTree> source = findSource(binaryName);
+            Elements elements = origin.getElements();
+            String binaryName = elements.getBinaryName(type).toString();
+            ModuleElement module = elements.getModuleOf(type);
+            String moduleName = module == null || module.isUnnamed()
+                    ? null
+                    : module.getQualifiedName().toString();
+            Pair<JavacTask, CompilationUnitTree> source = findSource(moduleName, binaryName);
 
             if (source == null)
                 return null;
@@ -636,7 +644,8 @@
                 }.scan(cut, null);
             }
 
-        private Pair<JavacTask, CompilationUnitTree> findSource(String binaryName) throws IOException {
+        private Pair<JavacTask, CompilationUnitTree> findSource(String moduleName,
+                                                                String binaryName) throws IOException {
             JavaFileObject jfo = fm.getJavaFileForInput(StandardLocation.SOURCE_PATH,
                                                         binaryName,
                                                         JavaFileObject.Kind.SOURCE);
@@ -645,7 +654,10 @@
                 return null;
 
             List<JavaFileObject> jfos = Arrays.asList(jfo);
-            JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, baseFileManager, d -> {}, null, null, jfos);
+            JavaFileManager patchFM = moduleName != null
+                    ? new PatchModuleFileManager(baseFileManager, jfo, moduleName)
+                    : baseFileManager;
+            JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, patchFM, d -> {}, null, null, jfos);
             Iterable<? extends CompilationUnitTree> cuts = task.parse();
 
             task.enter();
@@ -657,6 +669,61 @@
         public void close() throws IOException {
             fm.close();
         }
+
+        private static final class PatchModuleFileManager
+                extends ForwardingJavaFileManager<JavaFileManager> {
+
+            private final JavaFileObject file;
+            private final String moduleName;
+
+            public PatchModuleFileManager(JavaFileManager fileManager,
+                                          JavaFileObject file,
+                                          String moduleName) {
+                super(fileManager);
+                this.file = file;
+                this.moduleName = moduleName;
+            }
+
+            @Override @DefinedBy(Api.COMPILER)
+            public Location getLocationForModule(Location location,
+                                                 JavaFileObject fo,
+                                                 String pkgName) throws IOException {
+                return fo == file
+                        ? PATCH_LOCATION
+                        : super.getLocationForModule(location, fo, pkgName);
+            }
+
+            @Override @DefinedBy(Api.COMPILER)
+            public String inferModuleName(Location location) throws IOException {
+                return location == PATCH_LOCATION
+                        ? moduleName
+                        : super.inferModuleName(location);
+            }
+
+            @Override @DefinedBy(Api.COMPILER)
+            public boolean hasLocation(Location location) {
+                return location == StandardLocation.PATCH_MODULE_PATH ||
+                       super.hasLocation(location);
+            }
+
+            private static final Location PATCH_LOCATION = new Location() {
+                @Override @DefinedBy(Api.COMPILER)
+                public String getName() {
+                    return "PATCH_LOCATION";
+                }
+
+                @Override @DefinedBy(Api.COMPILER)
+                public boolean isOutputLocation() {
+                    return false;
+                }
+
+                @Override @DefinedBy(Api.COMPILER)
+                public boolean isModuleOrientedLocation() {
+                    return false;
+                }
+
+            };
+        }
     }
 
 }
--- a/langtools/src/jdk.compiler/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,6 +26,8 @@
 /** Defines the implementation of the
  *  {@link javax.tools.ToolProvider#getSystemJavaCompiler system Java compiler}
  *  and its command line equivalent, <em>javac</em>, as well as <em>javah</em>.
+ *
+ *  @since 9
  */
 module jdk.compiler {
     requires transitive java.compiler;
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1705,7 +1705,6 @@
         if (lessThanPos < 0) {
             return text;
         }
-
         StringBuilder result = new StringBuilder();
     main: while (lessThanPos != -1) {
             int currPos = lessThanPos + 1;
@@ -1740,17 +1739,16 @@
                     if (ch == '>' && quoteKind == null) {
                         foundGT = true;
                     }
-                    if (++currPos == len)
+                    if (++currPos == len) {
                         break;
+                    }
                     ch = text.charAt(currPos);
                 }
-                startPos = currPos + 1;
-                currPos = startPos;
+                startPos = currPos;
             }
             lessThanPos = text.indexOf('<', currPos);
         }
         result.append(text.substring(startPos));
-
         return result.toString();
     }
 
@@ -1760,10 +1758,6 @@
                 ('1' <= ch && ch <= '6');
     }
 
-    private static boolean isWhitespace(char ch) {
-        return Character.isWhitespace(ch);
-    }
-
     /**
      * Add a link to the stylesheet file.
      *
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java	Mon Mar 13 19:58:52 2017 +0000
@@ -204,13 +204,6 @@
         }
     },
 
-    XMODULE("-Xmodule:", false) {
-        @Override
-        public void process(Helper helper, String arg) throws InvalidValueException {
-            Option.XMODULE.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     PATCH_MODULE("--patch-module", true) {
         @Override
         public void process(Helper helper, String arg) throws InvalidValueException {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -82,7 +82,6 @@
 \                                   Specify additional modules to be considered as required by a\n\
 \                                   given module. <other-module> may be ALL-UNNAMED to require\n\
 \                                   the unnamed module.\n\
-\  -Xmodule:<module-name>           Specify a module to which the classes being compiled belong.\n\
 \  --patch-module <module>=<file>(:<file>)*\n\
 \                                   Override or augment a module with classes and resources\n\
 \                                   in JAR files or directories\n
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTaskImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +25,20 @@
 
 package jdk.javadoc.internal.api;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Locale;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.tools.DocumentationTool.DocumentationTask;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Options;
 import jdk.javadoc.internal.tool.Start;
 
 /**
@@ -53,6 +58,7 @@
     private Iterable<String> options;
     private Iterable<? extends JavaFileObject> fileObjects;
     private Locale locale;
+    private List<String> addModules = new ArrayList<>();
 
     public JavadocTaskImpl(Context context, Class<?> docletClass,
             Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
@@ -72,6 +78,16 @@
         this.locale = locale;
     }
 
+    @Override
+    public void addModules(Iterable<String> moduleNames) {
+        nullCheck(moduleNames);
+        if (used.get())
+            throw new IllegalStateException();
+        for (String name : moduleNames) {
+            addModules.add(name);
+        }
+    }
+
     public Boolean call() {
         if (!used.getAndSet(true)) {
             initContext();
@@ -89,6 +105,12 @@
     private void initContext() {
         //initialize compiler's default locale
         context.put(Locale.class, locale);
+        if (!addModules.isEmpty()) {
+            String names = String.join(",", addModules);
+            Options opts = Options.instance(context);
+            String prev = opts.get(Option.ADD_MODULES);
+            opts.put(Option.ADD_MODULES, (prev == null) ? names : prev + "," + names);
+        }
     }
 
     private static <T> Iterable<T> nullCheck(Iterable<T> items) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -647,6 +647,13 @@
                 tree.addContent(fixedNavDiv);
                 HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, Contents.SPACE);
                 tree.addContent(paddingDiv);
+                HtmlTree scriptTree = HtmlTree.SCRIPT();
+                String scriptCode = "<!--\n"
+                        + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                        + "//-->\n";
+                RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
+                scriptTree.addContent(scriptContent);
+                tree.addContent(scriptTree);
             } else {
                 subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
                 tree.addContent(subDiv);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,6 +144,7 @@
         Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
         if (configuration.allowTag(HtmlTag.MAIN)) {
             htmlTree.addContent(div);
+            body.addContent(htmlTree);
         } else {
             body.addContent(div);
         }
@@ -183,21 +184,12 @@
     protected void addOverviewHeader(Content body) {
         addConfigurationTitle(body);
         if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
-            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
-            subTitleDiv.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(configuration.overviewElement, subTitleDiv);
-            Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
-            Content see = new ContentBuilder();
-            see.addContent(contents.seeLabel);
-            see.addContent(" ");
-            Content descPara = HtmlTree.P(see);
-            Content descLink = getHyperLink(getDocLink(
-                    SectionName.OVERVIEW_DESCRIPTION),
-                    contents.descriptionLabel, "", "");
-            descPara.addContent(descLink);
-            div.addContent(descPara);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.contentContainer);
+            addOverviewComment(div);
             if (configuration.allowTag(HtmlTag.MAIN)) {
                 htmlTree.addContent(div);
+                body.addContent(htmlTree);
             } else {
                 body.addContent(div);
             }
@@ -213,29 +205,17 @@
      */
     protected void addOverviewComment(Content htmltree) {
         if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
-            htmltree.addContent(getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
             addInlineComment(configuration.overviewElement, htmltree);
         }
     }
 
     /**
-     * Adds the tag information as provided in the file specified by the
-     * "-overview" option on the command line.
+     * Not required for this page.
      *
      * @param body the documentation tree to which the overview will be added
      */
     @Override
-    protected void addOverview(Content body) {
-        HtmlTree div = new HtmlTree(HtmlTag.DIV);
-        div.addStyle(HtmlStyle.contentContainer);
-        addOverviewComment(div);
-        if (configuration.allowTag(HtmlTag.MAIN)) {
-            htmlTree.addContent(div);
-            body.addContent(htmlTree);
-        } else {
-            body.addContent(div);
-        }
-    }
+    protected void addOverview(Content body) {}
 
     /**
      * Adds the top text (from the -top option), the upper
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,6 +134,7 @@
         Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
         if (configuration.allowTag(HtmlTag.MAIN)) {
             htmlTree.addContent(div);
+            body.addContent(htmlTree);
         } else {
             body.addContent(div);
         }
@@ -176,21 +177,12 @@
     protected void addOverviewHeader(Content body) {
         addConfigurationTitle(body);
         if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
-            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
-            subTitleDiv.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(configuration.overviewElement, subTitleDiv);
-            Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
-            Content descBody = new ContentBuilder();
-            descBody.addContent(contents.seeLabel);
-            descBody.addContent(" ");
-            Content descPara = HtmlTree.P(descBody);
-            Content descLink = getHyperLink(getDocLink(
-                    SectionName.OVERVIEW_DESCRIPTION),
-                    contents.descriptionLabel, "", "");
-            descPara.addContent(descLink);
-            div.addContent(descPara);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.contentContainer);
+            addOverviewComment(div);
             if (configuration.allowTag(HtmlTag.MAIN)) {
                 htmlTree.addContent(div);
+                body.addContent(htmlTree);
             } else {
                 body.addContent(div);
             }
@@ -206,29 +198,17 @@
      */
     protected void addOverviewComment(Content htmltree) {
         if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
-            htmltree.addContent(getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
             addInlineComment(configuration.overviewElement, htmltree);
         }
     }
 
     /**
-     * Adds the tag information as provided in the file specified by the
-     * "-overview" option on the command line.
+     * Not required for this page.
      *
      * @param body the documentation tree to which the overview will be added
      */
     @Override
-    protected void addOverview(Content body) {
-        HtmlTree div = new HtmlTree(HtmlTag.DIV);
-        div.addStyle(HtmlStyle.contentContainer);
-        addOverviewComment(div);
-        if (configuration.allowTag(HtmlTag.MAIN)) {
-            htmlTree.addContent(div);
-            body.addContent(htmlTree);
-        } else {
-            body.addContent(div);
-        }
-    }
+    protected void addOverview(Content body) {}
 
     /**
      * Adds the top text (from the -top option), the upper
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -169,11 +169,42 @@
             var tresult = new Array();
             var mresult = new Array();
             var tgresult = new Array();
+            var secondaryresult = new Array();
             var displayCount = 0;
             var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i");
             camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join("([a-z0-9_$]*?)");
             var camelCaseMatcher = new RegExp("^" + camelCaseRegexp);
             secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
+
+            // Return the nested innermost name from the specified object
+            function nestedName(e) {
+                return e.l.substring(e.l.lastIndexOf(".") + 1);
+            }
+
+            // Sort array items by short name (as opposed to fully qualified name).
+            // Additionally, sort by the nested type name, when present,
+            // as opposed to top level short name.
+            function sortAndConcatResults(a1, a2) {
+                var sortingKey;
+                var sortArray = function(e1, e2) {
+                    var l = sortingKey(e1);
+                    var m = sortingKey(e2);
+                    if (l < m)
+                        return -1;
+                    if (l > m)
+                        return 1;
+                    return 0;
+                };
+                sortingKey = function(e) {
+                    return nestedName(e).toUpperCase();
+                };
+                a1.sort(sortArray);
+                a2.sort(sortArray);
+                a1 = a1.concat(a2);
+                a2.length = 0;
+                return a1;
+            }
+
             if (moduleSearchIndex) {
                 var mdleCount = 0;
                 $.each(moduleSearchIndex, function(index, item) {
@@ -184,10 +215,11 @@
                     } else if (camelCaseMatcher.test(item.l)) {
                         result.unshift(item);
                     } else if (secondaryMatcher.test(item.l)) {
-                        result.push(item);
+                        secondaryresult.push(item);
                     }
                 });
                 displayCount = mdleCount;
+                result = sortAndConcatResults(result, secondaryresult);
             }
             if (packageSearchIndex) {
                 var pCount = 0;
@@ -197,48 +229,51 @@
                     pkg = (item.m)
                             ? (item.m + "/" + item.l)
                             : item.l;
-                    if (exactMatcher.test(item.l)) {
+                    var s = nestedName(item);
+                    if (exactMatcher.test(s)) {
                         presult.unshift(item);
                         pCount++;
                     } else if (camelCaseMatcher.test(pkg)) {
                         presult.unshift(item);
                     } else if (secondaryMatcher.test(pkg)) {
-                        presult.push(item);
+                        secondaryresult.push(item);
                     }
                 });
-                result = result.concat(presult);
+                result = result.concat(sortAndConcatResults(presult, secondaryresult));
                 displayCount = (pCount > displayCount) ? pCount : displayCount;
             }
             if (typeSearchIndex) {
                 var tCount = 0;
                 $.each(typeSearchIndex, function(index, item) {
                     item[category] = catTypes;
-                    if (exactMatcher.test(item.l)) {
+                    var s = nestedName(item);
+                    if (exactMatcher.test(s)) {
                         tresult.unshift(item);
                         tCount++;
-                    } else if (camelCaseMatcher.test(item.l)) {
+                    } else if (camelCaseMatcher.test(s)) {
                         tresult.unshift(item);
                     } else if (secondaryMatcher.test(item.p + "." + item.l)) {
-                        tresult.push(item);
+                        secondaryresult.push(item);
                     }
                 });
-                result = result.concat(tresult);
+                result = result.concat(sortAndConcatResults(tresult, secondaryresult));
                 displayCount = (tCount > displayCount) ? tCount : displayCount;
             }
             if (memberSearchIndex) {
                 var mCount = 0;
                 $.each(memberSearchIndex, function(index, item) {
                     item[category] = catMembers;
-                    if (exactMatcher.test(item.l)) {
+                    var s = nestedName(item);
+                    if (exactMatcher.test(s)) {
                         mresult.unshift(item);
                         mCount++;
-                    } else if (camelCaseMatcher.test(item.l)) {
+                    } else if (camelCaseMatcher.test(s)) {
                         mresult.unshift(item);
                     } else if (secondaryMatcher.test(item.c + "." + item.l)) {
-                        mresult.push(item);
+                        secondaryresult.push(item);
                     }
                 });
-                result = result.concat(mresult);
+                result = result.concat(sortAndConcatResults(mresult, secondaryresult));
                 displayCount = (mCount > displayCount) ? mCount : displayCount;
             }
             if (tagSearchIndex) {
@@ -249,10 +284,10 @@
                         tgresult.unshift(item);
                         tgCount++;
                     } else if (secondaryMatcher.test(item.l)) {
-                        tgresult.push(item);
+                        secondaryresult.push(item);
                     }
                 });
-                result = result.concat(tgresult);
+                result = result.concat(sortAndConcatResults(tgresult, secondaryresult));
                 displayCount = (tgCount > displayCount) ? tgCount : displayCount;
             }
             displayCount = (displayCount > 500) ? displayCount : 500;
@@ -312,4 +347,4 @@
             }
         }
     });
-});
\ No newline at end of file
+});
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
-import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.SimpleElementVisitor9;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
@@ -1116,7 +1115,7 @@
 
         @Override
         public String toString() {
-            return names.toString();
+            return Arrays.toString(names);
         }
 
         @Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,6 @@
 import javax.lang.model.util.Elements;
 import javax.tools.FileObject;
 import javax.tools.JavaFileManager.Location;
-import javax.tools.JavaFileObject;
 
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.util.JavacTask;
@@ -62,7 +61,6 @@
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.model.JavacElements;
@@ -297,6 +295,33 @@
         return null;
     }
 
+    // TODO: the method jx.l.m.Elements::overrides does not check
+    // the return type, see JDK-8174840 until that is resolved,
+    // use a  copy of the same method, with a return type check.
+
+    // Note: the rider.overrides call in this method *must* be consistent
+    // with the call in overrideType(....), the method above.
+    public boolean overrides(ExecutableElement e1, ExecutableElement e2, TypeElement cls) {
+        MethodSymbol rider = (MethodSymbol)e1;
+        MethodSymbol ridee = (MethodSymbol)e2;
+        ClassSymbol origin = (ClassSymbol)cls;
+
+        return rider.name == ridee.name &&
+
+               // not reflexive as per JLS
+               rider != ridee &&
+
+               // we don't care if ridee is static, though that wouldn't
+               // compile
+               !rider.isStatic() &&
+
+               // Symbol.overrides assumes the following
+               ridee.isMemberOf(origin, toolEnv.getTypes()) &&
+
+               // check access, signatures and check return types
+               rider.overrides(ridee, origin, toolEnv.getTypes(), true);
+    }
+
     // TODO: jx.l.m ?
     public Location getLocationForModule(ModuleElement mdle) {
         ModuleSymbol msym = (ModuleSymbol)mdle;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Mon Mar 13 19:58:52 2017 +0000
@@ -92,6 +92,9 @@
     if (!tagSearchIndex) {
         createElem(doc, tag, 'tag-search-index.js');
     }
+    $(window).resize(function() {
+        $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
+    });
 }
 
 function createElem(doc, tag, path) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Mar 13 19:58:52 2017 +0000
@@ -144,7 +144,7 @@
     margin:0;
 }
 .navPadding {
-    padding-top: 100px;
+    padding-top: 107px;
 }
 .fixedNav {
     position:fixed;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Mon Mar 13 19:58:52 2017 +0000
@@ -893,7 +893,7 @@
             }
             List<? extends Element> methods = te.getEnclosedElements();
             for (ExecutableElement ee : ElementFilter.methodsIn(methods)) {
-                if (elementUtils.overrides(method, ee, origin)) {
+                if (configuration.workArounds.overrides(method, ee, origin)) {
                     return ee;
                 }
             }
@@ -1886,11 +1886,6 @@
             }
 
             @Override
-            public String visitPrimitive(PrimitiveType t, Void p) {
-                return t.toString();
-            }
-
-            @Override
             public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
                 // The knee jerk reaction is to do this but don't!, as we would like
                 // it to be compatible with the old world, now if we decide to do so
@@ -1900,9 +1895,10 @@
             }
 
             @Override
-            protected String defaultAction(TypeMirror e, Void p) {
-                throw new UnsupportedOperationException("should not happen");
+            protected String defaultAction(TypeMirror t, Void p) {
+                return t.toString();
             }
+
         }.visit(t);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -181,13 +181,6 @@
         }
     },
 
-    XMODULE("-Xmodule:", EXTENDED, false) {
-        @Override
-        public void process(Helper helper, String arg) throws InvalidValueException {
-            Option.XMODULE.process(helper.getOptionHelper(), arg);
-        }
-    },
-
     PATCH_MODULE("--patch-module", EXTENDED, true) {
         @Override
         public void process(Helper helper, String arg) throws InvalidValueException {
@@ -345,7 +338,7 @@
         }
     },
 
-    X("-X", STANDARD) {
+    HELP_EXTRA("--help-extra -X", STANDARD) {
         @Override
         public void process(Helper helper) throws OptionException {
            throw new OptionException(OK, helper::Xusage);
@@ -419,9 +412,7 @@
 
     static ToolOption get(String name) {
         String oname = name;
-        if (name.contains(":")) {
-            oname = name.substring(0, name.indexOf(':') + 1);
-        } else if (name.contains("=")) {
+        if (name.startsWith("--") && name.contains("=")) {
             oname = name.substring(0, name.indexOf('='));
         }
         for (ToolOption o : values()) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -205,7 +205,7 @@
 main.opt.J.desc=\
     Pass <flag> directly to the runtime system
 
-main.opt.X.desc=\
+main.opt.help.extra.desc=\
     Print a synopsis of nonstandard options and exit
 
 main.usage.foot=\n\
@@ -238,11 +238,6 @@
     given module. <other-module> may be ALL-UNNAMED to require\n\
     the unnamed module.
 
-main.opt.Xmodule.arg=\
-    <module-name>
-main.opt.Xmodule.desc=\
-    Specify a module to which the classes being compiled belong
-
 main.opt.patch.module.arg=\
     <module>=<file>(:<file>)*
 main.opt.patch.module.desc=\
--- a/langtools/src/jdk.javadoc/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,6 +26,8 @@
 /** Defines the implementation of the
  *  {@link javax.tools.ToolProvider#getSystemDocumentationTool system documentation tool}
  *  and its command line equivalent, <em>javadoc</em>.
+ *
+ *  @since 9
  */
 module jdk.javadoc {
     requires transitive java.compiler;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java	Mon Mar 13 19:58:52 2017 +0000
@@ -38,8 +38,8 @@
  *  deletion without notice.</b>
  */
 public class Module_attribute extends Attribute {
-    public static final int ACC_TRANSITIVE      =   0x10;
-    public static final int ACC_STATIC_PHASE    =   0x20;
+    public static final int ACC_TRANSITIVE      =   0x20;
+    public static final int ACC_STATIC_PHASE    =   0x40;
     public static final int ACC_OPEN            =   0x20;
     public static final int ACC_SYNTHETIC       = 0x1000;
     public static final int ACC_MANDATED        = 0x8000;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
 import javax.tools.Diagnostic;
 
-import static javax.lang.model.SourceVersion.RELEASE_9;
+import static javax.lang.model.SourceVersion.RELEASE_10;
 
 /**
  * Annotation processor for the Deprecation Scanner tool.
@@ -58,7 +58,7 @@
  *
  */
 @SupportedAnnotationTypes("java.lang.Deprecated")
-@SupportedSourceVersion(RELEASE_9)
+@SupportedSourceVersion(RELEASE_10)
 public class LoadProc extends AbstractProcessor {
     Elements elements;
     Messager messager;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
     // Keep these updated manually until there's a compiler API
     // that allows querying of supported releases.
     final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
-    final Set<String> releasesWithForRemoval = Set.of("9");
+    final Set<String> releasesWithForRemoval = Set.of("9", "10");
 
     final Set<String> validReleases;
     {
@@ -353,14 +353,14 @@
      * Process classes from a particular JDK release, using only information
      * in this JDK.
      *
-     * @param release "6", "7", "8", or "9"
+     * @param release "6", "7", "8", "9", or "10"
      * @param classes collection of classes to process, may be empty
      * @return success value
      */
     boolean processRelease(String release, Collection<String> classes) throws IOException {
         options.addAll(List.of("--release", release));
 
-        if (release.equals("9")) {
+        if (release.equals("9") || release.equals("10")) {
             List<String> rootMods = List.of("java.se", "java.se.ee");
             TraverseProc proc = new TraverseProc(rootMods);
             JavaCompiler.CompilationTask task =
@@ -484,7 +484,7 @@
         String dir = null;
         String jar = null;
         String jdkHome = null;
-        String release = "9";
+        String release = "10";
         List<String> loadClasses = new ArrayList<>();
         String csvFile = null;
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Graph.java	Mon Mar 13 19:58:52 2017 +0000
@@ -116,7 +116,7 @@
                 .forEach(u -> g.adjacentNodes(u).stream()
                                 .filter(v -> isAdjacent(u, v))
                                 .forEach(v -> builder.addEdge(u, v)));
-        return builder.build();
+        return builder.build().reduce();
     }
 
     /**
@@ -274,7 +274,7 @@
         }
 
         public void addNodes(Set<T> nodes) {
-            nodes.addAll(nodes);
+            this.nodes.addAll(nodes);
         }
 
         public void addEdge(T u, T v) {
@@ -335,67 +335,4 @@
             result.addLast(node);
         }
     }
-
-    public static class DotGraph {
-        static final String ORANGE = "#e76f00";
-        static final String BLUE = "#437291";
-        static final String GRAY = "#dddddd";
-
-        static final String REEXPORTS = "";
-        static final String REQUIRES = "style=\"dashed\"";
-        static final String REQUIRES_BASE = "color=\"" + GRAY + "\"";
-
-        static final Set<String> javaModules = modules(name ->
-            (name.startsWith("java.") && !name.equals("java.smartcardio")));
-        static final Set<String> jdkModules = modules(name ->
-            (name.startsWith("java.") ||
-                name.startsWith("jdk.") ||
-                name.startsWith("javafx.")) && !javaModules.contains(name));
-
-        private static Set<String> modules(Predicate<String> predicate) {
-            return ModuleFinder.ofSystem().findAll()
-                               .stream()
-                               .map(ModuleReference::descriptor)
-                               .map(ModuleDescriptor::name)
-                               .filter(predicate)
-                               .collect(Collectors.toSet());
-        }
-
-        static void printAttributes(PrintWriter out) {
-            out.format("  size=\"25,25\";%n");
-            out.format("  nodesep=.5;%n");
-            out.format("  ranksep=1.5;%n");
-            out.format("  pencolor=transparent;%n");
-            out.format("  node [shape=plaintext, fontname=\"DejaVuSans\", fontsize=36, margin=\".2,.2\"];%n");
-            out.format("  edge [penwidth=4, color=\"#999999\", arrowhead=open, arrowsize=2];%n");
-        }
-
-        static void printNodes(PrintWriter out, Graph<String> graph) {
-            out.format("  subgraph se {%n");
-            graph.nodes().stream()
-                 .filter(javaModules::contains)
-                 .forEach(mn -> out.format("  \"%s\" [fontcolor=\"%s\", group=%s];%n",
-                                           mn, ORANGE, "java"));
-            out.format("  }%n");
-            graph.nodes().stream()
-                 .filter(jdkModules::contains)
-                 .forEach(mn -> out.format("    \"%s\" [fontcolor=\"%s\", group=%s];%n",
-                                           mn, BLUE, "jdk"));
-
-            graph.nodes().stream()
-                 .filter(mn -> !javaModules.contains(mn) && !jdkModules.contains(mn))
-                 .forEach(mn -> out.format("  \"%s\";%n", mn));
-        }
-
-        static void printEdges(PrintWriter out, Graph<String> graph,
-                               String node, Set<String> requiresTransitive) {
-            graph.adjacentNodes(node).forEach(dn -> {
-                String attr = dn.equals("java.base") ? REQUIRES_BASE
-                        : (requiresTransitive.contains(dn) ? REEXPORTS : REQUIRES);
-                out.format("  \"%s\" -> \"%s\" [%s];%n", node, dn, attr);
-            });
-        }
-    }
-
-
 }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
         }
 
         this.configuration = Configuration.empty()
-                .resolveRequires(finder, ModuleFinder.of(), mods);
+                .resolve(finder, ModuleFinder.of(), mods);
 
         this.configuration.modules().stream()
                 .map(ResolvedModule::reference)
@@ -207,16 +207,6 @@
     }
 
     /**
-     * Returns the modules that the given module can read
-     */
-    public Stream<Module> reads(Module module) {
-        return configuration.findModule(module.name()).get()
-            .reads().stream()
-            .map(ResolvedModule::name)
-            .map(nameToModule::get);
-    }
-
-    /**
      * Returns the list of packages that split between resolved module and
      * unnamed module
      */
@@ -267,16 +257,15 @@
         return nameToModule;
     }
 
-    public Stream<Module> resolve(Set<String> roots) {
-        if (roots.isEmpty()) {
-            return nameToModule.values().stream();
-        } else {
-            return Configuration.empty()
-                    .resolveRequires(finder, ModuleFinder.of(), roots)
-                    .modules().stream()
-                    .map(ResolvedModule::name)
-                    .map(nameToModule::get);
-        }
+    /**
+     * Returns Configuration with the given roots
+     */
+    public Configuration resolve(Set<String> roots) {
+        if (roots.isEmpty())
+            throw new IllegalArgumentException("empty roots");
+
+        return Configuration.empty()
+                    .resolve(finder, ModuleFinder.of(), roots);
     }
 
     public List<Archive> classPathArchives() {
@@ -422,18 +411,13 @@
         }
 
         private ModuleDescriptor dropHashes(ModuleDescriptor md) {
-            ModuleDescriptor.Builder builder = ModuleDescriptor.module(md.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.newModule(md.name());
             md.requires().forEach(builder::requires);
             md.exports().forEach(builder::exports);
             md.opens().forEach(builder::opens);
             md.provides().stream().forEach(builder::provides);
             md.uses().stream().forEach(builder::uses);
-
-            Set<String> concealed = new HashSet<>(md.packages());
-            md.exports().stream().map(Exports::source).forEach(concealed::remove);
-            md.opens().stream().map(Opens::source).forEach(concealed::remove);
-            concealed.forEach(builder::contains);
-
+            builder.packages(md.packages());
             return builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Mon Mar 13 19:58:52 2017 +0000
@@ -721,9 +721,9 @@
             return run(config, writer, type);
         }
 
-        boolean run(JdepsConfiguration config, JdepsWriter writer, Type type) throws IOException {
-
-
+        boolean run(JdepsConfiguration config, JdepsWriter writer, Type type)
+            throws IOException
+        {
             // analyze the dependencies
             DepsAnalyzer analyzer = new DepsAnalyzer(config,
                                                      dependencyFilter(config),
@@ -1024,8 +1024,10 @@
         boolean run(JdepsConfiguration config) throws IOException {
             if ((options.showSummary || options.verbose == MODULE) &&
                 !options.addmods.isEmpty() && inputArgs.isEmpty()) {
-                // print module descriptor
-                return new ModuleAnalyzer(config, log).genDotFiles(dotOutputDir);
+                // generate dot graph from the resolved graph from module
+                // resolution.  No class dependency analysis is performed.
+                return new ModuleDotGraph(config, options.apiOnly)
+                        .genDotFiles(dotOutputDir);
             }
 
             Type type = getAnalyzerType();
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,8 +26,6 @@
 package com.sun.tools.jdeps;
 
 import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleDescriptor.Exports;
-import java.lang.module.ModuleDescriptor.Opens;
 import java.net.URI;
 import java.util.Collections;
 import java.util.HashMap;
@@ -55,6 +53,7 @@
 
     private final ModuleDescriptor descriptor;
     private final Map<String, Set<String>> exports;
+    private final Map<String, Set<String>> opens;
     private final boolean isSystem;
     private final URI location;
 
@@ -63,6 +62,7 @@
         this.descriptor = null;
         this.location = null;
         this.exports = Collections.emptyMap();
+        this.opens = Collections.emptyMap();
         this.isSystem = true;
     }
 
@@ -70,12 +70,14 @@
                    URI location,
                    ModuleDescriptor descriptor,
                    Map<String, Set<String>> exports,
+                   Map<String, Set<String>> opens,
                    boolean isSystem,
                    ClassFileReader reader) {
         super(name, location, reader);
         this.descriptor = descriptor;
         this.location = location;
         this.exports = Collections.unmodifiableMap(exports);
+        this.opens = Collections.unmodifiableMap(opens);
         this.isSystem = isSystem;
     }
 
@@ -124,35 +126,52 @@
         return descriptor.packages();
     }
 
-    /**
-     * Tests if the package of the given name is exported.
-     */
-    public boolean isExported(String pn) {
-        return exports.containsKey(pn) ? exports.get(pn).isEmpty() : false;
-    }
-
     public boolean isJDKUnsupported() {
         return JDK_UNSUPPORTED.equals(this.name());
     }
 
     /**
-     * Converts this module to a strict module with the given dependences
+     * Converts this module to a normal module with the given dependences
      *
      * @throws IllegalArgumentException if this module is not an automatic module
      */
-    public Module toStrictModule(Map<String, Boolean> requires) {
+    public Module toNormalModule(Map<String, Boolean> requires) {
         if (!isAutomatic()) {
-            throw new IllegalArgumentException(name() + " already a strict module");
+            throw new IllegalArgumentException(name() + " not an automatic module");
         }
-        return new StrictModule(this, requires);
+        return new NormalModule(this, requires);
+    }
+
+    /**
+     * Tests if the package of the given name is exported.
+     */
+    public boolean isExported(String pn) {
+        return exports.containsKey(pn) && exports.get(pn).isEmpty();
     }
 
     /**
-     * Tests if the package of the given name is qualifiedly exported
-     * to the target.
+     * Tests if the package of the given name is exported to the target
+     * in a qualified fashion.
      */
     public boolean isExported(String pn, String target) {
-        return isExported(pn) || exports.containsKey(pn) && exports.get(pn).contains(target);
+        return isExported(pn)
+                || exports.containsKey(pn) && exports.get(pn).contains(target);
+    }
+
+    /**
+     * Tests if the package of the given name is open.
+     */
+    public boolean isOpen(String pn) {
+        return opens.containsKey(pn) && opens.get(pn).isEmpty();
+    }
+
+    /**
+     * Tests if the package of the given name is open to the target
+     * in a qualified fashion.
+     */
+    public boolean isOpen(String pn, String target) {
+        return isOpen(pn)
+            || opens.containsKey(pn) && opens.get(pn).contains(target);
     }
 
     @Override
@@ -193,19 +212,28 @@
             }
 
             Map<String, Set<String>> exports = new HashMap<>();
+            Map<String, Set<String>> opens = new HashMap<>();
 
-            descriptor.exports().stream()
-                .forEach(exp -> exports.computeIfAbsent(exp.source(), _k -> new HashSet<>())
-                                    .addAll(exp.targets()));
-
-            return new Module(name, location, descriptor, exports, isSystem, reader);
+            if (descriptor.isAutomatic()) {
+                // ModuleDescriptor::exports and opens returns an empty set
+                descriptor.packages().forEach(pn -> exports.put(pn, Collections.emptySet()));
+                descriptor.packages().forEach(pn -> opens.put(pn, Collections.emptySet()));
+            } else {
+                descriptor.exports().stream()
+                          .forEach(exp -> exports.computeIfAbsent(exp.source(), _k -> new HashSet<>())
+                                                 .addAll(exp.targets()));
+                descriptor.opens().stream()
+                    .forEach(exp -> opens.computeIfAbsent(exp.source(), _k -> new HashSet<>())
+                        .addAll(exp.targets()));
+            }
+            return new Module(name, location, descriptor, exports, opens, isSystem, reader);
         }
     }
 
     private static class UnnamedModule extends Module {
         private UnnamedModule() {
             super("unnamed", null, null,
-                  Collections.emptyMap(),
+                  Collections.emptyMap(), Collections.emptyMap(),
                   false, null);
         }
 
@@ -230,19 +258,22 @@
         }
     }
 
-    private static class StrictModule extends Module {
+    /**
+     * A normal module has a module-info.class
+     */
+    private static class NormalModule extends Module {
         private final ModuleDescriptor md;
 
         /**
-         * Converts the given automatic module to a strict module.
+         * Converts the given automatic module to a normal module.
          *
          * Replace this module's dependences with the given requires and also
          * declare service providers, if specified in META-INF/services configuration file
          */
-        private StrictModule(Module m, Map<String, Boolean> requires) {
-            super(m.name(), m.location, m.descriptor, m.exports, m.isSystem, m.reader());
+        private NormalModule(Module m, Map<String, Boolean> requires) {
+            super(m.name(), m.location, m.descriptor, m.exports, m.opens, m.isSystem, m.reader());
 
-            ModuleDescriptor.Builder builder = ModuleDescriptor.module(m.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.newModule(m.name());
             requires.keySet().forEach(mn -> {
                 if (requires.get(mn).equals(Boolean.TRUE)) {
                     builder.requires(Set.of(ModuleDescriptor.Requires.Modifier.TRANSITIVE), mn);
@@ -250,16 +281,10 @@
                     builder.requires(mn);
                 }
             });
-            m.descriptor.exports().forEach(e -> builder.exports(e));
-            m.descriptor.opens().forEach(o -> builder.opens(o));
-            m.descriptor.uses().forEach(s -> builder.uses(s));
-            m.descriptor.provides().forEach(p -> builder.provides(p));
-
-            Set<String> concealed = new HashSet<>(m.descriptor.packages());
-            m.descriptor.exports().stream().map(Exports::source).forEach(concealed::remove);
-            m.descriptor.opens().stream().map(Opens::source).forEach(concealed::remove);
-            concealed.forEach(builder::contains);
-
+            // exports all packages
+            m.descriptor.packages().forEach(builder::exports);
+            m.descriptor.uses().forEach(builder::uses);
+            m.descriptor.provides().forEach(builder::provides);
             this.md = builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleAnalyzer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -59,15 +59,10 @@
 
     private final JdepsConfiguration configuration;
     private final PrintWriter log;
-
     private final DependencyFinder dependencyFinder;
     private final Map<Module, ModuleDeps> modules;
 
     public ModuleAnalyzer(JdepsConfiguration config,
-                          PrintWriter log) {
-        this(config, log, Collections.emptySet());
-    }
-    public ModuleAnalyzer(JdepsConfiguration config,
                           PrintWriter log,
                           Set<String> names) {
         this.configuration = config;
@@ -150,7 +145,7 @@
         private ModuleDescriptor descriptor(Set<Module> requiresTransitive,
                                             Set<Module> requires) {
 
-            ModuleDescriptor.Builder builder = ModuleDescriptor.module(root.name());
+            ModuleDescriptor.Builder builder = ModuleDescriptor.newModule(root.name());
 
             if (!root.name().equals(JAVA_BASE))
                 builder.requires(Set.of(MANDATED), JAVA_BASE);
@@ -333,88 +328,6 @@
         return true;
     }
 
-    /**
-     * Generate dotfile from module descriptor
-     *
-     * @param dir output directory
-     */
-    public boolean genDotFiles(Path dir) throws IOException {
-        Files.createDirectories(dir);
-        for (Module m : modules.keySet()) {
-            genDotFile(dir, m.name());
-        }
-        return true;
-    }
-
-
-    private void genDotFile(Path dir, String name) throws IOException {
-        try (OutputStream os = Files.newOutputStream(dir.resolve(name + ".dot"));
-             PrintWriter out = new PrintWriter(os)) {
-            Set<Module> modules = configuration.resolve(Set.of(name))
-                .collect(Collectors.toSet());
-
-            // transitive reduction
-            Graph<String> graph = gengraph(modules);
-
-            out.format("digraph \"%s\" {%n", name);
-            DotGraph.printAttributes(out);
-            DotGraph.printNodes(out, graph);
-
-            modules.stream()
-                .map(Module::descriptor)
-                .sorted(Comparator.comparing(ModuleDescriptor::name))
-                .forEach(md -> {
-                    String mn = md.name();
-                    Set<String> requiresTransitive = md.requires().stream()
-                        .filter(d -> d.modifiers().contains(TRANSITIVE))
-                        .map(d -> d.name())
-                        .collect(toSet());
-
-                    DotGraph.printEdges(out, graph, mn, requiresTransitive);
-                });
-
-            out.println("}");
-        }
-    }
-
-    /**
-     * Returns a Graph of the given Configuration after transitive reduction.
-     *
-     * Transitive reduction of requires transitive edge and requires edge have
-     * to be applied separately to prevent the requires transitive edges
-     * (e.g. U -> V) from being reduced by a path (U -> X -> Y -> V)
-     * in which  V would not be re-exported from U.
-     */
-    private Graph<String> gengraph(Set<Module> modules) {
-        // build a Graph containing only requires transitive edges
-        // with transitive reduction.
-        Graph.Builder<String> rpgbuilder = new Graph.Builder<>();
-        for (Module module : modules) {
-            ModuleDescriptor md = module.descriptor();
-            String mn = md.name();
-            md.requires().stream()
-                    .filter(d -> d.modifiers().contains(TRANSITIVE))
-                    .map(d -> d.name())
-                    .forEach(d -> rpgbuilder.addEdge(mn, d));
-        }
-
-        Graph<String> rpg = rpgbuilder.build().reduce();
-
-        // build the readability graph
-        Graph.Builder<String> builder = new Graph.Builder<>();
-        for (Module module : modules) {
-            ModuleDescriptor md = module.descriptor();
-            String mn = md.name();
-            builder.addNode(mn);
-            configuration.reads(module)
-                    .map(Module::name)
-                    .forEach(d -> builder.addEdge(mn, d));
-        }
-
-        // transitive reduction of requires edges
-        return builder.build().reduce(rpg);
-    }
-
     // ---- for testing purpose
     public ModuleDescriptor[] descriptors(String name) {
         ModuleDeps moduleDeps = modules.keySet().stream()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 static java.lang.module.ModuleDescriptor.Requires.Modifier.*;
+import static java.util.stream.Collectors.*;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.module.ResolvedModule;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Generate dot graph for modules
+ */
+public class ModuleDotGraph {
+    private final Map<String, Configuration> configurations;
+    private final boolean apiOnly;
+    public ModuleDotGraph(JdepsConfiguration config, boolean apiOnly) {
+        this(config.rootModules().stream()
+                   .map(Module::name)
+                   .sorted()
+                   .collect(toMap(Function.identity(), mn -> config.resolve(Set.of(mn)))),
+             apiOnly);
+    }
+
+    public ModuleDotGraph(Map<String, Configuration> configurations, boolean apiOnly) {
+        this.configurations = configurations;
+        this.apiOnly = apiOnly;
+    }
+
+    /**
+     * Generate dotfile for all modules
+     *
+     * @param dir output directory
+     */
+    public boolean genDotFiles(Path dir) throws IOException {
+        Files.createDirectories(dir);
+        for (String mn : configurations.keySet()) {
+            Path path = dir.resolve(mn + ".dot");
+            genDotFile(path, mn, configurations.get(mn));
+        }
+        return true;
+    }
+
+    /**
+     * Generate dotfile of the given path
+     */
+    public void genDotFile(Path path, String name, Configuration configuration)
+        throws IOException
+    {
+        // transitive reduction
+        Graph<String> graph = apiOnly
+                ? requiresTransitiveGraph(configuration, Set.of(name))
+                : gengraph(configuration);
+
+        DotGraphBuilder builder = new DotGraphBuilder(name, graph);
+        builder.subgraph("se", "java", DotGraphBuilder.ORANGE,
+                         DotGraphBuilder.JAVA_SE_SUBGRAPH)
+               .subgraph("jdk", "jdk", DotGraphBuilder.BLUE,
+                         DotGraphBuilder.JDK_SUBGRAPH)
+               .descriptors(graph.nodes().stream()
+                                 .map(mn -> configuration.findModule(mn).get()
+                                                .reference().descriptor()));
+        // build dot file
+        builder.build(path);
+    }
+
+    /**
+     * Returns a Graph of the given Configuration after transitive reduction.
+     *
+     * Transitive reduction of requires transitive edge and requires edge have
+     * to be applied separately to prevent the requires transitive edges
+     * (e.g. U -> V) from being reduced by a path (U -> X -> Y -> V)
+     * in which  V would not be re-exported from U.
+     */
+    private Graph<String> gengraph(Configuration cf) {
+        Graph.Builder<String> builder = new Graph.Builder<>();
+        cf.modules().stream()
+            .forEach(resolvedModule -> {
+                String mn = resolvedModule.reference().descriptor().name();
+                builder.addNode(mn);
+                resolvedModule.reads().stream()
+                    .map(ResolvedModule::name)
+                    .forEach(target -> builder.addEdge(mn, target));
+            });
+
+        Graph<String> rpg = requiresTransitiveGraph(cf, builder.nodes);
+        return builder.build().reduce(rpg);
+    }
+
+
+    /**
+     * Returns a Graph containing only requires transitive edges
+     * with transitive reduction.
+     */
+    public Graph<String> requiresTransitiveGraph(Configuration cf,
+                                                 Set<String> roots)
+    {
+        Deque<String> deque = new ArrayDeque<>(roots);
+        Set<String> visited = new HashSet<>();
+        Graph.Builder<String> builder = new Graph.Builder<>();
+
+        while (deque.peek() != null) {
+            String mn = deque.pop();
+            if (visited.contains(mn))
+                continue;
+
+            visited.add(mn);
+            builder.addNode(mn);
+            ModuleDescriptor descriptor = cf.findModule(mn).get()
+                .reference().descriptor();
+            descriptor.requires().stream()
+                .filter(d -> d.modifiers().contains(TRANSITIVE)
+                                || d.name().equals("java.base"))
+                .map(d -> d.name())
+                .forEach(d -> {
+                    deque.add(d);
+                    builder.addEdge(mn, d);
+                });
+        }
+
+        return builder.build().reduce();
+    }
+
+    public static class DotGraphBuilder {
+        static final Set<String> JAVA_SE_SUBGRAPH = javaSE();
+        static final Set<String> JDK_SUBGRAPH = jdk();
+
+        private static Set<String> javaSE() {
+            String root = "java.se.ee";
+            ModuleFinder system = ModuleFinder.ofSystem();
+            if (system.find(root).isPresent()) {
+                return Stream.concat(Stream.of(root),
+                                     Configuration.empty().resolve(system,
+                                                                   ModuleFinder.of(),
+                                                                   Set.of(root))
+                                                  .findModule(root).get()
+                                                  .reads().stream()
+                                                  .map(ResolvedModule::name))
+                             .collect(toSet());
+            } else {
+                // approximation
+                return system.findAll().stream()
+                    .map(ModuleReference::descriptor)
+                    .map(ModuleDescriptor::name)
+                    .filter(name -> name.startsWith("java.") &&
+                                        !name.equals("java.smartcardio"))
+                    .collect(Collectors.toSet());
+            }
+        }
+
+        private static Set<String> jdk() {
+            return ModuleFinder.ofSystem().findAll().stream()
+                    .map(ModuleReference::descriptor)
+                    .map(ModuleDescriptor::name)
+                    .filter(name -> !JAVA_SE_SUBGRAPH.contains(name) &&
+                                        (name.startsWith("java.") ||
+                                            name.startsWith("jdk.") ||
+                                            name.startsWith("javafx.")))
+                    .collect(Collectors.toSet());
+        }
+
+        static class SubGraph {
+            final String name;
+            final String group;
+            final String color;
+            final Set<String> nodes;
+            SubGraph(String name, String group, String color, Set<String> nodes) {
+                this.name = Objects.requireNonNull(name);
+                this.group = Objects.requireNonNull(group);
+                this.color = Objects.requireNonNull(color);
+                this.nodes = Objects.requireNonNull(nodes);
+            }
+        }
+
+        static final String ORANGE = "#e76f00";
+        static final String BLUE = "#437291";
+        static final String GRAY = "#dddddd";
+        static final String BLACK = "#000000";
+
+        static final String FONT_NAME = "DejaVuSans";
+        static final int FONT_SIZE = 12;
+        static final int ARROW_SIZE = 1;
+        static final int ARROW_WIDTH = 2;
+        static final int RANK_SEP = 1;
+
+        static final String REEXPORTS = "";
+        static final String REQUIRES = "style=\"dashed\"";
+        static final String REQUIRES_BASE = "color=\"" + GRAY + "\"";
+
+        // can be configured
+        static double rankSep   = RANK_SEP;
+        static String fontColor = BLACK;
+        static String fontName  = FONT_NAME;
+        static int fontsize     = FONT_SIZE;
+        static int arrowWidth   = ARROW_WIDTH;
+        static int arrowSize    = ARROW_SIZE;
+        static final Map<String, Integer> weights = new HashMap<>();
+        static final List<Set<String>> ranks = new ArrayList<>();
+
+        private final String name;
+        private final Graph<String> graph;
+        private final Set<ModuleDescriptor> descriptors = new TreeSet<>();
+        private final List<SubGraph> subgraphs = new ArrayList<>();
+        public DotGraphBuilder(String name, Graph<String> graph) {
+            this.name = name;
+            this.graph = graph;
+        }
+
+        public DotGraphBuilder descriptors(Stream<ModuleDescriptor> descriptors) {
+            descriptors.forEach(this.descriptors::add);
+            return this;
+        }
+
+        public void build(Path filename) throws IOException {
+            try (BufferedWriter writer = Files.newBufferedWriter(filename);
+                 PrintWriter out = new PrintWriter(writer)) {
+
+                out.format("digraph \"%s\" {%n", name);
+                out.format("  nodesep=.5;%n");
+                out.format("  ranksep=%f;%n", rankSep);
+                out.format("  pencolor=transparent;%n");
+                out.format("  node [shape=plaintext, fontname=\"%s\", fontsize=%d, margin=\".2,.2\"];%n",
+                           fontName, fontsize);
+                out.format("  edge [penwidth=%d, color=\"#999999\", arrowhead=open, arrowsize=%d];%n",
+                           arrowWidth, arrowSize);
+
+                // same RANKS
+                ranks.stream()
+                     .map(nodes -> descriptors.stream()
+                                        .map(ModuleDescriptor::name)
+                                        .filter(nodes::contains)
+                                        .map(mn -> "\"" + mn + "\"")
+                                        .collect(joining(",")))
+                     .filter(group -> group.length() > 0)
+                     .forEach(group -> out.format("  {rank=same %s}%n", group));
+
+                subgraphs.forEach(subgraph -> {
+                    out.format("  subgraph %s {%n", subgraph.name);
+                    descriptors.stream()
+                        .map(ModuleDescriptor::name)
+                        .filter(subgraph.nodes::contains)
+                        .forEach(mn -> printNode(out, mn, subgraph.color, subgraph.group));
+                    out.format("  }%n");
+                });
+
+                descriptors.stream()
+                    .filter(md -> graph.contains(md.name()) &&
+                                    !graph.adjacentNodes(md.name()).isEmpty())
+                    .forEach(md -> printNode(out, md, graph.adjacentNodes(md.name())));
+
+                out.println("}");
+            }
+        }
+
+        public DotGraphBuilder subgraph(String name, String group, String color,
+                                 Set<String> nodes) {
+            subgraphs.add(new SubGraph(name, group, color, nodes));
+            return this;
+        }
+
+        public void printNode(PrintWriter out, String node, String color, String group) {
+            out.format("  \"%s\" [fontcolor=\"%s\", group=%s];%n",
+                       node, color, group);
+        }
+
+        public void printNode(PrintWriter out, ModuleDescriptor md, Set<String> edges) {
+            Set<String> requiresTransitive = md.requires().stream()
+                .filter(d -> d.modifiers().contains(TRANSITIVE))
+                .map(d -> d.name())
+                .collect(toSet());
+
+            String mn = md.name();
+            edges.stream().forEach(dn -> {
+                String attr = dn.equals("java.base") ? REQUIRES_BASE
+                    : (requiresTransitive.contains(dn) ? REEXPORTS : REQUIRES);
+
+                int w = weightOf(mn, dn);
+                if (w > 1) {
+                    if (!attr.isEmpty())
+                        attr += ", ";
+
+                    attr += "weight=" + w;
+                }
+                out.format("  \"%s\" -> \"%s\" [%s];%n", mn, dn, attr);
+            });
+        }
+
+        public int weightOf(String s, String t) {
+            int w = weights.getOrDefault(s + ":" + t, 1);
+            if (w != 1)
+                return w;
+            if (s.startsWith("java.") && t.startsWith("java."))
+                return 10;
+            return 1;
+        }
+
+        public static void sameRankNodes(Set<String> nodes) {
+            ranks.add(nodes);
+        }
+
+        public static void weight(String s, String t, int w) {
+            weights.put(s + ":" + t, w);
+        }
+
+        public static void setRankSep(double value) {
+            rankSep = value;
+        }
+
+        public static void setFontSize(int size) {
+            fontsize = size;
+        }
+
+        public static void setFontColor(String color) {
+            fontColor = color;
+        }
+
+        public static void setArrowSize(int size) {
+            arrowSize = size;
+        }
+
+        public static void setArrowWidth(int width) {
+            arrowWidth = width;
+        }
+    }
+}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Mon Mar 13 19:58:52 2017 +0000
@@ -181,7 +181,7 @@
         RootModule(String name) {
             super(name);
 
-            ModuleDescriptor.Builder builder = ModuleDescriptor.module(name);
+            ModuleDescriptor.Builder builder = ModuleDescriptor.newModule(name);
             this.descriptor = builder.build();
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -43,10 +43,12 @@
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import static java.util.stream.Collectors.*;
 
@@ -60,8 +62,8 @@
     final Analyzer analyzer;
 
     // an input JAR file (loaded as an automatic module for analysis)
-    // maps to an explicit module to generate module-info.java
-    final Map<Module, Module> automaticToExplicitModule;
+    // maps to a normal module to generate module-info.java
+    final Map<Module, Module> automaticToNormalModule;
     public ModuleInfoBuilder(JdepsConfiguration configuration,
                              List<String> args,
                              Path outputdir,
@@ -78,20 +80,20 @@
             .map(fn -> Paths.get(fn))
             .collect(toList());
 
-        // automatic module to convert to explicit module
-        this.automaticToExplicitModule = ModuleFinder.of(paths.toArray(new Path[0]))
+        // automatic module to convert to normal module
+        this.automaticToNormalModule = ModuleFinder.of(paths.toArray(new Path[0]))
                 .findAll().stream()
                 .map(configuration::toModule)
                 .collect(toMap(Function.identity(), Function.identity()));
 
-        Optional<Module> om = automaticToExplicitModule.keySet().stream()
+        Optional<Module> om = automaticToNormalModule.keySet().stream()
                                     .filter(m -> !m.descriptor().isAutomatic())
                                     .findAny();
         if (om.isPresent()) {
             throw new UncheckedBadArgs(new BadArgs("err.genmoduleinfo.not.jarfile",
                                                    om.get().getPathName()));
         }
-        if (automaticToExplicitModule.isEmpty()) {
+        if (automaticToNormalModule.isEmpty()) {
             throw new UncheckedBadArgs(new BadArgs("err.invalid.path", args));
         }
     }
@@ -115,13 +117,13 @@
                 Path file = outputdir.resolve(m.name()).resolve("module-info.java");
 
                 // computes requires and requires transitive
-                Module explicitModule = toExplicitModule(m, apiDeps);
-                if (explicitModule != null) {
-                    automaticToExplicitModule.put(m, explicitModule);
+                Module normalModule = toNormalModule(m, apiDeps);
+                if (normalModule != null) {
+                    automaticToNormalModule.put(m, normalModule);
 
                     // generate module-info.java
                     System.out.format("writing to %s%n", file);
-                    writeModuleInfo(file,  explicitModule.descriptor());
+                    writeModuleInfo(file,  normalModule.descriptor());
                 } else {
                     // find missing dependences
                     System.out.format("Missing dependence: %s not generated%n", file);
@@ -139,7 +141,7 @@
         return m == NOT_FOUND || m == REMOVED_JDK_INTERNALS;
     }
 
-    private Module toExplicitModule(Module module, Set<Archive> requiresTransitive)
+    private Module toNormalModule(Module module, Set<Archive> requiresTransitive)
         throws IOException
     {
         // done analysis
@@ -159,21 +161,21 @@
             .map(Archive::getModule)
             .forEach(d -> requires.putIfAbsent(d.name(), Boolean.FALSE));
 
-        return module.toStrictModule(requires);
+        return module.toNormalModule(requires);
     }
 
     /**
      * Returns the stream of resulting modules
      */
     Stream<Module> modules() {
-        return automaticToExplicitModule.values().stream();
+        return automaticToNormalModule.values().stream();
     }
 
     /**
      * Returns the stream of resulting ModuleDescriptors
      */
     public Stream<ModuleDescriptor> descriptors() {
-        return automaticToExplicitModule.entrySet().stream()
+        return automaticToNormalModule.entrySet().stream()
                     .map(Map.Entry::getValue)
                     .map(Module::descriptor);
     }
@@ -205,13 +207,14 @@
         md.requires().stream()
           .filter(req -> !req.name().equals("java.base"))   // implicit requires
           .sorted(Comparator.comparing(Requires::name))
-          .forEach(req -> writer.format("    requires %s;%n", req));
+          .forEach(req -> writer.format("    requires %s;%n",
+                                        toString(req.modifiers(), req.name())));
 
         if (!open) {
             md.exports().stream()
               .peek(exp -> {
-                 if (exp.targets().size() > 0)
-                    throw new InternalError(md.name() + " qualified exports: " + exp);
+                  if (exp.isQualified())
+                      throw new InternalError(md.name() + " qualified exports: " + exp);
               })
               .sorted(Comparator.comparing(Exports::source))
               .forEach(exp -> writer.format("    exports %s;%n", exp.source()));
@@ -231,7 +234,16 @@
     }
 
     private Set<Module> automaticModules() {
-        return automaticToExplicitModule.keySet();
+        return automaticToNormalModule.keySet();
+    }
+
+    /**
+     * Returns a string containing the given set of modifiers and label.
+     */
+    private static <M> String toString(Set<M> mods, String what) {
+        return (Stream.concat(mods.stream().map(e -> e.toString().toLowerCase(Locale.US)),
+                              Stream.of(what)))
+                      .collect(Collectors.joining(" "));
     }
 
     /**
--- a/langtools/src/jdk.jdeps/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,8 @@
 
 /** Defines tools for analysing dependencies in Java libraries and programs, including
  *  the <em>jdeps</em> and <em>javap</em> tools.
+ *
+ *  @since 9
  */
 module jdk.jdeps {
     requires java.base;
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -90,6 +90,17 @@
     }
 
     /**
+     * Release a JShell instance.
+     *
+     * @param state the JShell instance
+     */
+    public static void release(JShell state) {
+        if (debugMap != null) {
+            debugMap.remove(state);
+        }
+    }
+
+    /**
      * Tests if any of the specified debug flags are enabled.
      *
      * @param state the JShell instance
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Mon Mar 13 19:58:52 2017 +0000
@@ -310,6 +310,8 @@
                         int firstLine = 0;
 
                         PRINT_PAGE: while (true) {
+                            in.print(lastNote.replaceAll(".", " ") + ConsoleReader.RESET_LINE);
+
                             int toPrint = height - 1;
 
                             while (toPrint > 0 && firstLine < lines.length) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Mon Mar 13 19:58:52 2017 +0000
@@ -116,6 +116,13 @@
                 name, type, value, unresolved, errorLines);
     }
 
+    public String format(String field, FormatCase fc, FormatAction fa, FormatWhen fw,
+                    FormatResolve fr, FormatUnresolved fu, FormatErrors fe,
+                    String name, String type, String value, String unresolved, List<String> errorLines) {
+        return mode.format(field, fc, fa, fw, fr, fu, fe,
+                name, type, value, unresolved, errorLines);
+    }
+
     public String truncateVarValue(String value) {
         return mode.truncateVarValue(value);
     }
@@ -463,6 +470,14 @@
         String format(FormatCase fc, FormatAction fa, FormatWhen fw,
                     FormatResolve fr, FormatUnresolved fu, FormatErrors fe,
                     String name, String type, String value, String unresolved, List<String> errorLines) {
+            return format("display", fc, fa, fw, fr, fu, fe,
+                name, type, value, unresolved, errorLines);
+        }
+
+        // Compute the display output given full context and values
+        String format(String field, FormatCase fc, FormatAction fa, FormatWhen fw,
+                    FormatResolve fr, FormatUnresolved fu, FormatErrors fe,
+                    String name, String type, String value, String unresolved, List<String> errorLines) {
             // Convert the context into a bit representation used as selectors for store field formats
             long bits = bits(fc, fa, fw, fr, fu, fe);
             String fname = name==null? "" : name;
@@ -476,7 +491,7 @@
                             fname, ftype, fvalue, funresolved, "*cannot-use-errors-here*", el))
                     .collect(joining());
             return String.format(
-                    format("display", bits),
+                    format(field, bits),
                     fname, ftype, fvalue, funresolved, errors, "*cannot-use-err-here*");
         }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Mon Mar 13 19:58:52 2017 +0000
@@ -36,12 +36,9 @@
 import java.io.PrintStream;
 import java.io.Reader;
 import java.io.StringReader;
-import java.net.URL;
 import java.nio.charset.Charset;
-import java.nio.file.AccessDeniedException;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.MessageFormat;
@@ -352,9 +349,56 @@
             }
         }
 
+        // check that the supplied string represent valid class/module paths
+        // converting any ~/ to user home
+        private Collection<String> validPaths(Collection<String> vals, String context, boolean isModulePath) {
+            Stream<String> result = vals.stream()
+                    .map(s -> Arrays.stream(s.split(File.pathSeparator))
+                        .map(sp -> toPathResolvingUserHome(sp))
+                        .filter(p -> checkValidPathEntry(p, context, isModulePath))
+                        .map(p -> p.toString())
+                        .collect(Collectors.joining(File.pathSeparator)));
+            if (failed) {
+                return Collections.emptyList();
+            } else {
+                return result.collect(toList());
+            }
+        }
+
+        // Adapted from compiler method Locations.checkValidModulePathEntry
+        private boolean checkValidPathEntry(Path p, String context, boolean isModulePath) {
+            if (!Files.exists(p)) {
+                msg("jshell.err.file.not.found", context, p);
+                failed = true;
+                return false;
+            }
+            if (Files.isDirectory(p)) {
+                // if module-path, either an exploded module or a directory of modules
+                return true;
+            }
+
+            String name = p.getFileName().toString();
+            int lastDot = name.lastIndexOf(".");
+            if (lastDot > 0) {
+                switch (name.substring(lastDot)) {
+                    case ".jar":
+                        return true;
+                    case ".jmod":
+                        if (isModulePath) {
+                            return true;
+                        }
+                }
+            }
+            msg("jshell.err.arg", context, p);
+            failed = true;
+            return false;
+        }
+
         Options parse(OptionSet options) {
-            addOptions(OptionKind.CLASS_PATH, options.valuesOf(argClassPath));
-            addOptions(OptionKind.MODULE_PATH, options.valuesOf(argModulePath));
+            addOptions(OptionKind.CLASS_PATH,
+                    validPaths(options.valuesOf(argClassPath), "--class-path", false));
+            addOptions(OptionKind.MODULE_PATH,
+                    validPaths(options.valuesOf(argModulePath), "--module-path", true));
             addOptions(OptionKind.ADD_MODULES, options.valuesOf(argAddModules));
             addOptions(OptionKind.ADD_EXPORTS, options.valuesOf(argAddExports).stream()
                     .map(mp -> mp.contains("=") ? mp : mp + "=ALL-UNNAMED")
@@ -812,6 +856,12 @@
         }
     }
 
+    /**
+     * The entry point into the JShell tool.
+     *
+     * @param args the command-line arguments
+     * @throws Exception catastrophic fatal exception
+     */
     public void start(String[] args) throws Exception {
         OptionParserCommandLine commandLineArgs = new OptionParserCommandLine();
         options = commandLineArgs.parse(args);
@@ -842,30 +892,33 @@
                 hardmsg("jshell.msg.welcome", version());
             }
             // Be sure history is always saved so that user code isn't lost
-            Runtime.getRuntime().addShutdownHook(new Thread() {
+            Thread shutdownHook = new Thread() {
                 @Override
                 public void run() {
                     replayableHistory.storeHistory(prefs);
                 }
-            });
+            };
+            Runtime.getRuntime().addShutdownHook(shutdownHook);
             // execute from user input
             try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
-                start(in);
+                while (regenerateOnDeath) {
+                    if (!live) {
+                        resetState();
+                    }
+                    run(in);
+                }
+            } finally {
+                replayableHistory.storeHistory(prefs);
+                closeState();
+                try {
+                    Runtime.getRuntime().removeShutdownHook(shutdownHook);
+                } catch (Exception ex) {
+                    // ignore, this probably caused by VM aready being shutdown
+                    // and this is the last act anyhow
+                }
             }
         }
-    }
-
-    private void start(IOContext in) {
-        try {
-            while (regenerateOnDeath) {
-                if (!live) {
-                    resetState();
-                }
-                run(in);
-            }
-        } finally {
-            closeState();
-        }
+        closeState();
     }
 
     private EditorSetting configEditor() {
@@ -1019,6 +1072,8 @@
         live = false;
         JShell oldState = state;
         if (oldState != null) {
+            state = null;
+            analysis = null;
             oldState.unsubscribe(shutdownSubscription); // No notification
             oldState.close();
         }
@@ -2006,7 +2061,6 @@
     private boolean cmdExit() {
         regenerateOnDeath = false;
         live = false;
-        replayableHistory.storeHistory(prefs);
         fluffmsg("jshell.msg.goodbye");
         return true;
     }
@@ -2614,9 +2668,16 @@
         if (stream == null) {
             return false;
         }
-        stream.forEachOrdered(mk
-                -> hard("  %s %s", mk.name(), mk.signature())
-        );
+        stream.forEachOrdered(meth -> {
+            String sig = meth.signature();
+            int i = sig.lastIndexOf(")") + 1;
+            if (i <= 0) {
+                hard("  %s", meth.name());
+            } else {
+                hard("  %s %s%s", sig.substring(i), meth.name(), sig.substring(0, i));
+            }
+            printSnippetStatus(meth, true);
+        });
         return true;
     }
 
@@ -2648,6 +2709,7 @@
                     break;
             }
             hard("  %s %s", kind, ck.name());
+            printSnippetStatus(ck, true);
         });
         return true;
     }
@@ -2837,7 +2899,8 @@
                         return true;
                     }
                 } else {
-                    new DisplayEvent(ste, false, ste.value(), diagnostics).displayDeclarationAndValue();
+                    new DisplayEvent(ste, FormatWhen.PRIMARY, ste.value(), diagnostics)
+                            .displayDeclarationAndValue();
                 }
             } else {
                 if (diagnostics.isEmpty()) {
@@ -2851,7 +2914,8 @@
                 List<Diag> other = errorsOnly(diagnostics);
 
                 // display update information
-                new DisplayEvent(ste, true, ste.value(), other).displayDeclarationAndValue();
+                new DisplayEvent(ste, FormatWhen.UPDATE, ste.value(), other)
+                        .displayDeclarationAndValue();
             }
         }
         return false;
@@ -2889,10 +2953,7 @@
     }
     //where
     void printUnresolvedException(UnresolvedReferenceException ex) {
-        DeclarationSnippet corralled =  ex.getSnippet();
-        List<Diag> otherErrors = errorsOnly(state.diagnostics(corralled).collect(toList()));
-        new DisplayEvent(corralled, state.status(corralled), FormatAction.USED, true, null, otherErrors)
-                .displayDeclarationAndValue();
+        printSnippetStatus(ex.getSnippet(), false);
     }
     //where
     void printEvalException(EvalException ex) {
@@ -2934,23 +2995,38 @@
         return act;
     }
 
+    void printSnippetStatus(DeclarationSnippet sn, boolean resolve) {
+        List<Diag> otherErrors = errorsOnly(state.diagnostics(sn).collect(toList()));
+        new DisplayEvent(sn, state.status(sn), resolve, otherErrors)
+                .displayDeclarationAndValue();
+    }
+
     class DisplayEvent {
         private final Snippet sn;
         private final FormatAction action;
-        private final boolean update;
+        private final FormatWhen update;
         private final String value;
         private final List<String> errorLines;
         private final FormatResolve resolution;
         private final String unresolved;
         private final FormatUnresolved unrcnt;
         private final FormatErrors errcnt;
+        private final boolean resolve;
 
-        DisplayEvent(SnippetEvent ste, boolean update, String value, List<Diag> errors) {
-            this(ste.snippet(), ste.status(), toAction(ste.status(), ste.previousStatus(), ste.isSignatureChange()), update, value, errors);
+        DisplayEvent(SnippetEvent ste, FormatWhen update, String value, List<Diag> errors) {
+            this(ste.snippet(), ste.status(), false,
+                    toAction(ste.status(), ste.previousStatus(), ste.isSignatureChange()),
+                    update, value, errors);
         }
 
-        DisplayEvent(Snippet sn, Status status, FormatAction action, boolean update, String value, List<Diag> errors) {
+        DisplayEvent(Snippet sn, Status status, boolean resolve, List<Diag> errors) {
+            this(sn, status, resolve, FormatAction.USED, FormatWhen.UPDATE, null, errors);
+        }
+
+        private DisplayEvent(Snippet sn, Status status, boolean resolve,
+                FormatAction action, FormatWhen update, String value, List<Diag> errors) {
             this.sn = sn;
+            this.resolve =resolve;
             this.action = action;
             this.update = update;
             this.value = value;
@@ -2958,6 +3034,12 @@
             for (Diag d : errors) {
                 displayDiagnostics(sn.source(), d, errorLines);
             }
+            if (resolve) {
+                // resolve needs error lines indented
+                for (int i = 0; i < errorLines.size(); ++i) {
+                    errorLines.set(i, "    " + errorLines.get(i));
+                }
+            }
             long unresolvedCount;
             if (sn instanceof DeclarationSnippet && (status == Status.RECOVERABLE_DEFINED || status == Status.RECOVERABLE_NOT_DEFINED)) {
                 resolution = (status == Status.RECOVERABLE_NOT_DEFINED)
@@ -3012,10 +3094,17 @@
         }
 
         private void custom(FormatCase fcase, String name, String type) {
-            String display = feedback.format(fcase, action, (update ? FormatWhen.UPDATE : FormatWhen.PRIMARY),
-                    resolution, unrcnt, errcnt,
-                    name, type, value, unresolved, errorLines);
-            if (interactive()) {
+            if (resolve) {
+                String resolutionErrors = feedback.format("resolve", fcase, action, update,
+                        resolution, unrcnt, errcnt,
+                        name, type, value, unresolved, errorLines);
+                if (!resolutionErrors.trim().isEmpty()) {
+                    hard("    %s", resolutionErrors);
+                }
+            } else if (interactive()) {
+                String display = feedback.format(fcase, action, update,
+                        resolution, unrcnt, errcnt,
+                        name, type, value, unresolved, errorLines);
                 cmdout.print(display);
             }
         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Mon Mar 13 19:58:52 2017 +0000
@@ -650,7 +650,7 @@
    varinit    -- variable declaration with init\n\t\
    expression -- expression -- note: {name}==scratch-variable-name\n\t\
    varvalue   -- variable value expression\n\t\
-   assignment -- assign variable\n\t\
+   assignment -- assign variable\n\
 The action selector kind describes what happened to the snippet.  The values are:\n\t\
    added     -- snippet has been added\n\t\
    modified  -- an existing snippet has been modified\n\t\
@@ -845,12 +845,12 @@
 /set format verbose action '  update overwrote' overwrote-update    \n\
 /set format verbose action '  update dropped' dropped-update    \n\
 \n\
-/set format verbose until ', however, it cannot be instanciated or its methods invoked until'   defined-class-primary    \n\
+/set format verbose until ', however, it cannot be instantiated or its methods invoked until'   defined-class-primary    \n\
 /set format verbose until ', however, its methods cannot be invoked until'                      defined-interface-primary    \n\
 /set format verbose until ', however, it cannot be used until'                                  defined-enum,annotation-primary    \n\
 /set format verbose until ', however, it cannot be invoked until'                               defined-method-primary    \n\
 /set format verbose until ', however, it cannot be referenced until'                            notdefined-primary    \n\
-/set format verbose until ' which cannot be instanciated or its methods invoked until'          defined-class-update    \n\
+/set format verbose until ' which cannot be instantiated or its methods invoked until'          defined-class-update    \n\
 /set format verbose until ' whose methods cannot be invoked until'                              defined-interface-update    \n\
 /set format verbose until ' which cannot be invoked until'                                      defined-method-update    \n\
 /set format verbose until ' which cannot be referenced until'                                   notdefined-update    \n\
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/DeclarationSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/DeclarationSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -45,6 +45,8 @@
  * <code>DeclarationSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  */
 public abstract class DeclarationSnippet extends PersistentSnippet {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Diag.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Diag.java	Mon Mar 13 19:58:52 2017 +0000
@@ -30,6 +30,8 @@
 
 /**
  * Diagnostic information for a Snippet.
+ *
+ * @since 9
  * @see jdk.jshell.JShell#diagnostics(jdk.jshell.Snippet)
  */
 public abstract class Diag {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ErroneousSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ErroneousSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * <code>ErroneousSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  */
 public class ErroneousSnippet extends Snippet {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/EvalException.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/EvalException.java	Mon Mar 13 19:58:52 2017 +0000
@@ -38,6 +38,8 @@
  * the Snippet id and for snippets without a method name (for example an
  * expression) <code>StackTraceElement.getMethodName()</code> will be the
  * empty string.
+ *
+ * @since 9
  */
 @SuppressWarnings("serial")             // serialVersionUID intentionally omitted
 public class EvalException extends JShellException {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExpressionSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExpressionSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * <code>ExpressionSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  * @jls 15: Expression.
  */
 public class ExpressionSnippet extends Snippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ImportSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ImportSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * {@code ImportSnippet} is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  * @jls 8.3: importDeclaration.
  */
 public class ImportSnippet extends PersistentSnippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,10 @@
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
 
+import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.stream.Stream;
+import javax.tools.StandardJavaFileManager;
 import jdk.internal.jshell.debug.InternalDebugControl;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.spi.ExecutionControl.EngineTerminationException;
@@ -77,7 +79,9 @@
  * <p>
  * This class is not thread safe, except as noted, all access should be through
  * a single thread.
+ *
  * @author Robert Field
+ * @since 9
  */
 public class JShell implements AutoCloseable {
 
@@ -92,6 +96,7 @@
     final BiFunction<Snippet, Integer, String> idGenerator;
     final List<String> extraRemoteVMOptions;
     final List<String> extraCompilerOptions;
+    final Function<StandardJavaFileManager, StandardJavaFileManager> fileManagerMapping;
 
     private int nextKeyIndex = 1;
 
@@ -115,6 +120,7 @@
         this.idGenerator = b.idGenerator;
         this.extraRemoteVMOptions = b.extraRemoteVMOptions;
         this.extraCompilerOptions = b.extraCompilerOptions;
+        this.fileManagerMapping = b.fileManagerMapping;
         try {
             if (b.executionControlProvider != null) {
                 executionControl = b.executionControlProvider.generate(new ExecutionEnvImpl(),
@@ -171,6 +177,7 @@
         ExecutionControlProvider executionControlProvider;
         Map<String,String> executionControlParameters;
         String executionControlSpec;
+        Function<StandardJavaFileManager, StandardJavaFileManager> fileManagerMapping;
 
         Builder() { }
 
@@ -365,6 +372,28 @@
         }
 
         /**
+         * Configure the {@code FileManager} to be used by compilation and
+         * source analysis.
+         * If not set or passed null, the compiler's standard file manager will
+         * be used (identity mapping).
+         * For use in special applications where the compiler's normal file
+         * handling needs to be overridden.  See the file manager APIs for more
+         * information.
+         * The file manager input enables forwarding file managers, if this
+         * is not needed, the incoming file manager can be ignored (constant
+         * function).
+         *
+         * @param mapping a function that given the compiler's standard file
+         * manager, returns a file manager to use
+         * @return the {@code Builder} instance (for use in chained
+         * initialization)
+         */
+        public Builder fileManager(Function<StandardJavaFileManager, StandardJavaFileManager> mapping) {
+            this.fileManagerMapping = mapping;
+            return this;
+        }
+
+        /**
          * Builds a JShell state engine. This is the entry-point to all JShell
          * functionality. This creates a remote process for execution. It is
          * thus important to close the returned instance.
@@ -501,6 +530,7 @@
      * @throws IllegalStateException if this {@code JShell} instance is closed.
      */
     public void addToClasspath(String path) {
+        checkIfAlive();
         // Compiler
         taskFactory.addToClasspath(path);
         // Runtime
@@ -543,17 +573,7 @@
      */
     @Override
     public void close() {
-        if (!closed) {
-            closeDown();
-            try {
-                executionControl().close();
-            } catch (Throwable ex) {
-                // don't care about exceptions on close
-            }
-            if (sourceCodeAnalysis != null) {
-                sourceCodeAnalysis.close();
-            }
-        }
+        closeDown();
     }
 
     /**
@@ -826,6 +846,15 @@
             } catch (Throwable thr) {
                 // Don't care about dying exceptions
             }
+            try {
+                executionControl().close();
+            } catch (Throwable ex) {
+                // don't care about exceptions on close
+            }
+            if (sourceCodeAnalysis != null) {
+                sourceCodeAnalysis.close();
+            }
+            InternalDebugControl.release(this);
         }
     }
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShellException.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShellException.java	Mon Mar 13 19:58:52 2017 +0000
@@ -27,6 +27,8 @@
 
 /**
  * The superclass of JShell generated exceptions
+ *
+ * @since 9
  */
 @SuppressWarnings("serial")             // serialVersionUID intentionally omitted
 public class JShellException extends Exception {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java	Mon Mar 13 19:58:52 2017 +0000
@@ -30,8 +30,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.net.URI;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
@@ -71,10 +69,6 @@
 
     private final JShell proc;
 
-    // Upcoming Jigsaw
-    private Method inferModuleNameMethod = null;
-    private Method listLocationsForModulesMethod = null;
-
     Iterable<? extends Path> getLocationAsPaths(Location loc) {
         return this.stdFileManager.getLocationAsPaths(loc);
     }
@@ -165,7 +159,9 @@
     }
 
     public MemoryFileManager(StandardJavaFileManager standardManager, JShell proc) {
-        this.stdFileManager = standardManager;
+        this.stdFileManager = proc.fileManagerMapping != null
+                ? proc.fileManagerMapping.apply(standardManager)
+                : standardManager;
         this.proc = proc;
     }
 
@@ -184,43 +180,6 @@
         return new SourceMemoryJavaFileObject(origin, name, code);
     }
 
-    // Make compatible with Jigsaw
-    public String inferModuleName(Location location) {
-        try {
-            if (inferModuleNameMethod == null) {
-                inferModuleNameMethod = JavaFileManager.class.getDeclaredMethod("inferModuleName", Location.class);
-            }
-            @SuppressWarnings("unchecked")
-            String result = (String) inferModuleNameMethod.invoke(stdFileManager, location);
-            return result;
-        } catch (NoSuchMethodException | SecurityException ex) {
-            throw new InternalError("Cannot lookup JavaFileManager method", ex);
-        } catch (IllegalAccessException |
-                IllegalArgumentException |
-                InvocationTargetException ex) {
-            throw new InternalError("Cannot invoke JavaFileManager method", ex);
-        }
-    }
-
-    // Make compatible with Jigsaw
-    public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
-        try {
-            if (listLocationsForModulesMethod == null) {
-                listLocationsForModulesMethod = JavaFileManager.class.getDeclaredMethod("listLocationsForModules", Location.class);
-            }
-            @SuppressWarnings("unchecked")
-            Iterable<Set<Location>> result = (Iterable<Set<Location>>) listLocationsForModulesMethod.invoke(stdFileManager, location);
-            return result;
-        } catch (NoSuchMethodException | SecurityException ex) {
-            throw new InternalError("Cannot lookup JavaFileManager method", ex);
-        } catch (IllegalAccessException |
-                IllegalArgumentException |
-                InvocationTargetException ex) {
-            throw new InternalError("Cannot invoke JavaFileManager method", ex);
-        }
-    }
-
-
     /**
      * Returns a class loader for loading plug-ins from the given location. For
      * example, to load annotation processors, a compiler will request a class
@@ -580,6 +539,26 @@
                 ", sibling: " + sibling);
     }
 
+    @Override
+    public Location getLocationForModule(Location location, String moduleName) throws IOException {
+        return stdFileManager.getLocationForModule(location, moduleName);
+    }
+
+    @Override
+    public Location getLocationForModule(Location location, JavaFileObject fo, String pkgName) throws IOException {
+        return stdFileManager.getLocationForModule(location, fo, pkgName);
+    }
+
+    @Override
+    public String inferModuleName(Location location) throws IOException {
+        return stdFileManager.inferModuleName(location);
+    }
+
+    @Override
+    public Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
+        return stdFileManager.listLocationsForModules(location);
+    }
+
     /**
      * Flushes any resources opened for output by this file manager
      * directly or indirectly.  Flushing a closed file manager has no
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/MethodSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/MethodSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -35,6 +35,8 @@
  * <code>MethodSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  * @jls 8.4: MethodDeclaration.
  */
 public class MethodSnippet extends DeclarationSnippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterImportSnippetWrap.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterImportSnippetWrap.java	Mon Mar 13 19:58:52 2017 +0000
@@ -32,7 +32,7 @@
  * The outer wrap for a set of snippets wrapped in a generated class
  * @author Robert Field
  */
-public class OuterImportSnippetWrap extends OuterWrap {
+class OuterImportSnippetWrap extends OuterWrap {
 
     private final Snippet snippet;
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterSnippetsClassWrap.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterSnippetsClassWrap.java	Mon Mar 13 19:58:52 2017 +0000
@@ -35,7 +35,7 @@
  * The outer wrap for a set of snippets wrapped in a generated class
  * @author Robert Field
  */
-public class OuterSnippetsClassWrap extends OuterWrap {
+class OuterSnippetsClassWrap extends OuterWrap {
 
     private final String className;
     private final LinkedHashMap<Wrap, Snippet> wrapToSnippet;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.java	Mon Mar 13 19:58:52 2017 +0000
@@ -44,7 +44,7 @@
  *
  * @author Robert Field
  */
-public class OuterWrapMap {
+class OuterWrapMap {
 
     private final JShell state;
     private final Map<String,OuterSnippetsClassWrap> classOuters = new HashMap<>();
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/PersistentSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/PersistentSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * <code>PersistentSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  */
 public abstract class PersistentSnippet extends Snippet {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -39,7 +39,9 @@
  * state engine, query {@code JShell} passing the Snippet.
  * <p>
  * Because it is immutable, {@code Snippet} (and subclasses) is thread-safe.
+ *
  * @author Robert Field
+ * @since 9
  * @see jdk.jshell.JShell#status
  */
 public abstract class Snippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java	Mon Mar 13 19:58:52 2017 +0000
@@ -38,7 +38,9 @@
  * {@code SnippetEvent} is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
  * @author Robert Field
+ * @since 9
  */
 public class SnippetEvent {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysis.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysis.java	Mon Mar 13 19:58:52 2017 +0000
@@ -39,6 +39,7 @@
  * etc.
  * Also includes completion suggestions, as might be used in tab-completion.
  *
+ * @since 9
  */
 public abstract class SourceCodeAnalysis {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/StatementSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/StatementSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * <code>StatementSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  * @jls 14.5: Statement.
  */
 public class StatementSnippet extends Snippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypeDeclSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypeDeclSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -36,6 +36,8 @@
  * <code>TypeDeclSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  */
 public class TypeDeclSnippet extends DeclarationSnippet {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/UnresolvedReferenceException.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/UnresolvedReferenceException.java	Mon Mar 13 19:58:52 2017 +0000
@@ -36,6 +36,8 @@
  * the Snippet id and for snippets without a method name (for example an
  * expression) <code>StackTraceElement.getName()</code> will be the
  * empty string.
+ *
+ * @since 9
  */
 @SuppressWarnings("serial")             // serialVersionUID intentionally omitted
 public class UnresolvedReferenceException extends JShellException {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarSnippet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarSnippet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -35,6 +35,8 @@
  * <code>VarSnippet</code> is immutable: an access to
  * any of its methods will always return the same result.
  * and thus is thread-safe.
+ *
+ * @since 9
  * @jls 8.3: FieldDeclaration.
  */
 public class VarSnippet extends DeclarationSnippet {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -39,6 +39,7 @@
  *
  * @author Robert Field
  * @author Jan Lahoda
+ * @since 9
  */
 public class DirectExecutionControl implements ExecutionControl {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -37,6 +37,8 @@
 
 /**
  * Tries other providers in sequence until one works.
+ *
+ * @since 9
  */
 public class FailOverExecutionControlProvider  implements ExecutionControlProvider{
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -33,6 +33,7 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,6 +61,7 @@
  *
  * @author Robert Field
  * @author Jan Lahoda
+ * @since 9
  */
 public class JdiDefaultExecutionControl extends JdiExecutionControl {
 
@@ -97,7 +99,8 @@
 
             // Set-up the JDI connection
             JdiInitiator jdii = new JdiInitiator(port,
-                    env.extraRemoteVMOptions(), remoteAgent, isLaunch, host, timeout);
+                    env.extraRemoteVMOptions(), remoteAgent, isLaunch, host,
+                    timeout, Collections.emptyMap());
             VirtualMachine vm = jdii.vm();
             Process process = jdii.process();
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -37,7 +37,9 @@
 import static java.util.stream.Collectors.toMap;
 
 /**
- * Abstract JDI implementation of {@link jdk.jshell.spi.ExecutionControl}
+ * Abstract JDI implementation of {@link jdk.jshell.spi.ExecutionControl}.
+ *
+ * @since 9
  */
 public abstract class JdiExecutionControl extends StreamingExecutionControl implements ExecutionControl {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControlProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControlProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -35,7 +35,9 @@
 
 /**
  * A provider of remote JDI-controlled execution engines.
+ *
  * @author Robert Field
+ * @since 9
  */
 public class JdiExecutionControlProvider implements ExecutionControlProvider {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016,2017 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
 /**
  * Sets up a JDI connection, providing the resulting JDI {@link VirtualMachine}
  * and the {@link Process} the remote agent is running in.
+ *
+ * @since 9
  */
 public class JdiInitiator {
 
@@ -66,16 +68,20 @@
      * Start the remote agent and establish a JDI connection to it.
      *
      * @param port the socket port for (non-JDI) commands
-     * @param remoteVMOptions any user requested VM options
+     * @param remoteVMOptions any user requested VM command-line options
      * @param remoteAgent full class name of remote agent to launch
      * @param isLaunch does JDI do the launch? That is, LaunchingConnector,
      * otherwise we start explicitly and use ListeningConnector
      * @param host explicit hostname to use, if null use discovered
      * hostname, applies to listening only (!isLaunch)
-     * @param timeout the start-up time-out in milliseconds
+     * @param timeout the start-up time-out in milliseconds. If zero or negative,
+     * will not wait thus will timeout immediately if not already started.
+     * @param customConnectorArgs custom arguments passed to the connector.
+     * These are JDI com.sun.jdi.connect.Connector arguments.
      */
     public JdiInitiator(int port, List<String> remoteVMOptions, String remoteAgent,
-            boolean isLaunch, String host, int timeout) {
+            boolean isLaunch, String host, int timeout,
+            Map<String, String> customConnectorArgs) {
         this.remoteAgent = remoteAgent;
         this.connectTimeout = (int) (timeout * CONNECT_TIMEOUT_FACTOR);
         String connectorName
@@ -96,6 +102,7 @@
                 argumentName2Value.put("localAddress", host);
             }
         }
+        argumentName2Value.putAll(customConnectorArgs);
         this.connectorArgs = mergeConnectorArgs(connector, argumentName2Value);
         this.vm = isLaunch
                 ? launchTarget()
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java	Mon Mar 13 19:58:52 2017 +0000
@@ -34,6 +34,8 @@
  * This interface specifies the loading specific subset of
  * {@link jdk.jshell.spi.ExecutionControl}.  For use in encapsulating the
  * {@link java.lang.ClassLoader} implementation.
+ *
+ * @since 9
  */
 public interface LoaderDelegate {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -33,6 +33,7 @@
  * in the same JVM as the JShell-core.
  *
  * @author Grigory Ptashko
+ * @since 9
  */
 public class LocalExecutionControl extends DirectExecutionControl {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControlProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControlProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -32,7 +32,9 @@
 
 /**
  * A provider of execution engines which run in the same process as JShell.
+ *
  * @author Robert Field
+ * @since 9
  */
 public class LocalExecutionControlProvider implements ExecutionControlProvider{
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -45,6 +45,7 @@
  *
  * @author Jan Lahoda
  * @author Robert Field
+ * @since 9
  */
 public class RemoteExecutionControl extends DirectExecutionControl implements ExecutionControl {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -37,6 +37,7 @@
  * execution takes place.
  *
  * @author Robert Field
+ * @since 9
  */
 public class StreamingExecutionControl implements ExecutionControl {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java	Mon Mar 13 19:58:52 2017 +0000
@@ -53,6 +53,7 @@
  *
  * @author Jan Lahoda
  * @author Robert Field
+ * @since 9
  */
 public class Util {
 
@@ -60,7 +61,7 @@
     private static final int TAG_CLOSED = 1;
     private static final int TAG_EXCEPTION = 2;
 
-    // never instanciated
+    // never instantiated
     private Util() {}
 
     /**
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -30,5 +30,7 @@
  * Also, provides related communication utilities.
  * This package may be used to define alternative execution engines.
  * The default JShell execution engine is included.
+ *
+ * @since 9
  */
 package jdk.jshell.execution;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -140,6 +140,8 @@
  * provide source boundary and completeness analysis to address cases like
  * those.  <code>SourceCodeAnalysis</code> also provides suggested completions
  * of input, as might be used in tab-completion.
+ *
+ * @since 9
  */
 
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -45,6 +45,8 @@
  * <p>
  * Methods defined in this interface should only be called by the core JShell
  * implementation.
+ *
+ * @since 9
  */
 public interface ExecutionControl extends AutoCloseable {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControlProvider.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControlProvider.java	Mon Mar 13 19:58:52 2017 +0000
@@ -33,7 +33,9 @@
  * evaluate Snippets.  Alternate execution engines can be created by
  * implementing this interface, then configuring JShell with the provider or
  * the providers name and parameter specifier.
+ *
  * @author Robert Field
+ * @since 9
  */
 public interface ExecutionControlProvider {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionEnv.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionEnv.java	Mon Mar 13 19:58:52 2017 +0000
@@ -36,6 +36,7 @@
  * This interface is designed to provide the access to core JShell functionality
  * needed to implement ExecutionControl.
  *
+ * @since 9
  * @see ExecutionControl
  */
 public interface ExecutionEnv {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/SPIResolutionException.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/SPIResolutionException.java	Mon Mar 13 19:58:52 2017 +0000
@@ -33,6 +33,8 @@
  * <p>
  * This exception is seen by the execution engine, but not seen by
  * the end user nor through the JShell API.
+ *
+ * @since 9
  */
 @SuppressWarnings("serial")             // serialVersionUID intentionally omitted
 public class SPIResolutionException extends RuntimeException {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -66,6 +66,7 @@
  *   <li>failover:1(jdi),2(jdi:launch(true),timeout(3000)),3(local)</li>
  * </ul>
  *
+ * @since 9
  * @see jdk.jshell.execution for execution implementation support
  */
 package jdk.jshell.spi;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/JavaShellToolBuilder.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/JavaShellToolBuilder.java	Mon Mar 13 19:58:52 2017 +0000
@@ -40,6 +40,8 @@
  * configuration methods have sensible defaults which will be used if they are
  * not called.. After zero or more calls to configuration methods, the tool is
  * launched with a call to {@link #run(java.lang.String...) }.
+ *
+ * @since 9
  */
 public interface JavaShellToolBuilder {
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/package-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -47,6 +47,8 @@
  *             .run("--feedback", "silent", "MyStart");
  * }
  * </pre>
+ *
+ * @since 9
  */
 
 
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/resources/PRINTING.jsh	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/resources/PRINTING.jsh	Mon Mar 13 19:58:52 2017 +0000
@@ -17,5 +17,5 @@
 void println(char s[]) { System.out.println(s); }
 void println(String s) { System.out.println(s); }
 void println(Object obj) { System.out.println(obj); }
-void printf(Locale l, String format, Object... args) { System.out.printf(l, format, args); }
+void printf(java.util.Locale l, String format, Object... args) { System.out.printf(l, format, args); }
 void printf(String format, Object... args) { System.out.printf(format, args); }
--- a/langtools/src/jdk.jshell/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -51,6 +51,8 @@
  *     independent, operate at different levels, and do not share functionality or
  *     definitions.
  * </p>
+ *
+ * @since 9
  */
 module jdk.jshell {
     requires transitive java.compiler;
--- a/langtools/test/ProblemList.txt	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/ProblemList.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -36,7 +36,7 @@
 #
 # jshell
 
-jdk/jshell/UserJdiUserRemoteTest.java                                           8173204    linux-all
+jdk/jshell/UserJdiUserRemoteTest.java                                           8173079    linux-all
 jdk/jshell/UserInputTest.java                                                   8169536    generic-all   
 
 ###########################################################################
--- a/langtools/test/com/sun/javadoc/testNonInlineHtmlTagRemoval/C.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/com/sun/javadoc/testNonInlineHtmlTagRemoval/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -71,4 +71,9 @@
      * caseA <ul type='"a">b'> <li> end of sentence. <li> more </ul>
      */
     public void caseA() {}
+
+    /**
+     * caseB <blockquote>A block quote example:</blockquote>
+     */
+    public void caseB() {}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testNonInlineHtmlTagRemoval/Negative.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 Negative {
+    /**
+     * case1: A hanging &lt;  : <blockquote>xx</blockquote><
+     */
+    public void case1() {}
+}
--- a/langtools/test/com/sun/javadoc/testNonInlineHtmlTagRemoval/TestNonInlineHtmlTagRemoval.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/com/sun/javadoc/testNonInlineHtmlTagRemoval/TestNonInlineHtmlTagRemoval.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8048628
+ * @bug      8048628 8174715
  * @summary  Verify html inline tags are removed correctly in the first sentence.
  * @library  ../lib
  * @modules jdk.javadoc
@@ -39,22 +39,34 @@
     }
 
     @Test
-    void test() {
-        javadoc("-d", "out",
+    void testPositive() {
+        javadoc("-d", "out1",
                 "-sourcepath", testSrc,
                 testSrc("C.java"));
         checkExit(Exit.OK);
 
         checkOutput("C.html", true,
-                "<div class=\"block\">case1 end of sentence.</div>",
-                "<div class=\"block\">case2 end of sentence.</div>",
-                "<div class=\"block\">case3 end of sentence.</div>",
-                "<div class=\"block\">case4 end of sentence.</div>",
-                "<div class=\"block\">case5 end of sentence.</div>",
-                "<div class=\"block\">case6 end of sentence.</div>",
-                "<div class=\"block\">case7 end of sentence.</div>",
-                "<div class=\"block\">case8 end of sentence.</div>",
-                "<div class=\"block\">case9 end of sentence.</div>",
-                "<div class=\"block\">caseA end of sentence.</div>");
+                "<div class=\"block\">case1   end of sentence.</div>",
+                "<div class=\"block\">case2   end of sentence.</div>",
+                "<div class=\"block\">case3   end of sentence.</div>",
+                "<div class=\"block\">case4   end of sentence.</div>",
+                "<div class=\"block\">case5   end of sentence.</div>",
+                "<div class=\"block\">case6   end of sentence.</div>",
+                "<div class=\"block\">case7   end of sentence.</div>",
+                "<div class=\"block\">case8   end of sentence.</div>",
+                "<div class=\"block\">case9   end of sentence.</div>",
+                "<div class=\"block\">caseA   end of sentence.</div>",
+                "<div class=\"block\">caseB A block quote example:</div>");
+    }
+
+    @Test
+    void testNegative() {
+        javadoc("-d", "out2",
+                "-sourcepath", testSrc,
+                testSrc("Negative.java"));
+        checkExit(Exit.FAILED);
+
+        checkOutput("Negative.html", true,
+                "<div class=\"block\">case1: A hanging &lt;  : xx<</div>");
     }
 }
--- a/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707
+ * @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743
  * @summary Test the version of HTML generated by the javadoc tool.
  * @author bpatel
  * @library ../lib
@@ -710,6 +710,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<table class=\"constantsSummary\" summary=\"Constant Field Values table, listing constant fields, and values\">");
 
@@ -723,6 +727,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">\n"
                 + "<h1 title=\"Deprecated API\" class=\"title\">Deprecated API</h1>\n"
                 + "<h2 title=\"Contents\">Contents</h2>",
@@ -747,6 +755,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<li class=\"blockList\">\n"
                 + "<h2 title=\"Package\">Package&nbsp;pkg</h2>");
@@ -761,6 +773,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<div class=\"contentContainer\">\n"
                 + "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>",
@@ -779,6 +795,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"contentContainer\">");
 
         // Negated test for src-html page
@@ -797,6 +817,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
@@ -1005,6 +1029,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">",
                 "<li class=\"blockList\"><a name=\"pkg\">\n"
@@ -1123,6 +1151,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<table class=\"constantsSummary\" summary=\"Constant Field Values table, listing constant fields, and values\">");
 
@@ -1136,6 +1168,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">\n"
                 + "<h1 title=\"Deprecated API\" class=\"title\">Deprecated API</h1>\n"
                 + "<h2 title=\"Contents\">Contents</h2>",
@@ -1160,6 +1196,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<li class=\"blockList\">\n"
                 + "<h2 title=\"Package\">Package&nbsp;pkg</h2>");
@@ -1175,6 +1215,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<h1 class=\"title\">Hierarchy For All Packages</h1>\n"
                 + "<span class=\"packageHierarchyLabel\">Package Hierarchies:</span>",
@@ -1195,6 +1239,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"contentContainer\">");
 
         // Test for src-html page
@@ -1213,6 +1261,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
@@ -1421,6 +1473,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">",
                 "<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">",
                 "<li class=\"blockList\"><a name=\"pkg\">\n"
--- a/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985 8151921
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985 8151921 8151743
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib
@@ -47,7 +47,11 @@
         checkExit(Exit.OK);
 
         checkOutput("pkg/C.html", true,
-                "<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>");
+                "<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>",
+                "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>");
 
         checkOutput("TestJavascript.html", true,
                 "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>");
@@ -119,5 +123,10 @@
                 + "    }\n"
                 + "    catch(err) {\n"
                 + "    }");
+
+        checkOutput("script.js", true,
+                "$(window).resize(function() {\n"
+                + "        $('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "    });");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testMissingType/TestMissingType.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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      8173804
+ * @summary  make sure doclet can handle missing types
+ * @library  ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester
+ * @run main TestMissingType
+ */
+
+public class TestMissingType extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestMissingType tester = new TestMissingType();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-use",
+                "-sourcepath", testSrc,
+                "p");
+        checkExit(Exit.OK);
+        checkFiles(true, "p/class-use/MissingType.html");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testMissingType/p/MissingType.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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;
+
+public final class MissingType  {
+    /**
+     * Do something with a missing type.
+     *
+     * @param out use the missing type
+     */
+    public void encode(MissingMe out) {}
+}
--- a/langtools/test/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug      4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188
+ * @bug      4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743
  * @summary  Make sure the Next/Prev Class links iterate through all types.
  *           Make sure the navagation is 2 columns, not 3.
  * @author   jamieh
@@ -77,12 +77,20 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<!-- ======== START OF CLASS DATA ======== -->");
 
         checkOutput("pkg/package-summary.html", true,
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">");
     }
 
@@ -98,6 +106,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "</nav>\n"
                 + "</header>\n"
                 + "<!-- ======== START OF CLASS DATA ======== -->");
@@ -106,6 +118,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "</nav>");
     }
 
@@ -121,12 +137,20 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<!-- ======== START OF CLASS DATA ======== -->");
 
         checkOutput("pkg/package-summary.html", false,
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "<div class=\"header\">");
     }
 
@@ -142,6 +166,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "</nav>\n"
                 + "</header>\n"
                 + "<!-- ======== START OF CLASS DATA ======== -->");
@@ -150,6 +178,10 @@
                 "<!-- ========= END OF TOP NAVBAR ========= -->\n"
                 + "</div>\n"
                 + "<div class=\"navPadding\">&nbsp;</div>\n"
+                + "<script type=\"text/javascript\"><!--\n"
+                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+                + "//-->\n"
+                + "</script>\n"
                 + "</nav>");
     }
 }
--- a/langtools/test/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/C.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -71,4 +71,9 @@
      * caseA <ul type='"a">b'> <li> end of sentence. <li> more </ul>
      */
     public void caseA() {}
+
+    /**
+     * caseB <blockquote>A block quote example:</blockquote>
+     */
+    public void caseB() {}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/Negative.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 Negative {
+    /**
+     * case1: A hanging &lt;  : <blockquote>xx</blockquote><
+     */
+    public void case1() {}
+}
--- a/langtools/test/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/TestNonInlineHtmlTagRemoval.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/TestNonInlineHtmlTagRemoval.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8048628
+ * @bug      8048628 8174715
  * @summary  Verify html inline tags are removed correctly in the first sentence.
  * @library  ../lib
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -39,8 +39,8 @@
     }
 
     @Test
-    void test() {
-        javadoc("-d", "out",
+    void testPositive() {
+        javadoc("-d", "out1",
                 "-sourcepath", testSrc,
                 testSrc("C.java"));
         checkExit(Exit.OK);
@@ -55,6 +55,18 @@
                 "<div class=\"block\">case7   end of sentence.</div>",
                 "<div class=\"block\">case8   end of sentence.</div>",
                 "<div class=\"block\">case9   end of sentence.</div>",
-                "<div class=\"block\">caseA   end of sentence.</div>");
+                "<div class=\"block\">caseA   end of sentence.</div>",
+                "<div class=\"block\">caseB A block quote example:</div>");
+    }
+
+    @Test
+    void testNegative() {
+        javadoc("-d", "out2",
+                "-sourcepath", testSrc,
+                testSrc("Negative.java"));
+        checkExit(Exit.ERROR);
+
+        checkOutput("Negative.html", true,
+                "<div class=\"block\">case1: A hanging &lt;  : xx<</div>");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverridenMethods/TestBadOverride.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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      8174839
+ * @summary  Bad overriding method should not crash
+ * @library  ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester
+ * @run main TestBadOverride
+ */
+
+public class TestBadOverride extends JavadocTester {
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String... args) throws Exception {
+        TestBadOverride tester = new TestBadOverride();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg4");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg4/Foo.html", true,
+                "<li class=\"blockList\">\n"
+                + "<h4>toString</h4>\n"
+                + "<pre>public&nbsp;void&nbsp;toString()</pre>\n"
+                + "<div class=\"block\">Why can't I do this ?</div>\n"
+                + "</li>");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverridenMethods/pkg4/Foo.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 pkg4;
+
+public class Foo {
+    /**
+     * Why can't I do this ?
+     */
+    public void toString() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/TestOverview.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173302
+ * @summary make sure the overview-summary and module-summary pages don't
+ *          don't have the See link, and the overview is copied correctly.
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestOverview
+ */
+
+public class TestOverview extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestOverview tester = new TestOverview();
+        tester.runTests();
+    }
+
+    @Test
+    void test1() {
+        javadoc("-d", "out-1",
+                    "-doctitle", "Document Title",
+                    "-windowtitle", "Window Title",
+                    "-overview", testSrc("overview.html"),
+                    "-sourcepath", testSrc("src"),
+                    "p1", "p2");
+        checkExit(Exit.OK);
+        checkOutput("overview-summary.html", true,
+                "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>\n"
+                + "</div>\n"
+                + "<div class=\"contentContainer\">\n"
+                + "<div class=\"block\">This is line1. This is line 2.</div>\n"
+                + "</div>\n"
+                + "<div class=\"contentContainer\">"
+        );
+    }
+
+    @Test
+    void test2() {
+        javadoc("-d", "out-2",
+                    "-doctitle", "Document Title",
+                    "-windowtitle", "Window Title",
+                    "-overview", testSrc("overview.html"),
+                    "-sourcepath", testSrc("msrc"),
+                    "p1", "p2");
+        checkExit(Exit.OK);
+        checkOutput("overview-summary.html", true,
+                "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>\n"
+                + "</div>\n"
+                + "<div class=\"contentContainer\">\n"
+                + "<div class=\"block\">This is line1. This is line 2.</div>\n"
+                + "</div>\n"
+                + "<div class=\"contentContainer\">"
+        );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/msrc/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+  *  Test module acme.
+  */
+module acme {
+    exports p1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/msrc/p1/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 p1;
+
+public class C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/msrc/p2/C2.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 p2;
+
+public class C2 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/overview.html	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<body bgcolor="white">
+    This is line1. This is line 2.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/src/p1/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 p1;
+
+public class C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testOverview/src/p2/C2.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 p2;
+
+public class C2 {}
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141492 8071982 8141636 8147890 8166175
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965
  * @summary Test the search feature of javadoc.
  * @author bpatel
  * @library ../lib
@@ -486,6 +486,9 @@
         checkOutput("search.js", true,
                 "camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join(\"([a-z0-9_$]*?)\");",
                 "var camelCaseMatcher = new RegExp(\"^\" + camelCaseRegexp);",
-                "camelCaseMatcher.test(item.l)");
+                "camelCaseMatcher.test(item.l)",
+                "var secondaryresult = new Array();",
+                "function nestedName(e) {",
+                "function sortAndConcatResults(a1, a2) {");
     }
 }
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196
+ * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -159,7 +159,10 @@
                 + "    float:none;\n"
                 + "    display:inline;\n"
                 + "}",
-                "@import url('resources/fonts/dejavu.css');");
+                "@import url('resources/fonts/dejavu.css');",
+                ".navPadding {\n"
+                + "    padding-top: 107px;\n"
+                + "}");
 
         // Test whether a link to the stylesheet file is inserted properly
         // in the class documentation.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testTypeVariableLinks/TestTypeVariableLinks.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8174805
+ * @summary JavacTrees should use Types.skipTypeVars() to get the upper bound of type variables
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestTypeVariableLinks
+ */
+
+public class TestTypeVariableLinks extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestTypeVariableLinks tester = new TestTypeVariableLinks();
+        tester.runTests();
+    }
+
+    @Test
+    void test1() {
+        javadoc("-d", "out", "-sourcepath", testSrc, "-package", "pkg1");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg1/C.html", true,
+                "<div class=\"block\">Linking to Object.equals() <code>Object.equals(Object)</code></div>");
+        checkOutput("pkg1/C.html", true,
+                "<div class=\"block\">Linking to List.clear() <code>List.clear()</code></div>");
+        checkOutput("pkg1/C.html", true,
+                "<div class=\"block\">Linking to Additional.doAction() <a href=\"../pkg1/Additional.html#doAction--\"><code>Additional.doAction()</code></a></div>");
+        checkOutput("pkg1/C.html", true,
+                "<div class=\"block\">Linking to I.abstractAction() <a href=\"../pkg1/I.html#abstractAction--\"><code>I.abstractAction()</code></a></div>");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testTypeVariableLinks/pkg1/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+import java.util.List;
+
+public class C<T, F extends List<String>, G extends Additional & I> {
+    /**
+     * Linking to Object.equals() {@link T#equals(Object)}
+     */
+    public void m1() {}
+    /**
+     * Linking to List.clear() {@link F#clear()}
+     */
+    public void m2() {}
+    /**
+     * Linking to Additional.doAction() {@link G#doAction()}
+     */
+    public void m3() {}
+    /**
+     * Linking to I.abstractAction() {@link G#abstractAction()}
+     */
+    public void m4() {}
+}
+
+class Additional {
+    public void doAction() {}
+}
+
+interface I {
+    void abstractAction();
+}
--- a/langtools/test/jdk/javadoc/doclet/testXOption/TestXOption.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testXOption/TestXOption.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,16 @@
     }
 
     @Test
+    void testWithHelpExtraOption() {
+        javadoc("-d", "out1",
+                "-sourcepath", testSrc,
+                "--help-extra",
+                testSrc("TestXOption.java"));
+        checkExit(Exit.OK);
+        checkOutput(true);
+    }
+
+    @Test
     void testWithOption() {
         javadoc("-d", "out1",
                 "-sourcepath", testSrc,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/tool/api/basic/AddModulesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173596
+ * @summary DocumentationTool.DocumentationTask should support addModules
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @library /tools/lib
+ * @build APITest toolbox.JavacTask toolbox.ToolBox
+ * @run main AddModulesTest
+ */
+
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import javax.tools.DocumentationTool;
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.DocumentationTool.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import toolbox.Assert;
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
+/**
+ * Tests for DocumentationTask.addModules method.
+ */
+public class AddModulesTest extends APITest {
+    public static void main(String... args) throws Exception {
+        new AddModulesTest().run();
+    }
+
+    private final ToolBox tb = new ToolBox();
+
+    /**
+     * Verify that addModules works as expected.
+     */
+    @Test
+    public void testAddModules() throws Exception {
+        Path base = Paths.get("testAddModules");
+        Path src = base.resolve("src");
+
+        // setup some utility modules
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports p1; }",
+                          "package p1; public class C1 { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { exports p2; }",
+                          "package p2; public class C2 { }");
+        Path modules = base.resolve("modules");
+        tb.createDirectories(modules);
+
+        new JavacTask(tb)
+                .options("--module-source-path", src.toString())
+                .outdir(modules)
+                .files(tb.findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        // now test access to the modules
+        Path src2 = base.resolve("src2");
+        tb.writeJavaFiles(src2,
+                          "public class Dummy { p1.C1 c1; p2.C2 c2; }");
+        Path api = base.resolve("api");
+        tb.createDirectories(api);
+
+        DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
+        try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
+            fm.setLocationFromPaths(StandardLocation.MODULE_PATH, Arrays.asList(modules));
+            fm.setLocationFromPaths(Location.DOCUMENTATION_OUTPUT, Arrays.asList(api));
+            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(tb.findJavaFiles(src2));
+
+            for (boolean useOption : new boolean[] { false, true }) {
+                System.err.println("Use --add-modules option: " + useOption);
+                StringWriter sw = new StringWriter();
+                DocumentationTask t = tool.getTask(sw, fm, null, null, null, files);
+                if (useOption) {
+                    t.addModules(Arrays.asList("m1x", "m2x"));
+                }
+                String out;
+                boolean ok;
+                try {
+                    ok = t.call();
+                } finally {
+                    out = sw.toString();
+                    System.err.println(out);
+                }
+                System.err.println("ok: " + ok);
+                boolean expectErrors = !useOption;
+                check(out, "package p1 is not visible", expectErrors);
+                check(out, "package p2 is not visible", expectErrors);
+                System.err.println();
+            }
+        }
+    }
+
+    void check(String out, String text, boolean expected) {
+        System.err.println("Checking for "
+            + (expected ? "expected" : "unexpected")
+            + " text: " + text);
+
+        if (expected) {
+            if (!out.contains(text)) {
+                error("expected text not found: " + text);
+            }
+        } else {
+            if (out.contains(text)) {
+                error("unexpected text found: " + text);
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/FileManagerTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173845
+ * @summary test custom file managers
+ * @build KullaTesting TestingInputStream
+ * @run testng FileManagerTest
+ */
+
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.Set;
+import javax.tools.ForwardingJavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
+import javax.tools.StandardJavaFileManager;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+
+@Test
+public class FileManagerTest extends KullaTesting {
+
+    boolean encountered;
+
+    class MyFileManager extends ForwardingJavaFileManager<StandardJavaFileManager>
+            implements StandardJavaFileManager {
+
+        protected MyFileManager(StandardJavaFileManager fileManager) {
+            super(fileManager);
+        }
+
+        @Override
+        public Iterable<JavaFileObject> list(Location location,
+                String packageName,
+                Set<Kind> kinds,
+                boolean recurse)
+                throws IOException {
+            //System.out.printf("list(%s, %s, %s, %b)\n",
+            //        location, packageName, kinds, recurse);
+            if (packageName.equals("java.lang.reflect")) {
+                encountered = true;
+            }
+            return fileManager.list(location, packageName, kinds, recurse);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
+            return fileManager.getJavaFileObjectsFromFiles(files);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
+            return fileManager.getJavaFileObjects(files);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
+            return fileManager.getJavaFileObjectsFromStrings(names);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
+            return fileManager.getJavaFileObjects(names);
+        }
+
+        @Override
+        public void setLocation(Location location, Iterable<? extends File> files) throws IOException {
+            fileManager.setLocation(location, files);
+        }
+
+        @Override
+        public Iterable<? extends File> getLocation(Location location) {
+            return fileManager.getLocation(location);
+        }
+
+    }
+
+    @BeforeMethod
+    @Override
+    public void setUp() {
+        setUp(b -> b.fileManager(fm -> new MyFileManager(fm)));
+    }
+
+    public void testSnippetMemberAssignment() {
+        assertEval("java.lang.reflect.Array.get(new String[1], 0) == null");
+        assertTrue(encountered, "java.lang.reflect not encountered");
+    }
+
+}
--- a/langtools/test/jdk/jshell/JavadocTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/JavadocTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8131019 8169561
+ * @bug 8131019 8169561 8174245
  * @summary Test Javadoc
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -107,4 +107,51 @@
         addToClasspath(compiler.getClassDir());
     }
 
+    public void testCollectionsMin() {
+        prepareJavaUtilZip();
+        assertJavadoc("java.util.Collections.min(|",
+                      "T java.util.Collections.<T>min(java.util.Collection<? extends T> coll, java.util.Comparator<? super T> comp)\n" +
+                       " min comparator\n",
+                       "T java.util.Collections.<T extends Object & Comparable<? super T>>min(java.util.Collection<? extends T> coll)\n" +
+                       " min comparable\n");
+    }
+
+    private void prepareJavaUtilZip() {
+        String clazz =
+                "package java.util;\n" +
+                "/**Top level." +
+                " */\n" +
+                "public class Collections {\n" +
+                "    /**\n" +
+                "     * min comparable\n" +
+                "     */\n" +
+                "    public static <T extends Object & Comparable<? super T>> T min(Collection<? extends T> coll) {" +
+                "        return null;\n" +
+                "    }\n" +
+                "    /**\n" +
+                "     * min comparator\n" +
+                "     */\n" +
+                "        public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {\n" +
+                "        return null;\n" +
+                "    }\n" +
+                "}\n";
+
+        Path srcZip = Paths.get("src.zip");
+
+        try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(srcZip))) {
+            out.putNextEntry(new JarEntry("java/util/Collections.java"));
+            out.write(clazz.getBytes());
+        } catch (IOException ex) {
+            throw new IllegalStateException(ex);
+        }
+
+        try {
+            Field availableSources = getAnalysis().getClass().getDeclaredField("availableSources");
+            availableSources.setAccessible(true);
+            availableSources.set(getAnalysis(), Arrays.asList(srcZip));
+        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
+            throw new IllegalStateException(ex);
+        }
+    }
+
 }
--- a/langtools/test/jdk/jshell/KullaTesting.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/KullaTesting.java	Mon Mar 13 19:58:52 2017 +0000
@@ -213,7 +213,7 @@
         ModuleFinder finder = ModuleFinder.of(modPath);
         Layer parent = Layer.boot();
         Configuration cf = parent.configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of(moduleName));
+                .resolve(finder, ModuleFinder.of(), Set.of(moduleName));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
         Layer layer = parent.defineModulesWithOneLoader(cf, scl);
         ClassLoader loader = layer.findLoader(moduleName);
--- a/langtools/test/jdk/jshell/MyExecutionControl.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/MyExecutionControl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -29,6 +29,7 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -78,7 +79,7 @@
                     + System.getProperty("path.separator")
                     + System.getProperty("user.dir"));
             JdiInitiator jdii = new JdiInitiator(port,
-                    opts, REMOTE_AGENT, true, null, TIMEOUT);
+                    opts, REMOTE_AGENT, true, null, TIMEOUT, Collections.emptyMap());
             VirtualMachine vm = jdii.vm();
             Process process = jdii.process();
 
--- a/langtools/test/jdk/jshell/ReplToolTesting.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/ReplToolTesting.java	Mon Mar 13 19:58:52 2017 +0000
@@ -72,27 +72,27 @@
     final static List<String> START_UP_CMD_METHOD = Stream.<String>of()
                     .collect(toList());
     final static List<String> PRINTING_CMD_METHOD = Stream.of(
-            "|    print (boolean)void",
-            "|    print (char)void",
-            "|    print (int)void",
-            "|    print (long)void",
-            "|    print (float)void",
-            "|    print (double)void",
-            "|    print (char s[])void",
-            "|    print (String)void",
-            "|    print (Object)void",
-            "|    println ()void",
-            "|    println (boolean)void",
-            "|    println (char)void",
-            "|    println (int)void",
-            "|    println (long)void",
-            "|    println (float)void",
-            "|    println (double)void",
-            "|    println (char s[])void",
-            "|    println (String)void",
-            "|    println (Object)void",
-            "|    printf (Locale,String,Object...)void",
-            "|    printf (String,Object...)void")
+            "|    void print(boolean)",
+            "|    void print(char)",
+            "|    void print(int)",
+            "|    void print(long)",
+            "|    void print(float)",
+            "|    void print(double)",
+            "|    void print(char s[])",
+            "|    void print(String)",
+            "|    void print(Object)",
+            "|    void println()",
+            "|    void println(boolean)",
+            "|    void println(char)",
+            "|    void println(int)",
+            "|    void println(long)",
+            "|    void println(float)",
+            "|    void println(double)",
+            "|    void println(char s[])",
+            "|    void println(String)",
+            "|    void println(Object)",
+            "|    void printf(java.util.Locale,String,Object...)",
+            "|    void printf(String,Object...)")
             .collect(toList());
     final static List<String> START_UP = Collections.unmodifiableList(
             Stream.concat(START_UP_IMPORTS.stream(), START_UP_METHODS.stream())
@@ -152,6 +152,7 @@
         return s -> {
             List<String> lines = Stream.of(s.split("\n"))
                     .filter(l -> !l.isEmpty())
+                    .filter(l -> !l.startsWith("|     ")) // error/unresolved info
                     .collect(Collectors.toList());
             assertEquals(lines.size(), set.size(), message + " : expected: " + set.keySet() + "\ngot:\n" + lines);
             for (String line : lines) {
@@ -664,7 +665,12 @@
 
         @Override
         public String toString() {
-            return String.format("%s %s", name, signature);
+            int i = signature.lastIndexOf(")") + 1;
+            if (i <= 0) {
+                return String.format("%s", name);
+            } else {
+                return String.format("%s %s%s", signature.substring(i), name, signature.substring(0, i));
+            }
         }
     }
 
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405
+ * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405 8174796 8174797
  * @summary Tests for Basic tests for REPL tool
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -35,6 +35,7 @@
  * @run testng/timeout=600 ToolBasicTest
  */
 
+import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -272,23 +273,58 @@
         );
     }
 
-    public void testClasspathJar() {
+    private String makeSimpleJar() {
         Compiler compiler = new Compiler();
         Path outDir = Paths.get("testClasspathJar");
         compiler.compile(outDir, "package pkg; public class A { public String toString() { return \"A\"; } }");
         String jarName = "test.jar";
         compiler.jar(outDir, jarName, "pkg/A.class");
-        Path jarPath = compiler.getPath(outDir).resolve(jarName);
+        return compiler.getPath(outDir).resolve(jarName).toString();
+    }
+
+    public void testClasspathJar() {
+        String jarPath = makeSimpleJar();
         test(
                 (a) -> assertCommand(a, "/env --class-path " + jarPath,
                         "|  Setting new options and restoring state."),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
-        test(new String[] { "--class-path", jarPath.toString() },
+        test(new String[] { "--class-path", jarPath },
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
     }
 
+    public void testClasspathUserHomeExpansion() {
+        String jarPath = makeSimpleJar();
+        String tilde = "~" + File.separator;
+        test(
+                (a) -> assertCommand(a, "/env --class-path " + tilde + "forblato",
+                        "|  File '" + System.getProperty("user.home") + File.separator
+                                + "forblato' for '--class-path' is not found."),
+                (a) -> assertCommand(a, "/env --class-path " + jarPath + File.pathSeparator
+                                                            + tilde + "forblato",
+                        "|  File '" + System.getProperty("user.home") + File.separator
+                                + "forblato' for '--class-path' is not found.")
+        );
+    }
+
+    public void testBadClasspath() {
+        String jarPath = makeSimpleJar();
+        Compiler compiler = new Compiler();
+        Path t1 = compiler.getPath("whatever/thing.zip");
+        compiler.writeToFile(t1, "");
+        Path t2 = compiler.getPath("whatever/thing.jmod");
+        compiler.writeToFile(t2, "");
+        test(
+                (a) -> assertCommand(a, "/env --class-path " + t1.toString(),
+                        "|  Invalid '--class-path' argument: " + t1.toString()),
+                (a) -> assertCommand(a, "/env --class-path " + jarPath + File.pathSeparator + t1.toString(),
+                        "|  Invalid '--class-path' argument: " + t1.toString()),
+                (a) -> assertCommand(a, "/env --class-path " + t2.toString(),
+                        "|  Invalid '--class-path' argument: " + t2.toString())
+        );
+    }
+
     public void testModulePath() {
         Compiler compiler = new Compiler();
         Path modsDir = Paths.get("mods");
@@ -304,6 +340,25 @@
         );
     }
 
+    public void testModulePathUserHomeExpansion() {
+        String tilde = "~" + File.separatorChar;
+        test(
+                (a) -> assertCommand(a, "/env --module-path " + tilde + "snardugol",
+                        "|  File '" + System.getProperty("user.home")
+                                + File.separatorChar + "snardugol' for '--module-path' is not found.")
+        );
+    }
+
+    public void testBadModulePath() {
+        Compiler compiler = new Compiler();
+        Path t1 = compiler.getPath("whatever/thing.zip");
+        compiler.writeToFile(t1, "");
+        test(
+                (a) -> assertCommand(a, "/env --module-path " + t1.toString(),
+                        "|  Invalid '--module-path' argument: " + t1.toString())
+        );
+    }
+
     public void testStartupFileOption() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("StartupFileOption/startup.txt");
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -92,8 +92,8 @@
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
+                a -> assertMethod(a, "int b() { return 0; }", "()int", "b"),
+                a -> dropMethod(a, "/drop b", "int b()", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> dropClass(a, "/dr A", "class A", "|  dropped class A"),
                 a -> assertCommand(a, "/reload",
@@ -115,8 +115,8 @@
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/dr 1", "int a = 0", "|  dropped variable a"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
+                a -> assertMethod(a, "int b() { return 0; }", "()int", "b"),
+                a -> dropMethod(a, "/drop b", "int b()", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> dropClass(a, "/dr A", "class A", "|  dropped class A"),
                 a -> assertCommand(a, "/reload -quiet",
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -212,6 +212,14 @@
     }
 
     @Test
+    public void testInvalidClassPath() {
+        test(
+                a -> assertCommand(a, "/env --class-path snurgefusal",
+                        "|  File 'snurgefusal' for '--class-path' is not found.")
+        );
+    }
+
+    @Test
     public void testNoArgument() {
         test(
                 (a) -> assertCommand(a, "/save",
@@ -238,8 +246,8 @@
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/drop 1", "int a = 0", "|  dropped variable a"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop 2", "b ()I", "|  dropped method b()"),
+                a -> assertMethod(a, "int b() { return 0; }", "()int", "b"),
+                a -> dropMethod(a, "/drop 2", "int b()", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> dropClass(a, "/drop 3", "class A", "|  dropped class A"),
                 a -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"),
@@ -255,8 +263,8 @@
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
                 a -> dropVariable(a, "/drop a", "int a = 0", "|  dropped variable a"),
-                a -> assertMethod(a, "int b() { return 0; }", "()I", "b"),
-                a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
+                a -> assertMethod(a, "int b() { return 0; }", "()int", "b"),
+                a -> dropMethod(a, "/drop b", "int b()", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> dropClass(a, "/drop A", "class A", "|  dropped class A"),
                 a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
@@ -466,10 +474,50 @@
                 a -> assertCommandCheckOutput(a, "/methods print println printf",
                         s -> checkLineToList(s, printingMethodList)),
                 a -> assertCommandOutputStartsWith(a, "/methods g",
-                        "|    g ()void"),
+                        "|    void g()"),
                 a -> assertCommandOutputStartsWith(a, "/methods f",
-                        "|    f ()int\n" +
-                        "|    f (int)void")
+                        "|    int f()\n" +
+                        "|    void f(int)")
+        );
+    }
+
+    @Test
+    public void testMethodsWithErrors() {
+        test(new String[]{"--no-startup"},
+                a -> assertCommand(a, "double m(int x) { return x; }",
+                        "|  created method m(int)"),
+                a -> assertCommand(a, "GARBAGE junk() { return TRASH; }",
+                        "|  created method junk(), however, it cannot be referenced until class GARBAGE, and variable TRASH are declared"),
+                a -> assertCommand(a, "int w = 5;",
+                        "w ==> 5"),
+                a -> assertCommand(a, "int tyer() { return w; }",
+                        "|  created method tyer()"),
+                a -> assertCommand(a, "String w = \"hi\";",
+                        "w ==> \"hi\""),
+                a -> assertCommand(a, "/methods",
+                        "|    double m(int)\n" +
+                        "|    GARBAGE junk()\n" +
+                        "|       which cannot be referenced until class GARBAGE, and variable TRASH are declared\n" +
+                        "|    int tyer()\n" +
+                        "|       which cannot be invoked until this error is corrected: \n" +
+                        "|          incompatible types: java.lang.String cannot be converted to int\n" +
+                        "|          int tyer() { return w; }\n" +
+                        "|                              ^\n")
+        );
+    }
+
+    @Test
+    public void testTypesWithErrors() {
+        test(new String[]{"--no-startup"},
+                a -> assertCommand(a, "class C extends NONE { int x; }",
+                        "|  created class C, however, it cannot be referenced until class NONE is declared"),
+                a -> assertCommand(a, "class D { void m() { System.out.println(nada); } }",
+                        "|  created class D, however, it cannot be instantiated or its methods invoked until variable nada is declared"),
+                a -> assertCommand(a, "/types",
+                        "|    class C\n" +
+                        "|       which cannot be referenced until class NONE is declared\n" +
+                        "|    class D\n" +
+                        "|       which cannot be instantiated or its methods invoked until variable nada is declared\n")
         );
     }
 
--- a/langtools/test/tools/javac/6627362/T6627362.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/6627362/T6627362.java	Mon Mar 13 19:58:52 2017 +0000
@@ -68,9 +68,9 @@
         // compile and disassemble E.java, using modified Object.java,
         // check for reference to System.arraycopy
         File x = new File(testSrc, "x");
-        String[] jcArgs = { "-d", ".", "-Xmodule:java.base",
+        String[] jcArgs = { "-d", ".", "--patch-module", "java.base=" + x.getAbsolutePath(),
                             new File(x, "E.java").getPath(),
-                            new File(x, "Object.java").getPath()};
+                            new File(new File(new File(x, "java"), "lang"), "Object.java").getPath()};
         compile(jcArgs);
 
         String[] jpArgs = { "-classpath", ".", "-c", "E" };
--- a/langtools/test/tools/javac/6627362/x/Object.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang;
-
-/*
- * Object, without clone()
- */
-public class Object {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6627362/x/java/lang/Object.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/*
+ * Object, without clone()
+ */
+public class Object {
+}
--- a/langtools/test/tools/javac/T4093617/T4093617.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/T4093617/T4093617.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,6 @@
  * @bug     4093617
  * @summary Object has no superclass
  * @author  Peter von der Ah\u00e9
- * @compile/module=java.base/fail/ref=T4093617.out -XDrawDiagnostics Object.java
+ * @compile/module=java.base/fail/ref=T4093617.out -XDrawDiagnostics java/lang/Object.java
  */
 
--- a/langtools/test/tools/javac/T4093617/java.base/Object.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-/*
- * /nodynamiccopyright/
- * See ../T4093617.java
- */
-
-package java.lang;
-
-class Object {
-    Object() { super(); }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T4093617/java.base/java/lang/Object.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,10 @@
+/*
+ * /nodynamiccopyright/
+ * See ../T4093617.java
+ */
+
+package java.lang;
+
+class Object {
+    Object() { super(); }
+}
--- a/langtools/test/tools/javac/T6234077.out	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/T6234077.out	Mon Mar 13 19:58:52 2017 +0000
@@ -1,2 +1,2 @@
-T6234077.java:7:8: compiler.err.class.public.should.be.in.file: Foo
+T6234077.java:7:8: compiler.err.class.public.should.be.in.file: kindname.class, Foo
 1 error
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java	Mon Mar 13 19:58:52 2017 +0000
@@ -107,7 +107,7 @@
         // by reflective lookup, to avoid explicit references that are not available
         // when running javac on JDK 8.
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Configuration",
-                "resolveRequiresAndUsesMethod", "configurationClass");
+                "resolveAndBindMethod", "configurationClass");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Layer",
                 "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod", "layerClass");
         ignore("com/sun/tools/javac/util/JDK9Wrappers$Module",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForClassTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,8 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8174027
+ * @summary error message should adapt to the corresponding top level element
+ * @compile/fail/ref=MessageForClassTest.out -XDrawDiagnostics MessageForClassTest.java
+ */
+
+public class MessageForClassTest_ {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForClassTest.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,2 @@
+MessageForClassTest.java:8:8: compiler.err.class.public.should.be.in.file: kindname.class, MessageForClassTest_
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForEnumTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,8 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8174027
+ * @summary error message should adapt to the corresponding top level element
+ * @compile/fail/ref=MessageForEnumTest.out -XDrawDiagnostics MessageForEnumTest.java
+ */
+
+public enum MessageForEnumTest_ {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForEnumTest.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,2 @@
+MessageForEnumTest.java:8:8: compiler.err.class.public.should.be.in.file: kindname.enum, MessageForEnumTest_
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForInterfaceTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,8 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8174027
+ * @summary error message should adapt to the corresponding top level element
+ * @compile/fail/ref=MessageForInterfaceTest.out -XDrawDiagnostics MessageForInterfaceTest.java
+ */
+
+public interface MessageForInterfaceTest_ {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8173955/MessageForInterfaceTest.out	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,2 @@
+MessageForInterfaceTest.java:8:8: compiler.err.class.public.should.be.in.file: kindname.interface, MessageForInterfaceTest_
+1 error
--- a/langtools/test/tools/javac/api/T6265137.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/api/T6265137.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
             String srcdir = System.getProperty("test.src");
             Iterable<? extends JavaFileObject> files =
                 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
-            javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
+            javac.getTask(null, fm, dl, Arrays.asList("-target","10"), null, files).call();
         }
     }
 }
--- a/langtools/test/tools/javac/api/T6395981.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/api/T6395981.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug     6395981 6458819 7025784 8028543
+ * @bug     6395981 6458819 7025784 8028543 8028544
  * @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
  * @author  Peter von der Ah\u00e9
  * @modules java.compiler
@@ -31,7 +31,7 @@
  * @run main/fail T6395981
  * @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
  * @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10
  */
 
 import java.util.EnumSet;
--- a/langtools/test/tools/javac/diags/Example.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/Example.java	Mon Mar 13 19:58:52 2017 +0000
@@ -63,6 +63,7 @@
         procFiles = new ArrayList<File>();
         srcPathFiles = new ArrayList<File>();
         moduleSourcePathFiles = new ArrayList<File>();
+        patchModulePathFiles = new ArrayList<File>();
         modulePathFiles = new ArrayList<File>();
         classPathFiles = new ArrayList<File>();
         additionalFiles = new ArrayList<File>();
@@ -88,6 +89,9 @@
                 } else if (files == srcFiles && c.getName().equals("modulesourcepath")) {
                     moduleSourcePathDir = c;
                     findFiles(c, moduleSourcePathFiles);
+                } else if (files == srcFiles && c.getName().equals("patchmodule")) {
+                    patchModulePathDir = c;
+                    findFiles(c, patchModulePathFiles);
                 } else if (files == srcFiles && c.getName().equals("additional")) {
                     additionalFilesDir = c;
                     findFiles(c, additionalFiles);
@@ -272,6 +276,16 @@
             files.addAll(nonEmptySrcFiles); // srcFiles containing declarations
         }
 
+        if (patchModulePathDir != null) {
+            for (File mod : patchModulePathDir.listFiles()) {
+                opts.add("--patch-module");
+                opts.add(mod.getName() + "=" + mod.getPath());
+            }
+            files = new ArrayList<>();
+            files.addAll(patchModulePathFiles);
+            files.addAll(nonEmptySrcFiles); // srcFiles containing declarations
+        }
+
         if (additionalFiles.size() > 0) {
             List<String> sOpts = Arrays.asList("-d", classesDir.getPath());
             new Jsr199Compiler(verbose).run(null, null, false, sOpts, additionalFiles);
@@ -343,9 +357,11 @@
     List<File> procFiles;
     File srcPathDir;
     File moduleSourcePathDir;
+    File patchModulePathDir;
     File additionalFilesDir;
     List<File> srcPathFiles;
     List<File> moduleSourcePathFiles;
+    List<File> patchModulePathFiles;
     List<File> modulePathFiles;
     List<File> classPathFiles;
     List<File> additionalFiles;
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Mon Mar 13 19:58:52 2017 +0000
@@ -5,6 +5,7 @@
 compiler.err.cant.read.file                             # (apt.JavaCompiler?)
 compiler.err.cant.select.static.class.from.param.type
 compiler.err.dc.unterminated.string                     # cannot happen
+compiler.err.file.patched.and.msp                       # needs the same dir on --module-source-path and --patch-module
 compiler.err.illegal.char.for.encoding
 compiler.err.invalid.repeatable.annotation              # should not happen
 compiler.err.invalid.repeatable.annotation.invalid.value # "can't" happen
--- a/langtools/test/tools/javac/diags/examples/IllegalArgumentForOption/IllegalArgumentForOption.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalArgumentForOption/IllegalArgumentForOption.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  */
 
 // key: compiler.err.illegal.argument.for.option
-// options: --module-path doesNotExist
+// options: --module-source-path=abc*def
 // run: simple
 
 class X {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleClassoutput/ModuleInfoWithPatchedModuleClassoutput.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.module-info.with.patched.module.classoutput
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleClassoutput/additional/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 mod {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleClassoutput/patchmodule/java.compiler/javax/lang/model/element/Extra.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.element;
+
+public interface Extra {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleSourcepath/ModuleInfoWithPatchedModule.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.module-info.with.patched.module.sourcepath
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleSourcepath/patchmodule/java.compiler/javax/lang/model/element/Extra.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.lang.model.element;
+
+public interface Extra {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ModuleInfoWithPatchedModuleSourcepath/patchmodule/java.compiler/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 java.compiler {}
--- a/langtools/test/tools/javac/diags/examples/ModuleInfoWithXModuleSourcePath/Extra.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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.
- */
-
-// key: compiler.err.module-info.with.xmodule.sourcepath
-// options: -Xmodule:java.compiler
-
-package javax.lang.model.element;
-
-public interface Extra {}
--- a/langtools/test/tools/javac/diags/examples/ModuleInfoWithXModuleSourcePath/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +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.
- */
-
-module java.compiler {}
--- a/langtools/test/tools/javac/diags/examples/ModuleInfoWithXmoduleClasspath/ModuleInfoWithXmoduleClasspath.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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.
- */
-
-// key: compiler.err.module-info.with.xmodule.classpath
-// options: -Xmodule:java.compiler
-
-package javax.lang.model.element;
-
-public interface ModuleInfoWithXModuleClasspath {}
--- a/langtools/test/tools/javac/diags/examples/ModuleInfoWithXmoduleClasspath/additional/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +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.
- */
-
-module mod {}
--- a/langtools/test/tools/javac/diags/examples/NoSuperclass.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.no.superclass
-// options: -Xmodule:java.base
-
-package java.lang;
-
-class Object {
-    public Object() {
-        super();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoSuperclass/NoSuperclass.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.no.superclass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoSuperclass/patchmodule/java.base/java/lang/Object.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+class Object {
+    public Object() {
+        super();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplNotPublic/ServiceImplNotPublic.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.def.public
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplNotPublic/example/ServiceImpl.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 example;
+class ServiceImpl implements example.SomeService {
+    public ServiceImpl() {}
+    public void foo() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplNotPublic/example/SomeService.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 example;
+public interface SomeService {
+    public void foo();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ServiceImplNotPublic/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 m {
+    exports example;
+    provides example.SomeService with example.ServiceImpl;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TooManyPatchedModules/TooManyPatchedModules.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.too.many.patched.modules
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TooManyPatchedModules/patchmodule/java.compiler/p/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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;
+
+class C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/TooManyPatchedModules/patchmodule/jdk.compiler/p/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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;
+
+class C {}
--- a/langtools/test/tools/javac/diags/examples/XModuleWithModulePath/XModuleWithModulePath.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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.
- */
-
-// key: compiler.err.xmodule.no.module.sourcepath
-// options: -Xmodule:java.compiler --module-source-path src
-
-class XModuleWithModulePath {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doclint/NPEDuplicateClassNamesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8174073
+ * @summary NPE caused by link reference to class
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @library /tools/lib
+ * @build toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox
+ * @run main NPEDuplicateClassNamesTest
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class NPEDuplicateClassNamesTest extends TestRunner {
+
+    public static void main(String... args) throws Exception {
+        NPEDuplicateClassNamesTest t = new NPEDuplicateClassNamesTest();
+        t.runTests();
+    }
+
+    private final ToolBox tb = new ToolBox();
+    private final String class1 =
+            "package com;\n" +
+            "/***/\n" +
+            "public class MyClass {}";
+    private final String class2 =
+            "package com;\n" +
+            "/**\n" +
+            " * The following link tag causes a NullPointerException: {@link Requirements}. \n" +
+            " */\n" +
+            "public class MyClass {}";
+
+    NPEDuplicateClassNamesTest() throws IOException {
+        super(System.err);
+    }
+
+    @Test
+    public void testDuplicateClassNames() throws IOException {
+        Path src = Paths.get("src");
+        Path one = src.resolve("one");
+        Path two = src.resolve("two");
+        Path classes = Paths.get("classes");
+        Files.createDirectories(classes);
+        tb.writeJavaFiles(one, class1);
+        tb.writeJavaFiles(two, class2);
+
+        List<String> expected = Arrays.asList(
+                "MyClass.java:5:8: compiler.err.duplicate.class: com.MyClass",
+                "MyClass.java:3:65: compiler.err.proc.messager: reference not found",
+                "2 errors");
+        List<String> output = new JavacTask(tb)
+                  .outdir(classes)
+                  .options("-XDrawDiagnostics", "-Xdoclint:all", "-XDdev")
+                  .files(tb.findJavaFiles(src))
+                  .run(Task.Expect.FAIL)
+                  .writeAll()
+                  .getOutputLines(Task.OutputKind.DIRECT);
+
+        if (!Objects.equals(output, expected)) {
+            throw new IllegalStateException("incorrect output; actual=" + output + "; expected=" + expected);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8174249/T8174249a.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8174249
+ * @summary Regression in generic method unchecked calls
+ * @compile T8174249a.java
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+class T8174249a {
+    static <T> T foo(Class<T> c, Collection<? super T> baz) {
+return null;
+    }
+
+    static void bar(String c) { }
+
+    void test() {
+        // this works
+        bar(foo(String.class, new ArrayList<String>()));
+
+        // this works with a warning
+        String s = foo(String.class, new ArrayList());
+        bar(s);
+
+        // this causes an error on JDK9 but should work
+        bar(foo(String.class, new ArrayList()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8174249/T8174249b.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8174249
+ * @summary Regression in generic method unchecked calls
+ * @compile T8174249b.java
+ */
+
+import java.util.*;
+
+class T8174249b {
+
+    static void cs(Collection<String> cs) {}
+
+    void test1(Collection c) {
+        cs(rawCollection((Class)null));
+        Collection<String> cs1 = rawCollection((Class)null);
+    }
+
+    void test2(Collection c) {
+        cs(rawCollection2((Class)null));
+        Collection<String> cs2 = rawCollection2((Class)null);
+    }
+
+    void test3(Collection c) {
+        cs(rawCollection3((Class)null));
+        Collection<String> cs3 = rawCollection2((Class)null);
+    }
+
+    Collection<Integer> rawCollection(Class<String> cs) { return null; }
+
+    <Z> Collection<Integer> rawCollection2(Class<Z> cs) { return null; }
+
+    <Z> Collection<Z> rawCollection3(Class<Z> cs) { return null; }
+}
--- a/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,6 +26,7 @@
  * @bug 8002099 8010822
  * @summary Add support for intersection types in cast expression
  * @modules jdk.compiler/com.sun.tools.javac.util
+ * @run main/othervm IntersectionTargetTypeTest
  */
 
 import com.sun.source.util.JavacTask;
--- a/langtools/test/tools/javac/lib/combo/ComboTask.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/lib/combo/ComboTask.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
 
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.util.JavacTask;
-import com.sun.source.util.TaskEvent.Kind;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.List;
 import combo.ComboParameter.Resolver;
 
@@ -36,11 +36,18 @@
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
+
 import java.io.IOException;
 import java.io.Writer;
 import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
 
@@ -184,6 +191,28 @@
     }
 
     /**
+     * Parse, analyze, perform code generation for the sources associated with this task and finally
+     * executes them
+     */
+    public <Z> Optional<Z> execute(Function<ExecutionTask, Z> executionFunc) throws IOException {
+        Result<Iterable<? extends JavaFileObject>> generationResult = generate();
+        Iterable<? extends JavaFileObject> jfoIterable = generationResult.get();
+        if (generationResult.hasErrors()) {
+            // we have nothing else to do
+            return Optional.empty();
+        }
+        java.util.List<URL> urlList = new ArrayList<>();
+        for (JavaFileObject jfo : jfoIterable) {
+            String urlStr = jfo.toUri().toURL().toString();
+            urlStr = urlStr.substring(0, urlStr.length() - jfo.getName().length());
+            urlList.add(new URL(urlStr));
+        }
+        return Optional.of(
+                executionFunc.apply(
+                        new ExecutionTask(new URLClassLoader(urlList.toArray(new URL[urlList.size()])))));
+    }
+
+    /**
      * Fork a new compilation task; if possible the compilation context from previous executions is
      * retained (see comments in ReusableContext as to when it's safe to do so); otherwise a brand
      * new context is created.
@@ -215,6 +244,80 @@
     }
 
     /**
+     * This class represents an execution task. It allows the execution of one or more classes previously
+     * added to a given class loader. This class uses reflection to execute any given static public method
+     * in any given class. It's not restricted to the execution of the {@code main} method
+     */
+    public class ExecutionTask {
+        private ClassLoader classLoader;
+        private String methodName = "main";
+        private Class<?>[] parameterTypes = new Class<?>[]{String[].class};
+        private Object[] args = new String[0];
+        private Consumer<Throwable> handler;
+        private Class<?> c;
+
+        private ExecutionTask(ClassLoader classLoader) {
+            this.classLoader = classLoader;
+        }
+
+        /**
+         * Set the name of the class to be loaded.
+         */
+        public ExecutionTask withClass(String className) {
+            Assert.check(className != null, "class name value is null, impossible to proceed");
+            try {
+                c = classLoader.loadClass(className);
+            } catch (Throwable t) {
+                throw new IllegalStateException(t);
+            }
+            return this;
+        }
+
+        /**
+         * Set the name of the method to be executed along with the parameter types to
+         * reflectively obtain the method.
+         */
+        public ExecutionTask withMethod(String methodName, Class<?>... parameterTypes) {
+            this.methodName = methodName;
+            this.parameterTypes = parameterTypes;
+            return this;
+        }
+
+        /**
+         * Set the arguments to be passed to the method.
+         */
+        public ExecutionTask withArguments(Object... args) {
+            this.args = args;
+            return this;
+        }
+
+        /**
+         * Set a handler to handle any exception thrown.
+         */
+        public ExecutionTask withHandler(Consumer<Throwable> handler) {
+            this.handler = handler;
+            return this;
+        }
+
+        /**
+         * Executes the given method in the given class. Returns true if the execution was
+         * successful, false otherwise.
+         */
+        public Object run() {
+            try {
+                java.lang.reflect.Method meth = c.getMethod(methodName, parameterTypes);
+                meth.invoke(null, (Object)args);
+                return true;
+            } catch (Throwable t) {
+                if (handler != null) {
+                    handler.accept(t);
+                }
+                return false;
+            }
+        }
+    }
+
+    /**
      * This class is used to help clients accessing the results of a given compilation task.
      * Contains several helper methods to inspect diagnostics generated during the task execution.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/main/EnvVariableTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173308
+ * @summary Check JDK_JAVA_OPTIONS parsing behavior
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.TestRunner
+ * @run main EnvVariableTest
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Path;
+
+import toolbox.*;
+
+import com.sun.tools.javac.main.CommandLine;
+
+public class EnvVariableTest extends TestRunner {
+    final String testClasses;
+    final ToolBox tb;
+    final Path javaExePath;
+    final ExecTask task;
+    final PrintStream ostream;
+    final ByteArrayOutputStream baos;
+
+    public EnvVariableTest() {
+        super(System.err);
+        ostream = System.err;
+        baos = new ByteArrayOutputStream();
+        testClasses = System.getProperty("test.classes");
+        tb = new ToolBox();
+        javaExePath = tb.getJDKTool("java");
+        task = new ExecTask(tb, javaExePath);
+    }
+
+    public static void main(String... args) throws Exception {
+        EnvVariableTest t = new EnvVariableTest();
+        t.runTests();
+    }
+
+    @Test
+    public void testDoubleQuote() throws Exception {
+        // white space quoted with double quotes
+        test("-version -cp \"c:\\\\java libs\\\\one.jar\" \n",
+                "-version", "-cp", "c:\\\\java libs\\\\one.jar");
+    }
+
+    @Test
+    public void testSingleQuote() throws Exception {
+        // white space quoted with single quotes
+        test("-version -cp \'c:\\\\java libs\\\\one.jar\' \n",
+                "-version", "-cp", "c:\\\\java libs\\\\one.jar");
+    }
+
+    @Test
+    public void testEscapeCharacters() throws Exception {
+        // escaped characters
+        test("escaped chars testing \"\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287\"",
+                "escaped", "chars", "testing", "\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287");
+    }
+
+    @Test
+    public void testMixedQuotes() throws Exception {
+        // more mixing of quote types
+        test("\"mix 'single quote' in double\" 'mix \"double quote\" in single' partial\"quote me\"this",
+                "mix 'single quote' in double", "mix \"double quote\" in single", "partialquote methis");
+    }
+
+    @Test
+    public void testWhiteSpaces() throws Exception {
+        // whitespace tests
+        test("line one #comment\n'line #2' #rest are comment\r\n#comment on line 3\fline 4 #comment to eof",
+                "line", "one", "#comment", "line #2", "#rest", "are", "comment", "#comment", "on", "line",
+                "3", "line", "4", "#comment", "to", "eof");
+    }
+
+    @Test
+    public void testMismatchedDoubleQuote() throws Exception {
+        // mismatched quote
+        test("This is an \"open quote \n    across line\n\t, note for WS.",
+                "Exception: JDK_JAVAC_OPTIONS");
+    }
+
+    @Test
+    public void testMismatchedSingleQuote() throws Exception {
+        // mismatched quote
+        test("This is an \'open quote \n    across line\n\t, note for WS.",
+                "Exception: JDK_JAVAC_OPTIONS");
+    }
+
+    void test(String full, String... expectedArgs) throws Exception {
+        task.envVar("JDK_JAVAC_OPTIONS", full);
+        task.args("--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
+                "-cp", testClasses, "EnvVariableTest$Tester");
+        Task.Result tr = task.run(Task.Expect.SUCCESS);
+        String expected = Tester.arrayToString(expectedArgs);
+        String in = tr.getOutput(Task.OutputKind.STDOUT);
+        System.err.println("Matching...");
+        System.err.println("Obtained: " + in);
+        System.err.println("Expected: " + expected);
+        if (in.contains(expected)) {
+            System.err.println("....OK");
+            return;
+        }
+        throw new Exception("Expected strings not found");
+    }
+
+    /**
+     * A tester class that is invoked to invoke the CommandLine class, and
+     * print the result.
+     */
+    public static class Tester {
+        private static final String[] EMPTY_ARRAY = new String[0];
+        static String arrayToString(String... args) {
+            return String.join(", ", args);
+        }
+        public static void main(String... args) throws IOException {
+            try {
+                String[] argv = CommandLine.parse("JDK_JAVAC_OPTIONS", EMPTY_ARRAY);
+                System.out.print(arrayToString(argv));
+            } catch (CommandLine.UnmatchedQuote ex) {
+                System.out.print("Exception: " + ex.variableName);
+            }
+        }
+    }
+}
--- a/langtools/test/tools/javac/meth/BadPolySig.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/*
- * @test
- * @bug 8168774
- * @summary Polymorhic signature method check crashes javac
- * @compile -Xmodule:java.base BadPolySig.java
- */
-
-package java.lang.invoke;
-
-class MethodHandle {
-    native Object m();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/meth/BadPolySig/BadPolySig.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8168774
+ * @summary Polymorhic signature method check crashes javac
+ * @modules jdk.compiler
+ * @compile/module=java.base java/lang/invoke/MethodHandle.java
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/meth/BadPolySig/java.base/java/lang/invoke/MethodHandle.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+class MethodHandle {
+    native Object m();
+}
--- a/langtools/test/tools/javac/modules/AddLimitMods.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java	Mon Mar 13 19:58:52 2017 +0000
@@ -293,7 +293,7 @@
         }
 
         actual = new JavacTask(tb)
-                   .options("-Xmodule:java.base",
+                   .options("--patch-module", "java.base=" + cpSrc.toString(),
                             "-XDrawDiagnostics",
                             "--add-modules", "ALL-MODULE-PATH")
                    .outdir(cpOut)
--- a/langtools/test/tools/javac/modules/AddModulesTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AddModulesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,17 +23,27 @@
 
 /*
  * @test
+ * @bug 8167975 8173596
  * @summary Test the --add-modules option
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
+ * @build toolbox.Assert toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main AddModulesTest
  */
 
 
 import java.nio.file.Path;
+import java.util.Arrays;
 
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import toolbox.Assert;
 import toolbox.JavacTask;
 import toolbox.Task;
 
@@ -227,5 +237,46 @@
                 .run()
                 .writeAll();
     }
+
+    @Test
+    public void testAddModulesAPI(Path base) throws Exception {
+        Path src = base.resolve("src");
+
+        // setup some utility modules
+        Path src_m1 = src.resolve("m1x");
+        tb.writeJavaFiles(src_m1,
+                          "module m1x { exports p1; }",
+                          "package p1; public class C1 { }");
+        Path src_m2 = src.resolve("m2x");
+        tb.writeJavaFiles(src_m2,
+                          "module m2x { exports p2; }",
+                          "package p2; public class C2 { }");
+        Path modules = base.resolve("modules");
+        tb.createDirectories(modules);
+
+        new JavacTask(tb)
+                .options("--module-source-path", src.toString())
+                .outdir(modules)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        // now test access to the modules
+        Path src2 = base.resolve("src2");
+        tb.writeJavaFiles(src2,
+                          "class Dummy { p1.C1 c1; p2.C2 c2; }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+        try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
+            fm.setLocationFromPaths(StandardLocation.MODULE_PATH, Arrays.asList(modules));
+            fm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Arrays.asList(classes));
+            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src2));
+            CompilationTask t = c.getTask(null, fm, null, null, null, files);
+            t.addModules(Arrays.asList("m1x", "m2x"));
+            Assert.check(t.call());
+        }
+    }
 }
 
--- a/langtools/test/tools/javac/modules/AddReadsTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AddReadsTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -217,7 +217,7 @@
         new JavacTask(tb)
           .options("--class-path", jar.toString(),
                    "--add-reads", "java.base=ALL-UNNAMED",
-                   "-Xmodule:java.base")
+                   "--patch-module", "java.base=" + src)
           .outdir(classes)
           .files(src.resolve("impl").resolve("Impl.java"))
           .run()
@@ -237,7 +237,7 @@
         new JavacTask(tb)
           .options("--add-modules", "java.desktop",
                    "--add-reads", "java.base=java.desktop",
-                   "-Xmodule:java.base")
+                   "--patch-module", "java.base=" + src)
           .outdir(classes)
           .files(findJavaFiles(src))
           .run()
@@ -304,7 +304,7 @@
 
         new JavacTask(tb)
           .options("--add-reads", "m1x=ALL-UNNAMED",
-                   "-Xmodule:m1x",
+                   "--patch-module", "m1x=" + unnamedSrc,
                    "--module-path", classes.toString())
           .outdir(unnamedClasses)
           .files(findJavaFiles(unnamedSrc))
--- a/langtools/test/tools/javac/modules/AllDefaultTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/AllDefaultTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 0000000
+ * @bug 8164590 8170691
  * @summary Test use of ALL-DEFAULT token
  * @library /tools/lib
  * @modules
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/CompileModulePatchTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,694 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173777
+ * @summary tests for multi-module mode compilation
+ * @library /tools/lib
+ * @modules
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.code
+ *      jdk.compiler/com.sun.tools.javac.main
+ *      jdk.compiler/com.sun.tools.javac.processing
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
+ * @run main CompileModulePatchTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+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.TypeElement;
+import javax.lang.model.util.Elements;
+
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import toolbox.JavacTask;
+import toolbox.ModuleBuilder;
+import toolbox.Task;
+import toolbox.Task.Expect;
+
+public class CompileModulePatchTest extends ModuleTestBase {
+
+    public static void main(String... args) throws Exception {
+        new CompileModulePatchTest().runTests();
+    }
+
+    @Test
+    public void testCorrectModulePatch(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("--patch-module", "java.compiler=" + src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testCorrectModulePatchMultiModule(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1, "package javax.lang.model.element; public interface Extra extends Element { }");
+        Path m2 = src.resolve("m2");
+        tb.writeJavaFiles(m2, "package com.sun.source.tree; public interface Extra extends Tree { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("--patch-module", "java.compiler=" + m1.toString(),
+                         "--patch-module", "jdk.compiler=" + m2.toString(),
+                         "--module-source-path", "dummy")
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+
+        checkFileExists(classes, "java.compiler/javax/lang/model/element/Extra.class");
+        checkFileExists(classes, "jdk.compiler/com/sun/source/tree/Extra.class");
+    }
+
+    @Test
+    public void testCorrectModulePatchMultiModule2(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1");
+        tb.writeJavaFiles(m1,
+                          "package javax.lang.model.element; public interface Extra extends Element { }");
+        Path m2 = src.resolve("m2");
+        tb.writeJavaFiles(m2,
+                          "package com.sun.source.tree; public interface Extra extends Tree { }");
+        Path msp = base.resolve("msp");
+        Path m3 = msp.resolve("m3x");
+        tb.writeJavaFiles(m3,
+                          "module m3x { }",
+                          "package m3; public class Test { }");
+        Path m4 = msp.resolve("m4x");
+        tb.writeJavaFiles(m4,
+                          "module m4x { }",
+                          "package m4; public class Test { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("--patch-module", "java.compiler=" + m1.toString(),
+                         "--patch-module", "jdk.compiler=" + m2.toString(),
+                         "--module-source-path", msp.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src, msp))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+
+        checkFileExists(classes, "java.compiler/javax/lang/model/element/Extra.class");
+        checkFileExists(classes, "jdk.compiler/com/sun/source/tree/Extra.class");
+        checkFileExists(classes, "m3x/m3/Test.class");
+        checkFileExists(classes, "m4x/m4/Test.class");
+    }
+
+    @Test
+    public void testPatchModuleModuleSourcePathConflict(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        Path m1 = src.resolve("m1x");
+        tb.writeJavaFiles(m1,
+                          "module m1x { }",
+                          "package m1; public class Test { }");
+        Path m2 = src.resolve("m2x");
+        tb.writeJavaFiles(m2,
+                          "module m2x { }",
+                          "package m2; public class Test { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("--patch-module", "m1x=" + m2.toString(),
+                         "--module-source-path", src.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(classes)
+                .files(findJavaFiles(src.resolve("m1x").resolve("m1"),
+                                     src.resolve("m2x").resolve("m2")))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expectedOut = Arrays.asList(
+                "Test.java:1:1: compiler.err.file.patched.and.msp: m1x, m2x",
+                "1 error"
+        );
+
+        if (!expectedOut.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testSourcePath(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element, Other { }");
+        Path srcPath = base.resolve("src-path");
+        tb.writeJavaFiles(srcPath, "package javax.lang.model.element; interface Other { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("--patch-module", "java.compiler=" + src.toString(),
+                         "-sourcepath", srcPath.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(classes)
+                .files(src.resolve("javax/lang/model/element/Extra.java"))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expectedOut = Arrays.asList(
+                "Extra.java:1:75: compiler.err.cant.resolve: kindname.class, Other, , ",
+                "1 error"
+        );
+
+        if (!expectedOut.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testClassPath(Path base) throws Exception {
+        Path cpSrc = base.resolve("cpSrc");
+        tb.writeJavaFiles(cpSrc, "package p; public interface Other { }");
+        Path cpClasses = base.resolve("cpClasses");
+        tb.createDirectories(cpClasses);
+
+        String cpLog = new JavacTask(tb)
+                .outdir(cpClasses)
+                .files(findJavaFiles(cpSrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!cpLog.isEmpty())
+            throw new Exception("expected output not found: " + cpLog);
+
+        Path src = base.resolve("src");
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element, p.Other { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("--patch-module", "java.compiler=" + src.toString(),
+                         "--class-path", cpClasses.toString(),
+                         "-XDrawDiagnostics")
+                .outdir(classes)
+                .files(src.resolve("javax/lang/model/element/Extra.java"))
+                .run(Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expectedOut = Arrays.asList(
+                "Extra.java:1:76: compiler.err.doesnt.exist: p",
+                "1 error"
+        );
+
+        if (!expectedOut.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testNoModuleInfoOnSourcePath(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module java.compiler {}",
+                          "package javax.lang.model.element; public interface Extra { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected;
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--patch-module", "java.compiler=" + src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.patched.module.sourcepath",
+                                 "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+
+        //multi-module mode:
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--patch-module", "java.compiler=" + src.toString(),
+                         "--module-source-path", "dummy")
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("- compiler.err.locn.module-info.not.allowed.on.patch.path: module-info.java",
+                                 "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testNoModuleInfoInClassOutput(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path srcMod = base.resolve("src-mod");
+        tb.writeJavaFiles(srcMod,
+                          "module mod {}");
+        Path classes = base.resolve("classes").resolve("java.compiler");
+        tb.createDirectories(classes);
+
+        String logMod = new JavacTask(tb)
+                .options()
+                .outdir(classes)
+                .files(findJavaFiles(srcMod))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!logMod.isEmpty())
+            throw new Exception("unexpected output found: " + logMod);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package javax.lang.model.element; public interface Extra { }");
+        tb.createDirectories(classes);
+
+        List<String> log;
+        List<String> expected;
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--patch-module", "java.compiler=" + src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.patched.module.classoutput",
+                                 "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+
+        log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--patch-module", "java.compiler=" + src.toString(),
+                         "--module-source-path", "dummy")
+                .outdir(classes.getParent())
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        expected = Arrays.asList("- compiler.err.locn.module-info.not.allowed.on.patch.path: module-info.class",
+                                 "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testWithModulePath(Path base) throws Exception {
+        Path modSrc = base.resolve("modSrc");
+        Path modules = base.resolve("modules");
+        new ModuleBuilder(tb, "m1")
+                .classes("package pkg1; public interface E { }")
+                .build(modSrc, modules);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package p; interface A extends pkg1.E { }");
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", modules.toString(),
+                        "--patch-module", "m1=" + src.toString())
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        //checks module bounds still exist
+        new ModuleBuilder(tb, "m2")
+                .classes("package pkg2; public interface D { }")
+                .build(modSrc, modules);
+
+        Path src2 = base.resolve("src2");
+        tb.writeJavaFiles(src2, "package p; interface A extends pkg2.D { }");
+
+        List<String> log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics",
+                        "--module-path", modules.toString(),
+                        "--patch-module", "m1=" + src2.toString())
+                .files(findJavaFiles(src2))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList("A.java:1:32: compiler.err.package.not.visible: pkg2, (compiler.misc.not.def.access.does.not.read: m1, pkg2, m2)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @Test
+    public void testWithUpgradeModulePath(Path base) throws Exception {
+        Path modSrc = base.resolve("modSrc");
+        Path modules = base.resolve("modules");
+        new ModuleBuilder(tb, "m1")
+                .classes("package pkg1; public interface E { }")
+                .build(modSrc, modules);
+
+        Path upgrSrc = base.resolve("upgradeSrc");
+        Path upgrade = base.resolve("upgrade");
+        new ModuleBuilder(tb, "m1")
+                .classes("package pkg1; public interface D { }")
+                .build(upgrSrc, upgrade);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package p; interface A extends pkg1.D { }");
+
+        new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("--module-path", modules.toString(),
+                        "--upgrade-module-path", upgrade.toString(),
+                        "--patch-module", "m1=" + src.toString())
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+    }
+
+    @Test
+    public void testUnnamedIsolation(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path sourcePath = base.resolve("source-path");
+        tb.writeJavaFiles(sourcePath, "package src; public class Src {}");
+
+        Path classPathSrc = base.resolve("class-path-src");
+        tb.writeJavaFiles(classPathSrc, "package cp; public class CP { }");
+        Path classPath = base.resolve("classPath");
+        tb.createDirectories(classPath);
+
+        String cpLog = new JavacTask(tb)
+                .outdir(classPath)
+                .files(findJavaFiles(classPathSrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!cpLog.isEmpty())
+            throw new Exception("expected output not found: " + cpLog);
+
+        Path modulePathSrc = base.resolve("module-path-src");
+        tb.writeJavaFiles(modulePathSrc,
+                          "module m {}",
+                          "package m; public class M {}");
+        Path modulePath = base.resolve("modulePath");
+        tb.createDirectories(modulePath.resolve("m"));
+
+        String modLog = new JavacTask(tb)
+                .outdir(modulePath.resolve("m"))
+                .files(findJavaFiles(modulePathSrc))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!modLog.isEmpty())
+            throw new Exception("expected output not found: " + modLog);
+
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package m; public class Extra { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("--patch-module", "m=" + sourcePath.toString(),
+                         "--class-path", classPath.toString(),
+                         "--source-path", sourcePath.toString(),
+                         "--module-path", modulePath.toString(),
+                         "--processor-path", System.getProperty("test.classes"),
+                         "-XDaccessInternalAPI=true",
+                         "-processor", CheckModuleContentProcessing.class.getName())
+                .outdir(classes)
+                .files(findJavaFiles(sourcePath))
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.isEmpty())
+            throw new Exception("expected output not found: " + log);
+    }
+
+    @SupportedAnnotationTypes("*")
+    public static final class CheckModuleContentProcessing extends AbstractProcessor {
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            Symtab syms = Symtab.instance(((JavacProcessingEnvironment) processingEnv).getContext());
+            Elements elements = processingEnv.getElementUtils();
+            ModuleElement unnamedModule = syms.unnamedModule;
+            ModuleElement mModule = elements.getModuleElement("m");
+
+            assertNonNull("mModule found", mModule);
+            assertNonNull("src.Src from m", elements.getTypeElement(mModule, "src.Src"));
+            assertNull("cp.CP not from m", elements.getTypeElement(mModule, "cp.CP"));
+            assertNull("src.Src not from unnamed", elements.getTypeElement(unnamedModule, "src.Src"));
+            assertNonNull("cp.CP from unnamed", elements.getTypeElement(unnamedModule, "cp.CP"));
+
+            return false;
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
+
+        private static void assertNonNull(String msg, Object val) {
+            if (val == null) {
+                throw new AssertionError(msg);
+            }
+        }
+
+        private static void assertNull(String msg, Object val) {
+            if (val != null) {
+                throw new AssertionError(msg);
+            }
+        }
+    }
+
+    @Test
+    public void testSingleModeIncremental(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "package javax.lang.model.element; public interface Extra extends Element { }",
+                          "package javax.lang.model.element; public interface Extra2 extends Extra { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        Thread.sleep(2000); //ensure newer timestamps on classfiles:
+
+        new JavacTask(tb)
+            .options("--patch-module", "java.compiler=" + src.toString())
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll()
+            .getOutput(Task.OutputKind.DIRECT);
+
+        List<String> log = new JavacTask(tb)
+            .options("--patch-module", "java.compiler=" + src.toString(),
+                     "-verbose")
+            .outdir(classes)
+            .files(findJavaFiles(src.resolve("javax/lang/model/element/Extra2.java"
+                                    .replace("/", src.getFileSystem().getSeparator()))))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.DIRECT)
+            .stream()
+            .filter(l -> l.contains("parsing"))
+            .collect(Collectors.toList());
+
+        boolean parsesExtra2 = log.stream()
+                                  .anyMatch(l -> l.contains("Extra2.java"));
+        boolean parsesExtra = log.stream()
+                              .anyMatch(l -> l.contains("Extra.java"));
+
+        if (!parsesExtra2 || parsesExtra) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    @Test
+    public void testComplexMSPAndPatch(Path base) throws Exception {
+        //note: avoiding use of java.base, as that gets special handling on some places:
+        Path src1 = base.resolve("src1");
+        Path src1ma = src1.resolve("ma");
+        tb.writeJavaFiles(src1ma,
+                          "module ma { exports ma; }",
+                          "package ma; public class C1 { public static void method() { } }",
+                          "package ma.impl; public class C2 { }");
+        Path src1mb = src1.resolve("mb");
+        tb.writeJavaFiles(src1mb,
+                          "module mb { requires ma; }",
+                          "package mb.impl; public class C2 { public static void method() { } }");
+        Path src1mc = src1.resolve("mc");
+        tb.writeJavaFiles(src1mc,
+                          "module mc { }");
+        Path classes1 = base.resolve("classes1");
+        tb.createDirectories(classes1);
+        tb.cleanDirectory(classes1);
+
+        new JavacTask(tb)
+            .options("--module-source-path", src1.toString())
+            .files(findJavaFiles(src1))
+            .outdir(classes1)
+            .run()
+            .writeAll();
+
+        //patching:
+        Path src2 = base.resolve("src2");
+        Path src2ma = src2.resolve("ma");
+        tb.writeJavaFiles(src2ma,
+                          "package ma.impl; public class C2 { public static void extra() { ma.C1.method(); } }",
+                          "package ma.impl; public class C3 { public void test() { C2.extra(); } }");
+        Path src2mb = src2.resolve("mb");
+        tb.writeJavaFiles(src2mb,
+                          "package mb.impl; public class C3 { public void test() { C2.method(); ma.C1.method(); ma.impl.C2.extra(); } }");
+        Path src2mc = src2.resolve("mc");
+        tb.writeJavaFiles(src2mc,
+                          "package mc.impl; public class C2 { public static void test() { } }",
+                          //will require --add-reads ma:
+                          "package mc.impl; public class C3 { public static void test() { ma.impl.C2.extra(); } }");
+        Path src2mt = src2.resolve("mt");
+        tb.writeJavaFiles(src2mt,
+                          "module mt { requires ma; requires mb; }",
+                          "package mt.impl; public class C2 { public static void test() { mb.impl.C2.method(); ma.impl.C2.extra(); } }",
+                          "package mt.impl; public class C3 { public static void test() { C2.test(); mc.impl.C2.test(); } }");
+        Path classes2 = base.resolve("classes2");
+        tb.createDirectories(classes2);
+        tb.cleanDirectory(classes2);
+
+        Thread.sleep(2000); //ensure newer timestamps on classfiles:
+
+        new JavacTask(tb)
+            .options("--module-path", classes1.toString(),
+                     "--patch-module", "ma=" + src2ma.toString(),
+                     "--patch-module", "mb=" + src2mb.toString(),
+                     "--add-exports", "ma/ma.impl=mb",
+                     "--patch-module", "mc=" + src2mc.toString(),
+                     "--add-reads", "mc=ma",
+                     "--add-exports", "ma/ma.impl=mc",
+                     "--add-exports", "ma/ma.impl=mt",
+                     "--add-exports", "mb/mb.impl=mt",
+                     "--add-exports", "mc/mc.impl=mt",
+                     "--add-reads", "mt=mc",
+                     "--module-source-path", src2.toString())
+            .outdir(classes2)
+            .files(findJavaFiles(src2))
+            .run()
+            .writeAll();
+
+        //incremental compilation (C2 mustn't be compiled, C3 must):
+        tb.writeJavaFiles(src2ma,
+                          "package ma.impl; public class C3 { public void test() { ma.C1.method(); C2.extra(); } }");
+        tb.writeJavaFiles(src2mt,
+                          "package mt.impl; public class C3 { public static void test() { mc.impl.C2.test(); C2.test(); } }");
+
+        List<String> log = new JavacTask(tb)
+            .options("--module-path", classes1.toString(),
+                     "--patch-module", "ma=" + src2ma.toString(),
+                     "--patch-module", "mb=" + src2mb.toString(),
+                     "--add-exports", "ma/ma.impl=mb",
+                     "--patch-module", "mc=" + src2mc.toString(),
+                     "--add-reads", "mc=ma",
+                     "--add-exports", "ma/ma.impl=mc",
+                     "--add-exports", "ma/ma.impl=mt",
+                     "--add-exports", "mb/mb.impl=mt",
+                     "--add-exports", "mc/mc.impl=mt",
+                     "--add-reads", "mt=mc",
+                     "--module-source-path", src2.toString(),
+                     "--add-modules", "mc",
+                     "-verbose")
+            .outdir(classes2)
+            .files(src2ma.resolve("ma").resolve("impl").resolve("C3.java"),
+                   src2mt.resolve("mt").resolve("impl").resolve("C3.java"))
+            .run()
+            .writeAll()
+            .getOutputLines(Task.OutputKind.DIRECT)
+            .stream()
+            .filter(l -> l.contains("parsing"))
+            .collect(Collectors.toList());
+
+        boolean parsesC3 = log.stream()
+                              .anyMatch(l -> l.contains("C3.java"));
+        boolean parsesC2 = log.stream()
+                              .anyMatch(l -> l.contains("C2.java"));
+
+        if (!parsesC3 || parsesC2) {
+            throw new AssertionError("Unexpected output: " + log);
+        }
+    }
+
+    private void checkFileExists(Path dir, String path) {
+        Path toCheck = dir.resolve(path.replace("/", dir.getFileSystem().getSeparator()));
+
+        if (!Files.exists(toCheck)) {
+            throw new AssertionError(toCheck.toString() + " does not exist!");
+        }
+    }
+}
--- a/langtools/test/tools/javac/modules/ConvenientAccessErrorsTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/ConvenientAccessErrorsTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8169197 8172668 8173117
+ * @bug 8169197 8172668 8173117 8175007
  * @summary Check convenient errors are produced for inaccessible classes.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -704,4 +704,44 @@
             throw new Exception("Expected names not generated: " + actual);
         }
     }
+
+    @Test
+    public void testInaccessibleInVisible(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_ma = src.resolve("ma");
+        tb.writeJavaFiles(src_ma,
+                          "module ma { exports ma; }",
+                          "package ma; class NotApi { public static class Inner { } }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new JavacTask(tb)
+            .outdir(classes)
+            .files(findJavaFiles(src_ma))
+            .run()
+            .writeAll();
+
+        Path src_mb = src.resolve("mb");
+        tb.writeJavaFiles(src_mb,
+                          "module mb { requires ma; }",
+                          "package mb.a; public class Test { ma.NotApi.Inner i1; mb.b.NotApi.Inner i2; }",
+                          "package mb.b; class NotApi { public static class Inner { } }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-path", classes.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src_mb))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:44: compiler.err.not.def.access.class.intf.cant.access: ma.NotApi.Inner, ma.NotApi",
+                "Test.java:1:66: compiler.err.not.def.access.class.intf.cant.access: mb.b.NotApi.Inner, mb.b.NotApi",
+                "2 errors");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
 }
--- a/langtools/test/tools/javac/modules/EnvVarTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/EnvVarTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8156962
- * @summary Tests use of _JAVAC_OPTIONS env variable
+ * @summary Tests use of JDK_JAVAC_OPTIONS env variable
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -71,7 +71,7 @@
 
         tb.out.println("test that addExports can be provided with env variable");
         new JavacTask(tb, Mode.EXEC)
-                .envVar("_JAVAC_OPTIONS", "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED")
+                .envVar("JDK_JAVAC_OPTIONS", "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run(Expect.SUCCESS)
@@ -83,7 +83,7 @@
                 "--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED");
 
         new JavacTask(tb, Mode.EXEC)
-                .envVar("_JAVAC_OPTIONS", "@" + atFile)
+                .envVar("JDK_JAVAC_OPTIONS", "@" + atFile)
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run(Expect.SUCCESS)
--- a/langtools/test/tools/javac/modules/InheritRuntimeEnvironmentTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/InheritRuntimeEnvironmentTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -177,7 +177,7 @@
         Files.createDirectories(patch);
 
         new JavacTask(tb)
-                .options("-Xmodule:java.base")
+                .options("--patch-module", "java.base=" + patchSrc.toString())
                 .outdir(patch)
                 .sourcepath(patchSrc)
                 .files(findJavaFiles(patchSrc))
@@ -238,7 +238,7 @@
                 Arrays.asList("--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED");
         List<Path> files = Arrays.asList(findJavaFiles(src));
 
-        String envName = "_JAVAC_OPTIONS";
+        String envName = "JDK_JAVAC_OPTIONS";
         String envValue = String.join(" ", testOpts);
 
         out.println("  javac:");
--- a/langtools/test/tools/javac/modules/ModuleInfoTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/ModuleInfoTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("module-info.java:1:8: compiler.err.class.public.should.be.in.file: C"))
+        if (!log.contains("module-info.java:1:8: compiler.err.class.public.should.be.in.file: kindname.class, C"))
             throw new Exception("expected output not found");
     }
 
@@ -557,4 +557,187 @@
                 throw new Exception("expected output not found for: " + moduleInfo + "; actual: " + log);
         }
     }
-}
+
+    @Test
+    public void testMalformedModuleNames(Path base) throws Exception {
+        testMalformedName(base, "m1.package", "module-info.java:1:11: compiler.err.expected: token.identifier");
+        testMalformedName(base, "m1/package", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "m1->long", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "m1::long", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "m1&long", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "m1%long", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "m1@long", "module-info.java:1:10: compiler.err.expected: '{'");
+        testMalformedName(base, "@m1", "module-info.java:1:7: compiler.err.expected: token.identifier");
+        testMalformedName(base, "!", "module-info.java:1:7: compiler.err.expected: token.identifier");
+        testMalformedName(base, "m1#long", "module-info.java:1:10: compiler.err.illegal.char: #");
+        testMalformedName(base, "m1\\long", "module-info.java:1:10: compiler.err.illegal.char: \\");
+        testMalformedName(base, "module.", "module-info.java:1:15: compiler.err.expected: token.identifier");
+        testMalformedName(base, ".module", "module-info.java:1:7: compiler.err.expected: token.identifier");
+        testMalformedName(base, "1module", "module-info.java:1:7: compiler.err.expected: token.identifier");
+        testMalformedName(base, "module module", "module-info.java:1:14: compiler.err.expected: '{'");
+    }
+
+    private void testMalformedName(Path base, String name, String expected) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1");
+        tb.writeJavaFiles(src_m1, "module " + name + " { }");
+
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics", "--module-source-path", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains(expected))
+            throw new Exception("expected output not found. Name: " + name + " Expected: " + expected);
+    }
+
+    @Test
+    public void testWrongOpensTransitiveFlag(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "module M { opens transitive p1; }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:28: compiler.err.expected: ';'"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testWrongOpensStaticFlag(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "module M { opens static p1; }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:17: compiler.err.expected: token.identifier"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testSeveralOpensDirectives(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "module M { opens opens p1; }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:23: compiler.err.expected: ';'"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testUnknownDirective(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "module M { boolean p1; }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:11: compiler.err.expected: '}'"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testUnknownModuleFlag(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "private module M { }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:9: compiler.err.mod.not.allowed.here: private"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testDirectiveOnModuleDeclaration(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "opens module M { }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:1: compiler.err.expected.module.or.open"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testTooOpenModule(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "open open module M { }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:6: compiler.err.expected.module"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testEnumAsModuleFlag(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "enum module M { }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:12: compiler.err.expected: '{'"))
+            throw new Exception("expected output not found");
+    }
+
+    @Test
+    public void testClassInModule(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "module M { class B { } }",
+                "package p1; public class A { }");
+        String log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("module-info.java:1:11: compiler.err.expected: '}'"))
+            throw new Exception("expected output not found");
+    }
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/ModulePathTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8142968 8174104
  * @summary tests for --module-path
  * @library /tools/lib
  * @modules
@@ -57,7 +58,7 @@
     }
 
     @Test
-    public void testNotExistsOnPath(Path base) throws Exception {
+    public void testNotExistsOnPath_noWarn(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "class C { }");
 
@@ -65,11 +66,29 @@
                 .options("-XDrawDiagnostics",
                         "--module-path", "doesNotExist")
                 .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
+                .run(Task.Expect.SUCCESS)
                 .writeAll()
                 .getOutput(Task.OutputKind.DIRECT);
 
-        if (!log.contains("- compiler.err.illegal.argument.for.option: --module-path, doesNotExist"))
+        if (!log.isEmpty())
+            throw new Exception("unexpected output");
+    }
+
+    @Test
+    public void testNotExistsOnPath_warn(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "class C { }");
+
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
+                .options("-XDrawDiagnostics",
+                        "-Xlint:path",
+                        "--module-path", "doesNotExist")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.SUCCESS)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!log.contains("- compiler.warn.path.element.not.found: doesNotExist"))
             throw new Exception("expected output not found");
     }
 
--- a/langtools/test/tools/javac/modules/PatchModulesTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/PatchModulesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -28,7 +28,7 @@
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.file:+open
+ *      jdk.compiler/com.sun.tools.javac.file
  *      jdk.compiler/com.sun.tools.javac.main
  * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
  * @run main PatchModulesTest
@@ -38,21 +38,26 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.lang.reflect.Field;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
 import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
 
+import javax.tools.JavaFileManager.Location;
 import javax.tools.JavaFileObject;
 import javax.tools.ToolProvider;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
 
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.file.BaseFileManager;
 import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.file.Locations;
 
 import static java.util.Arrays.asList;
 
@@ -115,21 +120,29 @@
     void test(List<String> patches, boolean expectOK, String expect) throws Exception {
         JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
         StringWriter sw = new StringWriter();
-        try (PrintWriter pw = new PrintWriter(sw)) {
-            JavacFileManager fm = tool.getStandardFileManager(null, null, null);
+        try (PrintWriter pw = new PrintWriter(sw);
+            JavacFileManager fm = tool.getStandardFileManager(null, null, null)) {
             List<String> opts = patches.stream()
                 .map(p -> "--patch-module=" + p.replace(":", PS))
                 .collect(Collectors.toList());
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects("C.java");
             JavacTask task = tool.getTask(pw, fm, null, opts, null, files);
 
-            Field locationsField = BaseFileManager.class.getDeclaredField("locations");
-            locationsField.setAccessible(true);
-            Object locations = locationsField.get(fm);
+            Map<String, List<Location>> mod2Location =
+                    StreamSupport.stream(fm.listLocationsForModules(StandardLocation.PATCH_MODULE_PATH)
+                                           .spliterator(),
+                                        false)
+                                 .flatMap(sl -> sl.stream())
+                                 .collect(Collectors.groupingBy(l -> fm.inferModuleName(l)));
 
-            Field patchMapField = Locations.class.getDeclaredField("patchMap");
-            patchMapField.setAccessible(true);
-            Map<?,?> patchMap = (Map<?,?>) patchMapField.get(locations);
+            Map<String, List<String>> patchMap = mod2Location.entrySet()
+                    .stream()
+                    .map(e -> new SimpleEntry<>(e.getKey(), e.getValue().get(0)))
+                    .map(e -> new SimpleEntry<>(e.getKey(), locationPaths(fm, e.getValue())))
+                    .collect(Collectors.toMap(Entry :: getKey,
+                                              Entry :: getValue,
+                                              (v1, v2) -> {throw new IllegalStateException();},
+                                              TreeMap::new));
             String found = patchMap.toString();
 
             if (!found.equals(expect)) {
@@ -150,5 +163,34 @@
             }
         }
     }
+
+    static List<String> locationPaths(StandardJavaFileManager fm, Location loc) {
+        return StreamSupport.stream(fm.getLocationAsPaths(loc).spliterator(), false)
+                            .map(p -> p.toString())
+                            .collect(Collectors.toList());
+    }
+
+    @Test
+    public void testPatchWithSource(Path base) throws Exception {
+        Path patch = base.resolve("patch");
+        tb.writeJavaFiles(patch, "package javax.lang.model.element; public interface Extra { }");
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                          "module m { requires java.compiler; }",
+                          "package test; public interface Test extends javax.lang.model.element.Extra { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new toolbox.JavacTask(tb)
+            .options("--patch-module", "java.compiler=" + patch.toString())
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        if (Files.exists(classes.resolve("javax"))) {
+            throw new AssertionError();
+        }
+    }
 }
 
--- a/langtools/test/tools/javac/modules/ProvidesTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/modules/ProvidesTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -377,7 +377,7 @@
                 .writeAll()
                 .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.public.cant.access: p2.C2, p2",
+        List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.public: p2.C2, p2",
                 "1 error");
         if (!output.containsAll(expected)) {
             throw new Exception("Expected output not found");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/WrongErrorMessageForNestedServiceProviderTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8174243
+ * @summary incorrect error message for nested service provider
+ * @library /tools/lib
+ * @modules
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
+ * @run main WrongErrorMessageForNestedServiceProviderTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class WrongErrorMessageForNestedServiceProviderTest extends ModuleTestBase {
+    public static void main(String... args) throws Exception {
+        WrongErrorMessageForNestedServiceProviderTest t = new WrongErrorMessageForNestedServiceProviderTest();
+        t.runTests();
+    }
+
+    private static final String twoServicesModuleDef =
+            "module m {\n" +
+            "    exports example;\n" +
+            "    provides example.SomeService with example.ServiceImpl;\n" +
+            "    provides example.SomeServiceOuter with example.Outer.ServiceImplOuter;\n" +
+            "}";
+
+    private static final String someServiceInt =
+            "package example;\n" +
+            "public interface SomeService {\n" +
+            "    public void foo();\n" +
+            "}";
+
+    private static final String someServiceIntOuter =
+            "package example;\n" +
+            "public interface SomeServiceOuter {\n" +
+            "    public void foo();\n" +
+            "}";
+
+    @Test
+    public void testPositive(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                twoServicesModuleDef,
+                someServiceInt,
+                someServiceIntOuter,
+                "package example;\n" +
+                "public class ServiceImpl implements example.SomeService {\n" +
+                "    public ServiceImpl() {}\n" +
+                "    public void foo() {}\n" +
+                "}",
+
+                "package example;\n" +
+                "class Outer {\n" +
+                "    public static class ServiceImplOuter implements example.SomeServiceOuter {\n" +
+                "        public ServiceImplOuter() {}\n" +
+                "        public void foo() {}\n" +
+                "    }\n" +
+                "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        List<String> output = new JavacTask(tb)
+                .outdir(classes)
+                .options("-Werror", "-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+        List<String> expected = Arrays.asList("");
+        if (!output.containsAll(expected)) {
+            throw new Exception("Expected output not found");
+        }
+    }
+
+    @Test
+    public void testNegative(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                twoServicesModuleDef,
+                someServiceInt,
+                someServiceIntOuter,
+
+                "package example;\n" +
+                "class ServiceImpl implements example.SomeService {\n" +
+                "    public ServiceImpl() {}\n" +
+                "    public void foo() {}\n" +
+                "}",
+
+                "package example;\n" +
+                "class Outer {\n" +
+                "    static class ServiceImplOuter implements example.SomeServiceOuter {\n" +
+                "        public ServiceImplOuter() {}\n" +
+                "        public void foo() {}\n" +
+                "    }\n" +
+                "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        List<String> output = new JavacTask(tb)
+                .outdir(classes)
+                .options("-Werror", "-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+        List<String> expected = Arrays.asList(
+                "module-info.java:3:46: compiler.err.not.def.public: example.ServiceImpl, example",
+                "module-info.java:4:57: compiler.err.not.def.public: example.Outer.ServiceImplOuter, example.Outer",
+                "2 errors");
+        if (!output.containsAll(expected)) {
+            throw new Exception("Expected output not found");
+        }
+    }
+
+    @Test
+    public void testClassWrappedByPrivateClass(Path base) throws Exception {
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src,
+                "module m {\n" +
+                "    exports example;\n" +
+                "    provides example.SomeServiceOuter with example.Outer1.Outer2.ServiceImplOuter;\n" +
+                "}",
+
+                someServiceIntOuter,
+
+                "package example;\n" +
+                "class Outer1 {\n" +
+                "    static private class Outer2 {\n" +
+                "        public static class ServiceImplOuter implements example.SomeServiceOuter {\n" +
+                "            public ServiceImplOuter() {}\n" +
+                "            public void foo() {}\n" +
+                "        }\n" +
+                "    }\n" +
+                "}");
+        Path classes = base.resolve("classes");
+        Files.createDirectories(classes);
+
+        List<String> output = new JavacTask(tb)
+                .outdir(classes)
+                .options("-Werror", "-XDrawDiagnostics")
+                .files(findJavaFiles(src))
+                .run(Task.Expect.SUCCESS)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+        List<String> expected = Arrays.asList("");
+        if (!output.containsAll(expected)) {
+            throw new Exception("Expected output not found");
+        }
+    }
+}
--- a/langtools/test/tools/javac/modules/XModuleTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,422 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 for multi-module mode compilation
- * @library /tools/lib
- * @modules
- *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.code
- *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.compiler/com.sun.tools.javac.processing
- * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase
- * @run main XModuleTest
- */
-
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.List;
-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.TypeElement;
-import javax.lang.model.util.Elements;
-
-import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import toolbox.JavacTask;
-import toolbox.ModuleBuilder;
-import toolbox.Task;
-import toolbox.Task.Expect;
-
-public class XModuleTest extends ModuleTestBase {
-
-    public static void main(String... args) throws Exception {
-        new XModuleTest().runTests();
-    }
-
-    @Test
-    public void testCorrectXModule(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        String log = new JavacTask(tb)
-                .options("-Xmodule:java.compiler")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!log.isEmpty())
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testSourcePath(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element, Other { }", "package javax.lang.model.element; interface Other { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        String log = new JavacTask(tb)
-                .options("-Xmodule:java.compiler", "-sourcepath", src.toString())
-                .outdir(classes)
-                .files(src.resolve("javax/lang/model/element/Extra.java"))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!log.isEmpty())
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testClassPath(Path base) throws Exception {
-        Path cpSrc = base.resolve("cpSrc");
-        tb.writeJavaFiles(cpSrc, "package p; public interface Other { }");
-        Path cpClasses = base.resolve("cpClasses");
-        tb.createDirectories(cpClasses);
-
-        String cpLog = new JavacTask(tb)
-                .outdir(cpClasses)
-                .files(findJavaFiles(cpSrc))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!cpLog.isEmpty())
-            throw new Exception("expected output not found: " + cpLog);
-
-        Path src = base.resolve("src");
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element, p.Other { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb)
-                .options("-Xmodule:java.compiler",
-                         "--class-path", cpClasses.toString(),
-                         "-XDrawDiagnostics")
-                .outdir(classes)
-                .files(src.resolve("javax/lang/model/element/Extra.java"))
-                .run(Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expectedOut = Arrays.asList(
-                "Extra.java:1:76: compiler.err.doesnt.exist: p",
-                "1 error"
-        );
-
-        if (!expectedOut.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testNoModuleInfoOnSourcePath(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src,
-                          "module java.compiler {}",
-                          "package javax.lang.model.element; public interface Extra { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb)
-                .options("-XDrawDiagnostics", "-Xmodule:java.compiler")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.xmodule.sourcepath",
-                                              "1 error");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testNoModuleInfoInClassOutput(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path srcMod = base.resolve("src-mod");
-        tb.writeJavaFiles(srcMod,
-                          "module mod {}");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        String logMod = new JavacTask(tb)
-                .options()
-                .outdir(classes)
-                .files(findJavaFiles(srcMod))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!logMod.isEmpty())
-            throw new Exception("unexpected output found: " + logMod);
-
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src,
-                          "package javax.lang.model.element; public interface Extra { }");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb)
-                .options("-XDrawDiagnostics", "-Xmodule:java.compiler")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.xmodule.classpath",
-                                              "1 error");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testModuleSourcePathXModule(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb)
-                .options("-XDrawDiagnostics", "-Xmodule:java.compiler", "--module-source-path", src.toString())
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("- compiler.err.xmodule.no.module.sourcepath");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testXModuleTooMany(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package javax.lang.model.element; public interface Extra extends Element { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("-XDrawDiagnostics", "-Xmodule:java.compiler", "-Xmodule:java.compiler")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("javac: option -Xmodule: can only be specified once",
-                                              "Usage: javac <options> <source files>",
-                                              "use --help for a list of possible options");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testWithModulePath(Path base) throws Exception {
-        Path modSrc = base.resolve("modSrc");
-        Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
-                .classes("package pkg1; public interface E { }")
-                .build(modSrc, modules);
-
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package p; interface A extends pkg1.E { }");
-
-        new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("--module-path", modules.toString(),
-                        "-Xmodule:m1")
-                .files(findJavaFiles(src))
-                .run()
-                .writeAll();
-
-        //checks module bounds still exist
-        new ModuleBuilder(tb, "m2")
-                .classes("package pkg2; public interface D { }")
-                .build(modSrc, modules);
-
-        Path src2 = base.resolve("src2");
-        tb.writeJavaFiles(src2, "package p; interface A extends pkg2.D { }");
-
-        List<String> log = new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("-XDrawDiagnostics",
-                        "--module-path", modules.toString(),
-                        "-Xmodule:m1")
-                .files(findJavaFiles(src2))
-                .run(Task.Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("A.java:1:32: compiler.err.package.not.visible: pkg2, (compiler.misc.not.def.access.does.not.read: m1, pkg2, m2)",
-                "1 error");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @Test
-    public void testWithUpgradeModulePath(Path base) throws Exception {
-        Path modSrc = base.resolve("modSrc");
-        Path modules = base.resolve("modules");
-        new ModuleBuilder(tb, "m1")
-                .classes("package pkg1; public interface E { }")
-                .build(modSrc, modules);
-
-        Path upgrSrc = base.resolve("upgradeSrc");
-        Path upgrade = base.resolve("upgrade");
-        new ModuleBuilder(tb, "m1")
-                .classes("package pkg1; public interface D { }")
-                .build(upgrSrc, upgrade);
-
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package p; interface A extends pkg1.D { }");
-
-        new JavacTask(tb, Task.Mode.CMDLINE)
-                .options("--module-path", modules.toString(),
-                        "--upgrade-module-path", upgrade.toString(),
-                        "-Xmodule:m1")
-                .files(findJavaFiles(src))
-                .run()
-                .writeAll();
-    }
-
-    @Test
-    public void testUnnamedIsolation(Path base) throws Exception {
-        //note: avoiding use of java.base, as that gets special handling on some places:
-        Path sourcePath = base.resolve("source-path");
-        tb.writeJavaFiles(sourcePath, "package src; public class Src {}");
-
-        Path classPathSrc = base.resolve("class-path-src");
-        tb.writeJavaFiles(classPathSrc, "package cp; public class CP { }");
-        Path classPath = base.resolve("classPath");
-        tb.createDirectories(classPath);
-
-        String cpLog = new JavacTask(tb)
-                .outdir(classPath)
-                .files(findJavaFiles(classPathSrc))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!cpLog.isEmpty())
-            throw new Exception("expected output not found: " + cpLog);
-
-        Path modulePathSrc = base.resolve("module-path-src");
-        tb.writeJavaFiles(modulePathSrc,
-                          "module m {}",
-                          "package m; public class M {}");
-        Path modulePath = base.resolve("modulePath");
-        tb.createDirectories(modulePath.resolve("m"));
-
-        String modLog = new JavacTask(tb)
-                .outdir(modulePath.resolve("m"))
-                .files(findJavaFiles(modulePathSrc))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!modLog.isEmpty())
-            throw new Exception("expected output not found: " + modLog);
-
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src, "package m; public class Extra { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        String log = new JavacTask(tb)
-                .options("-Xmodule:m",
-                         "--class-path", classPath.toString(),
-                         "--source-path", sourcePath.toString(),
-                         "--module-path", modulePath.toString(),
-                         "--processor-path", System.getProperty("test.classes"),
-                         "-XDaccessInternalAPI=true",
-                         "-processor", CheckModuleContentProcessing.class.getName())
-                .outdir(classes)
-                .files(findJavaFiles(sourcePath))
-                .run()
-                .writeAll()
-                .getOutput(Task.OutputKind.DIRECT);
-
-        if (!log.isEmpty())
-            throw new Exception("expected output not found: " + log);
-    }
-
-    @SupportedAnnotationTypes("*")
-    public static final class CheckModuleContentProcessing extends AbstractProcessor {
-
-        @Override
-        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-            Symtab syms = Symtab.instance(((JavacProcessingEnvironment) processingEnv).getContext());
-            Elements elements = processingEnv.getElementUtils();
-            ModuleElement unnamedModule = syms.unnamedModule;
-            ModuleElement mModule = elements.getModuleElement("m");
-
-            assertNonNull("mModule found", mModule);
-            assertNonNull("src.Src from m", elements.getTypeElement(mModule, "src.Src"));
-            assertNull("cp.CP not from m", elements.getTypeElement(mModule, "cp.CP"));
-            assertNull("src.Src not from unnamed", elements.getTypeElement(unnamedModule, "src.Src"));
-            assertNonNull("cp.CP from unnamed", elements.getTypeElement(unnamedModule, "cp.CP"));
-
-            return false;
-        }
-
-        @Override
-        public SourceVersion getSupportedSourceVersion() {
-            return SourceVersion.latest();
-        }
-
-        private static void assertNonNull(String msg, Object val) {
-            if (val == null) {
-                throw new AssertionError(msg);
-            }
-        }
-
-        private static void assertNull(String msg, Object val) {
-            if (val != null) {
-                throw new AssertionError(msg);
-            }
-        }
-    }
-
-}
--- a/langtools/test/tools/javac/processing/StopAfterError/StopAfterError.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/processing/StopAfterError/StopAfterError.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +27,8 @@
  * @summary If an error is produced by an annotation processor, the code should not be Attred, \
  *          unless requested
  * @modules jdk.compiler
- * @compile StopAfterError.java
+ * @library /tools/javac/lib
+ * @build StopAfterError JavacTestingAbstractProcessor
  * @compile/fail/ref=StopAfterError.out -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
  * @compile/fail/ref=StopAfterError.out -XDshould-stop.ifError=PROCESS -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
  * @compile/fail/ref=StopAfterErrorContinue.out -XDshould-stop.ifError=ATTR -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
@@ -42,8 +43,7 @@
 import javax.lang.model.element.TypeElement;
 import javax.tools.Diagnostic.Kind;
 
-@SupportedAnnotationTypes("*")
-public class StopAfterError extends AbstractProcessor {
+public class StopAfterError extends JavacTestingAbstractProcessor {
 
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -52,10 +52,4 @@
         }
         return false;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latestSupported();
-    }
-
 }
--- a/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/processing/model/LocalClasses/LocalClassesModel.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug 8166700
  * @summary Check that local classes originating in static initializer can be loaded properly.
  * @modules jdk.compiler
- * @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
+ * @library /tools/javac/lib
+ * @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest JavacTestingAbstractProcessor
  * @compile LocalClassesModel.java
  * @compile/process/ref=LocalClassesModel.out -processor LocalClassesModel LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
  */
@@ -42,8 +43,7 @@
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.util.ElementFilter;
 
-@SupportedAnnotationTypes("*")
-public class LocalClassesModel extends AbstractProcessor {
+public class LocalClassesModel extends JavacTestingAbstractProcessor {
 
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -65,9 +65,4 @@
 
         return false;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latestSupported();
-    }
 }
--- a/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug 7025809 8028543 6415644
+ * @bug 7025809 8028543 6415644 8028544 8029942
  * @summary Test latest, latestSupported, underscore as keyword, etc.
  * @author  Joseph D. Darcy
  * @modules java.compiler
@@ -44,8 +44,8 @@
     }
 
     private static void testLatestSupported() {
-        if (SourceVersion.latest() != RELEASE_9 ||
-            SourceVersion.latestSupported() != RELEASE_9)
+        if (SourceVersion.latest() != RELEASE_10 ||
+            SourceVersion.latestSupported() != RELEASE_10)
             throw new RuntimeException("Unexpected release value(s) found:\n" +
                                        "latest:\t" + SourceVersion.latest() + "\n" +
                                        "latestSupported:\t" + SourceVersion.latestSupported());
--- a/langtools/test/tools/javac/processing/model/nestedTypeVars/NestedTypeVars.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/processing/model/nestedTypeVars/NestedTypeVars.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,8 @@
 /**
  * @test
  * @modules jdk.compiler
- * @build NestedTypeVars
+ * @library /tools/javac/lib
+ * @build NestedTypeVars JavacTestingAbstractProcessor
  * @compile/process/ref=NestedTypeVars.out -processor NestedTypeVars Test$1L1$L2$1L3$L4$L5 Test$1L1$CCheck Test$1L1 Test$1CCheck Test$CCheck Test
  */
 
@@ -44,8 +45,7 @@
 import javax.lang.model.type.TypeVariable;
 import javax.lang.model.util.ElementFilter;
 
-@SupportedAnnotationTypes("*")
-public class NestedTypeVars extends AbstractProcessor{
+public class NestedTypeVars extends JavacTestingAbstractProcessor {
 
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -102,12 +102,6 @@
                 throw new IllegalStateException("Unexpected element: " + el + "(" + el.getKind() + ")");
         }
     }
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latestSupported();
-    }
-
-
 }
 
 class Test<T1, C> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/TestAllFoos.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173945
+ * @summary Test Elements.getAll{Type, Package, Module}Elements
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ *          jdk.compiler
+ * @build   JavacTestingAbstractProcessor TestAllFoos
+ * @compile -processor TestAllFoos -proc:only --release 8 --source-path modules/m1/pkg  modules/m1/pkg/C.java
+ * @compile -processor TestAllFoos -proc:only --release 8 --source-path modules/m2/pkg  modules/m2/pkg/C.java
+ */
+// @compile -processor TestAllFoos -proc:only             --module-source-path  modules -m m1,m2
+
+import java.util.Set;
+import static java.util.Objects.*;
+import javax.annotation.processing.*;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+
+/**
+ * Test basic workings of Elements.getAll{Type, Package, Module}Elements under
+ * pre- and post-modules.
+ */
+public class TestAllFoos extends JavacTestingAbstractProcessor {
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            boolean expectModules =
+                (processingEnv.getSourceVersion().compareTo(RELEASE_9) >= 0);
+
+            testSetSize(eltUtils.getAllTypeElements("java.lang.String"), 1);
+            testSetSize(eltUtils.getAllTypeElements("example.com"), 0);
+
+            if (!expectModules) {
+                // Expect empty modules set, single package named "pkg" with one type "pkg.C".
+                testSetSize(eltUtils.getAllModuleElements(), 0);
+                testSetSize(eltUtils.getAllPackageElements("pkg"), 1);
+                testSetSize(eltUtils.getAllTypeElements("pkg.C"),  1);
+            } else {
+                Set<? extends ModuleElement> modules =
+                    requireNonNull(eltUtils.getAllModuleElements());
+
+                ModuleElement m1 = requireNonNull(eltUtils.getModuleElement("m1"));
+                ModuleElement m2 = requireNonNull(eltUtils.getModuleElement("m2"));
+
+                if (!modules.contains(m1) ||
+                    !modules.contains(m2) ||
+                    !modules.contains(requireNonNull(eltUtils.getModuleElement("java.base"))))
+                    throw new RuntimeException("Missing modules " + modules);
+
+                // Expect two packages named "pkg" and two types named "pkg.C".
+                testSetSize(eltUtils.getAllPackageElements("pkg"), 2);
+                testSetSize(eltUtils.getAllTypeElements("pkg.C"),  2);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Check the set argument against null and throw an exception if
+     * the set is not of the expected size.
+     */
+    private static <E> Set<E> testSetSize(Set<E> set, int expectedSize) {
+        requireNonNull(set);
+        if (set.size() != expectedSize)
+            throw new RuntimeException("Unexpected size of set " + set);
+        return set;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m1/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,4 @@
+/* /nodynamiccopyright/ */
+
+module m1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m1/pkg/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,11 @@
+/* /nodynamiccopyright/ */
+
+package pkg;
+
+/**
+ * A lovely description of class C of package pkg in module m1.
+ */
+public class C {
+    public C() {}
+    public static String foo() {return "foo";}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m1/pkg/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,6 @@
+/* /nodynamiccopyright/ */
+
+/**
+ * A lovely description of package pkg in module m1.
+ */
+package pkg;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m2/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,4 @@
+/* /nodynamiccopyright/ */
+
+module m2 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m2/pkg/C.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,11 @@
+/* /nodynamiccopyright/ */
+
+package pkg;
+
+/**
+ * A lovely description of class C of package pkg in module m2.
+ */
+public class C {
+    public C() {}
+    public static String bar() {return "bar";}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/modules/m2/pkg/package-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,6 @@
+/* /nodynamiccopyright/ */
+
+/**
+ * A lovely description of package pkg in module m2.
+ */
+package pkg;
--- a/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
  * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
  * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_9 -source 1.9 -Xlint:-options HelloWorld.java
  */
 
 import java.util.Set;
--- a/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,6 +148,7 @@
                             error("unexpected exception from compiler: " + ise);
                         break;
                     case JDK1_9:
+                    case JDK1_10:
                         if (p == Profile.DEFAULT)
                             break;
                         if (ise == null)
--- a/langtools/test/tools/javac/redefineObject/Object1-test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/redefineObject/Object1-test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
  * @summary java.lang.Object can't be redefined without crashing javac
  * @author gafter
  *
- * @compile/module=java.base/fail/ref=Object1.out -XDrawDiagnostics Object1.java
+ * @compile/module=java.base/fail/ref=Object1.out -XDrawDiagnostics java/lang/Object1.java
  */
 
--- a/langtools/test/tools/javac/redefineObject/Object2-test.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/redefineObject/Object2-test.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,5 +27,5 @@
  * @summary java.lang.Object can't be redefined without crashing javac
  * @author gafter
  *
- * @compile/module=java.base/fail/ref=Object2.out -XDrawDiagnostics  Object2.java
+ * @compile/module=java.base/fail/ref=Object2.out -XDrawDiagnostics java/lang/Object2.java
  */
--- a/langtools/test/tools/javac/redefineObject/java.base/Object1.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
- * /nodynamiccopyright/
- * See ../Object1-test.java
- */
-
-package java.lang;
-class Object extends Throwable {
-    public final native Class getClass();
-    public native int hashCode();
-    public native boolean equals(Object obj);
-    protected native Object clone() throws CloneNotSupportedException;
-    public native String toString();
-    public final native void notify();
-    public final native void notifyAll();
-    public final native void wait(long timeout) throws InterruptedException;
-    public native final void wait(long timeout, int nanos) throws InterruptedException;
-    public native final void wait() throws InterruptedException;
-    protected void finalize() throws Throwable { }
-}
--- a/langtools/test/tools/javac/redefineObject/java.base/Object2.java	Thu Mar 09 21:35:19 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
- * /nodynamiccopyright/
- * See ../Object2-test.java
- */
-
-package java.lang;
-class Object implements Cloneable {
-    public final native Class getClass();
-    public native int hashCode();
-    public native boolean equals(Object obj);
-    public native Object clone() throws CloneNotSupportedException;
-    public native String toString();
-    public final native void notify();
-    public final native void notifyAll();
-    public final native void wait(long timeout) throws InterruptedException;
-    public native final void wait(long timeout, int nanos) throws InterruptedException;
-    public native final void wait() throws InterruptedException;
-    protected void finalize() throws Throwable { }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/redefineObject/java.base/java/lang/Object1.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,19 @@
+/*
+ * /nodynamiccopyright/
+ * See ../Object1-test.java
+ */
+
+package java.lang;
+class Object extends Throwable {
+    public final native Class getClass();
+    public native int hashCode();
+    public native boolean equals(Object obj);
+    protected native Object clone() throws CloneNotSupportedException;
+    public native String toString();
+    public final native void notify();
+    public final native void notifyAll();
+    public final native void wait(long timeout) throws InterruptedException;
+    public native final void wait(long timeout, int nanos) throws InterruptedException;
+    public native final void wait() throws InterruptedException;
+    protected void finalize() throws Throwable { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/redefineObject/java.base/java/lang/Object2.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,19 @@
+/*
+ * /nodynamiccopyright/
+ * See ../Object2-test.java
+ */
+
+package java.lang;
+class Object implements Cloneable {
+    public final native Class getClass();
+    public native int hashCode();
+    public native boolean equals(Object obj);
+    public native Object clone() throws CloneNotSupportedException;
+    public native String toString();
+    public final native void notify();
+    public final native void notifyAll();
+    public final native void wait(long timeout) throws InterruptedException;
+    public native final void wait(long timeout, int nanos) throws InterruptedException;
+    public native final void wait() throws InterruptedException;
+    protected void finalize() throws Throwable { }
+}
--- a/langtools/test/tools/javac/synthesize/Main.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/synthesize/Main.java	Mon Mar 13 19:58:52 2017 +0000
@@ -92,12 +92,17 @@
         File empty = new File("empty");
         empty.mkdirs();
 
+        // files to compile are in a separate directory from test to avoid
+        // confusing jtreg
+        File src = new File(testSrc, "src");
+
         List<String> args = new ArrayList<String>();
         args.add("-classpath");
         args.add("empty");
 
         if (stdBootClassPath) {
-            args.add("-Xmodule:java.base");
+            args.add("--patch-module");
+            args.add("java.base=" + testSrc.getAbsolutePath());
         } else {
             args.add("--system");
             args.add("none");
@@ -108,9 +113,6 @@
         args.add("-d");
         args.add(".");
 
-        // files to compile are in a separate directory from test to avoid
-        // confusing jtreg
-        File src = new File(testSrc, "src");
         for (String f: files)
             args.add(new File(src, f).getPath());
 
--- a/langtools/test/tools/javac/tree/ArrayTypeToString.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/tree/ArrayTypeToString.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug 8068737
  * @summary Tests ArrayType.toString with type annotations present
  * @modules jdk.compiler/com.sun.tools.javac.code
- * @build ArrayTypeToString
+ * @library /tools/javac/lib
+ * @build ArrayTypeToString JavacTestingAbstractProcessor
  * @compile/ref=ArrayTypeToString.out -XDaccessInternalAPI -XDrawDiagnostics -processor ArrayTypeToString -proc:only ArrayTypeToString.java
  */
 
@@ -54,8 +55,7 @@
 }
 
 @SupportedAnnotationTypes("Foo")
-@SupportedSourceVersion(SourceVersion.RELEASE_9)
-public class ArrayTypeToString extends AbstractProcessor {
+public class ArrayTypeToString extends JavacTestingAbstractProcessor {
     @Foo(0) String @Foo(1)[] @Foo(2)[] @Foo(3)[] field;
 
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
--- a/langtools/test/tools/javac/tree/JavacTreeScannerTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/tree/JavacTreeScannerTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -41,7 +41,7 @@
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
  * @build AbstractTreeScannerTest JavacTreeScannerTest
- * @run main JavacTreeScannerTest -q -r .
+ * @run main/othervm JavacTreeScannerTest -q -r .
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/tree/SourceTreeScannerTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -41,7 +41,7 @@
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
  * @build AbstractTreeScannerTest SourceTreeScannerTest
- * @run main SourceTreeScannerTest -q -r .
+ * @run main/othervm SourceTreeScannerTest -q -r .
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/tree/TreePosTest.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/tree/TreePosTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -108,7 +108,7 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
- * @run main TreePosTest -q -r .
+ * @run main/othervm TreePosTest -q -r .
  */
 public class TreePosTest {
     /**
--- a/langtools/test/tools/javac/varargs/7043922/T7043922.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/varargs/7043922/T7043922.java	Mon Mar 13 19:58:52 2017 +0000
@@ -28,6 +28,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.util
+ * @run main/othervm T7043922
  */
 
 import com.sun.source.util.JavacTask;
--- a/langtools/test/tools/javac/versions/Versions.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/javac/versions/Versions.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 
 /*
  * @test
- * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610
+ * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546
  * @summary Check interpretation of -target and -source options
  * @modules java.compiler
  *          jdk.compiler
@@ -69,6 +69,7 @@
         check("53.0", "-source 1.7");
         check("53.0", "-source 1.8");
         check("53.0", "-source 1.9");
+        check("53.0", "-source 1.10");
 
         check_source_target("50.0", "6", "6");
         check_source_target("51.0", "6", "7");
@@ -80,6 +81,7 @@
         check_source_target("53.0", "7", "9");
         check_source_target("53.0", "8", "9");
         check_source_target("53.0", "9", "9");
+        check_source_target("53.0", "10", "10");
 
         checksrc16("-source 1.6");
         checksrc16("-source 6");
@@ -93,19 +95,26 @@
         checksrc18("-source 8");
         checksrc18("-source 1.8", "-target 1.8");
         checksrc18("-source 8", "-target 8");
-        checksrc19();
         checksrc19("-source 1.9");
         checksrc19("-source 9");
         checksrc19("-source 1.9", "-target 1.9");
         checksrc19("-source 9", "-target 9");
-        checksrc19("-target 1.9");
-        checksrc19("-target 9");
+
+        checksrc110();
+        checksrc110("-source 1.10");
+        checksrc110("-source 10");
+        checksrc110("-source 1.10", "-target 1.10");
+        checksrc110("-source 10", "-target 10");
+        checksrc110("-target 1.10");
+        checksrc110("-target 10");
 
         fail("-source 7", "-target 1.6", "Base.java");
         fail("-source 8", "-target 1.6", "Base.java");
         fail("-source 8", "-target 1.7", "Base.java");
         fail("-source 9", "-target 1.7", "Base.java");
         fail("-source 9", "-target 1.8", "Base.java");
+        fail("-source 10", "-target 1.7", "Base.java");
+        fail("-source 10", "-target 1.8", "Base.java");
 
         fail("-source 1.5", "-target 1.5", "Base.java");
         fail("-source 1.4", "-target 1.4", "Base.java");
@@ -202,6 +211,11 @@
         checksrc18(args);
     }
 
+    protected void checksrc110(String... args) {
+        printargs("checksrc110", args);
+        checksrc19(args);
+    }
+
     protected void pass(String... args) {
         printargs("pass", args);
 
--- a/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
         assertTrue(invoke("7"));
         assertTrue(invoke("8"));
         assertTrue(invoke("9"));
+        assertTrue(invoke("10"));
     }
 
     @Test
--- a/langtools/test/tools/jdeps/jdkinternals/RemovedJDKInternals.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/langtools/test/tools/jdeps/jdkinternals/RemovedJDKInternals.java	Mon Mar 13 19:58:52 2017 +0000
@@ -63,7 +63,7 @@
         Path sunMiscSrc = Paths.get(TEST_SRC, "patches", JDK_UNSUPPORTED);
         Path patchDir = PATCHES_DIR.resolve(JDK_UNSUPPORTED);
         assertTrue(CompilerUtils.compile(sunMiscSrc, patchDir,
-                                         "-Xmodule:" + JDK_UNSUPPORTED));
+                                         "--patch-module", JDK_UNSUPPORTED + "=" + sunMiscSrc.toString()));
 
         // compile com.sun.image.codec.jpeg types
         Path codecSrc = Paths.get(TEST_SRC, "patches", "java.desktop");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/modules/DotFileTest.java	Mon Mar 13 19:58:52 2017 +0000
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8173374
+ * @summary Tests module dot graph
+ * @modules java.desktop
+ *          java.sql
+ *          jdk.jdeps/com.sun.tools.jdeps
+ * @run testng DotFileTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Set;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.spi.ToolProvider;
+import java.util.stream.Collectors;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+public class DotFileTest {
+    private static final ToolProvider JDEPS = ToolProvider.findFirst("jdeps")
+        .orElseThrow(() -> new RuntimeException("jdeps not found"));
+
+    private static final Path DOTS_DIR = Paths.get("dots");
+    private static final Path SPEC_DIR = Paths.get("spec");
+
+    @DataProvider(name = "modules")
+    public Object[][] modules() {
+        return new Object[][]{
+            {"java.desktop", Set.of("java.datatransfer -> java.base",
+                                    "java.desktop -> java.datatransfer",
+                                    "java.desktop -> java.prefs",
+                                    "java.prefs -> java.xml",
+                                    "java.xml -> java.base" )
+            },
+            { "java.sql",    Set.of("java.logging -> java.base",
+                                    "java.sql -> java.logging",
+                                    "java.sql -> java.xml",
+                                    "java.xml -> java.base" )
+            }
+        };
+    }
+    @DataProvider(name = "specVersion")
+    public Object[][] specVersion() {
+        return new Object[][]{
+            {"java.desktop", Set.of("java.datatransfer -> java.base",
+                                    "java.desktop -> java.datatransfer",
+                                    "java.desktop -> java.xml",
+                                    "java.xml -> java.base")
+            },
+            { "java.sql",    Set.of("java.logging -> java.base",
+                                    "java.sql -> java.logging",
+                                    "java.sql -> java.xml",
+                                    "java.xml -> java.base" )
+            }
+        };
+    }
+
+    @Test(dataProvider = "modules")
+    public void test(String name, Set<String> edges) throws Exception {
+        String[] options = new String[] {
+            "-dotoutput", DOTS_DIR.toString(),
+            "-s", "-m", name
+        };
+        assertTrue(JDEPS.run(System.out, System.out, options) == 0);
+
+        Path path = DOTS_DIR.resolve(name + ".dot");
+        assertTrue(Files.exists(path));
+        Set<String> lines = Files.readAllLines(path).stream()
+                                 .filter(l -> l.contains(" -> "))
+                                 .map(this::split)
+                                 .collect(Collectors.toSet());
+        assertEquals(lines, edges);
+    }
+
+    @Test(dataProvider = "specVersion")
+    public void testAPIOnly(String name, Set<String> edges) throws Exception {
+        String[] options = new String[]{
+            "-dotoutput", SPEC_DIR.toString(),
+            "-s", "-apionly",
+            "-m", name
+        };
+        assertTrue(JDEPS.run(System.out, System.out, options) == 0);
+
+        Path path = SPEC_DIR.resolve(name + ".dot");
+        assertTrue(Files.exists(path));
+        Set<String> lines = Files.readAllLines(path).stream()
+                                 .filter(l -> l.contains(" -> "))
+                                 .map(this::split)
+                                 .collect(Collectors.toSet());
+        assertEquals(lines, edges);
+    }
+
+    static Pattern PATTERN = Pattern.compile(" *\"(\\S+)\" -> \"(\\S+)\" .*");
+    String split(String line) {
+        Matcher pm = PATTERN.matcher(line);
+        assertTrue(pm.find());
+        return String.format("%s -> %s", pm.group(1), pm.group(2));
+    }
+}
--- a/make/CompileJavaModules.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/CompileJavaModules.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -85,7 +85,7 @@
 
 ################################################################################
 
-java.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
+java.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
@@ -247,7 +247,7 @@
 
 ################################################################################
 
-java.management.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:javax.*'
+java.management.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:javax.*'
 
 ################################################################################
 
--- a/make/GenerateLinkOptData.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/GenerateLinkOptData.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -49,7 +49,7 @@
 
 LINK_OPT_DIR := $(SUPPORT_OUTPUTDIR)/link_opt
 CLASSLIST_FILE := $(LINK_OPT_DIR)/classlist
-JLI_TRACE_FILE := $(LINK_OPT_DIR)/jli_trace.out
+JLI_TRACE_FILE := $(LINK_OPT_DIR)/default_jli_trace.txt
 
 # If an external buildjdk has been supplied, we don't build a separate interim
 # image, so just use the external build jdk instead.
@@ -83,6 +83,14 @@
 
 TARGETS += $(COPY_CLASSLIST)
 
+# Copy the default_jli_trace.txt file into jdk.jlink
+$(eval $(call SetupCopyFiles, COPY_JLI_TRACE, \
+    FILES := $(JLI_TRACE_FILE), \
+    DEST := $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jlink/internal/plugins, \
+))
+
+TARGETS += $(COPY_JLI_TRACE)
+
 ################################################################################
 
 all: $(TARGETS)
--- a/make/Images.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/Images.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -105,7 +105,7 @@
 JLINK_JLI_CLASSES :=
 ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
   JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/link_opt/classlist
-  JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/link_opt/jli_trace.out
+  JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/link_opt/default_jli_trace.txt
 endif
 JLINK_ORDER_RESOURCES += \
     /java.base/java/** \
--- a/make/Init.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/Init.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -66,7 +66,7 @@
   ifeq ($(CALLED_SPEC_TARGETS), )
     ONLY_GLOBAL_TARGETS := true
   endif
-  ifneq ($(findstring qp, $(MAKEFLAGS)),)
+  ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
     ONLY_GLOBAL_TARGETS := true
   endif
 
--- a/make/Javadoc.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/Javadoc.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -314,7 +314,7 @@
   $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html
 
   # Rule for actually running javadoc
-  $$($1_INDEX_FILE): $(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_PACKAGE_DEPS) $$($1_DEPS)
+  $$($1_INDEX_FILE): $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_PACKAGE_DEPS) $$($1_DEPS)
 	$$(call LogWarn, Generating Javadoc from $$(words $$($1_PACKAGES)) package(s) for $$($1_OUTPUT_DIRNAME))
 	$$(call MakeDir, $$(@D))
         ifneq ($$($1_PACKAGES_FILE), )
@@ -743,7 +743,7 @@
 
 ################################################################################
 
-docs-javadoc: $(BUILD_TOOLS_JDK) $(TARGETS)
+docs-javadoc: $(TARGETS)
 
 docs-copy: $(COPY_TARGETS)
 
--- a/make/Main.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/Main.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -654,8 +654,7 @@
   # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
   # we don't need to depend on all other jmods
   ifneq ($(CREATING_BUILDJDK), true)
-    java.base-jmod: jrtfs-jar $(filter-out java.base-jmod \
-        $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS))
+    java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
   endif
 
   # Building java.base-jmod requires all of hotspot to be built.
@@ -728,7 +727,7 @@
     generate-link-opt-data: buildtools-jdk
 
     # The generated classlist needs to go into java.base-jmod.
-    java.base-jmod jdk-image jre-image: generate-link-opt-data
+    java.base-jmod jdk.jlink-jmod jdk-image jre-image: generate-link-opt-data
   endif
 
   release-file: create-source-revision-tracker
--- a/make/common/Modules.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/common/Modules.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -107,7 +107,6 @@
     jdk.charsets \
     jdk.crypto.ec \
     jdk.crypto.cryptoki \
-    jdk.desktop \
     jdk.dynalink \
     jdk.jsobject \
     jdk.localedata \
@@ -115,6 +114,7 @@
     jdk.scripting.nashorn \
     jdk.security.auth \
     jdk.security.jgss \
+    jdk.vm.compiler \
     jdk.xml.dom \
     jdk.zipfs \
     #
--- a/make/common/SetupJavaCompilers.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/make/common/SetupJavaCompilers.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -69,7 +69,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 9 -target 9 \
+    FLAGS := -source 10 -target 10 \
         -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -79,7 +79,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 9 -target 9 \
+    FLAGS := -source 10 -target 10 \
         -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/nashorn/.hgtags	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/.hgtags	Mon Mar 13 19:58:52 2017 +0000
@@ -387,5 +387,9 @@
 2a0437036a64853334e538044eb68d2df70075fa jdk-9+151
 ddc52e72757086a75a54371e8e7f56a3f89f1e55 jdk-9+152
 19aaaf2d02b7d6986538cd9a8c46901ecb50eebf jdk-9+153
+a84b49cfee63716975535abae2865ffef4dd6474 jdk-10+0
 a84b49cfee63716975535abae2865ffef4dd6474 jdk-9+154
 f9bb37a817b3cd3b758a60f3c68258a6554eb382 jdk-9+155
+d577398d31111be4bdaa08008247cf4242eaea94 jdk-9+156
+f6070efba6af0dc003e24ca736426c93e99ee96a jdk-9+157
+13ae2480a4c395026b3aa1739e0f9895dc8b25d9 jdk-9+158
--- a/nashorn/.jcheck/conf	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/.jcheck/conf	Mon Mar 13 19:58:52 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
--- a/nashorn/src/jdk.dynalink/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.dynalink/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -216,6 +216,8 @@
  * language runtime B gets passed to code from language runtime A, the linker
  * from B will get a chance to link the call site in A when it encounters the
  * object from B.
+ *
+ * @since 9
  */
 module jdk.dynalink {
     requires java.logging;
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -25,6 +25,8 @@
 
 /**
  * Nashorn shell module
+ *
+ * @since 9
  */
 module jdk.scripting.nashorn.shell {
     requires java.desktop;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Mon Mar 13 19:58:52 2017 +0000
@@ -1372,7 +1372,7 @@
         };
 
         final Configuration cf = parent.configuration()
-                .resolveRequires(finder, ModuleFinder.of(), Set.of(mn));
+                .resolve(finder, ModuleFinder.of(), Set.of(mn));
 
         final PrivilegedAction<Layer> pa = () -> parent.defineModules(cf, name -> loader);
         final Layer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT);
@@ -1798,7 +1798,7 @@
 
         final Layer boot = Layer.boot();
         final Configuration conf = boot.configuration().
-            resolveRequires(mf, ModuleFinder.of(), rootMods);
+            resolve(mf, ModuleFinder.of(), rootMods);
         final String firstMod = rootMods.iterator().next();
         return boot.defineModulesWithOneLoader(conf, cl).findLoader(firstMod);
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -26,9 +26,11 @@
 package jdk.nashorn.internal.runtime;
 
 import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Modifier;
 import java.lang.reflect.Module;
 import java.security.CodeSource;
 import java.util.Objects;
+import java.util.Set;
 
 /**
  * Responsible for loading script generated classes.
@@ -69,12 +71,11 @@
     private Module createModule(final String moduleName) {
         final Module structMod = context.getStructLoader().getModule();
         final ModuleDescriptor.Builder builder =
-            ModuleDescriptor.module(moduleName)
-                    .requires("java.base")
+            ModuleDescriptor.newModule(moduleName, Set.of(Modifier.SYNTHETIC))
                     .requires("java.logging")
                     .requires(NASHORN_MODULE.getName())
                     .requires(structMod.getName())
-                    .contains(SCRIPTS_PKG);
+                    .packages(Set.of(SCRIPTS_PKG));
 
         if (Context.javaSqlFound) {
             builder.requires("java.sql");
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java	Mon Mar 13 19:58:52 2017 +0000
@@ -31,8 +31,10 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX;
 
 import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Modifier;
 import java.lang.reflect.Module;
 import java.security.ProtectionDomain;
+import java.util.Set;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 
 /**
@@ -62,12 +64,11 @@
     }
 
     private Module createModule(final String moduleName) {
-        final ModuleDescriptor descriptor
-                = ModuleDescriptor.module(moduleName)
-                    .requires("java.base")
-                    .requires(NASHORN_MODULE.getName())
-                    .contains(SCRIPTS_PKG)
-                    .build();
+        final ModuleDescriptor descriptor =
+            ModuleDescriptor.newModule(moduleName, Set.of(Modifier.SYNTHETIC))
+                            .requires(NASHORN_MODULE.getName())
+                            .packages(Set.of(SCRIPTS_PKG))
+                            .build();
 
         final Module mod = Context.createModuleTrusted(descriptor, this);
         loadModuleManipulator();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java	Thu Mar 09 21:35:19 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java	Mon Mar 13 19:58:52 2017 +0000
@@ -89,6 +89,8 @@
 <h2>Other non-standard built-in objects</h2>
 In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
 {@code JSAdapter}, {@code JavaImporter}, {@code Packages}
+
+@since 9
  */
 module jdk.scripting.nashorn {
     requires java.logging;
--- a/test/TestCommon.gmk	Thu Mar 09 21:35:19 2017 +0000
+++ b/test/TestCommon.gmk	Mon Mar 13 19:58:52 2017 +0000
@@ -370,7 +370,7 @@
 # Give tests access to JT_JAVA, see JDK-8141609
 JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
 # Set other vm and test options
-JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%)
+JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%)
 
 ifeq ($(IGNORE_MARKED_TESTS), true)
   # Option to tell jtreg to not run tests marked with "ignore"