Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 7f65a94..6f3a4bc 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -410,3 +410,4 @@
 aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165
 ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
 35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167
+143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168
diff --git a/common/autoconf/build-aux/install.sh b/common/autoconf/build-aux/install.sh
index 98c1dc4..5934326 100644
--- a/common/autoconf/build-aux/install.sh
+++ b/common/autoconf/build-aux/install.sh
@@ -1,5 +1,28 @@
-#!/bin/sh
-echo >&2 "No suitable 'install' command found.'"
-echo >&2 "If automake is installed, running 'automake -fa'"
-echo >&2 "(and ignoring the errors) might produce one."
-exit 1
+#!/bin/bash
+#
+# 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.
+#
+
+# This file is empty on purpose. It's a placeholder which is required by
+# autoconf, but it serves no purpose for us.
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 15a76ea..30d6273 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -995,8 +995,9 @@
 OPENJDK_TARGET_CPU_ISADIR
 OPENJDK_TARGET_CPU_LEGACY_LIB
 OPENJDK_TARGET_CPU_LEGACY
-OPENJDK_MODULE_TARGET_OS_ARCH
-OPENJDK_MODULE_TARGET_OS_NAME
+RELEASE_FILE_OS_ARCH
+RELEASE_FILE_OS_NAME
+OPENJDK_MODULE_TARGET_PLATFORM
 COMPILE_TYPE
 OPENJDK_TARGET_CPU_ENDIAN
 OPENJDK_TARGET_CPU_BITS
@@ -4897,6 +4898,8 @@
 
 
 
+
+
 #%%% Build and target systems %%%
 
 
@@ -5180,7 +5183,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1492975963
+DATE_WHEN_GENERATED=1493884285
 
 ###############################################################################
 #
@@ -16040,6 +16043,27 @@
     OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
   fi
 
+  OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
+
+
+
+  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+    RELEASE_FILE_OS_NAME=SunOS
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+    RELEASE_FILE_OS_NAME=Linux
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+    RELEASE_FILE_OS_NAME=Windows
+  fi
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    RELEASE_FILE_OS_NAME="Darwin"
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+    RELEASE_FILE_OS_NAME="AIX"
+  fi
+  RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
+
 
 
 
diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4
index c9c339d..0dbf74c 100644
--- a/common/autoconf/platform.m4
+++ b/common/autoconf/platform.m4
@@ -433,6 +433,29 @@
 
 ])
 
+AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
+[
+  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+    RELEASE_FILE_OS_NAME=SunOS
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+    RELEASE_FILE_OS_NAME=Linux
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+    RELEASE_FILE_OS_NAME=Windows
+  fi
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    RELEASE_FILE_OS_NAME="Darwin"
+  fi
+  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+    RELEASE_FILE_OS_NAME="AIX"
+  fi
+  RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
+
+  AC_SUBST(RELEASE_FILE_OS_NAME)
+  AC_SUBST(RELEASE_FILE_OS_ARCH)
+])
+
 AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
 [
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@@ -447,8 +470,8 @@
     OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
   fi
 
-  AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME)
-  AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH)
+  OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
+  AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
 ])
 
 #%%% Build and target systems %%%
@@ -466,6 +489,7 @@
   PLATFORM_EXTRACT_TARGET_AND_BUILD
   PLATFORM_SETUP_TARGET_CPU_BITS
   PLATFORM_SET_MODULE_TARGET_OS_VALUES
+  PLATFORM_SET_RELEASE_FILE_OS_VALUES
   PLATFORM_SETUP_LEGACY_VARS
 ])
 
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 08a38c6..ad113a2 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -101,9 +101,12 @@
 OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
 OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
 
-# OS values for use in ModuleTarget class file attribute.
-OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@
-OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@
+# Target platform value in ModuleTarget class file attribute.
+OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@
+
+# OS_* properties in release file
+RELEASE_FILE_OS_NAME:=@RELEASE_FILE_OS_NAME@
+RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@
 
 LIBM:=@LIBM@
 LIBDL:=@LIBDL@
diff --git a/common/doc/testing.md b/common/doc/testing.md
index 46f32f9..f84bd27 100644
--- a/common/doc/testing.md
+++ b/common/doc/testing.md
@@ -199,9 +199,8 @@
 Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
 
 ---
-# Override some definitions in http://openjdk.java.net/page.css that are
-# unsuitable for this document.
+# Override some definitions in the global css file that are not optimal for
+# this document.
 header-includes:
  - '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>'
- - '<style type="text/css">pre { font-size: 10pt; }</style>'
 ---
diff --git a/corba/.hgtags b/corba/.hgtags
index 0de63b7..aa44740 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -410,3 +410,4 @@
 a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
 934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166
 43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167
+03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 3a67e3d..4dc7b9e 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -570,3 +570,4 @@
 c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
 560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166
 1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167
+fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
diff --git a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp
index ceaec5d..57bc7b2 100644
--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp
@@ -1,8 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
- * reserved.  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE
- * HEADER.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -21,7 +20,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include <stdio.h>
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java
index ca06fc4..abe5e0c 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/hotspot/src/share/vm/classfile/moduleEntry.cpp b/hotspot/src/share/vm/classfile/moduleEntry.cpp
index 2f07b10..f9941c0 100644
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp
@@ -158,10 +158,10 @@
       loader_data() != m_loader_data &&
       !m_loader_data->is_builtin_class_loader_data()) {
     _must_walk_reads = true;
-    if (log_is_enabled(Trace, modules)) {
+    if (log_is_enabled(Trace, module)) {
       ResourceMark rm;
-      log_trace(modules)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked",
-                         (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
+      log_trace(module)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked",
+                        (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
     }
   }
 }
@@ -180,10 +180,10 @@
     // on the remaining live modules on the reads list.
     _must_walk_reads = false;
 
-    if (log_is_enabled(Trace, modules)) {
+    if (log_is_enabled(Trace, module)) {
       ResourceMark rm;
-      log_trace(modules)("ModuleEntry::purge_reads(): module %s reads list being walked",
-                         (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
+      log_trace(module)("ModuleEntry::purge_reads(): module %s reads list being walked",
+                        (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
     }
 
     // Go backwards because this removes entries that are dead.
@@ -236,8 +236,11 @@
       m = m->next();
 
       ResourceMark rm;
-      log_debug(modules)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ?
-                         to_remove->name()->as_C_string() : UNNAMED_MODULE);
+      if (to_remove->name() != NULL) {
+        log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string());
+      }
+      log_debug(module)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ?
+                        to_remove->name()->as_C_string() : UNNAMED_MODULE);
 
       // Clean out the C heap allocated reads list first before freeing the entry
       to_remove->delete_reads();
@@ -315,9 +318,9 @@
 
   if (ClassLoader::is_in_patch_mod_entries(name)) {
     entry->set_is_patched();
-    if (log_is_enabled(Trace, modules, patch)) {
+    if (log_is_enabled(Trace, module, patch)) {
       ResourceMark rm;
-      log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
+      log_trace(module, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
     }
   }
 
diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp
index 3992849..7328aec 100644
--- a/hotspot/src/share/vm/classfile/modules.cpp
+++ b/hotspot/src/share/vm/classfile/modules.cpp
@@ -237,16 +237,18 @@
   // Patch any previously loaded class's module field with java.base's java.lang.Module.
   ModuleEntryTable::patch_javabase_entries(module_handle);
 
-  log_debug(modules)("define_javabase_module(): Definition of module: "
-                     JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
-                     module_version != NULL ? module_version : "NULL",
-                     module_location != NULL ? module_location : "NULL",
-                     pkg_list->length());
+  log_info(module, load)(JAVA_BASE_NAME " location: %s",
+                         module_location != NULL ? module_location : "NULL");
+  log_debug(module)("define_javabase_module(): Definition of module: "
+                    JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
+                    module_version != NULL ? module_version : "NULL",
+                    module_location != NULL ? module_location : "NULL",
+                    pkg_list->length());
 
   // packages defined to java.base
   for (int x = 0; x < pkg_list->length(); x++) {
-    log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
-                       (pkg_list->at(x))->as_C_string());
+    log_trace(module)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
+                      (pkg_list->at(x))->as_C_string());
   }
 }
 
@@ -438,23 +440,24 @@
       throw_dup_pkg_exception(module_name, existing_pkg, CHECK);
   }
 
-  if (log_is_enabled(Debug, modules)) {
-    outputStream* logst = Log(modules)::debug_stream();
+  log_info(module, load)("%s location: %s", module_name,
+                         module_location != NULL ? module_location : "NULL");
+  if (log_is_enabled(Debug, module)) {
+    outputStream* logst = Log(module)::debug_stream();
     logst->print("define_module(): creation of module: %s, version: %s, location: %s, ",
                  module_name, module_version != NULL ? module_version : "NULL",
                  module_location != NULL ? module_location : "NULL");
     loader_data->print_value_on(logst);
     logst->print_cr(", package #: %d", pkg_list->length());
     for (int y = 0; y < pkg_list->length(); y++) {
-      log_trace(modules)("define_module(): creation of package %s for module %s",
-                         (pkg_list->at(y))->as_C_string(), module_name);
+      log_trace(module)("define_module(): creation of package %s for module %s",
+                        (pkg_list->at(y))->as_C_string(), module_name);
     }
   }
 
   // If the module is defined to the boot loader and an exploded build is being
   // used, prepend <java.home>/modules/modules_name, if it exists, to the system boot class path.
   if (loader == NULL &&
-      !Universe::is_module_initialized() &&
       !ClassLoader::has_jrt_entry()) {
     ClassLoader::add_to_exploded_build_list(module_symbol, CHECK);
   }
@@ -487,7 +490,7 @@
   }
   Handle h_loader = Handle(THREAD, loader);
 
-  log_debug(modules)("set_bootloader_unnamed_module(): recording unnamed module for boot loader");
+  log_debug(module)("set_bootloader_unnamed_module(): recording unnamed module for boot loader");
 
   // Ensure the boot loader's PackageEntryTable has been created
   ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK);
@@ -545,10 +548,10 @@
                       from_module_entry->name()->as_C_string()));
   }
 
-  log_debug(modules)("add_module_exports(): package %s in module %s is exported to module %s",
-                     package_entry->name()->as_C_string(),
-                     from_module_entry->name()->as_C_string(),
-                     to_module_entry == NULL ? "NULL" :
+  log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s",
+                    package_entry->name()->as_C_string(),
+                    from_module_entry->name()->as_C_string(),
+                    to_module_entry == NULL ? "NULL" :
                       to_module_entry->is_named() ?
                         to_module_entry->name()->as_C_string() : UNNAMED_MODULE);
 
@@ -592,12 +595,12 @@
   }
 
   ResourceMark rm(THREAD);
-  log_debug(modules)("add_reads_module(): Adding read from module %s to module %s",
-                     from_module_entry->is_named() ?
-                     from_module_entry->name()->as_C_string() : UNNAMED_MODULE,
-                     to_module_entry == NULL ? "all unnamed" :
-                       (to_module_entry->is_named() ?
-                        to_module_entry->name()->as_C_string() : UNNAMED_MODULE));
+  log_debug(module)("add_reads_module(): Adding read from module %s to module %s",
+                    from_module_entry->is_named() ?
+                    from_module_entry->name()->as_C_string() : UNNAMED_MODULE,
+                    to_module_entry == NULL ? "all unnamed" :
+                      (to_module_entry->is_named() ?
+                       to_module_entry->name()->as_C_string() : UNNAMED_MODULE));
 
   // if modules are the same or if from_module is unnamed then no need to add the read.
   if (from_module_entry != to_module_entry && from_module_entry->is_named()) {
@@ -616,7 +619,7 @@
   }
   oop mirror = JNIHandles::resolve_non_null(clazz);
   if (mirror == NULL) {
-    log_debug(modules)("get_module(): no mirror, returning NULL");
+    log_debug(module)("get_module(): no mirror, returning NULL");
     return NULL;
   }
   if (!java_lang_Class::is_instance(mirror)) {
@@ -629,9 +632,9 @@
   assert(module != NULL, "java.lang.Class module field not set");
   assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module");
 
-  if (log_is_enabled(Debug, modules)) {
+  if (log_is_enabled(Debug, module)) {
     ResourceMark rm(THREAD);
-    outputStream* logst = Log(modules)::debug_stream();
+    outputStream* logst = Log(module)::debug_stream();
     Klass* klass = java_lang_Class::as_Klass(mirror);
     oop module_name = java_lang_Module::name(module);
     if (module_name != NULL) {
@@ -764,8 +767,8 @@
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message);
   }
 
-  log_debug(modules)("add_module_package(): Adding package %s to module %s",
-                     package_name, module_entry->name()->as_C_string());
+  log_debug(module)("add_module_package(): Adding package %s to module %s",
+                    package_name, module_entry->name()->as_C_string());
 
   TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
   PackageEntryTable* package_table = loader_data->packages();
@@ -820,8 +823,8 @@
                         module_entry->name()->as_C_string()));
     }
 
-    log_debug(modules)("add_module_exports_to_all_unnamed(): package %s in module"
-                       " %s is exported to all unnamed modules",
+    log_debug(module)("add_module_exports_to_all_unnamed(): package %s in module"
+                      " %s is exported to all unnamed modules",
                        package_entry->name()->as_C_string(),
                        module_entry->name()->as_C_string());
 
diff --git a/hotspot/src/share/vm/classfile/packageEntry.cpp b/hotspot/src/share/vm/classfile/packageEntry.cpp
index ab80fcb..aec61c0 100644
--- a/hotspot/src/share/vm/classfile/packageEntry.cpp
+++ b/hotspot/src/share/vm/classfile/packageEntry.cpp
@@ -77,13 +77,13 @@
       (this_pkg_mod == NULL || this_pkg_mod->loader_data() != m_loader_data) &&
       !m_loader_data->is_builtin_class_loader_data()) {
     _must_walk_exports = true;
-    if (log_is_enabled(Trace, modules)) {
+    if (log_is_enabled(Trace, module)) {
       ResourceMark rm;
       assert(name() != NULL, "PackageEntry without a valid name");
-      log_trace(modules)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked",
-                         name()->as_C_string(),
-                         (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ?
-                           UNNAMED_MODULE : this_pkg_mod->name()->as_C_string());
+      log_trace(module)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked",
+                        name()->as_C_string(),
+                        (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ?
+                          UNNAMED_MODULE : this_pkg_mod->name()->as_C_string());
     }
   }
 }
@@ -132,13 +132,13 @@
     // on the remaining live modules on the exports list.
     _must_walk_exports = false;
 
-    if (log_is_enabled(Trace, modules)) {
+    if (log_is_enabled(Trace, module)) {
       ResourceMark rm;
       assert(name() != NULL, "PackageEntry without a valid name");
       ModuleEntry* pkg_mod = module();
-      log_trace(modules)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked",
-                         name()->as_C_string(),
-                         (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
+      log_trace(module)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked",
+                        name()->as_C_string(),
+                        (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
     }
 
     // Go backwards because this removes entries that are dead.
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 633bb8f..1340560 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -650,6 +650,8 @@
   template(addUses_signature,                          "(Ljava/lang/Module;Ljava/lang/Class;)V")                  \
   template(addProvides_name,                           "addProvides")                                             \
   template(addProvides_signature,                      "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
+  template(loadModule_name,                            "loadModule")                                              \
+  template(loadModule_signature,                       "(Ljava/lang/String;)Ljava/lang/Module;")                  \
   template(transformedByAgent_name,                    "transformedByAgent")                                      \
   template(transformedByAgent_signature,               "(Ljava/lang/Module;)V")                                   \
   template(appendToClassPathForInstrumentation_name,   "appendToClassPathForInstrumentation")                     \
diff --git a/hotspot/src/share/vm/logging/logTag.hpp b/hotspot/src/share/vm/logging/logTag.hpp
index e262d07..322e903 100644
--- a/hotspot/src/share/vm/logging/logTag.hpp
+++ b/hotspot/src/share/vm/logging/logTag.hpp
@@ -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
@@ -82,7 +82,7 @@
   LOG_TAG(metadata) \
   LOG_TAG(metaspace) \
   LOG_TAG(mmu) \
-  LOG_TAG(modules) \
+  LOG_TAG(module) \
   LOG_TAG(monitorinflation) \
   LOG_TAG(monitormismatch) \
   LOG_TAG(nmethod) \
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 7098451..044d26e 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -2331,21 +2331,21 @@
              name()->as_C_string(), loader_data->loader_name());
     }
 
-    if (log_is_enabled(Debug, modules)) {
+    if (log_is_enabled(Debug, module)) {
       ResourceMark rm;
       ModuleEntry* m = _package_entry->module();
-      log_trace(modules)("Setting package: class: %s, package: %s, loader: %s, module: %s",
-                         external_name(),
-                         pkg_name->as_C_string(),
-                         loader_data->loader_name(),
-                         (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE));
+      log_trace(module)("Setting package: class: %s, package: %s, loader: %s, module: %s",
+                        external_name(),
+                        pkg_name->as_C_string(),
+                        loader_data->loader_name(),
+                        (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE));
     }
   } else {
     ResourceMark rm;
-    log_trace(modules)("Setting package: class: %s, package: unnamed, loader: %s, module: %s",
-                       external_name(),
-                       (loader_data != NULL) ? loader_data->loader_name() : "NULL",
-                       UNNAMED_MODULE);
+    log_trace(module)("Setting package: class: %s, package: unnamed, loader: %s, module: %s",
+                      external_name(),
+                      (loader_data != NULL) ? loader_data->loader_name() : "NULL",
+                      UNNAMED_MODULE);
   }
 }
 
diff --git a/hotspot/src/share/vm/opto/parse3.cpp b/hotspot/src/share/vm/opto/parse3.cpp
index ca571af..ee0997e 100644
--- a/hotspot/src/share/vm/opto/parse3.cpp
+++ b/hotspot/src/share/vm/opto/parse3.cpp
@@ -146,8 +146,16 @@
 
 
 void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
+  BasicType bt = field->layout_type();
+
   // Does this field have a constant value?  If so, just push the value.
-  if (field->is_constant()) {
+  if (field->is_constant() &&
+      // Keep consistent with types found by ciTypeFlow: for an
+      // unloaded field type, ciTypeFlow::StateVector::do_getstatic()
+      // speculates the field is null. The code in the rest of this
+      // method does the same. We must not bypass it and use a non
+      // null constant here.
+      (bt != T_OBJECT || field->type()->is_loaded())) {
     // final or stable field
     Node* con = make_constant_from_field(field, obj);
     if (con != NULL) {
@@ -163,7 +171,6 @@
   int offset = field->offset_in_bytes();
   const TypePtr* adr_type = C->alias_type(field)->adr_type();
   Node *adr = basic_plus_adr(obj, obj, offset);
-  BasicType bt = field->layout_type();
 
   // Build the resultant type of the load
   const Type *type;
diff --git a/hotspot/src/share/vm/prims/jvmti.xml b/hotspot/src/share/vm/prims/jvmti.xml
index e7d02cc..df7f349 100644
--- a/hotspot/src/share/vm/prims/jvmti.xml
+++ b/hotspot/src/share/vm/prims/jvmti.xml
@@ -6814,7 +6814,9 @@
         <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
         <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
         and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
-        then the module can not be updated with these functions.
+        then the module can not be updated with these functions. The result of
+        this function is always <code>JNI_TRUE</code> when called to determine
+        if an unnamed module is modifiable.
       </description>
       <origin>new</origin>
       <capabilities>
diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp
index ad7984c..8ac9e1b 100644
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp
@@ -54,7 +54,6 @@
 #include "runtime/os.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
-#include "services/attachListener.hpp"
 #include "services/serviceUtil.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
@@ -2479,15 +2478,6 @@
   typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *);
 }
 
-jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
-  // get agent name and options
-  const char* agent = op->arg(0);
-  const char* absParam = op->arg(1);
-  const char* options = op->arg(2);
-
-  return load_agent_library(agent, absParam, options, st);
-}
-
 jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
                                      const char *options, outputStream* st) {
   char ebuf[1024];
diff --git a/hotspot/src/share/vm/prims/jvmtiExport.hpp b/hotspot/src/share/vm/prims/jvmtiExport.hpp
index 8599656..666ab62 100644
--- a/hotspot/src/share/vm/prims/jvmtiExport.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp
@@ -45,7 +45,6 @@
 class JvmtiManageCapabilities;
 class JvmtiEnv;
 class JvmtiThreadState;
-class AttachOperation;
 
 #define JVMTI_SUPPORT_FLAG(key)                                           \
   private:                                                                \
@@ -396,7 +395,6 @@
 #if INCLUDE_SERVICES
   // attach support
   static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
-  static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
 #endif
 
   // SetNativeMethodPrefix support
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 8d86e8a..dbbe554 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -2838,11 +2838,14 @@
         build_jvm_args(option->optionString);
     }
 
-    // -verbose:[class/gc/jni]
+    // -verbose:[class/module/gc/jni]
     if (match_option(option, "-verbose", &tail)) {
       if (!strcmp(tail, ":class") || !strcmp(tail, "")) {
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, load));
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload));
+      } else if (!strcmp(tail, ":module")) {
+        LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load));
+        LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload));
       } else if (!strcmp(tail, ":gc")) {
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
       } else if (!strcmp(tail, ":jni")) {
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index 77acae0..16ce96b 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -3874,6 +3874,9 @@
   product(bool, StartAttachListener, false,                                 \
           "Always start Attach Listener at VM startup")                     \
                                                                             \
+  product(bool, EnableDynamicAgentLoading, true,                            \
+          "Allow tools to load agents with the attach mechanism")           \
+                                                                            \
   manageable(bool, PrintConcurrentLocks, false,                             \
           "Print java.util.concurrent locks in thread dump")                \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index c5bf44f..758020a 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3404,7 +3404,7 @@
 //
 //     After phase 2, The VM will begin search classes from -Xbootclasspath/a.
 static void call_initPhase2(TRAPS) {
-  TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
+  TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, module, startuptime));
 
   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
   instanceKlassHandle klass (THREAD, k);
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
index 0de704d..99ba58b 100644
--- a/hotspot/src/share/vm/services/attachListener.cpp
+++ b/hotspot/src/share/vm/services/attachListener.cpp
@@ -100,6 +100,36 @@
   return JNI_OK;
 }
 
+// Implementation of "load" command.
+static jint load_agent(AttachOperation* op, outputStream* out) {
+  // get agent name and options
+  const char* agent = op->arg(0);
+  const char* absParam = op->arg(1);
+  const char* options = op->arg(2);
+
+  // If loading a java agent then need to ensure that the java.instrument module is loaded
+  if (strcmp(agent, "instrument") == 0) {
+    Thread* THREAD = Thread::current();
+    ResourceMark rm(THREAD);
+    HandleMark hm(THREAD);
+    JavaValue result(T_OBJECT);
+    Handle h_module_name = java_lang_String::create_from_str("java.instrument", THREAD);
+    JavaCalls::call_static(&result,
+                           SystemDictionary::module_Modules_klass(),
+                           vmSymbols::loadModule_name(),
+                           vmSymbols::loadModule_signature(),
+                           h_module_name,
+                           THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      java_lang_Throwable::print(PENDING_EXCEPTION, out);
+      CLEAR_PENDING_EXCEPTION;
+      return JNI_ERR;
+    }
+  }
+
+  return JvmtiExport::load_agent_library(agent, absParam, options, out);
+}
+
 // Implementation of "properties" command.
 // See also: PrintSystemPropertiesDCmd class
 static jint get_system_properties(AttachOperation* op, outputStream* out) {
@@ -282,7 +312,7 @@
   { "agentProperties",  get_agent_properties },
   { "datadump",         data_dump },
   { "dumpheap",         dump_heap },
-  { "load",             JvmtiExport::load_agent_library },
+  { "load",             load_agent },
   { "properties",       get_system_properties },
   { "threaddump",       thread_dump },
   { "inspectheap",      heap_inspection },
@@ -321,6 +351,10 @@
     // handle special detachall operation
     if (strcmp(op->name(), AttachOperation::detachall_operation_name()) == 0) {
       AttachListener::detachall();
+    } else if (!EnableDynamicAgentLoading && strcmp(op->name(), "load") == 0) {
+      st.print("Dynamic agent loading is not enabled. "
+               "Use -XX:+EnableDynamicAgentLoading to launch target VM.");
+      res = JNI_ERR;
     } else {
       // find the function to dispatch too
       AttachOperationFunctionInfo* info = NULL;
diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp
index 29aa08d..fab6990 100644
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp
@@ -42,6 +42,21 @@
 #include "utilities/macros.hpp"
 #include "oops/objArrayOop.inline.hpp"
 
+
+static void loadAgentModule(TRAPS) {
+  ResourceMark rm(THREAD);
+  HandleMark hm(THREAD);
+
+  JavaValue result(T_OBJECT);
+  Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK);
+  JavaCalls::call_static(&result,
+                         SystemDictionary::module_Modules_klass(),
+                         vmSymbols::loadModule_name(),
+                         vmSymbols::loadModule_signature(),
+                         h_module_name,
+                         THREAD);
+}
+
 void DCmdRegistrant::register_dcmds(){
   // Registration of the diagnostic commands
   // First argument specifies which interfaces will export the command
@@ -753,6 +768,7 @@
     // the remote management server.
     // throw java.lang.NoSuchMethodError if the method doesn't exist
 
+    loadAgentModule(CHECK);
     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
     instanceKlassHandle ik (THREAD, k);
@@ -826,6 +842,7 @@
     // the local management server
     // throw java.lang.NoSuchMethodError if method doesn't exist
 
+    loadAgentModule(CHECK);
     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
     instanceKlassHandle ik (THREAD, k);
@@ -843,6 +860,7 @@
     // management server
     // throw java.lang.NoSuchMethodError if method doesn't exist
 
+    loadAgentModule(CHECK);
     Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
     instanceKlassHandle ik (THREAD, k);
@@ -864,6 +882,7 @@
   // invoke getManagementAgentStatus() method to generate the status info
   // throw java.lang.NoSuchMethodError if method doesn't exist
 
+  loadAgentModule(CHECK);
   Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
   instanceKlassHandle ik (THREAD, k);
diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
index e923258..e792ad1 100644
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
@@ -32,7 +32,7 @@
  *          java.management
  *          jdk.attach
  *
- * @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
+ * @run main/othervm -Djdk.attach.allowAttachSelf compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
  */
 
 package compiler.jsr292;
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
index 5826f45..c9e027a 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
@@ -29,7 +29,7 @@
  *          jdk.internal.vm.ci/jdk.vm.ci.runtime
  *          jdk.attach
  *          java.base/jdk.internal.misc
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.RedefineClassTest
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null -Djdk.attach.allowAttachSelf jdk.vm.ci.runtime.test.RedefineClassTest
  */
 
 package jdk.vm.ci.runtime.test;
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
index 9ca9ba0..d2e1b13 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java
@@ -33,7 +33,7 @@
  * @run driver compiler.profiling.spectrapredefineclass.Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
  *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
- *                   -XX:ReservedCodeCacheSize=3M
+ *                   -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
  *                   compiler.profiling.spectrapredefineclass.Agent
  */
 
diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
index 857fbbb..cea5a47 100644
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java
@@ -36,7 +36,7 @@
  * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
  *                   -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
- *                   -XX:ReservedCodeCacheSize=3M
+ *                   -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
  *                   compiler.profiling.spectrapredefineclass_classloaders.Agent
  */
 
diff --git a/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java b/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java
index 96f10bb..6d1c2d6 100644
--- a/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java
+++ b/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reqserved.
+ * 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
diff --git a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
index 77c0a31..b0e9364 100644
--- a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
+++ b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
@@ -10,7 +10,7 @@
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
- * ac_heapanied this code).
+ * accompanied this code).
  *
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
diff --git a/hotspot/test/native/memory/test_metachunk.cpp b/hotspot/test/native/memory/test_metachunk.cpp
index e99bf42..9a4c6da 100644
--- a/hotspot/test/native/memory/test_metachunk.cpp
+++ b/hotspot/test/native/memory/test_metachunk.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java
index d5f20b5..4fb53df 100644
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java
@@ -28,7 +28,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.attach/sun.tools.attach
  *          java.management
- * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestOptionsWithRangesDynamic
+ * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Djdk.attach.allowAttachSelf TestOptionsWithRangesDynamic
  */
 
 import java.util.List;
diff --git a/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java b/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java
index 9a821e0..3ce993f 100644
--- a/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java
+++ b/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java
@@ -8,7 +8,7 @@
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
diff --git a/hotspot/test/runtime/Metaspace/DefineClass.java b/hotspot/test/runtime/Metaspace/DefineClass.java
index 4563e56..6225e155 100644
--- a/hotspot/test/runtime/Metaspace/DefineClass.java
+++ b/hotspot/test/runtime/Metaspace/DefineClass.java
@@ -41,8 +41,8 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions
                      -XX:-UnsyncloadClass -XX:-AllowParallelDefineClass
                      test.DefineClass defineClassParallel
- * @run main/othervm test.DefineClass redefineClass
- * @run main/othervm test.DefineClass redefineClassWithError
+ * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass
+ * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError
  * @author volker.simonis@gmail.com
  */
 
diff --git a/hotspot/test/runtime/logging/ModulesTest.java b/hotspot/test/runtime/logging/ModulesTest.java
index 58b94cc..0a469d3 100644
--- a/hotspot/test/runtime/logging/ModulesTest.java
+++ b/hotspot/test/runtime/logging/ModulesTest.java
@@ -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,7 +23,7 @@
 
 /*
  * @test
- * @summary modules=debug should have logging from statements in the code
+ * @summary -Xlog:module should emit logging output
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -35,9 +35,16 @@
 
 public class ModulesTest {
     public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xlog:modules=trace", "-version");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        testModuleTrace("-Xlog:module=trace", "-version");
+        testModuleLoad("-Xlog:module+load", "-version");
+        testModuleUnload("-Xlog:module+unload", "-version");
+
+        // same as -Xlog:module+load -Xlog:module+unload
+        testModuleLoad("-verbose:module", "-version");
+    }
+
+    static void testModuleTrace(String... args) throws Exception {
+        OutputAnalyzer output = run(args);
         output.shouldContain("define_javabase_module(): Definition of module:");
         output.shouldContain("define_javabase_module(): creation of package");
         output.shouldContain("define_module(): creation of module");
@@ -48,5 +55,22 @@
         output.shouldContain("Setting package: class:");
         output.shouldHaveExitValue(0);
     }
+
+    static void testModuleLoad(String... args) throws Exception {
+        OutputAnalyzer output = run(args);
+        output.shouldContain("java.base location:");
+        output.shouldContain("java.management location:");
+        output.shouldHaveExitValue(0);
+    }
+
+    static void testModuleUnload(String... args) throws Exception {
+        OutputAnalyzer output = run(args);
+        output.shouldHaveExitValue(0);
+    }
+
+    static OutputAnalyzer run(String... args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
+        return new OutputAnalyzer(pb.start());
+    }
 }
 
diff --git a/hotspot/test/runtime/logging/StartupTimeTest.java b/hotspot/test/runtime/logging/StartupTimeTest.java
index 4448cae..4069b02 100644
--- a/hotspot/test/runtime/logging/StartupTimeTest.java
+++ b/hotspot/test/runtime/logging/StartupTimeTest.java
@@ -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
@@ -57,7 +57,7 @@
 
     static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception {
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldNotContain("[modules,startuptime]");
+        output.shouldNotContain("[module,startuptime]");
         output.shouldHaveExitValue(0);
     }
 
@@ -70,11 +70,11 @@
                                                    InnerClass.class.getName());
         analyzeOutputOff(pb);
 
-        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules",
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module",
                                                    InnerClass.class.getName());
         analyzeModulesOutputOn(pb);
 
-        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off",
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module=off",
                                                    InnerClass.class.getName());
         analyzeModulesOutputOff(pb);
     }
diff --git a/hotspot/test/runtime/logging/ThreadLoggingTest.java b/hotspot/test/runtime/logging/ThreadLoggingTest.java
index 1f06e05..80b8cc6 100644
--- a/hotspot/test/runtime/logging/ThreadLoggingTest.java
+++ b/hotspot/test/runtime/logging/ThreadLoggingTest.java
@@ -9,7 +9,7 @@
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
diff --git a/hotspot/test/runtime/logging/p2/B.jcod b/hotspot/test/runtime/logging/p2/B.jcod
index 724c180..b30d1e3 100644
--- a/hotspot/test/runtime/logging/p2/B.jcod
+++ b/hotspot/test/runtime/logging/p2/B.jcod
@@ -8,7 +8,7 @@
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
diff --git a/hotspot/test/runtime/modules/JVMAddModuleExports.java b/hotspot/test/runtime/modules/JVMAddModuleExports.java
index 01d441c..da83982 100644
--- a/hotspot/test/runtime/modules/JVMAddModuleExports.java
+++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java
@@ -41,12 +41,12 @@
         MyClassLoader to_cl = new MyClassLoader();
         Module from_module, to_module;
 
-        from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "this/package" });
+        from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "x/apackage" });
         assertNotNull(from_module, "Module should not be null");
-        ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "this/package" });
-        to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/package" });
+        ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "x/apackage" });
+        to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/apackage" });
         assertNotNull(to_module, "Module should not be null");
-        ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/package" });
+        ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/apackage" });
 
         // Null from_module argument, expect an NPE
         try {
@@ -117,19 +117,19 @@
 
         // Export a package, that is not in from_module, to from_module
         try {
-            ModuleHelper.AddModuleExports(from_module, "that/package", from_module);
+            ModuleHelper.AddModuleExports(from_module, "that/apackage", from_module);
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
         }
 
         // Export the same package twice to the same module
-        ModuleHelper.AddModuleExports(from_module, "this/package", to_module);
-        ModuleHelper.AddModuleExports(from_module, "this/package", to_module);
+        ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module);
+        ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module);
 
         // Export a package, using '.' instead of '/'
         try {
-            ModuleHelper.AddModuleExports(from_module, "this.package", to_module);
+            ModuleHelper.AddModuleExports(from_module, "x.apackage", to_module);
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
@@ -137,8 +137,8 @@
 
         // Export a package to the unnamed module and then to a specific module.
         // The qualified export should be ignored.
-        ModuleHelper.AddModuleExportsToAll(to_module, "that/package");
-        ModuleHelper.AddModuleExports(to_module, "that/package", from_module);
+        ModuleHelper.AddModuleExportsToAll(to_module, "that/apackage");
+        ModuleHelper.AddModuleExports(to_module, "that/apackage", from_module);
     }
 
     static class MyClassLoader extends ClassLoader { }
diff --git a/hotspot/test/runtime/modules/JVMAddModulePackage.java b/hotspot/test/runtime/modules/JVMAddModulePackage.java
index eb2e3258..dc2237f 100644
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java
+++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java
@@ -49,16 +49,16 @@
         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" });
+        module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "apackage/num3" });
         assertNotNull(module_three, "Module should not be null");
-        ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" });
+        ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" });
 
         // Simple call
         ModuleHelper.AddModulePackage(module_one, "new_package");
 
         // Add a package and export it
-        ModuleHelper.AddModulePackage(module_one, "package/num3");
-        ModuleHelper.AddModuleExportsToAll(module_one, "package/num3");
+        ModuleHelper.AddModulePackage(module_one, "apackage/num3");
+        ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3");
 
         // Null module argument, expect an NPE
         try {
@@ -94,7 +94,7 @@
 
         // Invalid package name, expect an IAE
         try {
-            ModuleHelper.AddModulePackage(module_one, "your.package");
+            ModuleHelper.AddModulePackage(module_one, "your.apackage");
             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(module_one, ";your/package");
+            ModuleHelper.AddModulePackage(module_one, ";your/apackage");
             throw new RuntimeException("Failed to get the expected IAE");
         } catch(IllegalArgumentException e) {
             // Expected
diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java
index e3e263b..3c40f02 100644
--- a/hotspot/test/runtime/modules/JVMDefineModule.java
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java
@@ -207,10 +207,10 @@
         ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { });
 
         // Invalid package name, expect an IAE
-        m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.package" });
+        m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.apackage" });
         try {
-            ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.package" });
-            throw new RuntimeException("Failed to get expected IAE for your.package");
+            ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.apackage" });
+            throw new RuntimeException("Failed to get expected IAE for your.apackage");
         } catch(IllegalArgumentException e) {
             if (!e.getMessage().contains("Invalid package name")) {
               throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage());
@@ -220,8 +220,8 @@
         // Invalid package name, expect an IAE
         m = ModuleHelper.ModuleObject("moduleSix", cl, new String[] { "foo" }); // Name irrelevant
         try {
-            ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/package" });
-            throw new RuntimeException("Failed to get expected IAE for ;your.package");
+            ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/apackage" });
+            throw new RuntimeException("Failed to get expected IAE for ;your.apackage");
         } catch(IllegalArgumentException e) {
             if (!e.getMessage().contains("Invalid package name")) {
               throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage());
diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java
index 83f706d..c3906bc 100644
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java
@@ -53,7 +53,7 @@
         //   those loaders never die.
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
              "-Xbootclasspath/a:.",
-             "-Xlog:modules=trace",
+             "-Xlog:module=trace",
              "-version");
 
         OutputAnalyzer oa = new OutputAnalyzer(pb.start());
@@ -88,7 +88,7 @@
         //   the same loader and thus have the exact same life cycle.
         pb = ProcessTools.createJavaProcessBuilder(
              "-Xbootclasspath/a:.",
-             "-Xlog:modules=trace",
+             "-Xlog:module=trace",
              "ModuleSameCLMain");
 
         oa = new OutputAnalyzer(pb.start());
@@ -102,7 +102,7 @@
         //   class loaders which could die and thus be unloaded.
         pb = ProcessTools.createJavaProcessBuilder(
              "-Xbootclasspath/a:.",
-             "-Xlog:modules=trace",
+             "-Xlog:module=trace",
              "ModuleNonBuiltinCLMain");
 
         oa = new OutputAnalyzer(pb.start());
@@ -120,7 +120,7 @@
         pb = ProcessTools.createJavaProcessBuilder(
              "-Djava.system.class.loader=CustomSystemClassLoader",
              "-Xbootclasspath/a:.",
-             "-Xlog:modules=trace",
+             "-Xlog:module=trace",
              "ModuleNonBuiltinCLMain");
 
         oa = new OutputAnalyzer(pb.start());
diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java
index 9db70d4..dacc018 100644
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java
@@ -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
@@ -73,7 +73,7 @@
         // test's, defined to module jdk.translet, export list at
         // GC safepoints.
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xlog:modules=trace",
+            "-Xlog:module=trace",
             "-p", MODS_DIR.toString(),
             "-m", "jdk.test/test.MainGC");
         OutputAnalyzer oa = new OutputAnalyzer(pb.start());
diff --git a/hotspot/test/testlibrary/ctw/Makefile b/hotspot/test/testlibrary/ctw/Makefile
index db7204b..3b52118 100644
--- a/hotspot/test/testlibrary/ctw/Makefile
+++ b/hotspot/test/testlibrary/ctw/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2016. Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 1026653..24993c5 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -410,3 +410,4 @@
 55419603989707ec50c84bb379bbdc1adeec3ab2 jdk-9+165
 8d3febd5c9d82e49f3e6e5f8eb10f959e7b50f83 jdk-9+166
 646567dcfa64b9a39b33d71330427737d1c1a0d5 jdk-9+167
+23a87f409371fb8ce7b764cccb3a74c3f6b29900 jdk-9+168
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
index f33b34b..fbc5a60 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
@@ -1,8 +1,27 @@
-
-//----------------------------------------------------
-// The following code was generated by CUP v0.10j
-// Thu Oct 06 10:09:26 PDT 2005
-//----------------------------------------------------
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.org.apache.xalan.internal.xsltc.compiler;
 
@@ -16,8 +35,10 @@
 import com.sun.org.apache.xalan.internal.xsltc.runtime.Operators;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
 
-/** CUP v0.10j generated parser.
-  */
+/**
+ * CUP v0.10j generated parser.
+ * This class was generated by CUP v0.10j on Thu Oct 06 10:09:26 PDT 2005.
+ */
 public class XPathParser extends com.sun.java_cup.internal.runtime.lr_parser {
 
   /** Default constructor. */
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java
index d64dc3f..843521e 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/sym.java
@@ -1,12 +1,34 @@
-
-//----------------------------------------------------
-// The following code was generated by CUP v0.10j
-// Fri Feb 27 13:01:50 PST 2004
-//----------------------------------------------------
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.org.apache.xalan.internal.xsltc.compiler;
 
-/** CUP generated class containing symbol constants. */
+/**
+ * CUP generated class containing symbol constants.
+ * This class was generated by CUP v0.10j on Fri Feb 27 13:01:50 PST 2004.
+ */
 public class sym {
   /* terminals */
   public static final int Literal = 26;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java
index 816cdaa..ddd4558 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java
deleted file mode 100644
index 10d9d0b..0000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerElementHandler.java
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xerces.internal.xinclude;
-
-
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.Stack;
-
-import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
-import com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar;
-import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
-import com.sun.org.apache.xerces.internal.xni.Augmentations;
-import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
-import com.sun.org.apache.xerces.internal.xni.QName;
-import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
-import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
-import com.sun.org.apache.xerces.internal.xni.XMLLocator;
-import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-import com.sun.org.apache.xerces.internal.xni.XMLString;
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
-import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
-import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator;
-/**
- * @author Arun Yadav, Sun Microsystem
- */
-public class XPointerElementHandler implements XPointerSchema {
-
-
-    // recognized features and properties
-
-    /** Property identifier: error handler. */
-    protected static final String ERROR_REPORTER =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
-    /** Property identifier: grammar pool . */
-    protected static final String GRAMMAR_POOL =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
-
-    /** Property identifier: grammar pool . */
-    protected static final String ENTITY_RESOLVER =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
-
-    protected static final String XPOINTER_SCHEMA =
-    Constants.XERCES_PROPERTY_PREFIX + Constants.XPOINTER_SCHEMA_PROPERTY;
-
-    /** Recognized features. */
-    private static final String[] RECOGNIZED_FEATURES = {
-    };
-
-    /** Feature defaults. */
-    private static final Boolean[] FEATURE_DEFAULTS = {
-    };
-
-    /** Recognized properties. */
-
-    private static final String[] RECOGNIZED_PROPERTIES =
-    { ERROR_REPORTER, GRAMMAR_POOL, ENTITY_RESOLVER, XPOINTER_SCHEMA };
-
-    /** Property defaults. */
-    private static final Object[] PROPERTY_DEFAULTS = { null, null, null,null };
-
-    // Data
-
-    protected XMLDocumentHandler fDocumentHandler;
-    protected XMLDocumentSource fDocumentSource;
-
-    protected XIncludeHandler fParentXIncludeHandler;
-
-    protected XMLLocator fDocLocation;
-    protected XIncludeNamespaceSupport fNamespaceContext;
-    protected XMLErrorReporter fErrorReporter;
-    protected XMLGrammarPool fGrammarPool;
-    protected XMLGrammarDescription fGrammarDesc;
-    protected DTDGrammar fDTDGrammar;
-    protected XMLEntityResolver fEntityResolver;
-    protected ParserConfigurationSettings fSettings;
-    //protected String fPointerSchema;
-    protected StringBuffer fPointer;
-    private int elemCount = 0;
-
-
-    // The current element depth.
-    // This is used to access the appropriate level of the following stacks.
-    private int fDepth;
-
-    // The depth of the first element to actually be part of the result infoset.
-    // This will normally be 1, but it could be larger when the top-level item
-    // is an include, and processing goes to the fallback.
-    private int fRootDepth;
-
-    // this value must be at least 1
-    private static final int INITIAL_SIZE = 8;
-
-
-    // Used to ensure that fallbacks are always children of include elements,
-    // and that include elements are never children of other include elements.
-    // An index contains true if the ancestor of the current element which resides
-    // at that depth was an include element.
-    private boolean[] fSawInclude = new boolean[INITIAL_SIZE];
-
-
-    // Ensures that only one fallback element can be at a single depth.
-    // An index contains true if we have seen any fallback elements at that depth,
-    // and it is only reset to false when the end tag of the parent is encountered.
-    private boolean[] fSawFallback = new boolean[INITIAL_SIZE];
-
-
-    // The state of the processor at each given depth.
-    private int[] fState = new int[INITIAL_SIZE];
-
-    QName foundElement = null;
-    boolean skip = false;
-    // Constructors
-
-    public XPointerElementHandler() {
-
-
-        fDepth = 0;
-        fRootDepth = 0;
-        fSawFallback[fDepth] = false;
-        fSawInclude[fDepth] = false;
-        fSchemaName="element";
-
-
-    }
-
-    // START OF IMPLEMENTATION OF XMLComponent methods //////
-
-    public void reset(){
-        elemCount =0;
-        fPointerToken = null;
-        fCurrentTokenint=0;
-        fCurrentTokenString=null;
-        fCurrentTokenType=0 ;
-        fElementCount =0;
-        fCurrentToken =0;
-        includeElement = false;
-        foundElement = null;
-        skip = false;
-        fSubResourceIdentified=false;
-    }
-
-    public void reset(XMLComponentManager componentManager)
-    throws XNIException {
-        fNamespaceContext = null;
-        elemCount =0;
-        fDepth = 0;
-        fRootDepth = 0;
-        fPointerToken = null;
-        fCurrentTokenint=0;
-        fCurrentTokenString=null;
-        fCurrentTokenType=0 ;
-        foundElement = null;
-        includeElement = false;
-        skip = false;
-        fSubResourceIdentified=false;
-
-
-
-
-        try {
-            setErrorReporter(
-            (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER));
-        }
-        catch (XMLConfigurationException e) {
-            fErrorReporter = null;
-        }
-        try {
-            fGrammarPool =
-            (XMLGrammarPool)componentManager.getProperty(GRAMMAR_POOL);
-        }
-        catch (XMLConfigurationException e) {
-            fGrammarPool = null;
-        }
-        try {
-            fEntityResolver =
-            (XMLEntityResolver)componentManager.getProperty(
-            ENTITY_RESOLVER);
-        }
-        catch (XMLConfigurationException e) {
-            fEntityResolver = null;
-        }
-
-        fSettings = new ParserConfigurationSettings();
-
-        Enumeration xercesFeatures = Constants.getXercesFeatures();
-        while (xercesFeatures.hasMoreElements()) {
-            String featureId = (String)xercesFeatures.nextElement();
-            fSettings.addRecognizedFeatures(new String[] { featureId });
-            try {
-                fSettings.setFeature(
-                featureId,
-                componentManager.getFeature(featureId));
-            }
-            catch (XMLConfigurationException e) {
-                // componentManager doesn't support this feature,
-                // so we won't worry about it
-            }
-        }
-/*              try{
-          dtdValidator =   (XMLDTDValidator)componentManager.getProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY);
-                }Catch(Exception ex){
-                        ex.printStackTrace();
-                }*/
-
-    } // reset(XMLComponentManager)
-
-    /**
-     * Returns a list of feature identifiers that are recognized by
-     * this component. This method may return null if no features
-     * are recognized by this component.
-     */
-    public String[] getRecognizedFeatures() {
-        return RECOGNIZED_FEATURES;
-    } // getRecognizedFeatures():String[]
-
-    /**
-     * Sets the state of a feature. This method is called by the component
-     * manager any time after reset when a feature changes state.
-     * <p>
-     * <strong>Note:</strong> Components should silently ignore features
-     * that do not affect the operation of the component.
-     *
-     * @param featureId The feature identifier.
-     * @param state     The state of the feature.
-     *
-     * @throws SAXNotRecognizedException The component should not throw
-     *                                   this exception.
-     * @throws SAXNotSupportedException The component should not throw
-     *                                  this exception.
-     */
-    public void setFeature(String featureId, boolean state)
-    throws XMLConfigurationException {
-        if (fSettings != null) {
-            fSettings.setFeature(featureId, state);
-        }
-
-    } // setFeature(String,boolean)
-
-    /**
-     * Returns a list of property identifiers that are recognized by
-     * this component. This method may return null if no properties
-     * are recognized by this component.
-     */
-    public String[] getRecognizedProperties() {
-        return RECOGNIZED_PROPERTIES;
-    } // getRecognizedProperties():String[]
-
-    /**
-     * Sets the value of a property. This method is called by the component
-     * manager any time after reset when a property changes value.
-     * <p>
-     * <strong>Note:</strong> Components should silently ignore properties
-     * that do not affect the operation of the component.
-     *
-     * @param propertyId The property identifier.
-     * @param value      The value of the property.
-     *
-     * @throws SAXNotRecognizedException The component should not throw
-     *                                   this exception.
-     * @throws SAXNotSupportedException The component should not throw
-     *                                  this exception.
-     */
-    public void setProperty(String propertyId, Object value)
-    throws XMLConfigurationException {
-        if (propertyId.equals(ERROR_REPORTER)) {
-            setErrorReporter((XMLErrorReporter)value);
-        }
-        if (propertyId.equals(GRAMMAR_POOL)) {
-            fGrammarPool = (XMLGrammarPool)value;
-        }
-        if (propertyId.equals(ENTITY_RESOLVER)) {
-            fEntityResolver = (XMLEntityResolver)value;
-        }
-
-    } // setProperty(String,Object)
-
-    /**
-     * Returns the default state for a feature, or null if this
-     * component does not want to report a default value for this
-     * feature.
-     *
-     * @param featureId The feature identifier.
-     *
-     * @since Xerces 2.2.0
-     */
-    public Boolean getFeatureDefault(String featureId) {
-        for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
-            if (RECOGNIZED_FEATURES[i].equals(featureId)) {
-                return FEATURE_DEFAULTS[i];
-            }
-        }
-        return null;
-    } // getFeatureDefault(String):Boolean
-
-    /**
-     * Returns the default state for a property, or null if this
-     * component does not want to report a default value for this
-     * property.
-     *
-     * @param propertyId The property identifier.
-     *
-     * @since Xerces 2.2.0
-     */
-    public Object getPropertyDefault(String propertyId) {
-        for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
-            if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
-                return PROPERTY_DEFAULTS[i];
-            }
-        }
-        return null;
-    } // getPropertyDefault(String):Object
-
-    private void setErrorReporter(XMLErrorReporter reporter) {
-        fErrorReporter = reporter;
-        if (fErrorReporter != null) {
-            fErrorReporter.putMessageFormatter(
-            XIncludeMessageFormatter.XINCLUDE_DOMAIN,
-            new XIncludeMessageFormatter());
-        }
-    }
-    ///////// END OF IMPLEMENTATION  OF XMLComponents methods. //////////
-
-
-
-    //////// START OF  IMPLEMENTATION OF XMLDOCUMENTSOURCE INTERFACE /////////
-
-    public void setDocumentHandler(XMLDocumentHandler handler) {
-        fDocumentHandler = handler;
-    }
-
-    public XMLDocumentHandler getDocumentHandler() {
-        return fDocumentHandler;
-    }
-
-    ///////   END OF IMPLENTATION OF XMLDOCUMENTSOURCE INTERFACE ///////////
-
-
-
-
-    /////////////// Implementation of XPointerSchema Methods //////////////////////
-
-    String fSchemaName;
-    String fSchemaPointer;
-    boolean fSubResourceIdentified;
-    /**
-     * set the Schema Name  eg element , xpointer
-     */
-    public void setXPointerSchemaName(String schemaName){
-        fSchemaName = schemaName;
-    }
-
-    /**
-     * Return  Schema Name  eg element , xpointer
-     *
-     */
-    public String getXpointerSchemaName(){
-        return fSchemaName;
-    }
-
-    /**
-     * Parent Contenhandler for the this contenthandler.
-     * // not sure about the parameter type. It can be Contenthandler instead of Object type.
-     */
-    public void setParent(Object parent){
-        fParentXIncludeHandler = (XIncludeHandler)parent;
-    }
-
-
-    /**
-     * return the Parent Contenthandler
-     */
-    public Object getParent(){
-        return fParentXIncludeHandler;
-    }
-
-    /**
-     * Content of the XPointer Schema. Xpath to be resolved.
-     */
-    public void setXPointerSchemaPointer(String content){
-        fSchemaPointer = content;
-    }
-
-    /**
-     * Return the XPointer Schema.
-     */
-    public String getXPointerSchemaPointer(){
-        return fSchemaPointer;
-    }
-
-    public boolean isSubResourceIndentified(){
-        return fSubResourceIdentified;
-    }
-
-    ///////////End Implementation of XPointerSchema Methods //////////////////////
-
-
-
-    //////////// Tokens Playground ///////////////////
-
-    Stack fPointerToken = new Stack();
-    int  fCurrentTokenint=0;
-    String fCurrentTokenString=null;
-    int fCurrentTokenType=0 ;// 0 Notype; 1 for integer; 2 for string.
-
-    public void getTokens(){
-        fSchemaPointer = fSchemaPointer.substring(fSchemaPointer.indexOf("(")+1, fSchemaPointer.length());
-        StringTokenizer st = new StringTokenizer(fSchemaPointer, "/");
-        String tempToken;
-        Integer integerToken =null;
-        Stack tempPointerToken = new Stack();
-        if(fPointerToken == null){
-            fPointerToken = new Stack();
-        }
-        while(st.hasMoreTokens()){
-            tempToken=st.nextToken();
-            try {
-                integerToken = Integer.valueOf(tempToken);
-                tempPointerToken.push(integerToken);
-            }catch(NumberFormatException e){
-                tempPointerToken.push(tempToken);
-            }
-        }
-        while(!tempPointerToken.empty()){
-            fPointerToken.push(tempPointerToken.pop());
-        }
-    }//getTokens
-
-
-    public boolean hasMoreToken(){
-        if(fPointerToken.isEmpty())
-            return false;
-        else
-            return true;
-    }
-
-    public boolean getNextToken(){
-        Object currentToken;
-        if (!fPointerToken.isEmpty()){
-            currentToken = fPointerToken.pop();
-            if(currentToken instanceof Integer){
-                fCurrentTokenint = ((Integer)currentToken).intValue();
-                fCurrentTokenType = 1;
-            }
-            else{
-                fCurrentTokenString = ((String)currentToken).toString();
-                fCurrentTokenType = 2;
-            }
-            return true;
-        }
-        else {
-            return false;
-        }
-    }
-
-    private boolean isIdAttribute(XMLAttributes attributes,Augmentations augs, int index) {
-        Object o = augs.getItem(Constants.ID_ATTRIBUTE);
-        if( o instanceof Boolean )
-            return ((Boolean)o).booleanValue();
-        return "ID".equals(attributes.getType(index));
-    }
-
-    public boolean checkStringToken(QName element, XMLAttributes attributes){
-        QName cacheQName = null;
-        String id =null;
-        String rawname =null;
-        QName attrName = new QName();
-        String attrType = null;
-        String attrValue = null;
-        int attrCount = attributes.getLength();
-        for (int i = 0; i < attrCount; i++) {
-            Augmentations aaugs = attributes.getAugmentations(i);
-            attributes.getName(i,attrName);
-            attrType = attributes.getType(i);
-            attrValue = attributes.getValue(i);
-            if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
-                if(hasMoreToken()){
-                    fCurrentTokenType = 0;
-                    fCurrentTokenString = null;
-                    return true;
-                }
-                else{
-                    foundElement = element;
-                    includeElement = true;
-                    fCurrentTokenType = 0;
-                    fCurrentTokenString = null;
-                    fSubResourceIdentified = true;
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public boolean checkIntegerToken(QName element){
-        if(!skip){
-            fElementCount++;
-            if(fCurrentTokenint == fElementCount){
-                if(hasMoreToken()){
-                    fElementCount=0;
-                    fCurrentTokenType = 0;
-                    return true;
-                }
-                else{
-                    foundElement = element;
-                    includeElement = true;
-                    fCurrentTokenType = 0;
-                    fElementCount=0;
-                    fSubResourceIdentified =true;
-                    return true;
-                }
-            }else{
-                addQName(element);
-                skip = true;
-                return false;
-            }
-        }
-        return false;
-    }
-
-    public void addQName(QName element){
-        QName cacheQName = new QName(element);
-        ftempCurrentElement.push(cacheQName);
-    }
-
-    ///////////  END TOKEN PLAYGROUND ///////////////
-
-
-    /////   START OF IMPLEMTATION OF XMLDocumentHandler methods //////////
-
-
-    public void startDocument(XMLLocator locator, String encoding,
-    NamespaceContext namespaceContext, Augmentations augs)
-    throws XNIException {
-
-        getTokens();
-    }
-
-    public void doctypeDecl(String rootElement, String publicId, String systemId,
-    Augmentations augs)throws XNIException {
-    }
-
-    public void xmlDecl(String version, String encoding, String standalone,
-    Augmentations augs) throws XNIException {
-    }
-
-
-    public void comment(XMLString text, Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.comment(text, augs);
-        }
-    }
-
-    public void processingInstruction(String target, XMLString data,
-    Augmentations augs) throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.processingInstruction(target, data, augs);
-
-        }
-    }
-
-    Stack  ftempCurrentElement = new Stack();
-    int fElementCount =0;
-    int fCurrentToken ;
-    boolean includeElement;
-
-
-    public void startElement(QName element, XMLAttributes attributes,
-    Augmentations augs)throws XNIException {
-
-        boolean requiredToken=false;
-        if(fCurrentTokenType == 0)
-            getNextToken();
-        if(fCurrentTokenType ==1)
-            requiredToken = checkIntegerToken(element);
-        else if (fCurrentTokenType ==2)
-            requiredToken = checkStringToken(element, attributes);
-        if(requiredToken && hasMoreToken())
-            getNextToken();
-        if(fDocumentHandler != null && includeElement){
-            elemCount++;
-            fDocumentHandler.startElement(element, attributes, augs);
-        }
-
-    }
-
-
-    public void endElement(QName element, Augmentations augs)
-    throws XNIException {
-        if(includeElement && foundElement != null ){
-            if(elemCount >0 )elemCount --;
-            fDocumentHandler.endElement(element, augs);
-            if(elemCount == 0)includeElement = false;
-
-        }else if(!ftempCurrentElement.empty()){
-            QName name = (QName)ftempCurrentElement.peek();
-            if(name.equals(element)){
-                ftempCurrentElement.pop();
-                skip = false;
-            }
-        }
-    }
-
-    public void emptyElement(QName element, XMLAttributes attributes,
-    Augmentations augs)throws XNIException {
-        if(fDocumentHandler != null && includeElement){
-            fDocumentHandler.emptyElement(element, attributes, augs);
-        }
-    }
-
-    public void startGeneralEntity(String name, XMLResourceIdentifier resId,
-    String encoding,
-    Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.startGeneralEntity(name, resId, encoding, augs);
-        }
-    }
-
-    public void textDecl(String version, String encoding, Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.textDecl(version, encoding, augs);
-        }
-    }
-
-    public void endGeneralEntity(String name, Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null) {
-            fDocumentHandler.endGeneralEntity(name, augs);
-        }
-    }
-
-    public void characters(XMLString text, Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null  && includeElement) {
-            fDocumentHandler.characters(text, augs);
-        }
-    }
-
-    public void ignorableWhitespace(XMLString text, Augmentations augs)
-    throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.ignorableWhitespace(text, augs);
-        }
-    }
-
-    public void startCDATA(Augmentations augs) throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.startCDATA(augs);
-        }
-    }
-
-    public void endCDATA(Augmentations augs) throws XNIException {
-        if (fDocumentHandler != null && includeElement) {
-            fDocumentHandler.endCDATA(augs);
-        }
-    }
-
-    public void endDocument(Augmentations augs) throws XNIException {
-    }
-
-    public void setDocumentSource(XMLDocumentSource source) {
-        fDocumentSource = source;
-    }
-
-    public XMLDocumentSource getDocumentSource() {
-        return fDocumentSource;
-    }
-
-
-    protected void reportFatalError(String key) {
-        this.reportFatalError(key, null);
-    }
-
-    protected void reportFatalError(String key, Object[] args) {
-        if (fErrorReporter != null) {
-            fErrorReporter.reportError(
-            fDocLocation,
-            XIncludeMessageFormatter.XINCLUDE_DOMAIN,
-            key,
-            args,
-            XMLErrorReporter.SEVERITY_FATAL_ERROR);
-        }
-        // we won't worry about when error reporter is null, since there should always be
-        // at least the default error reporter
-    }
-
-
-
-    // used to know whether to pass declarations to the document handler
-    protected boolean isRootDocument() {
-        return this.fParentXIncludeHandler == null;
-    }
-
-
-} // class XPointerElementhandler
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java
deleted file mode 100644
index 08e7390..0000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerFramework.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xerces.internal.xinclude;
-
-import java.util.Stack;
-import com.sun.org.apache.xerces.internal.xinclude.XPointerSchema;
-
-public class XPointerFramework{
-
-        /*
-                Todo's by next integration.
-                While constructing schema names and uris use a dynamic datastructure.
-         */
-
-    XPointerSchema [] fXPointerSchema;
-    String [] fSchemaPointerName;
-    String [] fSchemaPointerURI;
-    String fSchemaPointer;
-    String fCurrentSchemaPointer;
-    Stack fSchemaNotAvailable;
-    int fCountSchemaName = 0;
-    int schemaLength = 0;
-    XPointerSchema fDefaultXPointerSchema;
-
-    public XPointerFramework(){
-        this(null);
-    }
-
-    public XPointerFramework(XPointerSchema [] xpointerschema){
-        fXPointerSchema = xpointerschema;
-        fSchemaNotAvailable = new Stack();
-    }
-
-    public void reset(){
-        fXPointerSchema = null;
-        fXPointerSchema = null;
-        fCountSchemaName = 0;
-        schemaLength = 0;
-        fSchemaPointerName = null;
-        fSchemaPointerURI = null;
-        fDefaultXPointerSchema = null;
-        fCurrentSchemaPointer = null;
-    }
-
-    public void setXPointerSchema(XPointerSchema [] xpointerschema){
-        fXPointerSchema = xpointerschema;
-    }
-
-    public void setSchemaPointer(String schemaPointer){
-        fSchemaPointer = schemaPointer;
-    }
-
-    public XPointerSchema getNextXPointerSchema(){
-        int  i=fCountSchemaName;
-        if(fSchemaPointerName == null){
-            getSchemaNames();
-        }
-        if(fDefaultXPointerSchema == null){
-            getDefaultSchema();
-        }
-        if(fDefaultXPointerSchema.getXpointerSchemaName().equalsIgnoreCase(fSchemaPointerName[i])){
-            fDefaultXPointerSchema.reset();
-            fDefaultXPointerSchema.setXPointerSchemaPointer(fSchemaPointerURI[i]);
-            fCountSchemaName = ++i;
-            return  getDefaultSchema();
-        }
-        if(fXPointerSchema == null){
-            fCountSchemaName = ++i;
-            return null;
-        }
-
-        int fschemalength = fXPointerSchema.length;
-
-        for(;fSchemaPointerName[i] != null; i++){
-            for(int j=0; j<fschemalength; j++ ){
-                if(fSchemaPointerName[i].equalsIgnoreCase(fXPointerSchema[j].getXpointerSchemaName())){
-                    fXPointerSchema[j].setXPointerSchemaPointer(fSchemaPointerURI[i]);
-                    fCountSchemaName = ++i;
-                    return fXPointerSchema[j];
-                }
-            }
-
-            if(fSchemaNotAvailable == null)
-            fSchemaNotAvailable = new Stack();
-
-            fSchemaNotAvailable.push(fSchemaPointerName[i]);
-        }
-        return null;
-    }
-
-    public XPointerSchema getDefaultSchema(){
-        if(fDefaultXPointerSchema == null)
-            fDefaultXPointerSchema = new XPointerElementHandler();
-        return fDefaultXPointerSchema;
-    }
-
-    public void getSchemaNames(){
-        int count =0;
-        int index =0, lastindex =0;
-        int schemapointerindex  =0, schemapointerURIindex=0;
-        char c;
-        int length = fSchemaPointer.length();
-        fSchemaPointerName = new String [5];
-        fSchemaPointerURI = new String [5];
-
-        index = fSchemaPointer.indexOf('(');
-        if( index <= 0)
-            return;
-
-        fSchemaPointerName[schemapointerindex++] = fSchemaPointer.substring(0, index++).trim();
-        lastindex = index;
-        String tempURI = null;
-        count++;
-
-        while(index < length){
-            c = fSchemaPointer.charAt(index);
-            if(c == '(')
-                count++;
-            if(c == ')')
-                count--;
-            if(count==0 ){
-                tempURI = fSchemaPointer.substring(lastindex, index).trim();
-                fSchemaPointerURI[schemapointerURIindex++] = getEscapedURI(tempURI);
-                lastindex = index;
-                if((index = fSchemaPointer.indexOf('(', lastindex)) != -1){
-                    fSchemaPointerName[schemapointerindex++] = fSchemaPointer.substring(lastindex+1, index).trim();
-                    count++;
-                    lastindex = index+1;
-                }
-                else{
-                    index = lastindex;
-                }
-            }
-            index++;
-        }
-        schemaLength = schemapointerURIindex -1;
-    }
-
-    public String   getEscapedURI(String URI){
-        return URI;
-    }
-
-    public int getSchemaCount(){
-        return schemaLength;
-    }
-
-    public int getCurrentPointer(){
-        return fCountSchemaName;
-    }
-
-}//XPointerFramwork
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java
deleted file mode 100644
index 3b4d585..0000000
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XPointerSchema.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.sun.org.apache.xerces.internal.xinclude;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter;
-
-
-
-public interface XPointerSchema extends XMLComponent, XMLDocumentFilter{
-
-    /**
-     * set the Schema Name  eg element , xpointer
-     */
-    public void setXPointerSchemaName(String schemaName);
-
-    /**
-     * Return  Schema Name  eg element , xpointer
-     *
-     */
-    public String getXpointerSchemaName();
-
-    /**
-     * Parent Contenhandler for the this contenthandler.
-     * // not sure about the parameter type. It can be Contenthandler instead of Object type.
-     */
-    public void setParent(Object parent);
-
-    /**
-     * return the Parent Contenthandler
-     */
-    public Object getParent();
-
-    /**
-     * Content of the XPointer Schema. Xpath to be resolved.
-     */
-    public void setXPointerSchemaPointer(String content);
-
-    /**
-     * Return the XPointer Schema.
-     */
-    public String getXPointerSchemaPointer();
-
-    public boolean isSubResourceIndentified();
-
-    public void reset();
-
-}
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
index 3d51028..c9358da 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
index add7646..adc85a3 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java
index 1fafb24..400741e 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOM3TreeWalker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index bfcf60a..dc36ed4 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -413,3 +413,4 @@
 a987401bac0d528475e57732c9d5d93f4405804c jdk-9+165
 b1f30c27367bd286fa4eb8a767335e917a5b5b82 jdk-9+166
 1c610f1b4097c64cdd722a7fb59f5a4d9cc15ca9 jdk-9+167
+2746716dcc5a8c28ccf41df0c8fb620b1a1e7098 jdk-9+168
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/newmessages.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/newmessages.properties
new file mode 100644
index 0000000..bd358f2
--- /dev/null
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/newmessages.properties
@@ -0,0 +1,6 @@
+wrapperTask.needEndorsed=\

+You are running on JDK6 or newer which comes with JAX-WS {0} API, but this tool requires JAX-WS {1} or newer API. Use \

+the standard override mechanism. 

+

+runtime.modeler.addressing.responses.nosuchmethod = JAX-WS 2.1 API is loaded from {0}, But JAX-WS runtime requires JAX-WS 2.2 or newer API. \

+  Use the standard override mechanism to load JAX-WS 2.2 or newer API.
\ No newline at end of file
diff --git a/jdk/.hgtags b/jdk/.hgtags
index c954b54..0789134 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -410,3 +410,4 @@
 a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
 5d2b48f1f0a322aca719b49ff02ab421705bffc7 jdk-9+166
 7828aedcb525df40b7c8122bcc3f997c75ebaf7f jdk-9+167
+e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168
diff --git a/jdk/make/data/docs-resources/specs/resources/jdk-default.css b/jdk/make/data/docs-resources/specs/resources/jdk-default.css
new file mode 100644
index 0000000..eea78ea
--- /dev/null
+++ b/jdk/make/data/docs-resources/specs/resources/jdk-default.css
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+body {
+  margin: 2em 2em;
+  font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica;
+  font-size: 10pt;
+  line-height: 1.4;
+}
+
+pre, code, tt {
+  font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono,
+    Courier New, monospace;
+}
+
+blockquote {
+  margin: 1.5ex 0em 1.5ex 2em;
+}
+
+p {
+  padding: 0pt;
+  margin: 1ex 0em;
+}
+
+p:first-child, pre:first-child { margin-top: 0pt; }
+
+h1 {
+  font-weight: bold;
+  padding: 0pt;
+  margin: 2ex .5ex 1ex 0pt;
+}
+
+h1:first-child, h2:first-child {
+  margin-top: 0ex;
+}
+
+h2 {
+  font-weight: bold;
+  padding: 0pt;
+  margin: 2ex 0pt 1ex 0pt;
+}
+
+h3 {
+  font-weight: bold;
+  padding: 0pt;
+  margin: 1.5ex 0pt 1ex 0pt;
+}
+
+h4 {
+  font-weight: bold;
+  padding: 0pt;
+  margin: 1.5ex 0pt 1ex 0pt;
+}
+
+a:link {
+  color: #437291;
+}
+
+a:visited {
+  color: #666666;
+}
+
+a[href]:hover {
+  color: #e76f00;
+}
+
+a img {
+  border-width: 0px;
+}
+
+img {
+  background: white;
+}
+
+table {
+  border-collapse: collapse;
+  margin-left: 15px;
+  margin-right: 15px;
+}
+
+th, td {
+  padding: 3px;
+  vertical-align: top;
+}
+
+table, th, td {
+  border: 1px solid black;
+}
+
+caption  {
+  text-align: left;
+  font-style: italic;
+  text-indent: 15px;
+  margin-bottom:10px;
+}
+
+tr:nth-child(even) {
+  background: #DDD;
+}
+
+tr:nth-child(odd) {
+  background: #FFF;
+}
+
+th {
+  background: #DDF;
+}
diff --git a/jdk/make/mapfiles/libinstrument/mapfile-vers b/jdk/make/mapfiles/libinstrument/mapfile-vers
index 7486701..c51a8af 100644
--- a/jdk/make/mapfiles/libinstrument/mapfile-vers
+++ b/jdk/make/mapfiles/libinstrument/mapfile-vers
@@ -39,6 +39,7 @@
             Java_sun_instrument_InstrumentationImpl_getObjectSize0;
 	    Java_sun_instrument_InstrumentationImpl_appendToClassLoaderSearch0;
 	    Java_sun_instrument_InstrumentationImpl_setNativeMethodPrefixes;
+            Java_sun_instrument_InstrumentationImpl_loadAgent0;
 	local:
 		*;
 };
diff --git a/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c b/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c
index ab6f465..aa91f30 100644
--- a/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c
+++ b/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
index 6a394e4..ffa681c 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017 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
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PropMap.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PropMap.java
index 3d54b91..4a1d4be9 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PropMap.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PropMap.java
@@ -29,6 +29,8 @@
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
@@ -62,12 +64,17 @@
         Properties props = new Properties();
 
         // Allow implementation selected via -Dpack.disable.native=true
+        String propValue = getPropertyValue(Utils.DEBUG_DISABLE_NATIVE, "false");
         props.put(Utils.DEBUG_DISABLE_NATIVE,
-                  String.valueOf(Boolean.getBoolean(Utils.DEBUG_DISABLE_NATIVE)));
+                  String.valueOf(Boolean.parseBoolean(propValue)));
 
         // Set the DEBUG_VERBOSE from system
-        props.put(Utils.DEBUG_VERBOSE,
-                  String.valueOf(Integer.getInteger(Utils.DEBUG_VERBOSE,0)));
+        int verbose = 0;
+        try {
+            verbose = Integer.decode(getPropertyValue(Utils.DEBUG_VERBOSE, "0"));
+        } catch (NumberFormatException e) {
+        }
+        props.put(Utils.DEBUG_VERBOSE, String.valueOf(verbose));
 
         // The segment size is unlimited
         props.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
@@ -87,7 +94,7 @@
         // Pass through files with unrecognized format by default, also
         // allow system property to be set
         props.put(Utils.CLASS_FORMAT_ERROR,
-                System.getProperty(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
+                  getPropertyValue(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
 
         // Default effort is 5, midway between 1 and 9.
         props.put(Pack200.Packer.EFFORT, "5");
@@ -97,7 +104,9 @@
         // to allow override if necessary.
         String propFile = "intrinsic.properties";
 
-        try (InputStream propStr = PackerImpl.class.getResourceAsStream(propFile)) {
+        PrivilegedAction<InputStream> pa =
+            () -> PackerImpl.class.getResourceAsStream(propFile);
+        try (InputStream propStr = AccessController.doPrivileged(pa)) {
             if (propStr == null) {
                 throw new RuntimeException(propFile + " cannot be loaded");
             }
@@ -119,6 +128,12 @@
         defaultProps = temp;
     }
 
+    private static String getPropertyValue(String key, String defaultValue) {
+        PrivilegedAction<String> pa = () -> System.getProperty(key);
+        String s = AccessController.doPrivileged(pa);
+        return s != null ? s : defaultValue;
+    }
+
     PropMap() {
         theMap.putAll(defaultProps);
     }
diff --git a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java
index 3d44f44..71ea81e 100644
--- a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java
+++ b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java
@@ -40,10 +40,8 @@
  *
  * <p> Each invocation of a write() method causes the encoding converter to be
  * invoked on the given character(s).  The resulting bytes are accumulated in a
- * buffer before being written to the underlying output stream.  The size of
- * this buffer may be specified, but by default it is large enough for most
- * purposes.  Note that the characters passed to the write() methods are not
- * buffered.
+ * buffer before being written to the underlying output stream.  Note that the
+ * characters passed to the write() methods are not buffered.
  *
  * <p> For top efficiency, consider wrapping an OutputStreamWriter within a
  * BufferedWriter so as to avoid frequent converter invocations.  For example:
diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
index 2f6af4d..fb9660f 100644
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -119,18 +119,24 @@
  * The Java run-time has the following built-in class loaders:
  *
  * <ul>
- * <li>Bootstrap class loader.
+ * <li><p>Bootstrap class loader.
  *     It is the virtual machine's built-in class loader, typically represented
  *     as {@code null}, and does not have a parent.</li>
- * <li>{@linkplain #getPlatformClassLoader() Platform class loader}.
+ * <li><p>{@linkplain #getPlatformClassLoader() Platform class loader}.
  *     All <em>platform classes</em> are visible to the platform class loader
  *     that can be used as the parent of a {@code ClassLoader} instance.
  *     Platform classes include Java SE platform APIs, their implementation
  *     classes and JDK-specific run-time classes that are defined by the
- *     platform class loader or its ancestors.</li>
- * <li>{@linkplain #getSystemClassLoader() System class loader}.
- *     It is also known as <em>application class
- *     loader</em> and is distinct from the platform class loader.
+ *     platform class loader or its ancestors.
+ *     <p> To allow for upgrading/overriding of modules defined to the platform
+ *     class loader, and where classes in the upgraded version link to
+ *     classes in modules defined to the application class loader, the
+ *     platform class loader may delegate to the application class loader.
+ *     In other words, classes in named modules defined to the application
+ *     class loader may be visible to the platform class loader. </li>
+ * <li><p>{@linkplain #getSystemClassLoader() System class loader}.
+ *     It is also known as <em>application class loader</em> and is distinct
+ *     from the platform class loader.
  *     The system class loader is typically used to define classes on the
  *     application class path, module path, and JDK-specific tools.
  *     The platform class loader is a parent or an ancestor of the system class
@@ -368,6 +374,10 @@
      * Creates a new class loader of the specified name and using the
      * specified parent class loader for delegation.
      *
+     * @apiNote If the parent is specified as {@code null} (for the
+     * bootstrap class loader) then there is no guarantee that all platform
+     * classes are visible.
+     *
      * @param  name   class loader name; or {@code null} if not named
      * @param  parent the parent class loader
      *
@@ -390,9 +400,12 @@
      * delegation.
      *
      * <p> If there is a security manager, its {@link
-     * SecurityManager#checkCreateClassLoader()
-     * checkCreateClassLoader} method is invoked.  This may result in
-     * a security exception.  </p>
+     * SecurityManager#checkCreateClassLoader() checkCreateClassLoader} method
+     * is invoked.  This may result in a security exception.  </p>
+     *
+     * @apiNote If the parent is specified as {@code null} (for the
+     * bootstrap class loader) then there is no guarantee that all platform
+     * classes are visible.
      *
      * @param  parent
      *         The parent class loader
@@ -2206,6 +2219,12 @@
      * this class loader are searched recursively (parent by parent)
      * for a {@code Package} of the given name.
      *
+     * @apiNote The {@link #getPlatformClassLoader() platform class loader}
+     * may delegate to the application class loader but the application class
+     * loader is not its ancestor.  When invoked on the platform class loader,
+     * this method  will not find packages defined to the application
+     * class loader.
+     *
      * @param  name
      *         The <a href="#name">package name</a>
      *
@@ -2251,6 +2270,14 @@
      * {@code Package} object of the same package name, each defined by
      * a different class loader in the class loader hierarchy.
      *
+     * @apiNote The {@link #getPlatformClassLoader() platform class loader}
+     * may delegate to the application class loader. In other words,
+     * packages in modules defined to the application class loader may be
+     * visible to the platform class loader.  On the other hand,
+     * the application class loader is not its ancestor and hence
+     * when invoked on the platform class loader, this method will not
+     * return any packages defined to the application class loader.
+     *
      * @return  The array of {@code Package} objects defined by this
      *          class loader and its ancestors
      *
diff --git a/jdk/src/java.base/share/classes/java/lang/Module.java b/jdk/src/java.base/share/classes/java/lang/Module.java
index 26337d8..f6ab49b 100644
--- a/jdk/src/java.base/share/classes/java/lang/Module.java
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java
@@ -57,6 +57,7 @@
 import jdk.internal.loader.BootLoader;
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.module.ModuleLoaderMap;
 import jdk.internal.module.ServicesCatalog;
 import jdk.internal.module.Resources;
 import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@@ -215,8 +216,8 @@
     }
 
     /**
-     * Returns the layer that contains this module or {@code null} if this
-     * module is not in a layer.
+     * Returns the module layer that contains this module or {@code null} if
+     * this module is not in a module layer.
      *
      * A module layer contains named modules and therefore this method always
      * returns {@code null} when invoked on an unnamed module.
@@ -691,6 +692,13 @@
      * <p> This method has no effect if the package is already <em>open</em>
      * to the given module. </p>
      *
+     * @apiNote This method can be used for cases where a <em>consumer
+     * module</em> uses a qualified opens to open a package to an <em>API
+     * module</em> but where the reflective access to the members of classes in
+     * the consumer module is delegated to code in another module. Code in the
+     * API module can use this method to open the package in the consumer module
+     * to the other module.
+     *
      * @param  pn
      *         The package name
      * @param  other
@@ -1077,7 +1085,7 @@
             if (loader != null) {
                 moduleToLoader.put(name, loader);
                 loaders.add(loader);
-            } else if (!isBootLayer) {
+            } else if (!(clf instanceof ModuleLoaderMap.Mapper)) {
                 throw new IllegalArgumentException("loader can't be 'null'");
             }
         }
@@ -1458,11 +1466,11 @@
      *     encapsulated. </li>
      *
      *     <li> A <em>package name</em> is derived from the resource name. If
-     *     the package name is a {@link #getPackages() package} in the module
-     *     then the resource can only be located by the caller of this method
-     *     when the package is {@link #isOpen(String,Module) open} to at least
-     *     the caller's module. If the resource is not in a package in the module
-     *     then the resource is not encapsulated. </li>
+     *     the package name is a {@linkplain #getPackages() package} in the
+     *     module then the resource can only be located by the caller of this
+     *     method when the package is {@linkplain #isOpen(String,Module) open}
+     *     to at least the caller's module. If the resource is not in a
+     *     package in the module then the resource is not encapsulated. </li>
      * </ul>
      *
      * <p> In the above, the <em>package name</em> for a resource is derived
@@ -1521,8 +1529,7 @@
         }
 
         // locate resource in module
-        JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
-        URL url = jla.findResource(loader, mn, name);
+        URL url = loader.findResource(mn, name);
         if (url != null) {
             try {
                 return url.openStream();
diff --git a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java
index 098e862..b60d63e 100644
--- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java
@@ -25,10 +25,10 @@
 
 package java.lang;
 
-import java.lang.RuntimePermission;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Exports;
 import java.lang.module.ModuleDescriptor.Opens;
+import java.lang.module.ModuleReference;
 import java.lang.reflect.Member;
 import java.io.FileDescriptor;
 import java.io.File;
@@ -42,12 +42,15 @@
 import java.security.Security;
 import java.security.SecurityPermission;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Objects;
 import java.util.PropertyPermission;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
+import jdk.internal.module.ModuleBootstrap;
+import jdk.internal.module.ModuleLoaderMap;
 import jdk.internal.reflect.CallerSensitive;
 import sun.security.util.SecurityConstants;
 
@@ -1431,31 +1434,31 @@
         return packages;
     }
 
-    // The non-exported packages of the modules in the boot layer that are
-    // loaded by the platform class loader or its ancestors. A non-exported
-    // package is a package that either is not exported at all by its containing
-    // module or is exported in a qualified fashion by its containing module.
-    private static final Set<String> nonExportedPkgs;
-
+    // The non-exported packages in modules defined to the boot or platform
+    // class loaders. A non-exported package is a package that is not exported
+    // or is only exported to specific modules.
+    private static final Map<String, Boolean> nonExportedPkgs = new ConcurrentHashMap<>();
     static {
-        // Get the modules in the boot layer
-        Stream<Module> bootLayerModules = ModuleLayer.boot().modules().stream();
-
-        // Filter out the modules loaded by the boot or platform loader
-        PrivilegedAction<Set<Module>> pa = () ->
-            bootLayerModules.filter(SecurityManager::isBootOrPlatformModule)
-                            .collect(Collectors.toSet());
-        Set<Module> modules = AccessController.doPrivileged(pa);
-
-        // Filter out the non-exported packages
-        nonExportedPkgs = modules.stream()
-                                 .map(Module::getDescriptor)
-                                 .map(SecurityManager::nonExportedPkgs)
-                                 .flatMap(Set::stream)
-                                 .collect(Collectors.toSet());
+        addNonExportedPackages(ModuleLayer.boot());
     }
 
     /**
+     * Record the non-exported packages of the modules in the given layer
+     */
+    static void addNonExportedPackages(ModuleLayer layer) {
+        Set<String> bootModules = ModuleLoaderMap.bootModules();
+        Set<String> platformModules = ModuleLoaderMap.platformModules();
+        layer.modules().stream()
+                .map(Module::getDescriptor)
+                .filter(md -> bootModules.contains(md.name())
+                        || platformModules.contains(md.name()))
+                .map(SecurityManager::nonExportedPkgs)
+                .flatMap(Set::stream)
+                .forEach(pn -> nonExportedPkgs.put(pn, Boolean.TRUE));
+    }
+
+
+    /**
      * Called by java.security.Security
      */
     static void invalidatePackageAccessCache() {
@@ -1468,14 +1471,6 @@
     }
 
     /**
-     * Returns true if the module's loader is the boot or platform loader.
-     */
-    private static boolean isBootOrPlatformModule(Module m) {
-        return m.getClassLoader() == null ||
-               m.getClassLoader() == ClassLoader.getPlatformClassLoader();
-    }
-
-    /**
      * Returns the non-exported packages of the specified module.
      */
     private static Set<String> nonExportedPkgs(ModuleDescriptor md) {
@@ -1535,7 +1530,7 @@
         Objects.requireNonNull(pkg, "package name can't be null");
 
         // check if pkg is not exported to all modules
-        if (nonExportedPkgs.contains(pkg)) {
+        if (nonExportedPkgs.containsKey(pkg)) {
             checkPermission(
                 new RuntimePermission("accessClassInPackage." + pkg));
             return;
@@ -1634,7 +1629,7 @@
         Objects.requireNonNull(pkg, "package name can't be null");
 
         // check if pkg is not exported to all modules
-        if (nonExportedPkgs.contains(pkg)) {
+        if (nonExportedPkgs.containsKey(pkg)) {
             checkPermission(
                 new RuntimePermission("defineClassInPackage." + pkg));
             return;
diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java
index edd5b55..630380e 100644
--- a/jdk/src/java.base/share/classes/java/lang/System.java
+++ b/jdk/src/java.base/share/classes/java/lang/System.java
@@ -41,7 +41,6 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.URI;
-import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
 import java.security.AccessController;
@@ -2111,9 +2110,6 @@
             public Class<?> findBootstrapClassOrNull(ClassLoader cl, String name) {
                 return cl.findBootstrapClassOrNull(name);
             }
-            public URL findResource(ClassLoader cl, String mn, String name) throws IOException {
-                return cl.findResource(mn, name);
-            }
             public Stream<Package> packages(ClassLoader cl) {
                 return cl.packages();
             }
@@ -2123,6 +2119,9 @@
             public String fastUUID(long lsb, long msb) {
                 return Long.fastUUID(lsb, msb);
             }
+            public void addNonExportedPackages(ModuleLayer layer) {
+                SecurityManager.addNonExportedPackages(layer);
+            }
             public void invalidatePackageAccessCache() {
                 SecurityManager.invalidatePackageAccessCache();
             }
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index eceba16..ae40f16 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -113,6 +113,19 @@
     }
 
     /**
+     * This reflected$lookup method is the alternate implementation of
+     * the lookup method when being invoked by reflection.
+     */
+    @CallerSensitive
+    private static Lookup reflected$lookup() {
+        Class<?> caller = Reflection.getCallerClass();
+        if (caller.getClassLoader() == null) {
+            throw newIllegalArgumentException("illegal lookupClass: "+caller);
+        }
+        return new Lookup(caller);
+    }
+
+    /**
      * Returns a {@link Lookup lookup object} which is trusted minimally.
      * The lookup has the {@code PUBLIC} and {@code UNCONDITIONAL} modes.
      * It can only be used to create method handles to public members of
@@ -747,7 +760,7 @@
         Lookup(Class<?> lookupClass) {
             this(lookupClass, FULL_POWER_MODES);
             // make sure we haven't accidentally picked up a privileged class:
-            checkUnprivilegedlookupClass(lookupClass, FULL_POWER_MODES);
+            checkUnprivilegedlookupClass(lookupClass);
         }
 
         private Lookup(Class<?> lookupClass, int allowedModes) {
@@ -827,7 +840,7 @@
                 newModes = 0;
             }
 
-            checkUnprivilegedlookupClass(requestedLookupClass, newModes);
+            checkUnprivilegedlookupClass(requestedLookupClass);
             return new Lookup(requestedLookupClass, newModes);
         }
 
@@ -876,9 +889,7 @@
          * accessible to the class. The {@code PACKAGE} lookup mode serves to authenticate
          * that the lookup object was created by a caller in the runtime package (or derived
          * from a lookup originally created by suitably privileged code to a target class in
-         * the runtime package). The lookup modes cannot include {@link #PRIVATE PRIVATE}
-         * access. A lookup with {@code PRIVATE} access can be downgraded to drop this lookup
-         * mode with the {@linkplain #dropLookupMode(int) dropLookupMode} method. </p>
+         * the runtime package). </p>
          *
          * <p> The {@code bytes} parameter is the class bytes of a valid class file (as defined
          * by the <em>The Java Virtual Machine Specification</em>) with a class name in the
@@ -896,7 +907,6 @@
          * @throws IllegalArgumentException the bytes are for a class in a different package
          * to the lookup class
          * @throws IllegalAccessException if this lookup does not have {@code PACKAGE} access
-         * @throws UnsupportedOperationException if the lookup class has {@code PRIVATE} access
          * @throws LinkageError if the class is malformed ({@code ClassFormatError}), cannot be
          * verified ({@code VerifyError}), is already defined, or another linkage error occurs
          * @throws SecurityException if denied by the security manager
@@ -911,8 +921,6 @@
             SecurityManager sm = System.getSecurityManager();
             if (sm != null)
                 sm.checkPermission(new RuntimePermission("defineClass"));
-            if (hasPrivateAccess())
-                throw new UnsupportedOperationException("PRIVATE access not supported");
             if ((lookupModes() & PACKAGE) == 0)
                 throw new IllegalAccessException("Lookup does not have PACKAGE access");
             assert (lookupModes() & (MODULE|PUBLIC)) != 0;
@@ -984,25 +992,10 @@
          */
         static final Lookup PUBLIC_LOOKUP = new Lookup(Object.class, (PUBLIC|UNCONDITIONAL));
 
-        private static void checkUnprivilegedlookupClass(Class<?> lookupClass, int allowedModes) {
+        private static void checkUnprivilegedlookupClass(Class<?> lookupClass) {
             String name = lookupClass.getName();
             if (name.startsWith("java.lang.invoke."))
                 throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
-
-            // For caller-sensitive MethodHandles.lookup() disallow lookup from
-            // restricted packages.  This a fragile and blunt approach.
-            // TODO replace with a more formal and less fragile mechanism
-            // that does not bluntly restrict classes under packages within
-            // java.base from looking up MethodHandles or VarHandles.
-            if (allowedModes == FULL_POWER_MODES && lookupClass.getClassLoader() == null) {
-                if ((name.startsWith("java.") &&
-                     !name.equals("java.lang.Thread") &&
-                     !name.startsWith("java.util.concurrent.")) ||
-                    (name.startsWith("sun.") &&
-                     !name.startsWith("sun.invoke."))) {
-                    throw newIllegalArgumentException("illegal lookupClass: " + lookupClass);
-                }
-            }
         }
 
         /**
diff --git a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
index d5fc16c..ef7e44a 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
@@ -109,20 +109,17 @@
     private final Set<ResolvedModule> modules;
     private final Map<String, ResolvedModule> nameToModule;
 
-    // module constraints on target
-    private final String osName;
-    private final String osArch;
+    // constraint on target platform
+    private final String targetPlatform;
 
-    String osName() { return osName; }
-    String osArch() { return osArch; }
+    String targetPlatform() { return targetPlatform; }
 
     private Configuration() {
         this.parents = Collections.emptyList();
         this.graph = Collections.emptyMap();
         this.modules = Collections.emptySet();
         this.nameToModule = Collections.emptyMap();
-        this.osName = null;
-        this.osArch = null;
+        this.targetPlatform = null;
     }
 
     private Configuration(List<Configuration> parents,
@@ -147,8 +144,7 @@
         this.modules = Set.of(moduleArray);
         this.nameToModule = Map.ofEntries(nameEntries);
 
-        this.osName = resolver.osName();
-        this.osArch = resolver.osArch();
+        this.targetPlatform = resolver.targetPlatform();
     }
 
     /**
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
index 01b4316..20d198b 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
@@ -99,6 +99,7 @@
      *
      * @see ModuleDescriptor#modifiers()
      * @since 9
+     * @spec JPMS
      */
     public static enum Modifier {
         /**
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
index 0be9d8d..e0e6d88 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
@@ -286,8 +286,9 @@
      *     class names of provider classes. </p></li>
      *
      *     <li><p> If the JAR file has a {@code Main-Class} attribute in its
-     *     main manifest then its value is the module {@link
-     *     ModuleDescriptor#mainClass() main class}. </p></li>
+     *     main manifest, its value is a legal class name, and its package is
+     *     in the set of packages derived for the module, then the value is the
+     *     module {@linkplain ModuleDescriptor#mainClass() main class}. </p></li>
      *
      * </ul>
      *
@@ -298,8 +299,7 @@
      * file, where the JAR file contains a {@code .class} in the top-level
      * directory of the JAR file, where an entry in a service configuration
      * file is not a legal class name or its package name is not in the set of
-     * packages derived for the module, or where the module main class is not
-     * a legal class name or its package is not in the module. </p>
+     * packages derived for the module. </p>
      *
      * <p> In addition to JAR files, an implementation may also support modules
      * that are packaged in other implementation specific module formats. If
diff --git a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java
index 6adf93f..a723e63 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java
@@ -28,6 +28,7 @@
 import java.io.PrintStream;
 import java.lang.module.ModuleDescriptor.Provides;
 import java.lang.module.ModuleDescriptor.Requires.Modifier;
+import java.net.URI;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -38,10 +39,8 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-import java.util.StringJoiner;
 import java.util.stream.Collectors;
 
 import jdk.internal.module.ModuleHashes;
@@ -69,12 +68,10 @@
     // true if all automatic modules have been found
     private boolean haveAllAutomaticModules;
 
-    // module constraints on target platform
-    private String osName;
-    private String osArch;
+    // constraint on target platform
+    private String targetPlatform;
 
-    String osName() { return osName; }
-    String osArch() { return osArch; }
+    String targetPlatform() { return targetPlatform; }
 
     /**
      * @throws IllegalArgumentException if there are more than one parent and
@@ -89,37 +86,23 @@
         this.afterFinder = afterFinder;
         this.traceOutput = traceOutput;
 
-        // record constraints on target platform, checking that they don't conflict
+        // record constraint on target platform, checking for conflicts
         for (Configuration parent : parents) {
-            String value = parent.osName();
+            String value = parent.targetPlatform();
             if (value != null) {
-                if (osName == null) {
-                    osName = value;
+                if (targetPlatform == null) {
+                    targetPlatform = value;
                 } else {
-                    if (!value.equals(osName)) {
-                        failParentConflict("Operating System", osName, value);
-                    }
-                }
-            }
-            value = parent.osArch();
-            if (value != null) {
-                if (osArch == null) {
-                    osArch = value;
-                } else {
-                    if (!value.equals(osArch)) {
-                        failParentConflict("OS architecture", osArch, value);
+                    if (!value.equals(targetPlatform)) {
+                        String msg = "Parents have conflicting constraints on target" +
+                                     "  platform: " + targetPlatform + ", " + value;
+                        throw new IllegalArgumentException(msg);
                     }
                 }
             }
         }
     }
 
-    private void failParentConflict(String constraint, String s1, String s2) {
-        String msg = "Parents have conflicting constraints on target "
-                     + constraint + ": " + s1 + ", " + s2;
-        throw new IllegalArgumentException(msg);
-    }
-
     /**
      * Resolves the given named modules.
      *
@@ -147,8 +130,7 @@
             }
 
             if (isTracing()) {
-                trace("Root module %s located", root);
-                mref.location().ifPresent(uri -> trace("  (%s)", uri));
+                trace("root %s", nameAndInfo(mref));
             }
 
             addFoundModule(mref);
@@ -180,9 +162,7 @@
                     ModuleDescriptor other = mref.descriptor();
                     q.offer(other);
                     if (isTracing()) {
-                        trace("Automatic module %s located, required by %s",
-                              other.name(), descriptor.name());
-                        mref.location().ifPresent(uri -> trace("  (%s)", uri));
+                        trace("%s requires %s", descriptor.name(), nameAndInfo(mref));
                     }
                 });
                 haveAllAutomaticModules = true;
@@ -213,21 +193,13 @@
                     }
                 }
 
+                if (isTracing() && !dn.equals("java.base")) {
+                    trace("%s requires %s", descriptor.name(), nameAndInfo(mref));
+                }
+
                 if (!nameToReference.containsKey(dn)) {
                     addFoundModule(mref);
                     q.offer(mref.descriptor());
-
-                    if (isTracing()) {
-                        String prefix;
-                        if (mref.descriptor().isAutomatic()) {
-                            prefix = "Automatic module";
-                        } else {
-                            prefix = "Module";
-                        }
-                        trace(prefix + " %s located, required by %s",
-                              dn, descriptor.name());
-                        mref.location().ifPresent(uri -> trace("  (%s)", uri));
-                    }
                 }
 
             }
@@ -291,6 +263,13 @@
         do {
             for (ModuleDescriptor descriptor : candidateConsumers) {
                 if (!descriptor.uses().isEmpty()) {
+
+                    // the modules that provide at least one service
+                    Set<ModuleDescriptor> modulesToBind = null;
+                    if (isTracing()) {
+                        modulesToBind = new HashSet<>();
+                    }
+
                     for (String service : descriptor.uses()) {
                         Set<ModuleReference> mrefs = availableProviders.get(service);
                         if (mrefs != null) {
@@ -298,15 +277,13 @@
                                 ModuleDescriptor provider = mref.descriptor();
                                 if (!provider.equals(descriptor)) {
 
-                                    trace("Module %s provides %s, used by %s",
-                                            provider.name(), service, descriptor.name());
+                                    if (isTracing() && modulesToBind.add(provider)) {
+                                        trace("%s binds %s", descriptor.name(),
+                                                nameAndInfo(mref));
+                                    }
 
                                     String pn = provider.name();
                                     if (!nameToReference.containsKey(pn)) {
-                                        if (isTracing()) {
-                                            mref.location()
-                                                .ifPresent(uri -> trace("  (%s)", uri));
-                                        }
                                         addFoundModule(mref);
                                         q.push(provider);
                                     }
@@ -349,59 +326,31 @@
         if (mref instanceof ModuleReferenceImpl) {
             ModuleTarget target = ((ModuleReferenceImpl)mref).moduleTarget();
             if (target != null)
-                checkTargetConstraints(mn, target);
+                checkTargetPlatform(mn, target);
         }
 
         nameToReference.put(mn, mref);
     }
 
     /**
-     * Check that the module's constraints on the target platform do not
-     * conflict with the constraints of other modules resolved so far or
-     * modules in parent configurations.
+     * Check that the module's constraints on the target platform does
+     * conflict with the constraint of other modules resolved so far.
      */
-    private void checkTargetConstraints(String mn, ModuleTarget target) {
-        String value = target.osName();
+    private void checkTargetPlatform(String mn, ModuleTarget target) {
+        String value = target.targetPlatform();
         if (value != null) {
-            if (osName == null) {
-                osName = value;
+            if (targetPlatform == null) {
+                targetPlatform = value;
             } else {
-                if (!value.equals(osName)) {
-                    failTargetConstraint(mn, target);
-                }
-            }
-        }
-        value = target.osArch();
-        if (value != null) {
-            if (osArch == null) {
-                osArch = value;
-            } else {
-                if (!value.equals(osArch)) {
-                    failTargetConstraint(mn, target);
+                if (!value.equals(targetPlatform)) {
+                    findFail("Module %s has constraints on target platform (%s)"
+                             + " that conflict with other modules: %s", mn,
+                             value, targetPlatform);
                 }
             }
         }
     }
 
-    private void failTargetConstraint(String mn, ModuleTarget target) {
-        String s1 = targetAsString(osName, osArch);
-        String s2 = targetAsString(target.osName(), target.osArch());
-        findFail("Module %s has constraints on target platform (%s) that"
-                 + " conflict with other modules: %s", mn, s1, s2);
-    }
-
-    private String targetAsString(ModuleTarget target) {
-        return targetAsString(target.osName(), target.osArch());
-    }
-
-    private String targetAsString(String osName, String osArch) {
-        return new StringJoiner("-")
-                .add(Objects.toString(osName, "*"))
-                .add(Objects.toString(osArch, "*"))
-                .toString();
-    }
-
-
     /**
      * Execute post-resolution checks and returns the module graph of resolved
      * modules as {@code Map}. The resolved modules will be in the given
@@ -412,12 +361,6 @@
     Map<ResolvedModule, Set<ResolvedModule>> finish(Configuration cf,
                                                     boolean check)
     {
-        if (isTracing()) {
-            trace("Result:");
-            Set<String> names = nameToReference.keySet();
-            names.stream().sorted().forEach(name -> trace("  %s", name));
-        }
-
         if (check) {
             detectCycles();
             checkHashes();
@@ -520,9 +463,8 @@
                     findFail("Unable to compute the hash of module %s", dn);
                 }
 
-                // skip checking the hash if the module has been patched
                 ModuleReferenceImpl other = (ModuleReferenceImpl)mref2;
-                if (other != null && !other.isPatched()) {
+                if (other != null) {
                     byte[] recordedHash = hashes.hashFor(dn);
                     byte[] actualHash = other.computeHash(algorithm);
                     if (actualHash == null)
@@ -965,9 +907,17 @@
 
     private void trace(String fmt, Object ... args) {
         if (traceOutput != null) {
-            traceOutput.format("[Resolver] " + fmt, args);
+            traceOutput.format(fmt, args);
             traceOutput.println();
         }
     }
 
+    private String nameAndInfo(ModuleReference mref) {
+        ModuleDescriptor descriptor = mref.descriptor();
+        StringBuilder sb = new StringBuilder(descriptor.name());
+        mref.location().ifPresent(uri -> sb.append(" " + uri));
+        if (descriptor.isAutomatic())
+            sb.append(" automatic");
+        return sb.toString();
+    }
 }
diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
index 08ff1f0..2754fa3 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 import java.util.ServiceConfigurationError;
 import java.util.ServiceLoader;
 
+import jdk.internal.misc.VM;
+
 /**
  * Factory methods for file systems. This class defines the {@link #getDefault
  * getDefault} method to get the default file system and factory methods to
@@ -120,8 +122,8 @@
 
             // if the property java.nio.file.spi.DefaultFileSystemProvider is
             // set then its value is the name of the default provider (or a list)
-            String propValue = System
-                .getProperty("java.nio.file.spi.DefaultFileSystemProvider");
+            String prop = "java.nio.file.spi.DefaultFileSystemProvider";
+            String propValue = System.getProperty(prop);
             if (propValue != null) {
                 for (String cn: propValue.split(",")) {
                     try {
@@ -184,7 +186,7 @@
      * @return  the default file system
      */
     public static FileSystem getDefault() {
-        if (jdk.internal.misc.VM.isBooted()) {
+        if (VM.isModuleSystemInited()) {
             return DefaultFileSystemHolder.defaultFileSystem;
         } else {
             return BuiltinFileSystemHolder.builtinFileSystem;
diff --git a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
index 9c8bc81..54ad961 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
@@ -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
@@ -93,7 +93,7 @@
     // stream status
     private boolean closed = false;
 
-    /**
+    /*
      * private convenience function.
      *
      * Entry condition: ostart = ofinish
diff --git a/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java b/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java
index 749e319..ddc2648 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, 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
@@ -196,19 +196,19 @@
      * Checks if the specified permission is "implied" by
      * this object.
      * <p>
-     * More specifically, this method returns true if:<p>
+     * More specifically, this method returns true if:
      * <ul>
-     * <li> <i>p</i> is an instance of CryptoPermission, and<p>
+     * <li> <i>p</i> is an instance of CryptoPermission, and</li>
      * <li> <i>p</i>'s algorithm name equals or (in the case of wildcards)
-     *       is implied by this permission's algorithm name, and<p>
+     *       is implied by this permission's algorithm name, and</li>
      * <li> <i>p</i>'s maximum allowable key size is less or
-     *       equal to this permission's maximum allowable key size, and<p>
+     *       equal to this permission's maximum allowable key size, and</li>
      * <li> <i>p</i>'s algorithm parameter spec equals or is
-     *        implied by this permission's algorithm parameter spec, and<p>
+     *        implied by this permission's algorithm parameter spec, and</li>
      * <li> <i>p</i>'s exemptionMechanism equals or
      *        is implied by this permission's
      *        exemptionMechanism (a <code>null</code> exemption mechanism
-     *        implies any other exemption mechanism).
+     *        implies any other exemption mechanism).</li>
      * </ul>
      *
      * @param p the permission to check against.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java b/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java
index 7f27ea2..0093ce6 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, 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
@@ -46,10 +46,12 @@
  *
  * The format of a permission entry in the jurisdiction policy file is:
  *
+ * <pre>{@code
  *   permission <crypto permission class name>[, <algorithm name>
  *              [[, <exemption mechanism name>][, <maxKeySize>
  *              [, <AlgrithomParameterSpec class name>, <parameters
  *              for constructing an AlgrithomParameterSpec object>]]]];
+ * }</pre>
  *
  * @author Sharon Liu
  *
@@ -526,8 +528,7 @@
 
     /**
      * Each grant entry in the policy configuration file is  represented by a
-     * GrantEntry object.  <p>
-     *
+     * GrantEntry object.
      * <p>
      * For example, the entry
      * <pre>
@@ -587,8 +588,7 @@
 
     /**
      * Each crypto permission entry in the policy configuration file is
-     * represented by a CryptoPermissionEntry object.  <p>
-     *
+     * represented by a CryptoPermissionEntry object.
      * <p>
      * For example, the entry
      * <pre>
diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
index ce3bb67..5d1c97c 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
@@ -172,12 +172,10 @@
     }
 
     /**
-     * Register a module this this class loader. This has the effect of making
-     * the types in the module visible.
+     * Register a module this class loader. This has the effect of making the
+     * types in the module visible.
      */
     public void loadModule(ModuleReference mref) {
-        assert !VM.isModuleSystemInited();
-
         String mn = mref.descriptor().name();
         if (nameToModule.putIfAbsent(mn, mref) != null) {
             throw new InternalError(mn + " already defined to this loader");
@@ -191,6 +189,11 @@
                                         + other.mref().descriptor().name());
             }
         }
+
+        // clear resources cache if VM is already initialized
+        if (VM.isModuleSystemInited() && resourceCache != null) {
+            resourceCache = null;
+        }
     }
 
     /**
@@ -355,7 +358,10 @@
     private List<URL> findMiscResource(String name) throws IOException {
         SoftReference<Map<String, List<URL>>> ref = this.resourceCache;
         Map<String, List<URL>> map = (ref != null) ? ref.get() : null;
-        if (map != null) {
+        if (map == null) {
+            map = new ConcurrentHashMap<>();
+            this.resourceCache = new SoftReference<>(map);
+        } else {
             List<URL> urls = map.get(name);
             if (urls != null)
                 return urls;
@@ -381,23 +387,18 @@
                                 }
                             }
                         }
-                        return result;
+                        return (result != null) ? result : Collections.emptyList();
                     }
                 });
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getCause();
         }
 
-        // only cache resources after all modules have been defined
+        // only cache resources after VM is fully initialized
         if (VM.isModuleSystemInited()) {
-            if (map == null) {
-                map = new ConcurrentHashMap<>();
-                this.resourceCache = new SoftReference<>(map);
-            }
-            if (urls == null)
-                urls = Collections.emptyList();
             map.putIfAbsent(name, urls);
         }
+
         return urls;
     }
 
diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
index ece20d8..92b60d7 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
@@ -25,13 +25,11 @@
 
 package jdk.internal.misc;
 
-import java.io.IOException;
 import java.lang.annotation.Annotation;
 import java.lang.module.ModuleDescriptor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.net.URI;
-import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.ProtectionDomain;
 import java.util.Map;
@@ -157,12 +155,6 @@
     Class<?> findBootstrapClassOrNull(ClassLoader cl, String name);
 
     /**
-     * Returns a URL to a resource with the given name in a module that is
-     * defined to the given class loader.
-     */
-    URL findResource(ClassLoader cl, String moduleName, String name) throws IOException;
-
-    /**
      * Returns the Packages for the given class loader.
      */
     Stream<Package> packages(ClassLoader cl);
@@ -178,6 +170,11 @@
     String fastUUID(long lsb, long msb);
 
     /**
+     * Record the non-exported packages of the modules in the given layer
+     */
+    void addNonExportedPackages(ModuleLayer layer);
+
+    /**
      * Invalidate package access cache
      */
     void invalidatePackageAccessCache();
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java b/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java
index 3271283..4d772df 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java
@@ -25,6 +25,8 @@
 
 package jdk.internal.module;
 
+import java.util.Set;
+
 /**
  * Utility class for checking module, package, and class names.
  */
@@ -45,18 +47,17 @@
         int next;
         int off = 0;
         while ((next = name.indexOf('.', off)) != -1) {
-            if (isJavaIdentifier(name, off, (next - off)) == -1) {
-                String id = name.substring(off, next);
+            String id = name.substring(off, next);
+            if (!isJavaIdentifier(id)) {
                 throw new IllegalArgumentException(name + ": Invalid module name"
                         + ": '" + id + "' is not a Java identifier");
             }
             off = next+1;
         }
-        int last = isJavaIdentifier(name, off, name.length() - off);
-        if (last == -1) {
-            String id = name.substring(off);
+        String last = name.substring(off);
+        if (!isJavaIdentifier(last)) {
             throw new IllegalArgumentException(name + ": Invalid module name"
-                    + ": '" + id + "' is not a Java identifier");
+                    + ": '" + last + "' is not a Java identifier");
         }
         return name;
     }
@@ -68,14 +69,13 @@
         int next;
         int off = 0;
         while ((next = name.indexOf('.', off)) != -1) {
-            if (isJavaIdentifier(name, off, (next - off)) == -1)
+            String id = name.substring(off, next);
+            if (!isJavaIdentifier(id))
                 return false;
             off = next+1;
         }
-        int last = isJavaIdentifier(name, off, name.length() - off);
-        if (last == -1)
-            return false;
-        return true;
+        String last = name.substring(off);
+        return isJavaIdentifier(last);
     }
 
     /**
@@ -144,12 +144,13 @@
         int next;
         int off = 0;
         while ((next = name.indexOf('.', off)) != -1) {
-            if (isJavaIdentifier(name, off, (next - off)) == -1)
+            String id = name.substring(off, next);
+            if (!isJavaIdentifier(id))
                 return false;
             off = next+1;
         }
-        int count = name.length() - off;
-        return (isJavaIdentifier(name, off, count) != -1);
+        String last = name.substring(off);
+        return isJavaIdentifier(last);
     }
 
     /**
@@ -164,76 +165,99 @@
         int next;
         int off = 0;
         while ((next = name.indexOf('.', off)) != -1) {
-            if (isJavaIdentifier(name, off, (next - off)) == -1) {
-                String id = name.substring(off, next);
+            String id = name.substring(off, next);
+            if (!isJavaIdentifier(id)) {
                 throw new IllegalArgumentException(name + ": Invalid " + what
                         + ": '" + id + "' is not a Java identifier");
             }
             off = next + 1;
         }
-        if (isJavaIdentifier(name, off, name.length() - off) == -1) {
-            String id = name.substring(off, name.length());
+        String last = name.substring(off);
+        if (!isJavaIdentifier(last)) {
             throw new IllegalArgumentException(name + ": Invalid " + what
-                    + ": '" + id + "' is not a Java identifier");
+                    + ": '" + last + "' is not a Java identifier");
         }
         return name;
     }
 
     /**
-     * Returns {@code true} if a given legal module name contains an identifier
-     * that doesn't end with a Java letter.
+     * Returns true if the given char sequence is a legal Java identifier,
+     * otherwise false.
      */
-    public static boolean hasJavaIdentifierWithTrailingDigit(String name) {
-        // quick scan to allow names that are just ASCII without digits
-        boolean needToParse = false;
-        int i = 0;
-        while (i < name.length()) {
-            int c = name.charAt(i);
-            if (c > 0x7F || (c >= '0' && c <= '9')) {
-                needToParse = true;
-                break;
-            }
-            i++;
-        }
-        if (!needToParse)
+    private static boolean isJavaIdentifier(CharSequence cs) {
+        if (cs.length() == 0 || RESERVED.contains(cs))
             return false;
 
-        // slow path
-        int next;
-        int off = 0;
-        while ((next = name.indexOf('.', off)) != -1) {
-            int last = isJavaIdentifier(name, off, (next - off));
-            if (!Character.isJavaIdentifierStart(last))
-                return true;
-            off = next+1;
-        }
-        int last = isJavaIdentifier(name, off, name.length() - off);
-        if (!Character.isJavaIdentifierStart(last))
-            return true;
-        return false;
-
-    }
-
-    /**
-     * Checks if a char sequence is a legal Java identifier, returning the code
-     * point of the last character if legal or {@code -1} if not legal.
-     */
-    private static int isJavaIdentifier(CharSequence cs, int offset, int count) {
-        if (count == 0)
-            return -1;
-        int first = Character.codePointAt(cs, offset);
+        int first = Character.codePointAt(cs, 0);
         if (!Character.isJavaIdentifierStart(first))
-            return -1;
+            return false;
 
-        int cp = first;
         int i = Character.charCount(first);
-        while (i < count) {
-            cp = Character.codePointAt(cs, offset+i);
+        while (i < cs.length()) {
+            int cp = Character.codePointAt(cs, i);
             if (!Character.isJavaIdentifierPart(cp))
-                return -1;
+                return false;
             i += Character.charCount(cp);
         }
 
-        return cp;
+        return true;
     }
+
+    // keywords, boolean and null literals, not allowed in identifiers
+    private static final Set<String> RESERVED = Set.of(
+            "abstract",
+            "assert",
+            "boolean",
+            "break",
+            "byte",
+            "case",
+            "catch",
+            "char",
+            "class",
+            "const",
+            "continue",
+            "default",
+            "do",
+            "double",
+            "else",
+            "enum",
+            "extends",
+            "final",
+            "finally",
+            "float",
+            "for",
+            "goto",
+            "if",
+            "implements",
+            "import",
+            "instanceof",
+            "int",
+            "interface",
+            "long",
+            "native",
+            "new",
+            "package",
+            "private",
+            "protected",
+            "public",
+            "return",
+            "short",
+            "static",
+            "strictfp",
+            "super",
+            "switch",
+            "synchronized",
+            "this",
+            "throw",
+            "throws",
+            "transient",
+            "try",
+            "void",
+            "volatile",
+            "while",
+            "true",
+            "false",
+            "null",
+            "_"
+    );
 }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java b/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java
index 6d88162..dd3520f 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java
@@ -549,34 +549,26 @@
      *   u2 attribute_name_index;
      *   u4 attribute_length;
      *
-     *   // index to CONSTANT_utf8_info structure with the OS name
-     *   u2 os_name_index;
-     *   // index to CONSTANT_utf8_info structure with the OS arch
-     *   u2 os_arch_index
+     *   // index to CONSTANT_utf8_info structure with the target platform
+     *   u2 target_platform_index;
      * }
      *
      * } </pre>
      */
     public static class ModuleTargetAttribute extends Attribute {
-        private final String osName;
-        private final String osArch;
+        private final String targetPlatform;
 
-        public ModuleTargetAttribute(String osName, String osArch) {
+        public ModuleTargetAttribute(String targetPlatform) {
             super(MODULE_TARGET);
-            this.osName = osName;
-            this.osArch = osArch;
+            this.targetPlatform = targetPlatform;
         }
 
         public ModuleTargetAttribute() {
-            this(null, null);
+            this(null);
         }
 
-        public String osName() {
-            return osName;
-        }
-
-        public String osArch() {
-            return osArch;
+        public String targetPlatform() {
+            return targetPlatform;
         }
 
         @Override
@@ -588,20 +580,14 @@
                                  Label[] labels)
         {
 
-            String osName = null;
-            String osArch = null;
+            String targetPlatform = null;
 
-            int name_index = cr.readUnsignedShort(off);
-            if (name_index != 0)
-                osName = cr.readUTF8(off, buf);
+            int target_platform_index = cr.readUnsignedShort(off);
+            if (target_platform_index != 0)
+                targetPlatform = cr.readUTF8(off, buf);
             off += 2;
 
-            int arch_index = cr.readUnsignedShort(off);
-            if (arch_index != 0)
-                osArch = cr.readUTF8(off, buf);
-            off += 2;
-
-            return new ModuleTargetAttribute(osName, osArch);
+            return new ModuleTargetAttribute(targetPlatform);
         }
 
         @Override
@@ -613,15 +599,10 @@
         {
             ByteVector attr = new ByteVector();
 
-            int name_index = 0;
-            if (osName != null && osName.length() > 0)
-                name_index = cw.newUTF8(osName);
-            attr.putShort(name_index);
-
-            int arch_index = 0;
-            if (osArch != null && osArch.length() > 0)
-                arch_index = cw.newUTF8(osArch);
-            attr.putShort(arch_index);
+            int target_platform_index = 0;
+            if (targetPlatform != null && targetPlatform.length() > 0)
+                target_platform_index = cw.newUTF8(targetPlatform);
+            attr.putShort(target_platform_index);
 
             return attr;
         }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
index 061b229..d083ead 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
@@ -84,8 +84,9 @@
     // The ModulePatcher for the initial configuration
     private static final ModulePatcher patcher = initModulePatcher();
 
-    // ModuleFinder for the initial configuration
-    private static ModuleFinder initialFinder;
+    // ModuleFinders for the initial configuration
+    private static ModuleFinder unlimitedFinder;
+    private static ModuleFinder limitedFinder;
 
     /**
      * Returns the ModulePatcher for the initial configuration.
@@ -95,11 +96,20 @@
     }
 
     /**
-     * Returns the ModuleFinder for the initial configuration
+     * Returns the ModuleFinder for the initial configuration before observability
+     * is limited by the --limit-modules command line option.
      */
-    public static ModuleFinder finder() {
-        assert initialFinder != null;
-        return initialFinder;
+    public static ModuleFinder unlimitedFinder() {
+        assert unlimitedFinder != null;
+        return unlimitedFinder;
+    }
+
+    /**
+     * Returns the ModuleFinder for the initial configuration.
+     */
+    public static ModuleFinder limitedFinder() {
+        assert limitedFinder != null;
+        return limitedFinder;
     }
 
     /**
@@ -134,6 +144,11 @@
 
         PerfCounters.defineBaseTime.addElapsedTimeFrom(t1);
 
+        // special mode to boot with only java.base, ignores other options
+        String propValue = getAndRemoveProperty("jdk.module.minimumBoot");
+        if (propValue != null) {
+            return createMinimalBootLayer();
+        }
 
         long t2 = System.nanoTime();
 
@@ -180,7 +195,8 @@
         }
 
         // --limit-modules
-        String propValue = getAndRemoveProperty("jdk.module.limitmods");
+        unlimitedFinder = finder;
+        propValue = getAndRemoveProperty("jdk.module.limitmods");
         if (propValue != null) {
             Set<String> mods = new HashSet<>();
             for (String mod: propValue.split(",")) {
@@ -188,6 +204,7 @@
             }
             finder = limitFinder(finder, mods, roots);
         }
+        limitedFinder = finder;
 
         // If there is no initial module specified then assume that the initial
         // module is the unnamed module of the application class loader. This
@@ -267,7 +284,8 @@
         }
 
         PrintStream traceOutput = null;
-        if (Boolean.getBoolean("jdk.launcher.traceResolver"))
+        propValue = getAndRemoveProperty("jdk.module.showModuleResolution");
+        if (propValue != null && Boolean.parseBoolean(propValue))
             traceOutput = System.out;
 
         // run the resolver to create the configuration
@@ -362,13 +380,24 @@
         // total time to initialize
         PerfCounters.bootstrapTime.addElapsedTimeFrom(t0);
 
-        // remember the ModuleFinder
-        initialFinder = finder;
-
         return bootLayer;
     }
 
     /**
+     * Create a "minimal" boot module layer that only contains java.base.
+     */
+    private static ModuleLayer createMinimalBootLayer() {
+        Configuration cf = SharedSecrets.getJavaLangModuleAccess()
+            .resolveAndBind(ModuleFinder.ofSystem(),
+                            Set.of(JAVA_BASE),
+                            false,
+                            null);
+
+        Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
+        return ModuleLayer.empty().defineModules(cf, clf);
+    }
+
+    /**
      * Returns a ModuleFinder that limits observability to the given root
      * modules, their transitive dependences, plus a set of other modules.
      */
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
index d808fe1..804f5eb 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
@@ -138,7 +138,7 @@
     }
 
     /*
-     * Utilty class
+     * Utility class
      */
     static class Graph<T> {
         private final Set<T> nodes;
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java
index b589e29..f6f1bb0 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java
@@ -546,21 +546,15 @@
     private ModuleTarget readModuleTargetAttribute(DataInput in, ConstantPool cpool)
         throws IOException
     {
-        String osName = null;
-        String osArch = null;
+        String targetPlatform = null;
 
-        int name_index = in.readUnsignedShort();
-        if (name_index != 0)
-            osName = cpool.getUtf8(name_index);
+        int index = in.readUnsignedShort();
+        if (index != 0)
+            targetPlatform = cpool.getUtf8(index);
 
-        int arch_index = in.readUnsignedShort();
-        if (arch_index != 0)
-            osArch = cpool.getUtf8(arch_index);
-
-        return new ModuleTarget(osName, osArch);
+        return new ModuleTarget(targetPlatform);
     }
 
-
     /**
      * Reads the ModuleHashes attribute
      */
@@ -612,7 +606,6 @@
         return new ModuleResolution(flags);
     }
 
-
     /**
      * Returns true if the given attribute can be present at most once
      * in the class file. Returns false otherwise.
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java
index 35f28d3..270d0a2 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java
@@ -62,9 +62,8 @@
     // the value of the ModuleMainClass attribute
     private String mainClass;
 
-    // the values for the ModuleTarget attribute
-    private String osName;
-    private String osArch;
+    // the value for the ModuleTarget attribute
+    private String targetPlatform;
 
     // the hashes for the ModuleHashes attribute
     private ModuleHashes hashes;
@@ -108,11 +107,10 @@
     }
 
     /**
-     * Sets the values for the ModuleTarget attribute.
+     * Sets the value for the ModuleTarget attribute.
      */
-    public ModuleInfoExtender targetPlatform(String osName, String osArch) {
-        this.osName = osName;
-        this.osArch = osArch;
+    public ModuleInfoExtender targetPlatform(String targetPlatform) {
+        this.targetPlatform = targetPlatform;
         return this;
     }
 
@@ -199,8 +197,8 @@
             cv.addAttribute(new ModulePackagesAttribute(packages));
         if (mainClass != null)
             cv.addAttribute(new ModuleMainClassAttribute(mainClass));
-        if (osName != null || osArch != null)
-            cv.addAttribute(new ModuleTargetAttribute(osName, osArch));
+        if (targetPlatform != null)
+            cv.addAttribute(new ModuleTargetAttribute(targetPlatform));
         if (hashes != null)
             cv.addAttribute(new ModuleHashesAttribute(hashes));
         if (moduleResolution != null)
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
index 01bee50..dded95f 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
@@ -66,10 +66,9 @@
         // write ModuleMainClass if the module has a main class
         md.mainClass().ifPresent(mc -> cw.visitAttribute(new ModuleMainClassAttribute(mc)));
 
-        // write ModuleTarget if there is a platform OS/arch
+        // write ModuleTarget if there is a target platform
         if (target != null) {
-            cw.visitAttribute(new ModuleTargetAttribute(target.osName(),
-                                                        target.osArch()));
+            cw.visitAttribute(new ModuleTargetAttribute(target.targetPlatform()));
         }
 
         cw.visitEnd();
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
index 15e60d0..b0f465d 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
@@ -37,36 +37,66 @@
 
 
 /**
- * The module to class loader map.  The list of boot modules and platform modules
- * are generated at build time.
+ * Supports the mapping of modules to class loaders. The set of modules mapped
+ * to the boot and platform class loaders is generated at build time from
+ * this source file.
  */
-final class ModuleLoaderMap {
+public final class ModuleLoaderMap {
+
+    /**
+     * Maps the system modules to the built-in class loaders.
+     */
+    public static final class Mapper implements Function<String, ClassLoader> {
+        private final Map<String, ClassLoader> map;
+
+        Mapper(Map<String, ClassLoader> map) {
+            this.map = map; // defensive copy not needed
+        }
+
+        @Override
+        public ClassLoader apply(String name) {
+            return map.get(name);
+        }
+    }
+
+    /**
+     * Returns the names of the modules defined to the boot loader.
+     */
+    public static Set<String> bootModules() {
+        // The list of boot modules generated at build time.
+        String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" };
+        Set<String> bootModules = new HashSet<>(BOOT_MODULES.length);
+        for (String mn : BOOT_MODULES) {
+            bootModules.add(mn);
+        }
+        return bootModules;
+    }
+
+    /**
+     * Returns the names of the modules defined to the platform loader.
+     */
+    public static Set<String> platformModules() {
+        // The list of platform modules generated at build time.
+        String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" };
+        Set<String> platformModules = new HashSet<>(PLATFORM_MODULES.length);
+        for (String mn : PLATFORM_MODULES) {
+            platformModules.add(mn);
+        }
+        return platformModules;
+    }
 
     /**
      * Returns the function to map modules in the given configuration to the
      * built-in class loaders.
      */
     static Function<String, ClassLoader> mappingFunction(Configuration cf) {
-
-        // The list of boot modules and platform modules are generated at build time.
-        final String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" };
-        final String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" };
-
-        Set<String> bootModules = new HashSet<>(BOOT_MODULES.length);
-        for (String mn : BOOT_MODULES) {
-            bootModules.add(mn);
-        }
-
-        Set<String> platformModules = new HashSet<>(PLATFORM_MODULES.length);
-        for (String mn : PLATFORM_MODULES) {
-            platformModules.add(mn);
-        }
+        Set<String> bootModules = bootModules();
+        Set<String> platformModules = platformModules();
 
         ClassLoader platformClassLoader = ClassLoaders.platformClassLoader();
         ClassLoader appClassLoader = ClassLoaders.appClassLoader();
 
         Map<String, ClassLoader> map = new HashMap<>();
-
         for (ResolvedModule resolvedModule : cf.modules()) {
             String mn = resolvedModule.name();
             if (!bootModules.contains(mn)) {
@@ -77,12 +107,6 @@
                 }
             }
         }
-
-        return new Function<String, ClassLoader> () {
-            @Override
-            public ClassLoader apply(String mn) {
-                return map.get(mn);
-            }
-        };
+        return new Mapper(map);
     }
 }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
index 3f5827b..c0458e0 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
@@ -120,7 +120,7 @@
 
                     // JAR file - do not open as a multi-release JAR as this
                     // is not supported by the boot class loader
-                    try (JarFile jf = new JarFile(file.toFile())) {
+                    try (JarFile jf = new JarFile(file.toString())) {
                         jf.stream()
                           .filter(e -> !e.isDirectory()
                                   && (!isAutomatic || e.getName().endsWith(".class")))
@@ -431,7 +431,7 @@
         private final URL csURL;
 
         JarResourceFinder(Path path) throws IOException {
-            this.jf = new JarFile(path.toFile());
+            this.jf = new JarFile(path.toString());
             this.csURL = path.toUri().toURL();
         }
 
@@ -505,7 +505,7 @@
         public Resource find(String name) throws IOException {
             Path file = Resources.toFilePath(dir, name);
             if (file != null) {
-                return  newResource(name, dir, file);
+                return newResource(name, dir, file);
             } else {
                 return null;
             }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java
index 75a76b0..750ac80 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java
@@ -59,6 +59,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
 import jdk.internal.jmod.JmodFile;
@@ -315,26 +316,42 @@
     {
         try {
 
+            // exploded module
             if (attrs.isDirectory()) {
                 return readExplodedModule(entry); // may return null
-            } else {
+            }
+
+            // JAR or JMOD file
+            if (attrs.isRegularFile()) {
                 String fn = entry.getFileName().toString();
-                if (attrs.isRegularFile()) {
-                    if (fn.endsWith(".jar")) {
+                boolean isDefaultFileSystem = isDefaultFileSystem(entry);
+
+                // JAR file
+                if (fn.endsWith(".jar")) {
+                    if (isDefaultFileSystem) {
                         return readJar(entry);
-                    } else if (isLinkPhase && fn.endsWith(".jmod")) {
-                        return readJMod(entry);
+                    } else {
+                        // the JAR file is in a custom file system so
+                        // need to copy it to the local file system
+                        Path tmpdir = Files.createTempDirectory("mlib");
+                        Path target = Files.copy(entry, tmpdir.resolve(fn));
+                        return readJar(target);
                     }
                 }
-                return null;
+
+                // JMOD file
+                if (isDefaultFileSystem && isLinkPhase && fn.endsWith(".jmod")) {
+                    return readJMod(entry);
+                }
             }
 
+            return null;
+
         } catch (InvalidModuleDescriptorException e) {
             throw new FindException("Error reading module: " + entry, e);
         }
     }
 
-
     /**
      * Returns a string with the file name of the module if possible.
      * If the module location is not a file URI then return the URI
@@ -434,7 +451,7 @@
      * 3. The contents of any META-INF/services configuration files are mapped
      *    to "provides" declarations
      * 4. The Main-Class attribute in the main attributes of the JAR manifest
-     *    is mapped to the module descriptor mainClass
+     *    is mapped to the module descriptor mainClass if possible
      */
     private ModuleDescriptor deriveModuleDescriptor(JarFile jf)
         throws IOException
@@ -530,12 +547,12 @@
             String mainClass = attrs.getValue(Attributes.Name.MAIN_CLASS);
             if (mainClass != null) {
                 mainClass = mainClass.replace("/", ".");
-                String pn = packageName(mainClass);
-                if (!packages.contains(pn)) {
-                    String msg = "Main-Class " + mainClass + " not in module";
-                    throw new InvalidModuleDescriptorException(msg);
+                if (Checks.isClassName(mainClass)) {
+                    String pn = packageName(mainClass);
+                    if (packages.contains(pn)) {
+                        builder.mainClass(mainClass);
+                    }
                 }
-                builder.mainClass(mainClass);
             }
         }
 
@@ -617,6 +634,8 @@
             }
 
             return ModuleReferences.newJarModule(attrs, patcher, file);
+        } catch (ZipException e) {
+            throw new FindException("Error reading " + file, e);
         }
     }
 
@@ -733,6 +752,16 @@
         }
     }
 
+
+    /**
+     * Return true if a path locates a path in the default file system
+     */
+    private boolean isDefaultFileSystem(Path path) {
+        return path.getFileSystem().provider()
+                .getScheme().equalsIgnoreCase("file");
+    }
+
+
     private static final PerfCounter scanTime
         = PerfCounter.newPerfCounter("jdk.module.finder.modulepath.scanTime");
     private static final PerfCounter moduleCount
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java
index 450cc5c..938c446 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java
@@ -25,6 +25,7 @@
 
 package jdk.internal.module;
 
+import java.io.File;
 import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
@@ -226,8 +227,8 @@
 
         static JarFile newJarFile(Path path) {
             try {
-                return new JarFile(path.toFile(),
-                                   true,               // verify
+                return new JarFile(new File(path.toString()),
+                                   true,                       // verify
                                    ZipFile.OPEN_READ,
                                    JarFile.runtimeVersion());
             } catch (IOException ioe) {
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java
index 76c4236..d8b9d96 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java
@@ -39,6 +39,10 @@
         this.value = value;
     }
 
+    public int value() {
+        return value;
+    }
+
     public static ModuleResolution empty() {
         return new ModuleResolution(0);
     }
@@ -74,35 +78,30 @@
             throw new InternalError("cannot add deprecated for removal to " + value);
         return new ModuleResolution(value | WARN_DEPRECATED_FOR_REMOVAL);
     }
+
     public ModuleResolution withIncubating() {
         if ((value & (WARN_DEPRECATED | WARN_DEPRECATED_FOR_REMOVAL)) != 0)
             throw new InternalError("cannot add incubating to " + value);
         return new ModuleResolution(value | WARN_INCUBATING);
     }
 
-    public int value() {
-        return value;
-    }
-
     public static boolean doNotResolveByDefault(ModuleReference mref) {
         // get the DO_NOT_RESOLVE_BY_DEFAULT flag, if any
-        if (!(mref instanceof ModuleReferenceImpl))
-            return false;
-
-        ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution();
-        if (mres != null)
-            return mres.doNotResolveByDefault();
+        if (mref instanceof ModuleReferenceImpl) {
+            ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution();
+            if (mres != null)
+                return mres.doNotResolveByDefault();
+        }
 
         return false;
     }
 
     public static boolean hasIncubatingWarning(ModuleReference mref) {
-        if (!(mref instanceof ModuleReferenceImpl))
-            return false;
-
-        ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution();
-        if (mres != null)
-            return mres.hasIncubatingWarning();
+        if (mref instanceof ModuleReferenceImpl) {
+            ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution();
+            if (mres != null)
+                return mres.hasIncubatingWarning();
+        }
 
         return false;
     }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java
index dcfe8ac..ffd5070 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java
@@ -25,22 +25,21 @@
 
 package jdk.internal.module;
 
+/**
+ * Represents the module target.
+ *
+ * For now, this is a single value for the target platform, e.g. "linux-x64".
+ */
 public final class ModuleTarget {
 
-    private final String osName;
-    private final String osArch;
+    private final String targetPlatform;
 
-    public ModuleTarget(String osName, String osArch) {
-        this.osName = osName;
-        this.osArch = osArch;
+    public ModuleTarget(String targetPlatform) {
+        this.targetPlatform = targetPlatform;
     }
 
-    public String osName() {
-        return osName;
-    }
-
-    public String osArch() {
-        return osArch;
+    public String targetPlatform() {
+        return targetPlatform;
     }
 
 }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java
index 6228862..af784dd 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java
@@ -25,12 +25,22 @@
 
 package jdk.internal.module;
 
+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.net.URI;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 import jdk.internal.loader.BootLoader;
+import jdk.internal.loader.BuiltinClassLoader;
 import jdk.internal.loader.ClassLoaders;
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
@@ -38,8 +48,8 @@
 /**
  * A helper class for creating and updating modules. This class is intended to
  * support command-line options, tests, and the instrumentation API. It is also
- * used by the VM to add read edges when agents are instrumenting code that
- * need to link to supporting classes.
+ * used by the VM to load modules or add read edges when agents are instrumenting
+ * code that need to link to supporting classes.
  *
  * The parameters that are package names in this API are the fully-qualified
  * names of the packages as defined in section 6.5.3 of <cite>The Java&trade;
@@ -154,4 +164,90 @@
         addReads(m, BootLoader.getUnnamedModule());
         addReads(m, ClassLoaders.appClassLoader().getUnnamedModule());
     }
+
+    /**
+     * Called by the VM to load a system module, typically "java.instrument" or
+     * "jdk.management.agent". If the module is not loaded then it is resolved
+     * and loaded (along with any dependences that weren't previously loaded)
+     * into a child layer.
+     */
+    public static synchronized Module loadModule(String name) {
+        ModuleLayer top = topLayer;
+        if (top == null)
+            top = ModuleLayer.boot();
+
+        Module module = top.findModule(name).orElse(null);
+        if (module != null) {
+            // module already loaded
+            return module;
+        }
+
+        // resolve the module with the top-most layer as the parent
+        ModuleFinder empty = ModuleFinder.of();
+        ModuleFinder finder = ModuleBootstrap.unlimitedFinder();
+        Set<String> roots = Set.of(name);
+        Configuration cf = top.configuration().resolveAndBind(empty, finder, roots);
+
+        // create the child layer
+        Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
+        ModuleLayer newLayer = top.defineModules(cf, clf);
+
+        // add qualified exports/opens to give access to modules in child layer
+        Map<String, Module> map = newLayer.modules().stream()
+                                          .collect(Collectors.toMap(Module::getName,
+                                                  Function.identity()));
+        ModuleLayer layer = top;
+        while (layer != null) {
+            for (Module m : layer.modules()) {
+                // qualified exports
+                m.getDescriptor().exports().stream()
+                    .filter(ModuleDescriptor.Exports::isQualified)
+                    .forEach(e -> e.targets().forEach(target -> {
+                        Module other = map.get(target);
+                        if (other != null) {
+                            addExports(m, e.source(), other);
+                        }}));
+
+                // qualified opens
+                m.getDescriptor().opens().stream()
+                    .filter(ModuleDescriptor.Opens::isQualified)
+                    .forEach(o -> o.targets().forEach(target -> {
+                        Module other = map.get(target);
+                        if (other != null) {
+                            addOpens(m, o.source(), other);
+                        }}));
+            }
+
+            List<ModuleLayer> parents = layer.parents();
+            assert parents.size() <= 1;
+            layer = parents.isEmpty() ? null : parents.get(0);
+        }
+
+        // update security manager before making types visible
+        JLA.addNonExportedPackages(newLayer);
+
+        // update the built-in class loaders to make the types visible
+        for (ResolvedModule resolvedModule : cf.modules()) {
+            ModuleReference mref = resolvedModule.reference();
+            String mn = mref.descriptor().name();
+            ClassLoader cl = clf.apply(mn);
+            if (cl == null) {
+                BootLoader.loadModule(mref);
+            } else {
+                ((BuiltinClassLoader) cl).loadModule(mref);
+            }
+        }
+
+        // new top layer
+        topLayer = newLayer;
+
+        // return module
+        return newLayer.findModule(name)
+                       .orElseThrow(() -> new InternalError("module not loaded"));
+
+    }
+
+    // the top-most system layer
+    private static ModuleLayer topLayer;
+
 }
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java b/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java
index 4498682..5386574 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java
@@ -26,10 +26,10 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.FileSystem;
 import java.nio.file.Files;
 import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.attribute.BasicFileAttributes;
 
 /**
@@ -94,7 +94,7 @@
         if (expectDirectory) {
             name = name.substring(0, name.length() - 1);  // drop trailing "/"
         }
-        Path path = toSafeFilePath(name);
+        Path path = toSafeFilePath(dir.getFileSystem(), name);
         if (path != null) {
             Path file = dir.resolve(path);
             try {
@@ -116,7 +116,7 @@
      * are rejected, as are resource names that translates to a file path
      * with a root component.
      */
-    private static Path toSafeFilePath(String name) {
+    private static Path toSafeFilePath(FileSystem fs, String name) {
         // scan elements of resource name
         int next;
         int off = 0;
@@ -135,12 +135,12 @@
         // convert to file path
         Path path;
         if (File.separatorChar == '/') {
-            path = Paths.get(name);
+            path = fs.getPath(name);
         } else {
             // not allowed to embed file separators
             if (name.contains(File.separator))
                 return null;
-            path = Paths.get(name.replace('/', File.separatorChar));
+            path = fs.getPath(name.replace('/', File.separatorChar));
         }
 
         // file path not allowed to have root component
diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
index 0d0ba62..f2670e5 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
@@ -31,6 +31,7 @@
 import java.util.Map;
 import java.util.Objects;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.loader.ClassLoaders;
 import jdk.internal.misc.VM;
 
 /** Common utility routines used by both java.lang and
@@ -315,23 +316,13 @@
      */
     public static boolean isCallerSensitive(Method m) {
         final ClassLoader loader = m.getDeclaringClass().getClassLoader();
-        if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
+        if (VM.isSystemDomainLoader(loader) ||
+                loader == ClassLoaders.platformClassLoader()) {
             return m.isAnnotationPresent(CallerSensitive.class);
         }
         return false;
     }
 
-    private static boolean isExtClassLoader(ClassLoader loader) {
-        ClassLoader cl = ClassLoader.getSystemClassLoader();
-        while (cl != null) {
-            if (cl.getParent() == null && cl == loader) {
-                return true;
-            }
-            cl = cl.getParent();
-        }
-        return false;
-    }
-
     /**
      * Returns an IllegalAccessException with an exception message based on
      * the access that is denied.
diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
index 50200fd..f919026 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
@@ -135,6 +135,24 @@
         return soleInstance;
     }
 
+    /**
+     * Returns an alternate reflective Method instance for the given method
+     * intended for reflection to invoke, if present.
+     *
+     * A trusted method can define an alternate implementation for a method `foo`
+     * by defining a method named "reflected$foo" that will be invoked
+     * reflectively.
+     */
+    private static Method findMethodForReflection(Method method) {
+        String altName = "reflected$" + method.getName();
+        try {
+           return method.getDeclaringClass()
+                        .getDeclaredMethod(altName, method.getParameterTypes());
+        } catch (NoSuchMethodException ex) {
+            return null;
+        }
+    }
+
     //--------------------------------------------------------------------------
     //
     // Routines used by java.lang.reflect
@@ -161,6 +179,13 @@
     public MethodAccessor newMethodAccessor(Method method) {
         checkInitted();
 
+        if (Reflection.isCallerSensitive(method)) {
+            Method altMethod = findMethodForReflection(method);
+            if (altMethod != null) {
+                method = altMethod;
+            }
+        }
+
         if (noInflation && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
             return new MethodAccessorGenerator().
                 generateMethod(method.getDeclaringClass(),
diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java
index 1c3f769..838f215 100644
--- a/jdk/src/java.base/share/classes/module-info.java
+++ b/jdk/src/java.base/share/classes/module-info.java
@@ -161,6 +161,7 @@
         java.security.jgss,
         java.sql,
         java.xml,
+        jdk.attach,
         jdk.charsets,
         jdk.compiler,   // reflective dependency
         jdk.incubator.httpclient,
diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
index d6cc366..5ac605a 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
@@ -43,13 +43,17 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
+import java.lang.module.Configuration;
+import java.lang.module.FindException;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Requires;
 import java.lang.module.ModuleDescriptor.Exports;
 import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleDescriptor.Provides;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.module.ResolvedModule;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.math.BigDecimal;
@@ -58,14 +62,16 @@
 import java.nio.charset.Charset;
 import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.text.Normalizer;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashSet;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -83,6 +89,7 @@
 import java.util.stream.Stream;
 
 import jdk.internal.misc.VM;
+import jdk.internal.module.ModuleBootstrap;
 import jdk.internal.module.Modules;
 
 
@@ -98,6 +105,7 @@
             "javafx.application.Application";
     private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
             "sun.launcher.LauncherHelper$FXHelper";
+    private static final String LAUNCHER_AGENT_CLASS = "Launcher-Agent-Class";
     private static final String MAIN_CLASS = "Main-Class";
     private static final String ADD_EXPORTS = "Add-Exports";
     private static final String ADD_OPENS = "Add-Opens";
@@ -408,8 +416,12 @@
         ostream =  (printToStderr) ? System.err : System.out;
     }
 
+    static void initOutput(PrintStream ps) {
+        ostream = ps;
+    }
+
     static String getMainClassFromJar(String jarname) {
-        String mainValue = null;
+        String mainValue;
         try (JarFile jarFile = new JarFile(jarname)) {
             Manifest manifest = jarFile.getManifest();
             if (manifest == null) {
@@ -426,6 +438,22 @@
                 abort(null, "java.launcher.jar.error3", jarname);
             }
 
+            // Launcher-Agent-Class (only check for this when Main-Class present)
+            String agentClass = mainAttrs.getValue(LAUNCHER_AGENT_CLASS);
+            if (agentClass != null) {
+                ModuleLayer.boot().findModule("java.instrument").ifPresent(m -> {
+                    try {
+                        String cn = "sun.instrument.InstrumentationImpl";
+                        Class<?> clazz = Class.forName(cn, false, null);
+                        Method loadAgent = clazz.getMethod("loadAgent", String.class);
+                        loadAgent.invoke(null, jarname);
+                    } catch (Throwable e) {
+                        if (e instanceof InvocationTargetException) e = e.getCause();
+                        abort(e, "java.launcher.jar.error4", jarname);
+                    }
+                });
+            }
+
             // Add-Exports and Add-Opens
             String exports = mainAttrs.getValue(ADD_EXPORTS);
             if (exports != null) {
@@ -913,141 +941,350 @@
         }
     }
 
-    private static void formatCommaList(PrintStream out,
-                                        String prefix,
-                                        Collection<?> list)
-    {
-        if (list.isEmpty())
-            return;
-        out.format("%s", prefix);
-        boolean first = true;
-        for (Object ob : list) {
-            if (first) {
-                out.format(" %s", ob);
-                first = false;
-            } else {
-                out.format(", %s", ob);
-            }
-        }
-        out.format("%n");
-    }
-
     /**
      * Called by the launcher to list the observable modules.
-     * If called without any sub-options then the output is a simple list of
-     * the modules. If called with sub-options then the sub-options are the
-     * names of the modules to list (e.g. --list-modules java.base,java.desktop)
      */
-    static void listModules(boolean printToStderr, String optionFlag)
-        throws IOException, ClassNotFoundException
-    {
-        initOutput(printToStderr);
+    static void listModules() {
+        initOutput(System.out);
 
-        ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder();
-        int colon = optionFlag.indexOf('=');
-        if (colon == -1) {
-            finder.findAll().stream()
-                  .sorted(Comparator.comparing(ModuleReference::descriptor))
-                  .forEach(mref -> describeModule(finder, mref, false));
-        } else {
-            String[] names = optionFlag.substring(colon+1).split(",");
-            for (String name: names) {
-                ModuleReference mref = finder.find(name).orElse(null);
-                if (mref == null) {
-                    System.err.format("%s not found%n", name);
-                    continue;
-                }
-                describeModule(finder, mref, true);
-            }
-        }
+        ModuleBootstrap.limitedFinder().findAll().stream()
+            .sorted(new JrtFirstComparator())
+            .forEach(LauncherHelper::showModule);
     }
 
     /**
-     * Describes the given module.
+     * Called by the launcher to show the resolved modules
      */
-    static void describeModule(ModuleFinder finder,
-                               ModuleReference mref,
-                               boolean verbose)
-    {
-        ModuleDescriptor md = mref.descriptor();
-        ostream.print("module " + midAndLocation(md, mref.location()));
-        if (md.isAutomatic())
-            ostream.print(" automatic");
-        ostream.println();
+    static void showResolvedModules() {
+        initOutput(System.out);
 
-        if (!verbose)
-            return;
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        Configuration cf = bootLayer.configuration();
+
+        cf.modules().stream()
+            .map(ResolvedModule::reference)
+            .sorted(new JrtFirstComparator())
+            .forEach(LauncherHelper::showModule);
+    }
+
+    /**
+     * Called by the launcher to describe a module
+     */
+    static void describeModule(String moduleName) {
+        initOutput(System.out);
+
+        ModuleFinder finder = ModuleBootstrap.limitedFinder();
+        ModuleReference mref = finder.find(moduleName).orElse(null);
+        if (mref == null) {
+            abort(null, "java.launcher.module.error4", moduleName);
+        }
+        ModuleDescriptor md = mref.descriptor();
+
+        // one-line summary
+        showModule(mref);
 
         // unqualified exports (sorted by package)
-        Set<Exports> exports = new TreeSet<>(Comparator.comparing(Exports::source));
-        md.exports().stream().filter(e -> !e.isQualified()).forEach(exports::add);
-        for (Exports e : exports) {
-            String modsAndSource = Stream.concat(toStringStream(e.modifiers()),
-                    Stream.of(e.source()))
+        md.exports().stream()
+            .filter(e -> !e.isQualified())
+            .sorted(Comparator.comparing(Exports::source))
+            .map(e -> Stream.concat(Stream.of(e.source()),
+                                    toStringStream(e.modifiers()))
+                    .collect(Collectors.joining(" ")))
+            .forEach(sourceAndMods -> ostream.format("exports %s%n", sourceAndMods));
+
+        // dependences
+        for (Requires r : md.requires()) {
+            String nameAndMods = Stream.concat(Stream.of(r.name()),
+                                               toStringStream(r.modifiers()))
                     .collect(Collectors.joining(" "));
-            ostream.format("  exports %s%n", modsAndSource);
+            ostream.format("requires %s", nameAndMods);
+            finder.find(r.name())
+                .map(ModuleReference::descriptor)
+                .filter(ModuleDescriptor::isAutomatic)
+                .ifPresent(any -> ostream.print(" automatic"));
+            ostream.println();
         }
 
-        for (Requires d : md.requires()) {
-            ostream.format("  requires %s", d);
-            String suffix = finder.find(d.name())
-                    .map(ModuleReference::descriptor)
-                    .map(any -> any.isAutomatic() ? " automatic" : "")
-                    .orElse(" not found");
-            ostream.println(suffix);
-        }
+        // service use and provides
         for (String s : md.uses()) {
-            ostream.format("  uses %s%n", s);
+            ostream.format("uses %s%n", s);
         }
-
         for (Provides ps : md.provides()) {
-            ostream.format("  provides %s with %s%n", ps.service(),
-                    ps.providers().stream().collect(Collectors.joining(", ")));
+            String names = ps.providers().stream().collect(Collectors.joining(" "));
+            ostream.format("provides %s with %s%n", ps.service(), names);
+
         }
 
         // qualified exports
         for (Exports e : md.exports()) {
             if (e.isQualified()) {
-                String modsAndSource = Stream.concat(toStringStream(e.modifiers()),
-                        Stream.of(e.source()))
-                        .collect(Collectors.joining(" "));
-                ostream.format("  exports %s", modsAndSource);
-                formatCommaList(ostream, " to", e.targets());
+                String who = e.targets().stream().collect(Collectors.joining(" "));
+                ostream.format("qualified exports %s to %s%n", e.source(), who);
             }
         }
 
         // open packages
-        for (Opens obj: md.opens()) {
-            String modsAndSource = Stream.concat(toStringStream(obj.modifiers()),
-                    Stream.of(obj.source()))
+        for (Opens opens: md.opens()) {
+            if (opens.isQualified())
+                ostream.print("qualified ");
+            String sourceAndMods = Stream.concat(Stream.of(opens.source()),
+                                                 toStringStream(opens.modifiers()))
                     .collect(Collectors.joining(" "));
-            ostream.format("  opens %s", modsAndSource);
-            if (obj.isQualified())
-                formatCommaList(ostream, " to", obj.targets());
-            else
-                ostream.println();
+            ostream.format("opens %s", sourceAndMods);
+            if (opens.isQualified()) {
+                String who = opens.targets().stream().collect(Collectors.joining(" "));
+                ostream.format(" to %s", who);
+            }
+            ostream.println();
         }
 
         // non-exported/non-open packages
         Set<String> concealed = new TreeSet<>(md.packages());
         md.exports().stream().map(Exports::source).forEach(concealed::remove);
         md.opens().stream().map(Opens::source).forEach(concealed::remove);
-        concealed.forEach(p -> ostream.format("  contains %s%n", p));
+        concealed.forEach(p -> ostream.format("contains %s%n", p));
     }
 
-    static <T> String toString(Set<T> s) {
-        return toStringStream(s).collect(Collectors.joining(" "));
+    /**
+     * Prints a single line with the module name, version and modifiers
+     */
+    private static void showModule(ModuleReference mref) {
+        ModuleDescriptor md = mref.descriptor();
+        ostream.print(md.toNameAndVersion());
+        mref.location()
+                .filter(uri -> !isJrt(uri))
+                .ifPresent(uri -> ostream.format(" %s", uri));
+        if (md.isOpen())
+            ostream.print(" open");
+        if (md.isAutomatic())
+            ostream.print(" automatic");
+        ostream.println();
     }
 
-    static <T> Stream<String> toStringStream(Set<T> s) {
+    /**
+     * A ModuleReference comparator that considers modules in the run-time
+     * image to be less than modules than not in the run-time image.
+     */
+    private static class JrtFirstComparator implements Comparator<ModuleReference> {
+        private final Comparator<ModuleReference> real;
+
+        JrtFirstComparator() {
+            this.real = Comparator.comparing(ModuleReference::descriptor);
+        }
+
+        @Override
+        public int compare(ModuleReference a, ModuleReference b) {
+            if (isJrt(a)) {
+                return isJrt(b) ? real.compare(a, b) : -1;
+            } else {
+                return isJrt(b) ? 1 : real.compare(a, b);
+            }
+        }
+    }
+
+    private static <T> Stream<String> toStringStream(Set<T> s) {
         return s.stream().map(e -> e.toString().toLowerCase());
     }
 
-    static String midAndLocation(ModuleDescriptor md, Optional<URI> location ) {
-        URI loc = location.orElse(null);
-        if (loc == null || loc.getScheme().equalsIgnoreCase("jrt"))
-            return md.toNameAndVersion();
-        else
-            return md.toNameAndVersion() + " (" + loc + ")";
+    private static boolean isJrt(ModuleReference mref) {
+        return isJrt(mref.location().orElse(null));
+    }
+
+    private static boolean isJrt(URI uri) {
+        return (uri != null && uri.getScheme().equalsIgnoreCase("jrt"));
+    }
+
+    /**
+     * Called by the launcher to validate the modules on the upgrade and
+     * application module paths.
+     *
+     * @return {@code true} if no errors are found
+     */
+    private static boolean validateModules() {
+        initOutput(System.out);
+
+        ModuleValidator validator = new ModuleValidator();
+
+        // upgrade module path
+        String value = System.getProperty("jdk.module.upgrade.path");
+        if (value != null) {
+            Stream.of(value.split(File.pathSeparator))
+                    .map(Paths::get)
+                    .forEach(validator::scan);
+        }
+
+        // system modules
+        ModuleFinder.ofSystem().findAll().stream()
+                .sorted(Comparator.comparing(ModuleReference::descriptor))
+                .forEach(validator::process);
+
+        // application module path
+        value = System.getProperty("jdk.module.path");
+        if (value != null) {
+            Stream.of(value.split(File.pathSeparator))
+                    .map(Paths::get)
+                    .forEach(validator::scan);
+        }
+
+        return !validator.foundErrors();
+    }
+
+    /**
+     * A simple validator to check for errors and conflicts between modules.
+     */
+    static class ModuleValidator {
+        private static final String MODULE_INFO = "module-info.class";
+
+        private Map<String, ModuleReference> nameToModule = new HashMap<>();
+        private Map<String, ModuleReference> packageToModule = new HashMap<>();
+        private boolean errorFound;
+
+        /**
+         * Returns true if at least one error was found
+         */
+        boolean foundErrors() {
+            return errorFound;
+        }
+
+        /**
+         * Prints the module location and name.
+         */
+        private void printModule(ModuleReference mref) {
+            mref.location()
+                .filter(uri -> !isJrt(uri))
+                .ifPresent(uri -> ostream.print(uri + " "));
+            ModuleDescriptor descriptor = mref.descriptor();
+            ostream.print(descriptor.name());
+            if (descriptor.isAutomatic())
+                ostream.print(" automatic");
+            ostream.println();
+        }
+
+        /**
+         * Prints the module location and name, checks if the module is
+         * shadowed by a previously seen module, and finally checks for
+         * package conflicts with previously seen modules.
+         */
+        void process(ModuleReference mref) {
+            printModule(mref);
+
+            String name = mref.descriptor().name();
+            ModuleReference previous = nameToModule.putIfAbsent(name, mref);
+            if (previous != null) {
+                ostream.print(INDENT + "shadowed by ");
+                printModule(previous);
+            } else {
+                // check for package conflicts when not shadowed
+                for (String pkg :  mref.descriptor().packages()) {
+                    previous = packageToModule.putIfAbsent(pkg, mref);
+                    if (previous != null) {
+                        String mn = previous.descriptor().name();
+                        ostream.println(INDENT + "contains " + pkg
+                                        + " conflicts with module " + mn);
+                        errorFound = true;
+                    }
+                }
+            }
+        }
+
+        /**
+         * Scan an element on a module path. The element is a directory
+         * of modules, an exploded module, or a JAR file.
+         */
+        void scan(Path entry) {
+            BasicFileAttributes attrs;
+            try {
+                attrs = Files.readAttributes(entry, BasicFileAttributes.class);
+            } catch (NoSuchFileException ignore) {
+                return;
+            } catch (IOException ioe) {
+                ostream.println(entry + " " + ioe);
+                errorFound = true;
+                return;
+            }
+
+            String fn = entry.getFileName().toString();
+            if (attrs.isRegularFile() && fn.endsWith(".jar")) {
+                // JAR file, explicit or automatic module
+                scanModule(entry).ifPresent(this::process);
+            } else if (attrs.isDirectory()) {
+                Path mi = entry.resolve(MODULE_INFO);
+                if (Files.exists(mi)) {
+                    // exploded module
+                    scanModule(entry).ifPresent(this::process);
+                } else {
+                    // directory of modules
+                    scanDirectory(entry);
+                }
+            }
+        }
+
+        /**
+         * Scan the JAR files and exploded modules in a directory.
+         */
+        private void scanDirectory(Path dir) {
+            try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+                Map<String, Path> moduleToEntry = new HashMap<>();
+
+                for (Path entry : stream) {
+                    BasicFileAttributes attrs;
+                    try {
+                        attrs = Files.readAttributes(entry, BasicFileAttributes.class);
+                    } catch (IOException ioe) {
+                        ostream.println(entry + " " + ioe);
+                        errorFound = true;
+                        continue;
+                    }
+
+                    ModuleReference mref = null;
+
+                    String fn = entry.getFileName().toString();
+                    if (attrs.isRegularFile() && fn.endsWith(".jar")) {
+                        mref = scanModule(entry).orElse(null);
+                    } else if (attrs.isDirectory()) {
+                        Path mi = entry.resolve(MODULE_INFO);
+                        if (Files.exists(mi)) {
+                            mref = scanModule(entry).orElse(null);
+                        }
+                    }
+
+                    if (mref != null) {
+                        String name = mref.descriptor().name();
+                        Path previous = moduleToEntry.putIfAbsent(name, entry);
+                        if (previous != null) {
+                            // same name as other module in the directory
+                            printModule(mref);
+                            ostream.println(INDENT + "contains same module as "
+                                            + previous.getFileName());
+                            errorFound = true;
+                        } else {
+                            process(mref);
+                        }
+                    }
+                }
+            } catch (IOException ioe) {
+                ostream.println(dir + " " + ioe);
+                errorFound = true;
+            }
+        }
+
+        /**
+         * Scan a JAR file or exploded module.
+         */
+        private Optional<ModuleReference> scanModule(Path entry) {
+            ModuleFinder finder = ModuleFinder.of(entry);
+            try {
+                return finder.findAll().stream().findFirst();
+            } catch (FindException e) {
+                ostream.println(entry);
+                ostream.println(INDENT + e.getMessage());
+                Throwable cause = e.getCause();
+                if (cause != null) {
+                    ostream.println(INDENT + cause);
+                }
+                errorFound = true;
+                return Optional.empty();
+            }
+        }
     }
 }
diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
index 7816cc0..7cf1470 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
@@ -53,26 +53,33 @@
 \                  A {0} separated list of directories, each directory\n\
 \                  is a directory of modules that replace upgradeable\n\
 \                  modules in the runtime image\n\
-\    --add-modules <modulename>[,<modulename>...]\n\
+\    --add-modules <module name>[,<module name>...]\n\
 \                  root modules to resolve in addition to the initial module.\n\
-\                  <modulename> can also be ALL-DEFAULT, ALL-SYSTEM,\n\
+\                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,\n\
 \                  ALL-MODULE-PATH.\n\
-\    --limit-modules <modulename>[,<modulename>...]\n\
-\                  limit the universe of observable modules\n\
-\    --list-modules [<modulename>[,<modulename>...]]\n\
-\                  list the observable modules and exit\n\
-\    --dry-run     create VM but do not execute main method.\n\
-\                  This --dry-run option may be useful for validating the\n\
+\    --list-modules\n\
+\                  list observable modules and exit\n\
+\    --d <module name>\n\
+\    --describe-module <module name>\n\
+\                  describe a module and exit\n\
+\    --dry-run     create VM and load main class but do not execute main method.\n\
+\                  The --dry-run option may be useful for validating the\n\
 \                  command-line options such as the module system configuration.\n\
+\    --validate-modules\n\
+\                  validate all modules and exit\n\
+\                  The --validate-modules option may be useful for finding\n\
+\                  conflicts and other errors with modules on the module path.\n\
 \    -D<name>=<value>\n\
 \                  set a system property\n\
-\    -verbose:[class|gc|jni]\n\
+\    -verbose:[class|module|gc|jni]\n\
 \                  enable verbose output\n\
 \    -version      print product version to the error stream and exit\n\
 \    --version     print product version to the output stream and exit\n\
 \    -showversion  print product version to the error stream and continue\n\
 \    --show-version\n\
 \                  print product version to the output stream and continue\n\
+\    --show-module-resolution\n\
+\                  show module resolution output during startup\n\
 \    -? -h -help\n\
 \                  print this help message to the error stream\n\
 \    --help        print this help message to the output stream\n\
@@ -119,7 +126,6 @@
 \    -Xcomp            forces compilation of methods on first invocation\n\
 \    -Xdebug           provided for backward compatibility\n\
 \    -Xdiag            show additional diagnostic messages\n\
-\    -Xdiag:resolver   show resolver diagnostic messages\n\
 \    -Xfuture          enable strictest checks, anticipating future default\n\
 \    -Xint             interpreted mode execution only\n\
 \    -Xinternalversion\n\
@@ -164,10 +170,12 @@
 \                      permit illegal access to members of types in named modules\n\
 \                      by code in unnamed modules. This compatibility option will\n\
 \                      be removed in the next release.\n\
-\    --disable-@files  disable further argument file expansion\n\
+\    --limit-modules <module name>[,<module name>...]\n\
+\                      limit the universe of observable modules\n\
 \    --patch-module <module>=<file>({0}<file>)*\n\
-\                      Override or augment a module with classes and resources\n\
-\                      in JAR files or directories.\n\n\
+\                      override or augment a module with classes and resources\n\
+\                      in JAR files or directories.\n\
+\    --disable-@files  disable further argument file expansion\n\n\
 These extra options are subject to change without notice.\n
 
 # Translators please note do not translate the options themselves
@@ -204,6 +212,7 @@
     Error: An unexpected error occurred while trying to open file {0}
 java.launcher.jar.error2=manifest not found in {0}
 java.launcher.jar.error3=no main manifest attribute, in {0}
+java.launcher.jar.error4=error loading java agent in {0}
 java.launcher.init.error=initialization error
 java.launcher.javafx.error1=\
     Error: The JavaFX launchApplication method has the wrong signature, it\n\
@@ -215,4 +224,5 @@
 java.launcher.module.error3=\
     Error: Unable to load main class {0} from module {1}\n\
     \t{2}
-
+java.launcher.module.error4=\
+    {0} not found
diff --git a/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java b/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java
index 8431865..83e6d32 100644
--- a/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java
+++ b/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
diff --git a/jdk/src/java.base/share/native/libjimage/endian.hpp b/jdk/src/java.base/share/native/libjimage/endian.hpp
index 81eca19..b14c39e 100644
--- a/jdk/src/java.base/share/native/libjimage/endian.hpp
+++ b/jdk/src/java.base/share/native/libjimage/endian.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp
index e2dbb79..96a175c 100644
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp
index c5a758a..ed98b32 100644
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/java.base/share/native/libjimage/imageFile.hpp b/jdk/src/java.base/share/native/libjimage/imageFile.hpp
index 9e02d87..c32d2fe 100644
--- a/jdk/src/java.base/share/native/libjimage/imageFile.hpp
+++ b/jdk/src/java.base/share/native/libjimage/imageFile.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/java.base/share/native/libjimage/inttypes.hpp b/jdk/src/java.base/share/native/libjimage/inttypes.hpp
index d66b054..c594726 100644
--- a/jdk/src/java.base/share/native/libjimage/inttypes.hpp
+++ b/jdk/src/java.base/share/native/libjimage/inttypes.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,4 +47,3 @@
 #endif
 
 #endif // LIBJIMAGE_INTTYPES_HPP
-
diff --git a/jdk/src/java.base/share/native/libjimage/jimage.hpp b/jdk/src/java.base/share/native/libjimage/jimage.hpp
index 8521307..305c6e2 100644
--- a/jdk/src/java.base/share/native/libjimage/jimage.hpp
+++ b/jdk/src/java.base/share/native/libjimage/jimage.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -202,4 +202,3 @@
 
 typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location,
         char* buffer, jlong size);
-
diff --git a/jdk/src/java.base/share/native/libjimage/osSupport.hpp b/jdk/src/java.base/share/native/libjimage/osSupport.hpp
index 8fa15e3..aeb6c6a 100644
--- a/jdk/src/java.base/share/native/libjimage/osSupport.hpp
+++ b/jdk/src/java.base/share/native/libjimage/osSupport.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/jdk/src/java.base/share/native/libjli/emessages.h b/jdk/src/java.base/share/native/libjli/emessages.h
index 8c3c341..c5ae8d7 100644
--- a/jdk/src/java.base/share/native/libjli/emessages.h
+++ b/jdk/src/java.base/share/native/libjli/emessages.h
@@ -43,13 +43,14 @@
 #define ARG_ERROR2      "Error: %s requires jar file specification"
 #define ARG_ERROR3      "Error: The -J option should not be followed by a space."
 #define ARG_ERROR4      "Error: %s requires module path specification"
-#define ARG_ERROR5      "Error: %s requires module id"
+#define ARG_ERROR5      "Error: %s requires module name"
 #define ARG_ERROR6      "Error: %s requires modules to be specified"
 #define ARG_ERROR7      "Error: %s can only be specified once"
 #define ARG_ERROR8      "Error: Unmatched quote in environment variable %s"
 #define ARG_ERROR9      "Error: Option %s is not allowed in environment variable %s"
 #define ARG_ERROR10     "Error: Option %s in %s is not allowed in environment variable %s"
 #define ARG_ERROR11     "Error: Cannot specify main class in environment variable %s"
+#define ARG_ERROR12     "Error: %s requires module name"
 
 #define JVM_ERROR1      "Error: Could not create the Java Virtual Machine.\n" GEN_ERROR
 #define JVM_ERROR2      "Error: Could not detach main thread.\n" JNI_ERROR
diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index f8265ee..927c09f 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,10 @@
 static jboolean printXUsage = JNI_FALSE;  /* print and exit*/
 static jboolean dryRun = JNI_FALSE;       /* initialize VM and exit */
 static char     *showSettings = NULL;     /* print but continue */
-static char     *listModules = NULL;
+static jboolean showResolvedModules = JNI_FALSE;
+static jboolean listModules = JNI_FALSE;
+static char     *describeModule = NULL;
+static jboolean validateModules = JNI_FALSE;
 
 static const char *_program_name;
 static const char *_launcher_name;
@@ -118,7 +121,10 @@
 static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
 static void PrintUsage(JNIEnv* env, jboolean doXUsage);
 static void ShowSettings(JNIEnv* env, char *optString);
-static void ListModules(JNIEnv* env, char *optString);
+static void ShowResolvedModules(JNIEnv* env);
+static void ListModules(JNIEnv* env);
+static void DescribeModule(JNIEnv* env, char* optString);
+static jboolean ValidateModules(JNIEnv* env);
 
 static void SetPaths(int argc, char **argv);
 
@@ -409,9 +415,31 @@
         CHECK_EXCEPTION_LEAVE(1);
     }
 
-    if (listModules != NULL) {
-        ListModules(env, listModules);
+    // show resolved modules and continue
+    if (showResolvedModules) {
+        ShowResolvedModules(env);
         CHECK_EXCEPTION_LEAVE(1);
+    }
+
+    // list observable modules, then exit
+    if (listModules) {
+        ListModules(env);
+        CHECK_EXCEPTION_LEAVE(1);
+        LEAVE();
+    }
+
+    // describe a module, then exit
+    if (describeModule != NULL) {
+        DescribeModule(env, describeModule);
+        CHECK_EXCEPTION_LEAVE(1);
+        LEAVE();
+    }
+
+    // validate modules on the module path, then exit
+    if (validateModules) {
+        jboolean okay = ValidateModules(env);
+        CHECK_EXCEPTION_LEAVE(1);
+        if (!okay) ret = 1;
         LEAVE();
     }
 
@@ -552,7 +580,8 @@
 IsLauncherOption(const char* name) {
     return IsClassPathOption(name) ||
            IsLauncherMainOption(name) ||
-           JLI_StrCmp(name, "--list-modules") == 0;
+           JLI_StrCmp(name, "--describe-module") == 0 ||
+           JLI_StrCmp(name, "-d") == 0;
 }
 
 /*
@@ -1199,7 +1228,7 @@
 
     } else if (JLI_StrCCmp(arg, "--") == 0 && (equals = JLI_StrChr(arg, '=')) != NULL) {
         value = equals+1;
-        if (JLI_StrCCmp(arg, "--list-modules=") == 0 ||
+        if (JLI_StrCCmp(arg, "--describe-module=") == 0 ||
             JLI_StrCCmp(arg, "--module=") == 0 ||
             JLI_StrCCmp(arg, "--class-path=") == 0) {
             kind = LAUNCHER_OPTION_WITH_ARGUMENT;
@@ -1263,18 +1292,18 @@
             REPORT_ERROR (has_arg_any_len, ARG_ERROR1, arg);
             SetClassPath(value);
             mode = LM_CLASS;
-        } else if (JLI_StrCmp(arg, "--list-modules") == 0 ||
-                   JLI_StrCCmp(arg, "--list-modules=") == 0) {
-            listModules = arg;
-
-            // set listModules to --list-modules=<module-names> if argument is specified
-            if (JLI_StrCmp(arg, "--list-modules") == 0 && has_arg) {
-                static const char format[] = "%s=%s";
-                size_t buflen = JLI_StrLen(option) + 2 + JLI_StrLen(value);
-                listModules = JLI_MemAlloc(buflen);
-                JLI_Snprintf(listModules, buflen, format, option, value);
-            }
-            return JNI_TRUE;
+        } else if (JLI_StrCmp(arg, "--list-modules") == 0) {
+            listModules = JNI_TRUE;
+        } else if (JLI_StrCmp(arg, "--show-resolved-modules") == 0) {
+            showResolvedModules = JNI_TRUE;
+        } else if (JLI_StrCmp(arg, "--validate-modules") == 0) {
+            AddOption("-Djdk.module.minimumBoot=true", NULL);
+            validateModules = JNI_TRUE;
+        } else if (JLI_StrCmp(arg, "--describe-module") == 0 ||
+                   JLI_StrCCmp(arg, "--describe-module=") == 0 ||
+                   JLI_StrCmp(arg, "-d") == 0) {
+            REPORT_ERROR (has_arg_any_len, ARG_ERROR12, arg);
+            describeModule = value;
 /*
  * Parse white-space options
  */
@@ -1336,9 +1365,8 @@
             showSettings = arg;
         } else if (JLI_StrCmp(arg, "-Xdiag") == 0) {
             AddOption("-Dsun.java.launcher.diag=true", NULL);
-            AddOption("-Djdk.launcher.traceResolver=true", NULL);
-        } else if (JLI_StrCmp(arg, "-Xdiag:resolver") == 0) {
-            AddOption("-Djdk.launcher.traceResolver=true", NULL);
+        } else if (JLI_StrCmp(arg, "--show-module-resolution") == 0) {
+            AddOption("-Djdk.module.showModuleResolution=true", NULL);
 /*
  * The following case provide backward compatibility with old-style
  * command line options.
@@ -1399,7 +1427,10 @@
     }
 
     if (*pwhat == NULL) {
-        *pret = 1;
+        /* LM_UNKNOWN okay for options that exit */
+        if (!listModules && !describeModule && !validateModules) {
+            *pret = 1;
+        }
     } else if (mode == LM_UNKNOWN) {
         /* default to LM_CLASS if -m, -jar and -cp options are
          * not specified */
@@ -1828,21 +1859,61 @@
 }
 
 /**
- * List modules supported by the runtime
+ * Show resolved modules
  */
 static void
-ListModules(JNIEnv *env, char *optString)
+ShowResolvedModules(JNIEnv *env)
+{
+    jmethodID showResolvedModulesID;
+    jclass cls = GetLauncherHelperClass(env);
+    NULL_CHECK(cls);
+    NULL_CHECK(showResolvedModulesID = (*env)->GetStaticMethodID(env, cls,
+            "showResolvedModules", "()V"));
+    (*env)->CallStaticVoidMethod(env, cls, showResolvedModulesID);
+}
+
+/**
+ * List observable modules
+ */
+static void
+ListModules(JNIEnv *env)
 {
     jmethodID listModulesID;
-    jstring joptString = NULL;
     jclass cls = GetLauncherHelperClass(env);
     NULL_CHECK(cls);
     NULL_CHECK(listModulesID = (*env)->GetStaticMethodID(env, cls,
-            "listModules", "(ZLjava/lang/String;)V"));
+            "listModules", "()V"));
+    (*env)->CallStaticVoidMethod(env, cls, listModulesID);
+}
+
+/**
+ * Describe a module
+ */
+static void
+DescribeModule(JNIEnv *env, char *optString)
+{
+    jmethodID describeModuleID;
+    jstring joptString = NULL;
+    jclass cls = GetLauncherHelperClass(env);
+    NULL_CHECK(cls);
+    NULL_CHECK(describeModuleID = (*env)->GetStaticMethodID(env, cls,
+            "describeModule", "(Ljava/lang/String;)V"));
     NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString));
-    (*env)->CallStaticVoidMethod(env, cls, listModulesID,
-                                 USE_STDOUT,
-                                 joptString);
+    (*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString);
+}
+
+/**
+ * Validate modules
+ */
+static jboolean
+ValidateModules(JNIEnv *env)
+{
+    jmethodID validateModulesID;
+    jclass cls = GetLauncherHelperClass(env);
+    NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
+    validateModulesID = (*env)->GetStaticMethodID(env, cls, "validateModules", "()Z");
+    NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
+    return (*env)->CallStaticBooleanMethod(env, cls, validateModulesID);
 }
 
 /*
diff --git a/jdk/src/java.desktop/macosx/native/include/jawt_md.h b/jdk/src/java.desktop/macosx/native/include/jawt_md.h
index c6859fd..94a13c9 100644
--- a/jdk/src/java.desktop/macosx/native/include/jawt_md.h
+++ b/jdk/src/java.desktop/macosx/native/include/jawt_md.h
@@ -37,7 +37,7 @@
 #endif
 
 /*
- * Mac OS X specific declarations for AWT native interface.
+ * MacOS specific declarations for AWT native interface.
  * See notes in jawt.h for an example of use.
  */
 
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
index 677ee8b..c14f328 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
@@ -339,11 +339,16 @@
     public Dimension getMinimumSize( JComponent c ) {
         Dimension d = super.getMinimumSize(c);
         if (XPStyle.getXP() != null) {
-            d.width += 5;
+            d.width += 7;
+            boolean isEditable = false;
+            if (c instanceof JComboBox) {
+                isEditable = ((JComboBox) c).isEditable();
+            }
+            d.height += isEditable ? 4 : 6;
         } else {
             d.width += 4;
+            d.height += 2;
         }
-        d.height += 2;
         return d;
     }
 
diff --git a/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java
index dc65063..abf7025 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java
@@ -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
@@ -74,7 +74,7 @@
  *
  * <blockquote>
  * <table summary="layout">
- * <tr><th align=left>Factor&nbsp;&nbsp;<th align=left>Definition
+ * <tr><th style="text-align:left">Factor&nbsp;&nbsp;<th style="text-align:left">Definition
  * <tr><td><em>A<sub>s</sub></em><td>the alpha component of the source pixel
  * <tr><td><em>C<sub>s</sub></em><td>a color component of the source pixel in premultiplied form
  * <tr><td><em>A<sub>d</sub></em><td>the alpha component of the destination pixel
@@ -114,7 +114,7 @@
  *
  * <blockquote>
  * <table summary="layout">
- * <tr><th align=left>Factor&nbsp;&nbsp;<th align=left>Definition
+ * <tr><th style="text-align:left">Factor&nbsp;&nbsp;<th style="text-align:left">Definition
  * <tr><td><em>C<sub>sr</sub></em> <td>one of the raw color components of the source pixel
  * <tr><td><em>C<sub>dr</sub></em> <td>one of the raw color components of the destination pixel
  * <tr><td><em>A<sub>ac</sub></em>  <td>the "extra" alpha component from the AlphaComposite instance
@@ -205,7 +205,7 @@
  * appropriate conversions are performed before and after the compositing
  * operation.
  *
- * <h3><a name="caveats">Implementation Caveats</a></h3>
+ * <h3><a id="caveats">Implementation Caveats</a></h3>
  *
  * <ul>
  * <li>
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Graphics2D.java b/jdk/src/java.desktop/share/classes/java/awt/Graphics2D.java
index ec5f9bd..ed6f406 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Graphics2D.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Graphics2D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
  * <p>
  * When creating a {@code Graphics2D} object,  the
  * {@code GraphicsConfiguration}
- * specifies the <a name="deftransform">default transform</a> for
+ * specifies the <a id="deftransform">default transform</a> for
  * the target of the {@code Graphics2D} (a
  * {@link Component} or {@link Image}).  This default transform maps the
  * user space coordinate system to screen and printer device coordinates
@@ -129,7 +129,7 @@
  * of their particular rendering processes are:
  * <ol>
  * <li>
- * <b><a name="rendershape">{@code Shape} operations</a></b>
+ * <b><a id="rendershape">{@code Shape} operations</a></b>
  * <ol>
  * <li>
  * If the operation is a {@code draw(Shape)} operation, then
@@ -160,7 +160,7 @@
  * colors to render in device space.
  * </ol>
  * <li>
- * <b><a name=rendertext>Text operations</a></b>
+ * <b><a id=rendertext>Text operations</a></b>
  * <ol>
  * <li>
  * The following steps are used to determine the set of glyphs required
@@ -201,7 +201,7 @@
  * the colors to render in device space.
  * </ol>
  * <li>
- * <b><a name= renderingimage>{@code Image} Operations</a></b>
+ * <b><a id= renderingimage>{@code Image} Operations</a></b>
  * <ol>
  * <li>
  * The region of interest is defined by the bounding box of the source
diff --git a/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java
index 1ecf408..e17d85d 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
  * are not.  Baseline relative values are calculated relative to the
  * baseline.  Valid values are:
  *
- * <center><table BORDER=0 WIDTH=800
+ * <center><table BORDER=0 style="width:800"
  *        SUMMARY="absolute, relative and baseline values as described above">
  * <tr>
  * <th><P style="text-align:left">Absolute Values</th>
@@ -198,7 +198,7 @@
  * The following figure shows a baseline layout and includes a
  * component that spans rows:
  * <center><table summary="Baseline Layout">
- * <tr ALIGN=CENTER>
+ * <tr style="text-align:center">
  * <td>
  * <img src="doc-files/GridBagLayout-baseline.png"
  *  alt="The following text describes this graphic (Figure 1)." style="float:center">
@@ -252,15 +252,15 @@
  * left-to-right container and Figure 3 shows the layout for a horizontal,
  * right-to-left container.
  *
- * <center><table WIDTH=600 summary="layout">
- * <tr ALIGN=CENTER>
+ * <center><table style="width:600" summary="layout">
+ * <tr style="text-align:center">
  * <td>
  * <img src="doc-files/GridBagLayout-1.gif" alt="The preceding text describes this graphic (Figure 1)." style="float:center; margin: 7px 10px;">
  * </td>
  * <td>
  * <img src="doc-files/GridBagLayout-2.gif" alt="The preceding text describes this graphic (Figure 2)." style="float:center; margin: 7px 10px;">
  * </td>
- * <tr ALIGN=CENTER>
+ * <tr style="text-align:center">
  * <td>Figure 2: Horizontal, Left-to-Right</td>
  * <td>Figure 3: Horizontal, Right-to-Left</td>
  * </tr>
diff --git a/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
index a5eab8a..f096fce 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,20 +55,20 @@
  * If the container's {@code ComponentOrientation} property is horizontal
  * and right-to-left, the example produces the output shown in Figure 2.
  *
- * <table style="float:center" WIDTH=600 summary="layout">
- * <tr ALIGN=CENTER>
+ * <table style="float:center;width:600" summary="layout">
+ * <tr style="text-align:center">
  * <td><img SRC="doc-files/GridLayout-1.gif"
  *      alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
  * Row 2 shows buttons 3 then 4. Row 3 shows buttons 5 then 6.">
  * </td>
  *
- * <td ALIGN=CENTER><img SRC="doc-files/GridLayout-2.gif"
- *                   alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
+ * <td style="text-align:center"><img SRC="doc-files/GridLayout-2.gif"
+ *              alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
  * Row 2 shows buttons 4 then 3. Row 3 shows buttons 6 then 5.">
  * </td>
  * </tr>
  *
- * <tr ALIGN=CENTER>
+ * <tr style="text-align:center">
  * <td>Figure 1: Horizontal, Left-to-Right</td>
  *
  * <td>Figure 2: Horizontal, Right-to-Left</td>
diff --git a/jdk/src/java.desktop/share/classes/java/awt/LinearGradientPaint.java b/jdk/src/java.desktop/share/classes/java/awt/LinearGradientPaint.java
index ad70a60..179405d 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/LinearGradientPaint.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/LinearGradientPaint.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, 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
@@ -91,10 +91,9 @@
  * <p>
  * This image demonstrates the example code above for each
  * of the three cycle methods:
- * <center>
+ * <p style="text-align:center">
  * <img src = "doc-files/LinearGradientPaint.png"
  * alt="image showing the output of the example code">
- * </center>
  *
  * @see java.awt.Paint
  * @see java.awt.Graphics2D#setPaint
diff --git a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java
index a5eaca1..6a6d304 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java
@@ -46,7 +46,7 @@
  * the menu bar with a {@code Frame} object, call the
  * frame's {@code setMenuBar} method.
  * <p>
- * <A NAME="mbexample"></A><!-- target for cross references -->
+ * <a id="mbexample"></a><!-- target for cross references -->
  * This is what a menu bar might look like:
  * <p>
  * <img src="doc-files/MenuBar-1.gif"
diff --git a/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java b/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java
index a58fdf6..51bea64 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaint.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, 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
@@ -79,18 +79,18 @@
  * The gradient color proportions are equal for any particular line drawn
  * from the focus point. The following figure shows that the distance AB
  * is equal to the distance BC, and the distance AD is equal to the distance DE.
- * <center>
+ * <p style="text-align:center">
  * <img src = "doc-files/RadialGradientPaint-3.png" alt="image showing the
  * distance AB=BC, and AD=DE">
- * </center>
+ * <p>
  * If the gradient and graphics rendering transforms are uniformly scaled and
  * the user sets the focus so that it coincides with the center of the circle,
  * the gradient color proportions are equal for any line drawn from the center.
  * The following figure shows the distances AB, BC, AD, and DE. They are all equal.
- * <center>
+ * <p style="text-align:center">
  * <img src = "doc-files/RadialGradientPaint-4.png" alt="image showing the
  * distance of AB, BC, AD, and DE are all equal">
- * </center>
+ * <p>
  * Note that some minor variations in distances may occur due to sampling at
  * the granularity of a pixel.
  * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
@@ -116,11 +116,9 @@
  * <p>
  * This image demonstrates the example code above, with default
  * (centered) focus for each of the three cycle methods:
- * <center>
+ * <p style="text-align:center">
  * <img src = "doc-files/RadialGradientPaint-1.png" alt="image showing the
  * output of the sameple code">
- * </center>
- *
  * <p>
  * It is also possible to specify a non-centered focus point, as
  * in the following code:
@@ -139,10 +137,9 @@
  * <p>
  * This image demonstrates the previous example code, with non-centered
  * focus for each of the three cycle methods:
- * <center>
+ * <p style="text-align:center">
  * <img src = "doc-files/RadialGradientPaint-2.png" alt="image showing the
  * output of the sample code">
- * </center>
  *
  * @see java.awt.Paint
  * @see java.awt.Graphics2D#setPaint
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java
index fcc5cf3..ecc531c 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * that create a {@code Rectangle}, and the methods that can modify
  * one, do not prevent setting a negative value for width or height.
  * <p>
- * <a name="Empty">
+ * <a id="Empty">
  * A {@code Rectangle} whose width or height is exactly zero has location
  * along those axes with zero dimension, but is otherwise considered empty.</a>
  * The {@link #isEmpty} method will return true for such a {@code Rectangle}.
@@ -49,7 +49,7 @@
  * will include the location of the {@code Rectangle} on that axis in the
  * result as if the {@link #add(Point)} method were being called.
  * <p>
- * <a name="NonExistent">
+ * <a id="NonExistent">
  * A {@code Rectangle} whose width or height is negative has neither
  * location nor dimension along those axes with negative dimensions.
  * Such a {@code Rectangle} is treated as non-existent along those axes.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Shape.java b/jdk/src/java.desktop/share/classes/java/awt/Shape.java
index 209063c..d8c385f 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Shape.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Shape.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * object that describes the trajectory path of the {@code Shape}
  * outline.
  * <p>
- * <a name="def_insideness"><b>Definition of insideness:</b></a>
+ * <a id="def_insideness"><b>Definition of insideness:</b></a>
  * A point is considered to lie inside a
  * {@code Shape} if and only if:
  * <ul>
diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java
index 63ceb3f..1de393a 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java
@@ -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
@@ -65,7 +65,7 @@
  * itself between the platform and the
  * listeners provided by the initiator of the drag operation.
  * <p>
- * <a name="defaultCursor"></a>
+ * <a id="defaultCursor"></a>
  * By default, {@code DragSourceContext} sets the cursor as appropriate
  * for the current state of the drag and drop operation. For example, if
  * the user has chosen {@linkplain DnDConstants#ACTION_MOVE the move action},
diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
index c9ae836..d9170d1 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
@@ -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
@@ -96,14 +96,14 @@
  * </UL>
  *
  * <h4>Summary of attributes</h4>
- * <table style="float:center" border="0" cellspacing="0" cellpadding="2" width="95%"
+ * <table style="float:center;width:95%" border="0" cellspacing="0" cellpadding="2"
  *     summary="Key, value type, principal constants, and default value
  *     behavior of all TextAttributes">
  * <tr style="background-color:#ccccff">
- * <th valign="TOP" align="CENTER">Key</th>
- * <th valign="TOP" align="CENTER">Value Type</th>
- * <th valign="TOP" align="CENTER">Principal Constants</th>
- * <th valign="TOP" align="CENTER">Default Value</th>
+ * <th valign="TOP" style="text-align:center">Key</th>
+ * <th valign="TOP" style="text-align:center">Value Type</th>
+ * <th valign="TOP" style="text-align:center">Principal Constants</th>
+ * <th valign="TOP" style="text-align:center">Default Value</th>
  * </tr>
  * <tr>
  * <td valign="TOP">{@link #FAMILY}</td>
diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java b/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java
index 019abbe..4bdb3d1 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
  *      [ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
  *      [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
  * </pre>
- * <h3><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
+ * <h3><a id="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
  * <p>
  * In some variations of the {@code rotate} methods in the
  * {@code AffineTransform} class, a double-precision argument
diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java
index c5bb52a..00e553b 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java
@@ -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
@@ -33,11 +33,11 @@
  * start angle, angular extent (length of the arc), and a closure type
  * ({@code OPEN}, {@code CHORD}, or {@code PIE}).
  * <p>
- * <a name="inscribes">
+ * <a id="inscribes">
  * The arc is a partial section of a full ellipse which
  * inscribes the framing rectangle of its parent</a> {@link RectangularShape}.
  *
- * <a name="angles">
+ * <a id="angles">
  * The angles are specified relative to the non-square
  * framing rectangle such that 45 degrees always falls on the line from
  * the center of the ellipse to the upper right corner of the framing
diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java
index b877519..98f70b7 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java
@@ -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
@@ -618,7 +618,7 @@
      *           specified line segment
      * @param y2 the Y coordinate of the end point of the
      *           specified line segment
-     * @return {@code <true>} if this line segment and the specified line segment
+     * @return {@code true} if this line segment and the specified line segment
      *                  intersect each other; {@code false} otherwise.
      * @since 1.2
      */
diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java
index 9ef2bb1..08df1a7 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java
@@ -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
@@ -846,7 +846,7 @@
          * path.
          *
          * @serialData
-         * <a name="Path2DSerialData"><!-- --></a>
+         * <a id="Path2DSerialData"><!-- --></a>
          * <ol>
          * <li>The default serializable fields.
          * There are no default serializable fields as of 1.6.
@@ -1605,7 +1605,7 @@
          * path.
          *
          * @serialData
-         * <a name="Path2DSerialData"><!-- --></a>
+         * <a id="Path2DSerialData"><!-- --></a>
          * <ol>
          * <li>The default serializable fields.
          * There are no default serializable fields as of 1.6.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java b/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java
index 59e3496..ca2e533 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java
@@ -33,7 +33,7 @@
  * languages and the use of entirely different input mechanisms, such as
  * handwriting recognition.
  *
- * <h2><a name="Packaging"></a>Packaging Input Methods</h2>
+ * <h2><a id="Packaging"></a>Packaging Input Methods</h2>
  * Input methods can be made available by adding them to the application's class
  * path. The main JAR file of an input method must contain the file:
  * <pre>
@@ -61,14 +61,14 @@
  * that loading of the class implementing {@code InputMethod} can be deferred
  * until actually needed.
  *
- * <h2><a name="Loading"></a>Loading Input Methods</h2>
+ * <h2><a id="Loading"></a>Loading Input Methods</h2>
  * The input method framework will usually defer loading of input  method
  * classes until they are absolutely needed. It loads only the
  * {@code InputMethodDescriptor} implementations during AWT initialization. It
  * loads an {@code InputMethod} implementation when the input method has been
  * selected.
  *
- * <h2><a name="PeeredComponents"></a>Java Input Methods and Peered Text
+ * <h2><a id="PeeredComponents"></a>Java Input Methods and Peered Text
  * Components</h2>
  * The Java input method framework intends to support all combinations of input
  * methods (host input methods and Java input methods) and components (peered
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
index 89c4387..aa105cc 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
@@ -29,7 +29,8 @@
 
 /**
  * This class provides default implementations of several {@code Image} methods
- * for classes that want to implement the {@MultiResolutionImage} interface.
+ * for classes that want to implement the {@code MultiResolutionImage}
+ * interface.
  *
  * For example,
  * <pre> {@code
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java
index e1c3267..d6fadd9 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java
@@ -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
@@ -42,7 +42,7 @@
  * Values stored in the byte array(s) of this {@code DataBuffer} are treated as
  * unsigned values.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java
index 4ca5471..cfd78cd 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * This class extends {@code DataBuffer} and stores data internally
  * in {@code double} form.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java
index 48e0cf4..259f069 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * This class extends {@code DataBuffer} and stores data internally
  * in {@code float} form.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java
index cdf43ce..58d8e65 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java
@@ -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,7 +41,7 @@
  * This class extends {@code DataBuffer} and stores data internally
  * as integers.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java
index 1c90a5f..90d8148 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java
@@ -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,7 +40,7 @@
 /**
  * This class extends {@code DataBuffer} and stores data internally as shorts.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java
index d2009f9..f8ec77a 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java
@@ -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
@@ -42,7 +42,7 @@
  * shorts.  Values stored in the short array(s) of this {@code DataBuffer}
  * are treated as unsigned values.
  * <p>
- * <a name="optimizations">
+ * <a id="optimizations">
  * Note that some implementations may function more efficiently
  * if they can maintain control over how the data for an image is
  * stored.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
index 81aab99..2ef638e 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
@@ -55,7 +55,7 @@
  * {@code IndexColorModel} objects are never pre-multiplied with
  * the alpha components.
  * <p>
- * <a name="transparency">
+ * <a id="transparency">
  * The transparency of an {@code IndexColorModel} object is
  * determined by examining the alpha components of the colors in the
  * colormap and choosing the most specific value after considering
@@ -86,7 +86,7 @@
  * and {@code getNumComponents} returns 4.
  *
  * <p>
- * <a name="index_values">
+ * <a id="index_values">
  * The values used to index into the colormap are taken from the least
  * significant <em>n</em> bits of pixel representations where
  * <em>n</em> is based on the pixel size specified in the constructor.
diff --git a/jdk/src/java.desktop/share/classes/java/awt/package-info.java b/jdk/src/java.desktop/share/classes/java/awt/package-info.java
index b2335c3..682a371 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/package-info.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/package-info.java
@@ -35,10 +35,10 @@
  * components can fire. See AWTEvent for a description of the AWT event model.
  * <p>
  * A container is a component that can contain components and other containers.
- * A con tainer can also have a layout manager that controls the visual
- * placement of components in the container. The AWT package contains several
- * layout manager classes and an interface for building your own layout manager.
- * See Container and LayoutManager for more information.
+ * A container can also have a layout manager that controls the visual placement
+ * of components in the container. The AWT package contains several layout
+ * manager classes and an interface for building your own layout manager. See
+ * Container and LayoutManager for more information.
  * <p>
  * Each {@code Component} object is limited in its maximum size and its location
  * because the values are stored as an integer. Also, a platform may further
@@ -54,6 +54,8 @@
  * <ul>
  *     <li><a href="doc-files/FocusSpec.html">The AWT Focus Subsystem</a>
  *     <li><a href="doc-files/Modality.html">The AWT Modality</a>
+ *     <li><a href="{@docRoot}/../specs/AWT_Native_Interface.html">
+ *                  The Java AWT Native Interface (JAWT)</a>
  * </ul>
  *
  * @since 1.0
diff --git a/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java
index eb311c2..74b81fe 100644
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java
@@ -37,7 +37,7 @@
  * interfaces, and 6 Java programming language classes. These are described
  * below.
  *
- * <h3><a name="Accessible"></a><a href="Accessible.html">Interface
+ * <h3><a id="Accessible"></a><a href="Accessible.html">Interface
  * Accessible</a></h3>
  * <a href="Accessible.html">Interface Accessible</a> is the main interface of
  * the Java Accessibility API. All components that support the Java
@@ -48,7 +48,7 @@
  * object that is part of the user interface of a Java application, if that
  * program is to be compatible with assistive technologies.
  *
- * <h3><a name="AccessibleContext"></a><a href="AccessibleContext.html">Class
+ * <h3><a id="AccessibleContext"></a><a href="AccessibleContext.html">Class
  * AccessibleContext</a></h3>
  * <a href="AccessibleContext.html">AccessibleContext</a> represents the minimum
  * information all accessible objects return and is obtained by calling the
@@ -108,7 +108,7 @@
  *     called on an AccessibleContext.</li>
  * </ul>
  *
- * <h3><a name="AccessibleRole"></a><a href="AccessibleRole.html">Class
+ * <h3><a id="AccessibleRole"></a><a href="AccessibleRole.html">Class
  * AccessibleRole</a></h3>
  * This class encapsulates the Accessible object's role in the user interface
  * and is obtained by calling the {@code getAccessibleRole} method on an
@@ -123,7 +123,7 @@
  * programmer-defined roles can be added in the future without needing to modify
  * the base class.
  *
- * <h3><a name="AccessibleState"></a><a href="AccessibleState.html">Class
+ * <h3><a id="AccessibleState"></a><a href="AccessibleState.html">Class
  * AccessibleState</a></h3>
  * This class encapsulates a particular state of the Accessible object.
  * Accessible states include things like "Armed", "Busy", "Checked", "Focused",
@@ -142,7 +142,7 @@
  * additional, programmer-defined roles can be added in the future without
  * needing to modify the base class.
  *
- * <h3><a name="AccessibleStateSet"></a><a href="AccessibleStateSet.html">Class
+ * <h3><a id="AccessibleStateSet"></a><a href="AccessibleStateSet.html">Class
  * AccessibleStateSet</a></h3>
  * This class encapsulates a collection of states of the Accessible object and
  * is obtained by calling the {@code getAccessibleStateSet} method on an
@@ -152,7 +152,7 @@
  * class provide for retrieving the individual
  * <a href="#AccessibleState">AccessibleStates</a> on the state set.
  *
- * <h3><a name="AccessibleBundle"></a><a href="AccessibleBundle.html">Class
+ * <h3><a id="AccessibleBundle"></a><a href="AccessibleBundle.html">Class
  * AccessibleBundle</a></h3>
  * This class is used to maintain a strongly typed enumeration. It is the super
  * class of both the <a href="#AccessibleRole">AccessibleRole</a> and
@@ -161,7 +161,7 @@
  * <a href="#AccessibleRole">AccessibleRole</a> and
  * <a href="#AccessibleState">AccessibleState</a> classes.
  *
- * <h3><a name="AccessibleAction"></a><a href="AccessibleAction.html">Interface
+ * <h3><a id="AccessibleAction"></a><a href="AccessibleAction.html">Interface
  * AccessibleAction</a></h3>
  * The <a href="AccessibleAction.html">AccessibleAction</a> interface should be
  * supported by any object that can perform one or more actions. This interface
@@ -177,7 +177,7 @@
  * <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
  * not null, the object supports this interface.
  *
- * <h3> <a name="AccessibleComponent"></a><a href="AccessibleComponent.html">
+ * <h3> <a id="AccessibleComponent"></a><a href="AccessibleComponent.html">
  * Interface AccessibleComponent</a></h3>
  * The <a href="AccessibleComponent.html">AccessibleComponent</a> interface
  * should be supported by any object that is rendered on the screen. This
@@ -190,7 +190,7 @@
  * <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
  * not null, the object supports this interface.
  *
- * <h3><a name="AccessibleSelection"></a><a href="AccessibleSelection.html">
+ * <h3><a id="AccessibleSelection"></a><a href="AccessibleSelection.html">
  * Interface AccessibleSelection</a></h3>
  * The <a href="AccessibleSelection.html">AccessibleSelection</a> interface
  * provides the standard mechanism for an assistive technology to determine what
@@ -206,7 +206,7 @@
  * <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
  * not null, the object supports this interface.
  *
- * <h3><a name="AccessibleText"></a><a href="AccessibleText.html">Interface
+ * <h3><a id="AccessibleText"></a><a href="AccessibleText.html">Interface
  * AccessibleText</a></h3>
  * Interface <a href="AccessibleText.html">AccessibleText</a> is the contract
  * for making rich, editable text Accessible. Not all text displayed on the
@@ -230,7 +230,7 @@
  * <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
  * not null, the object supports this interface.
  *
- * <h3><a name="AccessibleHypertext"></a> <a href="AccessibleHypertext.html">
+ * <h3><a id="AccessibleHypertext"></a> <a href="AccessibleHypertext.html">
  * Interface AccessibleHypertext</a></h3>
  * The <a href="AccessibleHypertext.html">AccessibleHypertext</a> interface
  * should be supported by any object that presents hypertext information on the
@@ -246,7 +246,7 @@
  * class which extends AccessibleHypertext, then that object supports
  * AccessibleHypertext.
  *
- * <h3><a name="AccessibleHyperlink"></a><a href="AccessibleHyperlink.html">
+ * <h3><a id="AccessibleHyperlink"></a><a href="AccessibleHyperlink.html">
  * Interface AccessibleHyperlink</a></h3>
  * An object that is a hyperlink should support the
  * <a href="AccessibleHyperlink.html">AccessibleHyperlink</a> interface.&nbsp;
@@ -254,7 +254,7 @@
  * getLink method on an <a href="#AccessibleHypertext">AccessibleHypertext</a>
  * object.
  *
- * <h3><a name="AccessibleValue"></a><a href="AccessibleValue.html">Interface
+ * <h3><a id="AccessibleValue"></a><a href="AccessibleValue.html">Interface
  * AccessibleValue</a></h3>
  * The <a href="AccessibleValue.html">AccessibleValue</a> interface should be
  * supported by any object that supports a numerical value (e.g., a scroll bar).
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java
index 7678762..8b522da 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java
@@ -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
@@ -63,8 +63,8 @@
  * <p>A {@code TIFFDirectory} is aware of the tag numbers in the
  * group of {@link TIFFTagSet}s associated with it. When
  * a {@code TIFFDirectory} is created from a native image metadata
- * object, these tag sets are derived from the <tt>tagSets</tt> attribute
- * of the <tt>TIFFIFD</tt> node.</p>
+ * object, these tag sets are derived from the {@code tagSets} attribute
+ * of the {@code TIFFIFD} node.</p>
  *
  * <p>A {@code TIFFDirectory} might also have a parent {@link TIFFTag}.
  * This will occur if the directory represents an IFD other than the root
@@ -73,8 +73,8 @@
  * {@link TIFFTag#isIFDPointer} method of this parent {@code TIFFTag}
  * must return {@code true}.  When a {@code TIFFDirectory} is
  * created from a native image metadata object, the parent tag set is set
- * from the <tt>parentTagName</tt> attribute of the corresponding
- * <tt>TIFFIFD</tt> node. Note that a {@code TIFFDirectory} instance
+ * from the {@code parentTagName} attribute of the corresponding
+ * {@code TIFFIFD} node. Note that a {@code TIFFDirectory} instance
  * which has a non-{@code null} parent tag will be contained in the
  * data field of a {@code TIFFField} instance which has a tag field
  * equal to the contained directory's parent tag.</p>
@@ -133,8 +133,8 @@
      * an image metadata object. The supplied object must support an image
      * metadata format supported by the TIFF {@link javax.imageio.ImageWriter}
      * plug-in. This will usually be either the TIFF native image metadata
-     * format <tt>javax_imageio_tiff_image_1.0</tt> or the Java
-     * Image I/O standard metadata format <tt>javax_imageio_1.0</tt>.
+     * format {@code javax_imageio_tiff_image_1.0} or the Java
+     * Image I/O standard metadata format {@code javax_imageio_1.0}.
      *
      * @param tiffImageMetadata A metadata object which supports a compatible
      * image metadata format.
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
index 7d4152c..abc041a 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
@@ -62,7 +62,7 @@
  *
  * <tr>
  * <td>
- * <tt>BYTE</tt>
+ * {@code BYTE}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_BYTE}
@@ -77,7 +77,7 @@
  *
  * <tr>
  * <td>
- * <tt>ASCII</tt>
+ * {@code ASCII}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_ASCII}
@@ -92,7 +92,7 @@
  *
  * <tr>
  * <td>
- * <tt>SHORT</tt>
+ * {@code SHORT}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_SHORT}
@@ -107,7 +107,7 @@
  *
  * <tr>
  * <td>
- * <tt>LONG</tt>
+ * {@code LONG}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_LONG}
@@ -122,7 +122,7 @@
  *
  * <tr>
  * <td>
- * <tt>RATIONAL</tt>
+ * {@code RATIONAL}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_RATIONAL}
@@ -137,7 +137,7 @@
  *
  * <tr>
  * <td>
- * <tt>SBYTE</tt>
+ * {@code SBYTE}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_SBYTE}
@@ -152,7 +152,7 @@
  *
  * <tr>
  * <td>
- * <tt>UNDEFINED</tt>
+ * {@code UNDEFINED}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_UNDEFINED}
@@ -167,7 +167,7 @@
  *
  * <tr>
  * <td>
- * <tt>SSHORT</tt>
+ * {@code SSHORT}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_SSHORT}
@@ -182,7 +182,7 @@
  *
  * <tr>
  * <td>
- * <tt>SLONG</tt>
+ * {@code SLONG}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_SLONG}
@@ -197,7 +197,7 @@
  *
  * <tr>
  * <td>
- * <tt>SRATIONAL</tt>
+ * {@code SRATIONAL}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_SRATIONAL}
@@ -212,7 +212,7 @@
  *
  * <tr>
  * <td>
- * <tt>FLOAT</tt>
+ * {@code FLOAT}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_FLOAT}
@@ -227,7 +227,7 @@
  *
  * <tr>
  * <td>
- * <tt>DOUBLE</tt>
+ * {@code DOUBLE}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_DOUBLE}
@@ -242,7 +242,7 @@
  *
  * <tr>
  * <td>
- * <tt>IFD</tt>
+ * {@code IFD}
  * </td>
  * <td>
  * {@link TIFFTag#TIFF_IFD_POINTER}
@@ -941,14 +941,14 @@
 
     /**
      * Returns the {@code TIFFField} as a node named either
-     * <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the
+     * {@code "TIFFField"} or {@code "TIFFIFD"} as described in the
      * TIFF native image metadata specification. The node will be named
-     * <tt>"TIFFIFD"</tt> if and only if {@link #hasDirectory()} returns
+     * {@code "TIFFIFD"} if and only if {@link #hasDirectory()} returns
      * {@code true} and the field's type is either {@link TIFFTag#TIFF_LONG}
      * or {@link TIFFTag#TIFF_IFD_POINTER}.
      *
-     * @return a {@code Node} named <tt>"TIFFField"</tt> or
-     * <tt>"TIFFIFD"</tt>.
+     * @return a {@code Node} named {@code "TIFFField"} or
+     * {@code "TIFFIFD"}.
      */
     public Node getAsNativeNode() {
         return new TIFFFieldNode(this);
diff --git a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java
index c9d1f61..e96859e 100644
--- a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java
+++ b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
  * <LI>
  * Since not all Java profiles include the AWT, the Jini Print Service should
  * not depend on an AWT class.
- * <P>
  * <LI>
  * The implementation of class java.awt.datatransfer.MimeType does not
  * guarantee
@@ -76,7 +75,6 @@
  * <LI> Quoting backslash characters inside parameter values are removed.
  * <LI> The parameters are arranged in ascending order of parameter name.
  * </UL>
- * <P>
  *
  * @author  Alan Kaminsky
  */
diff --git a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java
index 8369f7f..7df4445 100644
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +40,7 @@
  * for purposes of finishing.
  * <P>
  * Standard Finishings values are:
- * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
+ * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
  * <TR>
  * <TD STYLE="WIDTH:10%">
  * &nbsp;
@@ -76,7 +76,7 @@
  * <P>
  * The following Finishings values are more specific; they indicate a
  * corner or an edge as if the document were a portrait document:
- * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
+ * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
  * <TR>
  * <TD STYLE="WIDTH:10%">
  * &nbsp;
diff --git a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java
index 7f06e95..86a84de 100644
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * The standard MultipleDocumentHandling values are:
  * <UL>
  * <LI>
- * <a NAME="sdfi"></a>{@link #SINGLE_DOCUMENT
+ * <a id="sdfi"></a>{@link #SINGLE_DOCUMENT
  * <B>SINGLE_DOCUMENT</B>}. If a print job has multiple
  * documents -- say, the document data is called {@code a} and
  * {@code b} -- then the result of processing all the document data
@@ -85,7 +85,7 @@
  * each copy ({@code a(*),b(*)}) to start on a new media sheet.
  *
  * <LI>
- * <a NAME="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
+ * <a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
  * <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}. If a print job
  * has multiple documents -- say, the document data is called {@code a} and
  * {@code b} -- then the result of processing the data in each document
@@ -98,7 +98,7 @@
  * {@code a(*),a(*),...,b(*),b(*)...}.
  *
  * <LI>
- * <a NAME="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
+ * <a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
  * <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}. If a print job
  * has multiple documents -- say, the document data is called {@code a} and
  * {@code b} -- then the result of processing the data in each document
@@ -111,7 +111,7 @@
  * {@code a(*),b(*),a(*),b(*),...}.
  *
  * <LI>
- * <a NAME="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
+ * <a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
  * <B>SINGLE_DOCUMENT_NEW_SHEET</B>}. Same as SINGLE_DOCUMENT,
  * except that the printer must ensure that the first impression of each
  * document instance in the job is placed on a new media sheet. This value
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java
index 8c6a590..0fe40e8 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java
@@ -59,7 +59,7 @@
      *
      * @see MidiMessage#getStatus
      */
-    public static final int META                                                = 0xFF; // 255
+    public static final int META = 0xFF; // 255
 
     /**
      * The length of the actual message in the data array. This is used to
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java
index f7b8b9b..6ca01ac 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +47,15 @@
  * {@code MidiMessage} includes methods to get, but not set, these values.
  * Setting them is a subclass responsibility.
  * <p>
- * <a name="integersVsBytes"></a> The MIDI standard expresses MIDI data in
+ * <a id="integersVsBytes"></a> The MIDI standard expresses MIDI data in
  * bytes. However, because Java<sup>TM</sup> uses signed bytes, the Java Sound
  * API uses integers instead of bytes when expressing MIDI data. For example,
  * the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status
  * bytes as integers. If you are processing MIDI data that originated outside
  * Java Sound and now is encoded as signed bytes, the bytes can be
  * converted to integers using this conversion:
- *
- * <center>{@code int i = (int)(byte & 0xFF)}</center>
+ * <p style="text-align:center">
+ * {@code int i = (int)(byte & 0xFF)}
  * <p>
  * If you simply need to pass a known MIDI byte value as a method parameter, it
  * can be expressed directly as an integer, using (for example) decimal or
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java
index b8cfba0..f8b8aaac 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java
@@ -58,7 +58,7 @@
      *
      * @see #Sequence(float, int)
      */
-    public static final float PPQ                                                       = 0.0f;
+    public static final float PPQ = 0.0f;
 
     /**
      * The SMPTE-based timing type with 24 frames per second (resolution is
@@ -66,7 +66,7 @@
      *
      * @see #Sequence(float, int)
      */
-    public static final float SMPTE_24                                          = 24.0f;
+    public static final float SMPTE_24 = 24.0f;
 
     /**
      * The SMPTE-based timing type with 25 frames per second (resolution is
@@ -74,7 +74,7 @@
      *
      * @see #Sequence(float, int)
      */
-    public static final float SMPTE_25                                          = 25.0f;
+    public static final float SMPTE_25 = 25.0f;
 
     /**
      * The SMPTE-based timing type with 29.97 frames per second (resolution is
@@ -82,7 +82,7 @@
      *
      * @see #Sequence(float, int)
      */
-    public static final float SMPTE_30DROP                                      = 29.97f;
+    public static final float SMPTE_30DROP = 29.97f;
 
     /**
      * The SMPTE-based timing type with 30 frames per second (resolution is
@@ -90,7 +90,7 @@
      *
      * @see #Sequence(float, int)
      */
-    public static final float SMPTE_30                                          = 30.0f;
+    public static final float SMPTE_30 = 30.0f;
 
     // Variables
 
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java
index 4050f38..c1e9490 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java
@@ -733,7 +733,7 @@
          * information from its internal clock. This is not a legal slave sync
          * mode.
          */
-        public static final SyncMode INTERNAL_CLOCK             = new SyncMode("Internal Clock");
+        public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock");
 
         /**
          * A master or slave synchronization mode that specifies the use of MIDI
@@ -745,7 +745,7 @@
          * receiver. MIDI clock messages are sent at a rate of 24 per quarter
          * note.
          */
-        public static final SyncMode MIDI_SYNC                  = new SyncMode("MIDI Sync");
+        public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync");
 
         /**
          * A master or slave synchronization mode that specifies the use of MIDI
@@ -756,13 +756,13 @@
          * sequencer sends MIDI Time Code messages to its receiver. (See the
          * MIDI 1.0 Detailed Specification for a description of MIDI Time Code.)
          */
-        public static final SyncMode MIDI_TIME_CODE             = new SyncMode("MIDI Time Code");
+        public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code");
 
         /**
          * A slave synchronization mode indicating that no timing information
          * should be sent to the receiver. This is not a legal master sync mode.
          */
-        public static final SyncMode NO_SYNC                            = new SyncMode("No Timing");
+        public static final SyncMode NO_SYNC = new SyncMode("No Timing");
 
     }
 }
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java
index 8d0a9a2..c02deda 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java
@@ -61,35 +61,35 @@
      *
      * @see MidiMessage#getStatus
      */
-    public static final int MIDI_TIME_CODE                              = 0xF1; // 241
+    public static final int MIDI_TIME_CODE = 0xF1; // 241
 
     /**
      * Status byte for Song Position Pointer message (0xF2, or 242).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int SONG_POSITION_POINTER               = 0xF2; // 242
+    public static final int SONG_POSITION_POINTER = 0xF2; // 242
 
     /**
      * Status byte for MIDI Song Select message (0xF3, or 243).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int SONG_SELECT                                 = 0xF3; // 243
+    public static final int SONG_SELECT = 0xF3; // 243
 
     /**
      * Status byte for Tune Request message (0xF6, or 246).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int TUNE_REQUEST                                = 0xF6; // 246
+    public static final int TUNE_REQUEST = 0xF6; // 246
 
     /**
      * Status byte for End of System Exclusive message (0xF7, or 247).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int END_OF_EXCLUSIVE                    = 0xF7; // 247
+    public static final int END_OF_EXCLUSIVE = 0xF7; // 247
 
     // System real-time messages
 
@@ -98,80 +98,80 @@
      *
      * @see MidiMessage#getStatus
      */
-    public static final int TIMING_CLOCK                                = 0xF8; // 248
+    public static final int TIMING_CLOCK = 0xF8; // 248
 
     /**
      * Status byte for Start message (0xFA, or 250).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int START                                               = 0xFA; // 250
+    public static final int START = 0xFA; // 250
 
     /**
      * Status byte for Continue message (0xFB, or 251).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int CONTINUE                                    = 0xFB; // 251
+    public static final int CONTINUE = 0xFB; // 251
 
     /**
      * Status byte for Stop message (0xFC, or 252).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int STOP                                                = 0xFC; //252
+    public static final int STOP = 0xFC; //252
 
     /**
      * Status byte for Active Sensing message (0xFE, or 254).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int ACTIVE_SENSING                              = 0xFE; // 254
+    public static final int ACTIVE_SENSING = 0xFE; // 254
 
     /**
      * Status byte for System Reset message (0xFF, or 255).
      *
      * @see MidiMessage#getStatus
      */
-    public static final int SYSTEM_RESET                                = 0xFF; // 255
+    public static final int SYSTEM_RESET = 0xFF; // 255
 
     // Channel voice message upper nibble defines
 
     /**
      * Command value for Note Off message (0x80, or 128).
      */
-    public static final int NOTE_OFF                                    = 0x80;  // 128
+    public static final int NOTE_OFF = 0x80;  // 128
 
     /**
      * Command value for Note On message (0x90, or 144).
      */
-    public static final int NOTE_ON                                             = 0x90;  // 144
+    public static final int NOTE_ON = 0x90;  // 144
 
     /**
      * Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or
      * 160).
      */
-    public static final int POLY_PRESSURE                               = 0xA0;  // 160
+    public static final int POLY_PRESSURE = 0xA0;  // 160
 
     /**
      * Command value for Control Change message (0xB0, or 176).
      */
-    public static final int CONTROL_CHANGE                              = 0xB0;  // 176
+    public static final int CONTROL_CHANGE = 0xB0;  // 176
 
     /**
      * Command value for Program Change message (0xC0, or 192).
      */
-    public static final int PROGRAM_CHANGE                              = 0xC0;  // 192
+    public static final int PROGRAM_CHANGE = 0xC0;  // 192
 
     /**
      * Command value for Channel Pressure (Aftertouch) message (0xD0, or 208).
      */
-    public static final int CHANNEL_PRESSURE                    = 0xD0;  // 208
+    public static final int CHANNEL_PRESSURE = 0xD0;  // 208
 
     /**
      * Command value for Pitch Bend message (0xE0, or 224).
      */
-    public static final int PITCH_BEND                                  = 0xE0;  // 224
+    public static final int PITCH_BEND = 0xE0;  // 224
 
     /**
      * Constructs a new {@code ShortMessage}. The contents of the new message
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java
index de478c3..b561faa 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java
@@ -81,7 +81,7 @@
      *
      * @see MidiMessage#getStatus
      */
-    public static final int SYSTEM_EXCLUSIVE                    = 0xF0; // 240
+    public static final int SYSTEM_EXCLUSIVE = 0xF0; // 240
 
     /**
      * Status byte for Special System Exclusive message (0xF7, or 247), which is
@@ -90,7 +90,7 @@
      *
      * @see MidiMessage#getStatus
      */
-    public static final int SPECIAL_SYSTEM_EXCLUSIVE    = 0xF7; // 247
+    public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; // 247
 
     /**
      * The data bytes for this system exclusive message. These are initialized
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java
index 2d67961..0019a74 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
  * given type of {@code Synthesizer} always has a fixed number of voices, equal
  * to the maximum number of simultaneous notes it is capable of sounding.
  * <p>
- * <a NAME="description_of_active"></a> If the voice is not currently processing
+ * <a id="description_of_active"></a> If the voice is not currently processing
  * a MIDI note, it is considered inactive. A voice is inactive when it has been
  * given no note-on commands, or when every note-on command received has been
  * terminated by a corresponding note-off (or by an "all notes off" message).
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java
index 4f81d7c..a1abf92 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java
@@ -141,14 +141,14 @@
          * Represents a control for the mute status of a line. Note that mute
          * status does not affect gain.
          */
-        public static final Type MUTE                           = new Type("Mute");
+        public static final Type MUTE = new Type("Mute");
 
         /**
          * Represents a control for whether reverberation is applied to a line.
          * Note that the status of this control not affect the reverberation
          * settings for a line, but does affect whether these settings are used.
          */
-        public static final Type APPLY_REVERB           = new Type("Apply Reverb");
+        public static final Type APPLY_REVERB = new Type("Apply Reverb");
 
         /**
          * Constructs a new boolean control type.
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java
index 485225b..af31021 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, 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
@@ -361,8 +361,8 @@
          * loudness is unaffected. Note that gain measures dB, not amplitude.
          * The relationship between a gain in decibels and the corresponding
          * linear amplitude multiplier is:
-         *
-         * <CENTER>{@code linearScalar = pow(10.0, gainDB/20.0)}</CENTER>
+         * <p style="text-align:center">
+         * {@code linearScalar = pow(10.0, gainDB/20.0)}
          * <p>
          * The {@code FloatControl} class has methods to impose a maximum and
          * minimum allowable value for gain. However, because an audio signal
@@ -386,7 +386,7 @@
          * @see #REVERB_RETURN
          * @see #VOLUME
          */
-        public static final Type MASTER_GAIN            = new Type("Master Gain");
+        public static final Type MASTER_GAIN = new Type("Master Gain");
 
         /**
          * Represents a control for the auxiliary send gain on a line.
@@ -394,7 +394,7 @@
          * @see #MASTER_GAIN
          * @see #AUX_RETURN
          */
-        public static final Type AUX_SEND                       = new Type("AUX Send");
+        public static final Type AUX_SEND = new Type("AUX Send");
 
         /**
          * Represents a control for the auxiliary return gain on a line.
@@ -402,7 +402,7 @@
          * @see #MASTER_GAIN
          * @see #AUX_SEND
          */
-        public static final Type AUX_RETURN                     = new Type("AUX Return");
+        public static final Type AUX_RETURN = new Type("AUX Return");
 
         /**
          * Represents a control for the pre-reverb gain on a line. This control
@@ -413,7 +413,7 @@
          * @see #REVERB_RETURN
          * @see EnumControl.Type#REVERB
          */
-        public static final Type REVERB_SEND            = new Type("Reverb Send");
+        public static final Type REVERB_SEND = new Type("Reverb Send");
 
         /**
          * Represents a control for the post-reverb gain on a line. This control
@@ -423,7 +423,7 @@
          * @see #MASTER_GAIN
          * @see #REVERB_SEND
          */
-        public static final Type REVERB_RETURN          = new Type("Reverb Return");
+        public static final Type REVERB_RETURN = new Type("Reverb Return");
 
         /**
          * Represents a control for the volume on a line.
@@ -431,7 +431,7 @@
         /*
          * $$kk: 08.30.99: ISSUE: what units?  linear or dB?
          */
-        public static final Type VOLUME                         = new Type("Volume");
+        public static final Type VOLUME = new Type("Volume");
 
         /**
          * Represents a control for the relative pan (left-right positioning) of
@@ -442,7 +442,7 @@
          *
          * @see #BALANCE
          */
-        public static final Type PAN                            = new Type("Pan");
+        public static final Type PAN = new Type("Pan");
 
         /**
          * Represents a control for the relative balance of a stereo signal
@@ -452,7 +452,7 @@
          *
          * @see #PAN
          */
-        public static final Type BALANCE                        = new Type("Balance");
+        public static final Type BALANCE = new Type("Balance");
 
         /**
          * Represents a control that changes the sample rate of audio playback.
@@ -470,7 +470,7 @@
          * doubling the sample rate has the effect of doubling the frequencies
          * in the sound's spectrum, which raises the pitch by an octave.
          */
-        public static final Type SAMPLE_RATE            = new Type("Sample Rate");
+        public static final Type SAMPLE_RATE = new Type("Sample Rate");
 
         /**
          * Constructs a new float control type.
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
index 19fb585..ca57d1d 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
@@ -220,7 +220,7 @@
          * @see #CLOSE
          * @see Line#open
          */
-        public static final Type OPEN   = new Type("Open");
+        public static final Type OPEN = new Type("Open");
 
         /**
          * A type of event that is sent when a line closes, freeing the system
@@ -229,7 +229,7 @@
          * @see #OPEN
          * @see Line#close
          */
-        public static final Type CLOSE  = new Type("Close");
+        public static final Type CLOSE = new Type("Close");
 
         /**
          * A type of event that is sent when a line begins to engage in active
@@ -239,7 +239,7 @@
          * @see #STOP
          * @see DataLine#start
          */
-        public static final Type START  = new Type("Start");
+        public static final Type START = new Type("Start");
 
         /**
          * A type of event that is sent when a line ceases active input or
@@ -249,7 +249,7 @@
          * @see #START
          * @see DataLine#stop
          */
-        public static final Type STOP   = new Type("Stop");
+        public static final Type STOP = new Type("Stop");
 
         /**
          * A type of event that is sent when a line ceases to engage in active
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java
index 7749b3a..b5e20f0 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, 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
@@ -159,9 +159,9 @@
      * <p>
      * The number of bytes to write must represent an integral number of sample
      * frames, such that:
-     * <br>
-     * <center>{@code [ bytes written ] % [frame size in bytes ] == 0}</center>
-     * <br>
+     * <p style="text-align:center">
+     * {@code [ bytes written ] % [frame size in bytes ] == 0}
+     * <p>
      * The return value will always meet this requirement. A request to write a
      * number of bytes representing a non-integral number of sample frames
      * cannot be fulfilled and may result in an
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java
index acacdbc..944c8e0 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, 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
@@ -149,9 +149,9 @@
      * <p>
      * The number of bytes to be read must represent an integral number of
      * sample frames, such that:
-     * <br>
-     * <center>{@code [ bytes read ] % [frame size in bytes ] == 0}</center>
-     * <br>
+     * <p style="text-align:center">
+     * {@code [ bytes read ] % [frame size in bytes ] == 0}
+     * <p>
      * The return value will always meet this requirement. A request to read a
      * number of bytes representing a non-integral number of sample frames
      * cannot be fulfilled and may result in an IllegalArgumentException.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/Action.java b/jdk/src/java.desktop/share/classes/javax/swing/Action.java
index f34fe51..52c6cd8 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/Action.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java
@@ -69,7 +69,7 @@
  * are desired, and use simple <code>ActionListener</code>s elsewhere.
  * <br>
  *
- * <h3><a name="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
+ * <h3><a id="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
  * <p>
  * Many of Swing's components have an <code>Action</code> property.  When
  * an <code>Action</code> is set on a component, the following things
@@ -96,34 +96,34 @@
  *
  * <table border="1" cellpadding="1" cellspacing="0"
  *         summary="Supported Action properties">
- *  <tr valign="top"  align="left">
- *    <th style="background-color:#CCCCFF" align="left">Component Property
- *    <th style="background-color:#CCCCFF" align="left">Components
- *    <th style="background-color:#CCCCFF" align="left">Action Key
- *    <th style="background-color:#CCCCFF" align="left">Notes
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
+ *    <th style="background-color:#CCCCFF;text-align:left">Component Property
+ *    <th style="background-color:#CCCCFF;text-align:left">Components
+ *    <th style="background-color:#CCCCFF;text-align:left">Action Key
+ *    <th style="background-color:#CCCCFF;text-align:left">Notes
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>enabled</code></b>
  *      <td>All
  *      <td>The <code>isEnabled</code> method
  *      <td>&nbsp;
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>toolTipText</code></b>
  *      <td>All
  *      <td><code>SHORT_DESCRIPTION</code>
  *      <td>&nbsp;
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>actionCommand</code></b>
  *      <td>All
  *      <td><code>ACTION_COMMAND_KEY</code>
  *      <td>&nbsp;
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>mnemonic</code></b>
  *      <td>All buttons
  *      <td><code>MNEMONIC_KEY</code>
  *      <td>A <code>null</code> value or <code>Action</code> results in the
  *          button's <code>mnemonic</code> property being set to
  *          <code>'\0'</code>.
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>text</code></b>
  *      <td>All buttons
  *      <td><code>NAME</code>
@@ -139,7 +139,7 @@
  *          <code>true</code> if the <code>Action</code> has a
  *          non-<code>null</code> value for <code>LARGE_ICON_KEY</code> or
  *          <code>SMALL_ICON</code>.
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>displayedMnemonicIndex</code></b>
  *      <td>All buttons
  *      <td><code>DISPLAYED_MNEMONIC_INDEX_KEY</code>
@@ -150,7 +150,7 @@
  *          mnemonic index is not updated.  In any subsequent changes to
  *          <code>DISPLAYED_MNEMONIC_INDEX_KEY</code>, <code>null</code>
  *          is treated as -1.
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>icon</code></b>
  *      <td>All buttons except of <code>JCheckBox</code>,
  *      <code>JToggleButton</code> and <code>JRadioButton</code>.
@@ -160,13 +160,13 @@
  *         <code>SMALL_ICON</code>.  All other buttons will use
  *         <code>LARGE_ICON_KEY</code>; if the value is <code>null</code> they
  *         use <code>SMALL_ICON</code>.
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>accelerator</code></b>
  *      <td>All <code>JMenuItem</code> subclasses, with the exception of
  *          <code>JMenu</code>.
  *      <td><code>ACCELERATOR_KEY</code>
  *      <td>&nbsp;
- *  <tr valign="top"  align="left">
+ *  <tr valign="top" style="text-align:left">
  *      <td><b><code>selected</code></b>
  *      <td><code>JToggleButton</code>, <code>JCheckBox</code>,
  *          <code>JRadioButton</code>, <code>JCheckBoxMenuItem</code> and
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java
index ceaa943..c56f020 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java
@@ -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,7 +38,7 @@
  * arranged when the frame is resized.
  * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
  *    <TR>
- *      <TD ALIGN="CENTER">
+ *      <TD style="text-align:center">
  *         <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/BoxLayout-1.gif"
  *          alt="The following text describes this graphic."
  *          WIDTH="191" HEIGHT="201" STYLE="FLOAT:BOTTOM; BORDER:0">
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java
index 31bb7dd..3ac3755 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +40,7 @@
 /**
  * Renders an item in a list.
  * <p>
- * <strong><a name="override">Implementation Note:</a></strong>
+ * <strong><a id="override">Implementation Note:</a></strong>
  * This class overrides
  * <code>invalidate</code>,
  * <code>validate</code>,
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java
index 4e9884d..e832abb 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java
@@ -3735,7 +3735,7 @@
          * @since 1.3
          * @deprecated This class is no longer used or needed.
          * {@code java.awt.Component.AccessibleAWTComponent} provides
-         * the same functionality and it is handled in {@Component}.
+         * the same functionality and it is handled in {@code Component}.
          */
         @Deprecated
         protected class AccessibleFocusHandler implements FocusListener {
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
index 6de8a0b..1c1f56a 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
@@ -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
@@ -49,7 +49,7 @@
  *
  * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
  * <TR>
- *   <TD ALIGN="CENTER">
+ *   <TD style="text-align:center">
  *     <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JLayeredPane-1.gif"
  *     alt="The following text describes this image."
  *     WIDTH="269" HEIGHT="264" STYLE="FLOAT:BOTTOM; BORDER=0">
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JList.java b/jdk/src/java.desktop/share/classes/javax/swing/JList.java
index ca82020..0e7648c 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java
@@ -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
@@ -145,7 +145,7 @@
  * Responsibility for listening to selection changes in order to keep the list's
  * visual representation up to date lies with the list's {@code ListUI}.
  * <p>
- * <a name="renderer"></a>
+ * <a id="renderer"></a>
  * Painting of cells in a {@code JList} is handled by a delegate called a
  * cell renderer, installed on the list as the {@code cellRenderer} property.
  * The renderer provides a {@code java.awt.Component} that is used
@@ -201,7 +201,7 @@
  * To avoid these calculations, you can set a {@code fixedCellWidth} and
  * {@code fixedCellHeight} on the list, or have these values calculated
  * automatically based on a single prototype value:
- * <a name="prototype_example"></a>
+ * <a id="prototype_example"></a>
  * <pre>
  * {@code
  * JList<String> bigDataList = new JList<String>(bigData);
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
index a61f150..1fec8d2 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
@@ -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
@@ -143,7 +143,7 @@
  * in which case a default <code>Frame</code> is used as the parent,
  * and the dialog will be
  * centered on the screen (depending on the {@literal L&F}).
- * <dt><a name=message>message</a><dd>
+ * <dt><a id=message>message</a><dd>
  * A descriptive message to be placed in the dialog box.
  * In the most common usage, message is just a <code>String</code> or
  * <code>String</code> constant.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
index 3f72a8b..2a16d69 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
@@ -72,7 +72,7 @@
  * </blockquote>
  * <table style="float:right" border="0" summary="layout">
  * <tr>
- * <td align="center">
+ * <td style="text-align:center">
  * <img src="doc-files/JRootPane-2.gif"
  * alt="The following text describes this graphic." HEIGHT=386 WIDTH=349>
  * </td>
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java
index a51509b..04e99bc 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java
@@ -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
@@ -57,7 +57,7 @@
  *
  * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
  *    <TR>
- *    <TD ALIGN="CENTER">
+ *    <TD style="text-align:center">
  *      <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JScrollPane-1.gif"
  *      alt="The following text describes this image."
  *      WIDTH="256" HEIGHT="248" STYLE="FLOAT:BOTTOM; BORDER:0px">
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java
index 34f779a..0dfcaeb 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java
@@ -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
@@ -44,7 +44,7 @@
 import static sun.swing.SwingUtilities2.Section.*;
 
 /**
- * <a name="jtree_description"></a>
+ * <a id="jtree_description"></a>
  * A control that displays a set of hierarchical data as an outline.
  * You can find task-oriented documentation and examples of using trees in
  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>,
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java b/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java
index bd8ea83..0356def 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java
@@ -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
@@ -91,7 +91,7 @@
  * to provide a specific set of defaults. These are documented in the
  * classes that require the specific default.
  *
- * <h3><a name="defaultRecommendation">ComponentUIs and defaults</a></h3>
+ * <h3><a id="defaultRecommendation">ComponentUIs and defaults</a></h3>
  *
  * All {@code ComponentUIs} typically need to set various properties
  * on the {@code JComponent} the {@code ComponentUI} is providing the
@@ -121,7 +121,7 @@
  * provided by this class as they handle the necessary checking and install
  * the property using the recommended guidelines.
  *
- * <h3><a name="exceptions"></a>Exceptions</h3>
+ * <h3><a id="exceptions"></a>Exceptions</h3>
  *
  * All of the install methods provided by {@code LookAndFeel} need to
  * access the defaults if the value of the property being changed is
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java b/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java
index 131032d..24b4c84 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, 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
@@ -53,11 +53,10 @@
  * The following figure shows the relationship between size and position data
  * for a multi-column component.
  *
- * <center>
+ * <p style="text-align:center">
  * <img src="doc-files/SizeSequence-1.gif" width=384 height = 100
  * alt="The first item begins at position 0, the second at the position equal
  to the size of the previous item, and so on.">
- * </center>
  * <p>
  * In the figure, the first index (0) corresponds to the first column,
  * the second index (1) to the second column, and so on.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
index 05efd8f..42fc80b 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
@@ -1283,14 +1283,13 @@
      * text component (i.e. the root of the hierarchy) that
      * can be traversed to determine how the model is being
      * represented spatially.
-     * <p>
-     * <font style="color: red;"><b>NOTE:</b>The View hierarchy can
+     * <p style="color:red;">
+     * <b>NOTE:</b>The View hierarchy can
      * be traversed from the root view, and other things
      * can be done as well.  Things done in this way cannot
      * be protected like simple method calls through the TextUI.
      * Therefore, proper operation in the presence of concurrency
      * must be arranged by any logic that calls this method!
-     * </font>
      *
      * @param tc the text component for which this UI is installed
      * @return the view
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java
index dae37d5..0ded39c 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * All colors returned by {@code DefaultMetalTheme} are completely
  * opaque.
  *
- * <h3><a name="fontStyle"></a>Font Style</h3>
+ * <h3><a id="fontStyle"></a>Font Style</h3>
  *
  * {@code DefaultMetalTheme} uses bold fonts for many controls.  To make all
  * controls (with the exception of the internal frame title bars and
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
index 9320bd1..fed8e2b 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -292,85 +292,85 @@
      * added to {@code table}:
      * <table border="1" cellpadding="1" cellspacing="0"
      *         summary="Metal's system color mapping">
-     *  <tr valign="top"  align="left">
-     *    <th style="background-color:#CCCCFF" align="left">Key
-     *    <th style="background-color:#CCCCFF" align="left">Value
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
+     *    <th style="background-color:#CCCCFF;text-align:left">Key
+     *    <th style="background-color:#CCCCFF;text-align:left">Value
+     *  <tr valign="top" style="text-align:left">
      *    <td>"desktop"
      *    <td>{@code theme.getDesktopColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"activeCaption"
      *    <td>{@code theme.getWindowTitleBackground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"activeCaptionText"
      *    <td>{@code theme.getWindowTitleForeground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"activeCaptionBorder"
      *    <td>{@code theme.getPrimaryControlShadow()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"inactiveCaption"
      *    <td>{@code theme.getWindowTitleInactiveBackground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"inactiveCaptionText"
      *    <td>{@code theme.getWindowTitleInactiveForeground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"inactiveCaptionBorder"
      *    <td>{@code theme.getControlShadow()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"window"
      *    <td>{@code theme.getWindowBackground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"windowBorder"
      *    <td>{@code theme.getControl()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"windowText"
      *    <td>{@code theme.getUserTextColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"menu"
      *    <td>{@code theme.getMenuBackground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"menuText"
      *    <td>{@code theme.getMenuForeground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"text"
      *    <td>{@code theme.getWindowBackground()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"textText"
      *    <td>{@code theme.getUserTextColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"textHighlight"
      *    <td>{@code theme.getTextHighlightColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"textHighlightText"
      *    <td>{@code theme.getHighlightedTextColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"textInactiveText"
      *    <td>{@code theme.getInactiveSystemTextColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"control"
      *    <td>{@code theme.getControl()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"controlText"
      *    <td>{@code theme.getControlTextColor()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"controlHighlight"
      *    <td>{@code theme.getControlHighlight()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"controlLtHighlight"
      *    <td>{@code theme.getControlHighlight()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"controlShadow"
      *    <td>{@code theme.getControlShadow()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"controlDkShadow"
      *    <td>{@code theme.getControlDarkShadow()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"scrollbar"
      *    <td>{@code theme.getControl()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"info"
      *    <td>{@code theme.getPrimaryControl()}
-     *  <tr valign="top"  align="left">
+     *  <tr valign="top" style="text-align:left">
      *    <td>"infoText"
      *    <td>{@code theme.getPrimaryControlInfo()}
      * </table>
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java
index 0a7504d..541a4e7 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +41,7 @@
  * in a <code>JTable</code>.
  * <p>
  *
- * <strong><a name="override">Implementation Note:</a></strong>
+ * <strong><a id="override">Implementation Note:</a></strong>
  * This class inherits from <code>JLabel</code>, a standard component class.
  * However <code>JTable</code> employs a unique mechanism for rendering
  * its cells and therefore requires some slightly modified behavior
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
index d61d1f8..640ca1c 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -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
@@ -999,17 +999,17 @@
      * </pre>
      *
      * <p>Invoking <code>setInnerHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
-     * results in the following structure (new elements are <font
-     * style="color: red;">in red</font>).</p>
+     * results in the following structure (new elements are <span
+     * style="color: red;">in red</span>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *         \
-     *         <font style="color: red;">&lt;ul&gt;</font>
+     *         <span style="color: red;">&lt;ul&gt;</span>
      *           \
-     *           <font style="color: red;">&lt;li&gt;</font>
+     *           <span style="color: red;">&lt;li&gt;</span>
      * </pre>
      *
      * <p>Parameter <code>elem</code> must not be a leaf element,
@@ -1083,15 +1083,15 @@
      * </pre>
      *
      * <p>Invoking <code>setOuterHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
-     * results in the following structure (new elements are <font
-     * style="color: red;">in red</font>).</p>
+     * results in the following structure (new elements are <span
+     * style="color: red;">in red</span>).</p>
      *
      * <pre>
      *    &lt;body&gt;
      *      |
-     *     <font style="color: red;">&lt;ul&gt;</font>
+     *     <span style="color: red;">&lt;ul&gt;</span>
      *       \
-     *       <font style="color: red;">&lt;li&gt;</font>
+     *       <span style="color: red;">&lt;li&gt;</span>
      * </pre>
      *
      * <p>If either <code>elem</code> or <code>htmlText</code>
@@ -1157,16 +1157,16 @@
      *
      * <p>Invoking <code>insertAfterStart(elem,
      * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
-     * (new elements are <font style="color: red;">in red</font>).</p>
+     * (new elements are <span style="color: red;">in red</span>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *          |
      *        <b>&lt;div&gt;</b>
      *       /  |  \
-     *    <font style="color: red;">&lt;ul&gt;</font> &lt;p&gt; &lt;p&gt;
+     *    <span style="color: red;">&lt;ul&gt;</span> &lt;p&gt; &lt;p&gt;
      *     /
-     *  <font style="color: red;">&lt;li&gt;</font>
+     *  <span style="color: red;">&lt;li&gt;</span>
      * </pre>
      *
      * <p>Unlike the <code>insertBeforeStart</code> method, new
@@ -1229,17 +1229,17 @@
      * </pre>
      *
      * <p>Invoking <code>insertBeforeEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
-     * results in the following structure (new elements are <font
-     * style="color: red;">in red</font>).</p>
+     * results in the following structure (new elements are <span
+     * style="color: red;">in red</span>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *          |
      *        <b>&lt;div&gt;</b>
      *       /  |  \
-     *     &lt;p&gt; &lt;p&gt; <font style="color: red;">&lt;ul&gt;</font>
+     *     &lt;p&gt; &lt;p&gt; <span style="color: red;">&lt;ul&gt;</span>
      *               \
-     *               <font style="color: red;">&lt;li&gt;</font>
+     *               <span style="color: red;">&lt;li&gt;</span>
      * </pre>
      *
      * <p>Unlike the <code>insertAfterEnd</code> method, new elements
@@ -1300,14 +1300,14 @@
      *
      * <p>Invoking <code>insertBeforeStart(elem,
      * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
-     * (new elements are <font style="color: red;">in red</font>).</p>
+     * (new elements are <span style="color: red;">in red</span>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *         /  \
-     *      <font style="color: red;">&lt;ul&gt;</font> <b>&lt;div&gt;</b>
+     *      <span style="color: red;">&lt;ul&gt;</span> <b>&lt;div&gt;</b>
      *       /    /  \
-     *     <font style="color: red;">&lt;li&gt;</font> &lt;p&gt;  &lt;p&gt;
+     *     <span style="color: red;">&lt;li&gt;</span> &lt;p&gt;  &lt;p&gt;
      * </pre>
      *
      * <p>Unlike the <code>insertAfterStart</code> method, new
@@ -1360,15 +1360,15 @@
      * </pre>
      *
      * <p>Invoking <code>insertAfterEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
-     * results in the following structure (new elements are <font
-     * style="color: red;">in red</font>).</p>
+     * results in the following structure (new elements are <span
+     * style="color: red;">in red</span>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *         /  \
-     *      <b>&lt;div&gt;</b> <font style="color: red;">&lt;ul&gt;</font>
+     *      <b>&lt;div&gt;</b> <span style="color: red;">&lt;ul&gt;</span>
      *       / \    \
-     *     &lt;p&gt; &lt;p&gt;  <font style="color: red;">&lt;li&gt;</font>
+     *     &lt;p&gt; &lt;p&gt;  <span style="color: red;">&lt;li&gt;</span>
      * </pre>
      *
      * <p>Unlike the <code>insertBeforeEnd</code> method, new elements
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
index d5d995e..7117fdd 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
@@ -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
@@ -1120,7 +1120,7 @@
      *
      * <table summary="Describes the tag and view created by this factory by default">
      * <tr>
-     * <th align=left>Tag<th align=left>View created
+     * <th style="text-align:left">Tag<th style="text-align:left">View created
      * </tr><tr>
      * <td>HTML.Tag.CONTENT<td>InlineView
      * </tr><tr>
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
index c7cdfc3..1b60034 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -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
@@ -61,9 +61,9 @@
  * defaults table. The following table lists the mapping between
  * {@code DefaultTreeCellRenderer} property and defaults table key:
  * <table border="1" cellpadding="1" cellspacing="0" summary="">
- *   <tr valign="top"  align="left">
- *     <th style="background-color:#CCCCFF" align="left">Property:
- *     <th style="background-color:#CCCCFF" align="left">Key:
+ *   <tr valign="top" style="text-align:left">
+ *     <th style="background-color:#CCCCFF;text-align:left">Property:
+ *     <th style="background-color:#CCCCFF;text-align:left">Key:
  *   <tr><td>"leafIcon"<td>"Tree.leafIcon"
  *   <tr><td>"closedIcon"<td>"Tree.closedIcon"
  *   <tr><td>"openIcon"<td>"Tree.openIcon"
@@ -74,7 +74,7 @@
  *   <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
  * </table>
  * <p>
- * <strong><a name="override">Implementation Note:</a></strong>
+ * <strong><a id="override">Implementation Note:</a></strong>
  * This class overrides
  * <code>invalidate</code>,
  * <code>validate</code>,
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java
index cb85826..55fa622 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java
@@ -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
@@ -57,11 +57,11 @@
  * upper-case letter in bold are significant, those in lower-case
  * and italicized are insignificant.
  * <p>
- * <a name="figure1"></a>
+ * <a id="figure1"></a>
  * <table border=0 summary="">
  * <tr><td>
  *     <img src="doc-files/UndoManager-1.gif" alt="">
- * <tr><td align=center>Figure 1
+ * <tr><td style="text-align:center">Figure 1
  * </table>
  * <p>
  * As shown in <a href="#figure1">figure 1</a>, if <b>D</b> was just added, the
@@ -70,11 +70,11 @@
  * index of the next edit to 3 (edit <i>c</i>), as shown in the following
  * figure.
  * <p>
- * <a name="figure2"></a>
+ * <a id="figure2"></a>
  * <table border=0 summary="">
  * <tr><td>
  *     <img src="doc-files/UndoManager-2.gif" alt="">
- * <tr><td align=center>Figure 2
+ * <tr><td style="text-align:center">Figure 2
  * </table>
  * <p>
  * The last significant edit is <b>A</b>, so that invoking
@@ -82,11 +82,11 @@
  * <i>b</i>, and <b>A</b>, in that order, setting the index of the
  * next edit to 0, as shown in the following figure.
  * <p>
- * <a name="figure3"></a>
+ * <a id="figure3"></a>
  * <table border=0 summary="">
  * <tr><td>
  *     <img src="doc-files/UndoManager-3.gif" alt="">
- * <tr><td align=center>Figure 3
+ * <tr><td style="text-align:center">Figure 3
  * </table>
  * <p>
  * Invoking <code>redo</code> results in invoking <code>redo</code> on
@@ -108,11 +108,11 @@
  * the new edit is added after <i>c</i>, as shown in the following
  * figure.
  * <p>
- * <a name="figure4"></a>
+ * <a id="figure4"></a>
  * <table border=0 summary="">
  * <tr><td>
  *     <img src="doc-files/UndoManager-4.gif" alt="">
- * <tr><td align=center>Figure 4
+ * <tr><td style="text-align:center">Figure 4
  * </table>
  * <p>
  * Once <code>end</code> has been invoked on an <code>UndoManager</code>
diff --git a/jdk/src/java.desktop/share/classes/module-info.java b/jdk/src/java.desktop/share/classes/module-info.java
index 29d24e6..658becc 100644
--- a/jdk/src/java.desktop/share/classes/module-info.java
+++ b/jdk/src/java.desktop/share/classes/module-info.java
@@ -114,10 +114,17 @@
     uses javax.sound.sampled.spi.FormatConversionProvider;
     uses javax.sound.sampled.spi.MixerProvider;
 
-    provides sun.datatransfer.DesktopDatatransferService with sun.awt.datatransfer.DesktopDatatransferServiceImpl;
-    provides java.net.ContentHandlerFactory with sun.awt.www.content.MultimediaContentHandlers;
-    provides javax.print.PrintServiceLookup with sun.print.PrintServiceLookupProvider;
-    provides javax.print.StreamPrintServiceFactory with sun.print.PSStreamPrinterFactory;
+    provides sun.datatransfer.DesktopDatatransferService with
+        sun.awt.datatransfer.DesktopDatatransferServiceImpl;
+
+    provides java.net.ContentHandlerFactory with
+        sun.awt.www.content.MultimediaContentHandlers;
+
+    provides javax.print.PrintServiceLookup with
+        sun.print.PrintServiceLookupProvider;
+
+    provides javax.print.StreamPrintServiceFactory with
+        sun.print.PSStreamPrinterFactory;
 
     provides javax.sound.midi.spi.MidiDeviceProvider with
         com.sun.media.sound.MidiInDeviceProvider,
@@ -125,14 +132,17 @@
         com.sun.media.sound.RealTimeSequencerProvider,
         com.sun.media.sound.SoftProvider;
 
-    provides javax.sound.midi.spi.MidiFileReader with com.sun.media.sound.StandardMidiFileReader;
-    provides javax.sound.midi.spi.MidiFileWriter with com.sun.media.sound.StandardMidiFileWriter;
+    provides javax.sound.midi.spi.MidiFileReader with
+        com.sun.media.sound.StandardMidiFileReader;
+
+    provides javax.sound.midi.spi.MidiFileWriter with
+        com.sun.media.sound.StandardMidiFileWriter;
 
     provides javax.sound.midi.spi.SoundbankReader with
-         com.sun.media.sound.AudioFileSoundbankReader,
-         com.sun.media.sound.DLSSoundbankReader,
-         com.sun.media.sound.JARSoundbankReader,
-         com.sun.media.sound.SF2SoundbankReader;
+        com.sun.media.sound.AudioFileSoundbankReader,
+        com.sun.media.sound.DLSSoundbankReader,
+        com.sun.media.sound.JARSoundbankReader,
+        com.sun.media.sound.SF2SoundbankReader;
 
     provides javax.sound.sampled.spi.AudioFileReader with
         com.sun.media.sound.AiffFileReader,
@@ -158,4 +168,3 @@
         com.sun.media.sound.DirectAudioDeviceProvider,
         com.sun.media.sound.PortMixerProvider;
 }
-
diff --git a/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java b/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java
index a18d056..169332a 100644
--- a/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java
+++ b/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/src/java.desktop/share/native/include/jawt.h b/jdk/src/java.desktop/share/native/include/jawt.h
index 8cb2cb8..2079b0b 100644
--- a/jdk/src/java.desktop/share/native/include/jawt.h
+++ b/jdk/src/java.desktop/share/native/include/jawt.h
@@ -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,18 +38,22 @@
  * The AWT native interface allows a native C or C++ application a means
  * by which to access native structures in AWT.  This is to facilitate moving
  * legacy C and C++ applications to Java and to target the needs of the
- * community who, at present, wish to do their own native rendering to canvases
- * for performance reasons.  Standard extensions such as Java3D also require a
- * means to access the underlying native data structures of AWT.
+ * developers who need to do their own native rendering to canvases
+ * for performance or other reasons.
  *
- * There may be future extensions to this API depending on demand.
+ * Conversely it also provides mechanisms for an application which already
+ * has a native window to provide that to AWT for AWT rendering.
  *
- * A VM does not have to implement this API in order to pass the JCK.
- * It is recommended, however, that this API is implemented on VMs that support
- * standard extensions, such as Java3D.
+ * Since every platform may be different in its native data structures
+ * and APIs for windowing systems the application must necessarily
+ * provided per-platform source and compile and deliver per-platform
+ * native code  to use this API.
  *
- * Since this is a native API, any program which uses it cannot be considered
- * 100% pure java.
+ * These interfaces are not part of the Java SE specification and
+ * a VM is not required to implement this API. However it is strongly
+ * recommended that all implementations which support headful AWT
+ * also support these interfaces.
+ *
  */
 
 /*
@@ -58,7 +62,7 @@
  * For each platform, there is a native drawing surface structure.  This
  * platform-specific structure can be found in jawt_md.h.  It is recommended
  * that additional platforms follow the same model.  It is also recommended
- * that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
+ * that VMs on all platforms support the existing structures in jawt_md.h.
  *
  *******************
  * EXAMPLE OF USAGE:
@@ -98,8 +102,8 @@
  *     jboolean result;
  *     jint lock;
  *
- *     // Get the AWT
- *     awt.version = JAWT_VERSION_1_3;
+ *     // Get the AWT. Request version 9 to access features in that release.
+ *     awt.version = JAWT_VERSION_9;
  *     result = JAWT_GetAWT(env, &awt);
  *     assert(result != JNI_FALSE);
  *
@@ -154,7 +158,7 @@
     /*
      * Pointer to the platform-specific information.  This can be safely
      * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
-     * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
+     * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On Mac OS X this is a
      * pointer to a NSObject that conforms to the JAWT_SurfaceLayers
      * protocol. See jawt_md.h for details.
      */
@@ -237,7 +241,8 @@
 typedef struct jawt {
     /*
      * Version of this structure.  This must always be set before
-     * calling JAWT_GetAWT()
+     * calling JAWT_GetAWT(). It affects the functions returned.
+     * Must be one of the known pre-defined versions.
      */
     jint version;
     /*
@@ -332,6 +337,13 @@
 _JNI_IMPORT_OR_EXPORT_
 jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
 
+/*
+ * Specify one of these constants as the JAWT.version
+ * Specifying an earlier version will limit the available functions to
+ * those provided in that earlier version of JAWT.
+ * See the "Since" note on each API. Methods with no "Since"
+ * may be presumed to be present in JAWT_VERSION_1_3.
+ */
 #define JAWT_VERSION_1_3 0x00010003
 #define JAWT_VERSION_1_4 0x00010004
 #define JAWT_VERSION_1_7 0x00010007
diff --git a/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html b/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html
new file mode 100644
index 0000000..7823760
--- /dev/null
+++ b/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html
@@ -0,0 +1,776 @@
+<!--
+ 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
+ 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.
+-->
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
+"en-US">
+<head>
+<title>Java AWT Native Interface Specification and Guide</title>
+</head>
+<body>
+<h2>The Java AWT Native Interface Specification and Guide</h2>
+<h3>Introduction</h3>
+<p>The Java AWT Native Interface (JAWT) comprises a small set of native
+(eg C language-based) APIs that provide a standard supported way
+for interaction between Java API windows and surfaces, and
+platform native API windows and surfaces.
+Non-Java libraries may then render to a Java owned window.
+<p>
+Note: in this document the terms "Java AWT Native Interface",
+"AWT Native Interface" and "JAWT" are interchangeable and
+refer to this same specification.
+<p>
+The fundamental obstacle to native rendering without JAWT is that
+is that the rendering code cannot identify where to draw.
+The native code needs access to information about a Java
+drawing surface (such as a handle to the underlying native ID of a
+<tt>Canvas</tt>), but cannot get it.</p>
+Without that information (ie without JAWT) an application could
+use native rendering only by creating its own top-level window
+not shared at all with Java. This is unacceptable for most uses.
+Except for usage via JAWT, this is considered to be entirely
+internal to the Java platform implementation: private, unsupported
+and undocumented.
+<p>
+JAWT should be supported in all headful implementations
+where technically possible although this is not enforced by the JCK.
+There is a platform-specific and a platform
+independent portion to the API, to account for the differing
+data structures and requirements of each platform.
+This document specifies the platform independent portions and
+also documents the platform dependent portions for the Oracle JDK
+supported desktop operating environments.
+For AWT the term platform is less tied to the underlying operating
+system than it is to the desktop windowing environment.
+<p>
+Reasons for using the AWT Native Interface include
+<ul>
+<li>Use of a 3rd party native library not available in Java
+<li>A temporary porting aid before converting legacy code to Java
+<li>Rendering performance available only to native hardware accelerated APIs
+<li>Interoperation with another toolkit
+</ul>
+<p>
+Drawbacks include
+<ul>
+<li>A more complex application implementation, eg for painting
+<li>Potential for application instability if the native library does
+not interoperate properly with AWT.
+<li>Increased application delivery complexity - per platform binaries
+</ul>
+The header file <a href="#jawt.h"> "jawt.h"</a>
+in the Appendix fully specifies the APIs provided by JAWT.
+<p>
+An example illustrating how easy it is to use the AWT Native Interface
+is presented and discussed later in this document.</p>
+
+<p><b>JAWT usage depends on JNI</b></p>
+<p>The definition of Java Standard Edition includes JNI, the Java
+Native Interface. Many Java developers will never need to use it,
+but the interface is the only standard supported way for a Java
+language program to interact directly with
+application code that has been compiled to the native machine
+instructions for the host processor architecture.
+JNI is used where ever there is a need for mixed languages.
+These are by no means limited to cases like AWT. For example, you
+could use JNI to integrate with native code that communicates with
+a peripheral device, such as a scanner, connected to a system via a
+USB port.</p>
+<p>So JNI is general enough to be used to access almost any
+sort of native library.
+The rest of this document assumes a familiarity with how
+to use JNI.
+
+<p><b>How to use JAWT </b></p>
+<p>In this section we describe the most common usage of the AWT
+Native Interface &mdash; overriding the <tt>paint</tt> method to
+direct drawing operations to a native rendering library which then
+queries the Java VM to determine the information it needs in order
+to render. Note, however, that any native code may use the AWT
+Native Interface to learn about a target drawing surface, not just
+code in a <tt>paint</tt> method.</p>
+<p>The first step in hooking up a native rendering library to a
+Java <tt>Canvas</tt> is to define a new class that extends
+<tt>Canvas</tt> and overrides the <tt>paint</tt> method. The Java
+system routes all drawing operations for a <tt>Canvas</tt> object
+through the <tt>paint</tt> method, as it does for all other GUI
+objects. Canvas is a good candidate for the rendering surface as
+it does not have any content as a Button would.</p>
+<p>The new <tt>paint</tt> method, to be implemented in the native
+rendering library, must be declared as <tt>public native void</tt>
+, and the native library itself is loaded at runtime by including a
+call to <tt>System.loadLibrary( &quot;myRenderingLib&quot;)</tt>in
+the <tt>static</tt> block of the class. The <tt>myRenderingLib</tt>
+name is used for the native shared library; for Linux or the Solaris
+operating environment, the actual name for the library file on disk
+is <tt>libmyRenderingLib.so</tt> .</p>
+<p>Here is a simple example of such a class:</p>
+<pre>
+import java.awt.*;
+import java.awt.event.*;
+
+public class MyCanvas extends Canvas {
+    static {
+        System.loadLibrary("myRenderingLib");
+    }
+    public native void paint(Graphics g);
+
+    public static void main(String[] args) {
+        Frame f = new Frame();
+        f.setBounds(0, 0, 500, 110);
+        f.add(new MyCanvas());
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent ev) {
+                System.exit(0);
+            }
+        } );
+        f.show();
+    }
+}
+<br />
+</pre>
+<p>Note that this class has a <tt>main</tt> method that can be used
+to run this code as an application for testing purposes.</p>
+<p>The next step is to run the <tt>javah</tt> tool on the
+<tt>MyCanvas</tt> class file above to generate a C/C++ header file
+that describes the interface to the native <tt>paint</tt> method
+that Java expects to be used. <tt>javah</tt> is a standard tool
+included with the JDK. NB: <tt>javac -h outputdir</tt> may also be used.</p>
+
+<p>The final step &#173; and the most interesting one &#173; is to
+write the native rendering method, with an interface that conforms
+to the header file that <tt>javah</tt> generated, and build it as a
+standard shared library (called <tt>myRenderingLib</tt> in the
+above example) by linking it, against the appropriate JDK provided
+$JDK_HOME/lib/$JAWT_LIB library for the target platform.
+Where JAWT_LIB has the base name "jawt" and follows platform
+shared object naming rules. i.e.:
+<ul>
+<li>Windows: jawt.dll
+<li>MacOS: libjawt.dylib
+<li>Linux: libjawt.so
+<li>Solaris: libjawt.so
+</ul>
+
+This code will call back to the Java virtual machine to
+get the drawing surface information it needs to access the
+<tt>MyCanvas</tt> peer. Once this information is available, the
+code can draw directly to <tt>MyCanvas</tt> using standard drawing
+routines supplied by the underlying operating system.</p>
+<p>Here is sample source code for a native <tt>paint</tt> method
+designed for use in a X11-based drawing environment (Linux
+or Solaris) and a Java VM where the AWT Native Interface is present:</p>
+<pre>
+#include "MyCanvas.h"
+#include "jawt_md.h"
+
+/*
+ * Class:     MyCanvas
+ * Method:    paint
+ * Signature: (Ljava/awt/Graphics;)V
+ */
+JNIEXPORT void JNICALL Java_MyCanvas_paint
+(JNIEnv* env, jobject canvas, jobject graphics)
+{
+    JAWT awt;
+    JAWT_DrawingSurface* ds;
+    JAWT_DrawingSurfaceInfo* dsi;
+    JAWT_X11DrawingSurfaceInfo* dsi_x11;
+    jboolean result;
+    jint lock;
+    GC gc;
+
+    short       i;
+    char        *testString = "^^^ rendered from native code ^^^";
+
+    /* Get the AWT */
+    awt.version = JAWT_VERSION_9;
+    if (JAWT_GetAWT(env, &amp;awt) == JNI_FALSE) {
+        printf("AWT Not found\n");
+        return;
+    }
+
+    /* Get the drawing surface */
+    ds = awt.GetDrawingSurface(env, canvas);
+    if (ds == NULL) {
+        printf("NULL drawing surface\n");
+        return;
+    }
+
+    /* Lock the drawing surface */
+    lock = ds-&gt;Lock(ds);
+    if((lock &amp; JAWT_LOCK_ERROR) != 0) {
+        printf("Error locking surface\n");
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    /* Get the drawing surface info */
+    dsi = ds-&gt;GetDrawingSurfaceInfo(ds);
+    if (dsi == NULL) {
+        printf("Error getting surface info\n");
+        ds-&gt;Unlock(ds);
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    /* Get the platform-specific drawing info */
+    dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi-&gt;platformInfo;
+
+
+    /* Now paint */
+    gc = XCreateGC(dsi_x11-&gt;display, dsi_x11-&gt;drawable, 0, 0);
+    XSetBackground(dsi_x11-&gt;display, gc, 0);
+    for (i=0; i&lt;36;i++)
+    {
+        XSetForeground(dsi_x11-&gt;display, gc, 10*i);
+        XFillRectangle(dsi_x11-&gt;display, dsi_x11-&gt;drawable, gc,
+                        10*i, 5, 90, 90);
+    }
+    XSetForeground(dsi_x11-&gt;display, gc, 155);
+    XDrawImageString(dsi_x11-&gt;display, dsi_x11-&gt;drawable, gc,
+                        100, 110, testString, strlen(testString));
+    XFreeGC(dsi_x11-&gt;display, gc);
+
+
+    /* Free the drawing surface info */
+    ds-&gt;FreeDrawingSurfaceInfo(dsi);
+
+    /* Unlock the drawing surface */
+    ds-&gt;Unlock(ds);
+
+    /* Free the drawing surface */
+    awt.FreeDrawingSurface(ds);
+}
+</pre>
+<p>The key data structure here is <tt>JAWT</tt> , which is defined
+in <tt>jawt.h</tt> (included by <tt>jawt_md.h)</tt> ; it provides
+access to all the information the native code needs to get the job
+done. The first part of the native method is boilerplate: it
+populates the <tt>JAWT</tt> structure, gets a
+<tt>JAWT_DrawingSurface</tt> structure, locks the surface (only one
+drawing engine at a time, please!), then gets a
+<tt>JAWT_DrawingSurfaceInfo</tt> structure that contains a pointer
+(in the <tt>platformInfo</tt> field) to the necessary
+platform-specific drawing information. It also includes the
+bounding rectangle of the drawing surface and the current clipping
+region.</p>
+<p>The structure of the information pointed to by
+<tt>platformInfo</tt> is defined in a machine-dependent header file
+called <tt>jawt_md.h</tt>. For X11 drawing, it includes
+information about the X11 display and X11 drawable associated with
+<tt>MyCanvas</tt>. After the drawing operations are completed,
+there is more boilerplate code as <tt>JAWT_DrawingSurfaceInfo</tt>
+is freed and <tt>JAWT_DrawingSurface</tt> is unlocked and
+freed.</p>
+<p>The corresponding code for the GDI API on the Microsoft Windows platform would
+be structured similarly, but would include the version of
+<tt>jawt_md.h</tt> for Microsoft Windows and the structure located
+in the <tt>platformInfo</tt> field of drawing surface info would be
+cast as a <tt>JAWT_Win32DrawingSurfaceInfo*</tt> . And, of course,
+the actual drawing operations would need to be changed to those
+appropriate for the Microsoft Windows platform.
+The same also for MacOS.
+</p>
+<p><b>Summary</b></p>
+<p>The ability to draw directly into a Java <tt>Canvas</tt> from a
+native code library is extremely useful for developers planning to
+migrate a legacy software system to Java, especially one that
+includes a high-performance rendering engine. It makes it much
+easier to migrate in stages, leaving performance-sensitive
+rendering code alone, while other less-sensitive portions of code
+are converted to Java. The result can be a modern Java-centric
+application, providing the benefit of portability and development
+efficiency, but one that does not sacrifice an investment in
+performance of a key piece of native code.</p>
+<p><b>References</b></p>
+<p>The definitive reference to the Java Native Interface is <i>The
+Java Native Interface: Programmer's Guide and Specification</i> by
+Sheng Liang. This book was published in June
+1999 by Addison-Wesley. The ISBN is 0-201-32577-2.</p>
+<p><b>Appendix</b></p>
+<p><b>Header Files for jawt.h and jawt_md.h</b></p>
+<a name="jawt.h"></a>
+<p>jawt.h</p>
+<pre>
+#ifndef _JAVASOFT_JAWT_H_
+#define _JAVASOFT_JAWT_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AWT native interface.
+ *
+ * The AWT native interface allows a native C or C++ application a means
+ * by which to access native structures in AWT.  This is to facilitate moving
+ * legacy C and C++ applications to Java and to target the needs of the
+ * developers who need to do their own native rendering to canvases
+ * for performance or other reasons.
+ *
+ * Conversely it also provides mechanisms for an application which already
+ * has a native window to provide that to AWT for AWT rendering.
+ *
+ * Since every platform may be different in its native data structures
+ * and APIs for windowing systems the application must necessarily
+ * provided per-platform source and compile and deliver per-platform
+ * native code  to use this API.
+ *
+ * These interfaces are not part of the Java SE specification and
+ * a VM is not required to implement this API. However it is strongly
+ * recommended that all implementations which support headful AWT
+ * also support these interfaces.
+ *
+ */
+
+/*
+ * AWT Native Drawing Surface (JAWT_DrawingSurface).
+ *
+ * For each platform, there is a native drawing surface structure.  This
+ * platform-specific structure can be found in jawt_md.h.  It is recommended
+ * that additional platforms follow the same model.  It is also recommended
+ * that VMs on all platforms support the existing structures in jawt_md.h.
+ *
+ *******************
+ * EXAMPLE OF USAGE:
+ *******************
+ *
+ * On Microsoft Windows, a programmer wishes to access the HWND of a canvas
+ * to perform native rendering into it.  The programmer has declared the
+ * paint() method for their canvas subclass to be native:
+ *
+ *
+ * MyCanvas.java:
+ *
+ * import java.awt.*;
+ *
+ * public class MyCanvas extends Canvas {
+ *
+ *     static {
+ *         System.loadLibrary("mylib");
+ *     }
+ *
+ *     public native void paint(Graphics g);
+ * }
+ *
+ *
+ * myfile.c:
+ *
+ * #include "jawt_md.h"
+ * #include &lt;assert.h&gt;
+ *
+ * JNIEXPORT void JNICALL
+ * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
+ * {
+ *     JAWT awt;
+ *     JAWT_DrawingSurface* ds;
+ *     JAWT_DrawingSurfaceInfo* dsi;
+ *     JAWT_Win32DrawingSurfaceInfo* dsi_win;
+ *     jboolean result;
+ *     jint lock;
+ *
+ *     // Get the AWT. Request version 9 to access features in that release.
+ *     awt.version = JAWT_VERSION_9;
+ *     result = JAWT_GetAWT(env, &amp;awt);
+ *     assert(result != JNI_FALSE);
+ *
+ *     // Get the drawing surface
+ *     ds = awt.GetDrawingSurface(env, canvas);
+ *     assert(ds != NULL);
+ *
+ *     // Lock the drawing surface
+ *     lock = ds-&gt;Lock(ds);
+ *     assert((lock &amp; JAWT_LOCK_ERROR) == 0);
+ *
+ *     // Get the drawing surface info
+ *     dsi = ds-&gt;GetDrawingSurfaceInfo(ds);
+ *
+ *     // Get the platform-specific drawing info
+ *     dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi-&gt;platformInfo;
+ *
+ *     //////////////////////////////
+ *     // !!! DO PAINTING HERE !!! //
+ *     //////////////////////////////
+ *
+ *     // Free the drawing surface info
+ *     ds-&gt;FreeDrawingSurfaceInfo(dsi);
+ *
+ *     // Unlock the drawing surface
+ *     ds-&gt;Unlock(ds);
+ *
+ *     // Free the drawing surface
+ *     awt.FreeDrawingSurface(ds);
+ * }
+ *
+ */
+
+/*
+ * JAWT_Rectangle
+ * Structure for a native rectangle.
+ */
+typedef struct jawt_Rectangle {
+    jint x;
+    jint y;
+    jint width;
+    jint height;
+} JAWT_Rectangle;
+
+struct jawt_DrawingSurface;
+
+/*
+ * JAWT_DrawingSurfaceInfo
+ * Structure for containing the underlying drawing information of a component.
+ */
+typedef struct jawt_DrawingSurfaceInfo {
+    /*
+     * Pointer to the platform-specific information.  This can be safely
+     * cast to a JAWT_Win32DrawingSurfaceInfo on Microsoft Windows or a
+     * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On MacOS this is a
+     * pointer to a NSObject that conforms to the JAWT_SurfaceLayers protocol.
+     * See jawt_md.h for details.
+     */
+    void* platformInfo;
+    /* Cached pointer to the underlying drawing surface */
+    struct jawt_DrawingSurface* ds;
+    /* Bounding rectangle of the drawing surface */
+    JAWT_Rectangle bounds;
+    /* Number of rectangles in the clip */
+    jint clipSize;
+    /* Clip rectangle array */
+    JAWT_Rectangle* clip;
+} JAWT_DrawingSurfaceInfo;
+
+#define JAWT_LOCK_ERROR                 0x00000001
+#define JAWT_LOCK_CLIP_CHANGED          0x00000002
+#define JAWT_LOCK_BOUNDS_CHANGED        0x00000004
+#define JAWT_LOCK_SURFACE_CHANGED       0x00000008
+
+/*
+ * JAWT_DrawingSurface
+ * Structure for containing the underlying drawing information of a component.
+ * All operations on a JAWT_DrawingSurface MUST be performed from the same
+ * thread as the call to GetDrawingSurface.
+ */
+typedef struct jawt_DrawingSurface {
+    /* Cached reference to the Java environment of the calling thread.
+     * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
+     * FreeDrawingSurfaceInfo() are called from a different thread,
+     * this data member should be set before calling those functions.
+     */
+    JNIEnv* env;
+    /* Cached reference to the target object */
+    jobject target;
+    /*
+     * Lock the surface of the target component for native rendering.
+     * When finished drawing, the surface must be unlocked with
+     * Unlock().  This function returns a bitmask with one or more of the
+     * following values:
+     *
+     * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
+     * be locked.
+     *
+     * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
+     *
+     * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
+     *
+     * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
+     */
+    jint (JNICALL *Lock)
+        (struct jawt_DrawingSurface* ds);
+    /*
+     * Get the drawing surface info.
+     * The value returned may be cached, but the values may change if
+     * additional calls to Lock() or Unlock() are made.
+     * Lock() must be called before this can return a valid value.
+     * Returns NULL if an error has occurred.
+     * When finished with the returned value, FreeDrawingSurfaceInfo must be
+     * called.
+     */
+    JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
+        (struct jawt_DrawingSurface* ds);
+    /*
+     * Free the drawing surface info.
+     */
+    void (JNICALL *FreeDrawingSurfaceInfo)
+        (JAWT_DrawingSurfaceInfo* dsi);
+    /*
+     * Unlock the drawing surface of the target component for native rendering.
+     */
+    void (JNICALL *Unlock)
+        (struct jawt_DrawingSurface* ds);
+} JAWT_DrawingSurface;
+
+/*
+ * JAWT
+ * Structure for containing native AWT functions.
+ */
+typedef struct jawt {
+    /*
+     * Version of this structure.  This must always be set before
+     * calling JAWT_GetAWT(). It affects the functions returned.
+     * Must be one of the known pre-defined versions.
+     */
+    jint version;
+    /*
+     * Return a drawing surface from a target jobject.  This value
+     * may be cached.
+     * Returns NULL if an error has occurred.
+     * Target must be a java.awt.Component (should be a Canvas
+     * or Window for native rendering).
+     * FreeDrawingSurface() must be called when finished with the
+     * returned JAWT_DrawingSurface.
+     */
+    JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
+        (JNIEnv* env, jobject target);
+    /*
+     * Free the drawing surface allocated in GetDrawingSurface.
+     */
+    void (JNICALL *FreeDrawingSurface)
+        (JAWT_DrawingSurface* ds);
+    /*
+     * Since 1.4
+     * Locks the entire AWT for synchronization purposes
+     */
+    void (JNICALL *Lock)(JNIEnv* env);
+    /*
+     * Since 1.4
+     * Unlocks the entire AWT for synchronization purposes
+     */
+    void (JNICALL *Unlock)(JNIEnv* env);
+    /*
+     * Since 1.4
+     * Returns a reference to a java.awt.Component from a native
+     * platform handle.  On Windows, this corresponds to an HWND;
+     * on Solaris and Linux, this is a Drawable.  For other platforms,
+     * see the appropriate machine-dependent header file for a description.
+     * The reference returned by this function is a local
+     * reference that is only valid in this environment.
+     * This function returns a NULL reference if no component could be
+     * found with matching platform information.
+     */
+    jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
+
+    /**
+     * Since 9
+     * Creates a java.awt.Frame placed in a native container. Container is
+     * referenced by the native platform handle. For example on Windows this
+     * corresponds to an HWND. For other platforms, see the appropriate
+     * machine-dependent header file for a description. The reference returned
+     * by this function is a local reference that is only valid in this
+     * environment. This function returns a NULL reference if no frame could be
+     * created with matching platform information.
+     */
+    jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo);
+
+    /**
+     * Since 9
+     * Moves and resizes the embedded frame. The new location of the top-left
+     * corner is specified by x and y parameters relative to the native parent
+     * component. The new size is specified by width and height.
+     *
+     * The embedded frame should be created by CreateEmbeddedFrame() method, or
+     * this function will not have any effect.
+     *
+     * java.awt.Component.setLocation() and java.awt.Component.setBounds() for
+     * EmbeddedFrame really don't move it within the native parent. These
+     * methods always locate the embedded frame at (0, 0) for backward
+     * compatibility. To allow moving embedded frames this method was
+     * introduced, and it works just the same way as setLocation() and
+     * setBounds() for usual, non-embedded components.
+     *
+     * Using usual get/setLocation() and get/setBounds() together with this new
+     * method is not recommended.
+     */
+    void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame,
+            jint x, jint y, jint w, jint h);
+    /**
+     * Since 9
+     * Synthesize a native message to activate or deactivate an EmbeddedFrame
+     * window depending on the value of parameter doActivate, if "true"
+     * activates the window; otherwise, deactivates the window.
+     *
+     * The embedded frame should be created by CreateEmbeddedFrame() method, or
+     * this function will not have any effect.
+     */
+    void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env,
+            jobject embeddedFrame, jboolean doActivate);
+} JAWT;
+
+/*
+ * Get the AWT native structure.  This function returns JNI_FALSE if
+ * an error occurs.
+ */
+_JNI_IMPORT_OR_EXPORT_
+jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
+
+/*
+ * Specify one of these constants as the JAWT.version
+ * Specifying an earlier version will limit the available functions to
+ * those provided in that earlier version of JAWT.
+ * See the "Since" note on each API. Methods with no "Since"
+ * may be presumed to be present in JAWT_VERSION_1_3.
+ */
+#define JAWT_VERSION_1_3 0x00010003
+#define JAWT_VERSION_1_4 0x00010004
+#define JAWT_VERSION_1_7 0x00010007
+#define JAWT_VERSION_9 0x00090000
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !_JAVASOFT_JAWT_H_ */
+
+</pre>
+<p>jawt_md.h (Linux/Solaris/X11 operating environment version)</p>
+<pre>
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include &lt;X11/Xlib.h&gt;
+#include &lt;X11/Xutil.h&gt;
+#include &lt;X11/Intrinsic.h&gt;
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * X11-specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+typedef struct jawt_X11DrawingSurfaceInfo {
+    Drawable drawable;
+    Display* display;
+    VisualID visualID;
+    Colormap colormapID;
+    int depth;
+} JAWT_X11DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+</pre>
+<p>jawt_md.h (Microsoft Windows version)</p>
+<pre>
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include &lt;windows.h&gt;
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Microsoft Windows specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+typedef struct jawt_Win32DrawingSurfaceInfo {
+    /* Native window, DDB, or DIB handle */
+    union {
+        HWND hwnd;
+        HBITMAP hbitmap;
+        void* pbits;
+    };
+    /*
+     * This HDC should always be used instead of the HDC returned from
+     * BeginPaint() or any calls to GetDC().
+     */
+    HDC hdc;
+    HPALETTE hpalette;
+} JAWT_Win32DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+</pre>
+<p>jawt_md.h (MacOS version)</p>
+<pre>
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include "jawt.h"
+
+#ifdef __OBJC__
+#import <QuartzCore/CALayer.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * MacOS specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+
+/*
+ * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
+ * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
+ * return false. This is to maintain compatibility with applications that used the
+ * interface with Java 6 which had multiple rendering models. This flag is not necessary
+ * when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
+ *
+ * Example:
+ *   JAWT awt;
+ *   awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
+ *   jboolean success = JAWT_GetAWT(env, &awt);
+ */
+#define JAWT_MACOSX_USE_CALAYER 0x80000000
+
+/*
+ * When the native Cocoa toolkit is in use, the pointer stored in
+ * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
+ * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
+ * specified layer to be overlaid on the Components rectangle. If the window the
+ * Component belongs to has a CALayer attached to it, this layer will be accessible via
+ * the windowLayer property.
+ */
+#ifdef __OBJC__
+@protocol JAWT_SurfaceLayers
+@property (readwrite, retain) CALayer *layer;
+@property (readonly) CALayer *windowLayer;
+@end
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+</pre>
+<!-- Body text ends here -->
+</body>
+</html>
diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java
index 74444b8..c430ac4 100644
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java
@@ -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
@@ -139,6 +139,12 @@
 
     @Override
     public void handleExposeEvent(XEvent xev) {
+        if(parentFrame.isTargetUndecorated() &&
+           XWM.getWMID() != XWM.UNITY_COMPIZ_WM &&
+                width <= 0 && height <= 0) {
+            // WM didn't send initial ConfigureNotify, so set the bounds here
+            setContentBounds(parentFrame.getDimensions());
+        }
         if (width <= 0 || height <= 0) {
             return;
         }
diff --git a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java
index fc7f3d9..bfe9a26 100644
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java
@@ -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
@@ -112,11 +112,13 @@
     }
 
     public static class GLXWindowSurfaceData extends GLXSurfaceData {
+        protected final int scale;
 
         public GLXWindowSurfaceData(X11ComponentPeer peer,
                                     GLXGraphicsConfig gc)
         {
             super(peer, gc, peer.getColorModel(), WINDOW);
+            scale = gc.getScale();
         }
 
         public SurfaceData getReplacement() {
@@ -126,6 +128,8 @@
         public Rectangle getBounds() {
             Rectangle r = peer.getBounds();
             r.x = r.y = 0;
+            r.width = (int) Math.ceil(r.width * scale);
+            r.height = (int) Math.ceil(r.height * scale);
             return r;
         }
 
@@ -135,6 +139,16 @@
         public Object getDestination() {
             return peer.getTarget();
         }
+
+        @Override
+        public double getDefaultScaleX() {
+            return scale;
+        }
+
+        @Override
+        public double getDefaultScaleY() {
+            return scale;
+        }
     }
 
     /**
@@ -177,6 +191,7 @@
 
         private Image offscreenImage;
         private int width, height;
+        private final int scale;
 
         public GLXOffScreenSurfaceData(X11ComponentPeer peer,
                                        GLXGraphicsConfig gc,
@@ -186,11 +201,12 @@
         {
             super(peer, gc, cm, type);
 
-            this.width = width;
-            this.height = height;
+            scale = gc.getDevice().getScaleFactor();
+            this.width = width * scale;
+            this.height = height * scale;
             offscreenImage = image;
 
-            initSurface(width, height);
+            initSurface(this.width, this.height);
         }
 
         public SurfaceData getReplacement() {
@@ -201,6 +217,8 @@
             if (type == FLIP_BACKBUFFER) {
                 Rectangle r = peer.getBounds();
                 r.x = r.y = 0;
+                r.width = (int) Math.ceil(r.width * scale);
+                r.height = (int) Math.ceil(r.height * scale);
                 return r;
             } else {
                 return new Rectangle(width, height);
@@ -213,5 +231,15 @@
         public Object getDestination() {
             return offscreenImage;
         }
+
+        @Override
+        public double getDefaultScaleX() {
+            return scale;
+        }
+
+        @Override
+        public double getDefaultScaleY() {
+            return scale;
+        }
     }
 }
diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java
index 65d1569..fb94e38 100644
--- a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java
@@ -729,7 +729,8 @@
      * Tests whether a module can be modified with {@link #redefineModule
      * redefineModule}. If a module is modifiable then this method returns
      * {@code true}. If a module is not modifiable then this method returns
-     * {@code false}.
+     * {@code false}. This method always returns {@code true} when the module
+     * is an unnamed module (as redefining an unnamed module is a no-op).
      *
      * @param module the module to test if it can be modified
      * @return {@code true} if the module is modifiable, otherwise {@code false}
diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html b/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html
index e7f8d8f..5c40a23 100644
--- a/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html
@@ -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
@@ -112,7 +112,9 @@
 The <code>premain</code> methods will be run under the same security and classloader 
 rules as the application <code>main</code> method.
 There are no modeling restrictions on what the agent <code>premain</code> method may do.
-Anything application <code>main</code> can do, including creating threads, is legal from <code>premain</code>.
+Anything application <code>main</code> can do, including creating threads, is legal from
+<code>premain</code>.
+
 
 <P>
 Each agent is passed its agent options via the <code>agentArgs</code> parameter.
@@ -126,7 +128,6 @@
 If a <code>premain</code> method throws an uncaught exception, the JVM will abort.
 
 
-
 <h3>Starting Agents After VM Startup</h3>
 
 <p>
@@ -191,76 +192,134 @@
 not abort. If the <code>agentmain</code> method throws an uncaught exception it will be ignored.
 
 
+<h3>Deploying Agents in Executable JAR file</h3>
+
+The JAR File Specification defines manifest attributes for standalone applications that are
+bundled as <em>executable JAR files</em>. If an implementation supports a mechanism to start
+an application as an executable JAR then the main manifest may include the
+<code>Launcher-Agent-Class</code> attribute to specify the class name
+of an agent to start before the application <code>main</code> method is invoked. The Java
+virtual machine attempts to invoke the following method on the agent class:
+
+<blockquote>
+    <code>public static void
+        agentmain(String agentArgs, Instrumentation inst);
+    </code>
+</blockquote>
+
+<P>
+If the agent class does not implement this method then the JVM will attempt to invoke:
+
+<blockquote>
+    <code>public static void
+        agentmain(String agentArgs);
+    </code>
+</blockquote>
+
+<p>
+The value of the <code>agentArgs</code> parameter is always the empty string.
+
+<P>
+The <code>agentmain</code> method should do any necessary initialization
+required to start the agent and return. If the agent cannot be started, for
+example the agent class cannot be loaded, the agent class does not define a
+conformant <code>agentmain</code> method, or the <code>agentmain</code> method
+throws an uncaught exception or error, the JVM will abort.
+
+
+<h3>Visibility</h3>
+
+The types visible to the agent class are the types visible to the system class
+loader. They minimally include the types in packages exported by
+<a href="{@docRoot}/java.base-summary.html">java.base</a> and
+<a href="{@docRoot}/java.instrument-summary.html">java.instrument</a>.
+Whether all {@linkplain ClassLoader#getPlatformClassLoader() platform classes}
+are visible or not will depend on the initial module or application.
+
+<p>
+Supporting classes that the agent makes visible to the bootstrap class loader
+(by means of {@link Instrumentation#appendToBootstrapClassLoaderSearch
+appendToBootstrapClassLoaderSearch} or the <code>Boot-Class-Path</code> attribute
+specified below) can only link to types defined to the bootstrap class loader.
+There is no guarantee that all platform classes are visible to the boot class
+loader.
+
 
 <h3>Manifest Attributes</h3>
+
 The following manifest attributes are defined for an agent JAR file:
 <blockquote>
 <dl>
 <dt><code>Premain-Class</code></dt>
 <dd>
-                        When an agent is specified at JVM launch time this attribute
-			specifies the agent class.
-			That is, the class containing the <code>premain</code> method.
-                        When an agent is specified at JVM launch time this attribute
-			is required. If the attribute is not present the JVM will abort.
-                        Note: this is a class name, not a file name or path.							
+            When an agent is specified at JVM launch time this attribute
+            specifies the agent class.
+            That is, the class containing the <code>premain</code> method.
+            When an agent is specified at JVM launch time this attribute
+            is required. If the attribute is not present the JVM will abort.
+            Note: this is a class name, not a file name or path.
 </dd>
-
 <dt><code>Agent-Class</code></dt>
 <dd>
-                        If an implementation supports a mechanism to start agents 
-                        sometime after the VM has started then this attribute specifies
-                        the agent class.
-                        That is, the class containing the <code>agentmain</code> method.
-                        This attribute is required, if it is not present the agent
-                        will not be started.
-                        Note: this is a class name, not a file name or path.
-</dd>			
-
+            If an implementation supports a mechanism to start agents
+            sometime after the VM has started then this attribute specifies
+            the agent class.
+            That is, the class containing the <code>agentmain</code> method.
+            This attribute is required, if it is not present the agent
+            will not be started.
+            Note: this is a class name, not a file name or path.
+</dd>
+<dt><code>Launcher-Agent-Class</code></dt>
+<dd>
+            If an implementation supports a mechanism to start an application
+            as an executable JAR then the main manifest may include this
+            attribute to specify the class name of an agent to start before the
+            application <code>main</code> method is invoked.
+</dd>
 <dt><code>Boot-Class-Path</code></dt>
 <dd>
-                        A list of paths to be searched by the bootstrap class
-                        loader. Paths represent directories or libraries
-                        (commonly referred to as JAR or zip libraries on
-                        many platforms). 			
-                        These paths are searched by the
-                        bootstrap class loader after the platform specific
-                        mechanisms of locating a class have failed.
-                        Paths are searched in the order listed.
-                        Paths in the list are separated by one or more spaces.
-                        A path takes the syntax of the path component of a
-                        hierarchical URI. The path is
-                        absolute if it begins with a slash character ('/'),
-                        otherwise it is relative. A relative path is resolved
-                        against the absolute path of the agent JAR file.
-                        Malformed and non-existent paths are ignored.	
-			When an agent is started sometime after the VM has
-			started then paths that do not represent a JAR file
-			are ignored.
-                        This attribute is optional.
+            A list of paths to be searched by the bootstrap class
+            loader. Paths represent directories or libraries
+            (commonly referred to as JAR or zip libraries on
+            many platforms).
+            These paths are searched by the
+            bootstrap class loader after the platform specific
+            mechanisms of locating a class have failed.
+            Paths are searched in the order listed.
+            Paths in the list are separated by one or more spaces.
+            A path takes the syntax of the path component of a
+            hierarchical URI. The path is
+            absolute if it begins with a slash character ('/'),
+            otherwise it is relative. A relative path is resolved
+            against the absolute path of the agent JAR file.
+            Malformed and non-existent paths are ignored.
+            When an agent is started sometime after the VM has
+            started then paths that do not represent a JAR file
+            are ignored.
+            This attribute is optional.
 </dd>
 <dt><code>Can-Redefine-Classes</code></dt>
 <dd>
-                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
-                        Is the ability to redefine classes
-                        needed by this agent.
-                        Values other than <code>true</code> are considered <code>false</code>.
-                        This attribute is optional, the default is <code>false</code>.
+            Boolean (<code>true</code> or <code>false</code>, case irrelevant).
+            Is the ability to redefine classes
+            needed by this agent.
+            Values other than <code>true</code> are considered <code>false</code>.
+            This attribute is optional, the default is <code>false</code>.
 </dd>
 <dt><code>Can-Retransform-Classes</code></dt>
 <dd>
-                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
-                        Is the ability to retransform classes
-                        needed by this agent.
-                        Values other than <code>true</code> are considered <code>false</code>.
-                        This attribute is optional, the default is <code>false</code>.
+            Boolean (<code>true</code> or <code>false</code>, case irrelevant).
+            Is the ability to retransform classes
+            needed by this agent.
+            Values other than <code>true</code> are considered <code>false</code>.
+            This attribute is optional, the default is <code>false</code>.
 </dd>
 <dt><code>Can-Set-Native-Method-Prefix</code></dt>
 <dd>
-                        Boolean (<code>true</code> or <code>false</code>, case irrelevant).
-                        Is the ability to set native method prefix needed by this agent.
-                        Values other than <code>true</code> are considered <code>false</code>.
-                        This attribute is optional, the default is <code>false</code>.
+            Boolean (<code>true</code> or <code>false</code>, case irrelevant).
+            Is the ability to set native method prefix needed by this agent.
+            Values other than <code>true</code> are considered <code>false</code>.
+            This attribute is optional, the default is <code>false</code>.
 </dd>
 </dl>
 </blockquote>
diff --git a/jdk/src/java.instrument/share/classes/module-info.java b/jdk/src/java.instrument/share/classes/module-info.java
index c0a3810..526aed6 100644
--- a/jdk/src/java.instrument/share/classes/module-info.java
+++ b/jdk/src/java.instrument/share/classes/module-info.java
@@ -32,5 +32,8 @@
  */
 module java.instrument {
     exports java.lang.instrument;
+
+    // allow java launcher to load agents in executable JAR files
+    exports sun.instrument to java.base;
 }
 
diff --git a/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java b/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java
index f31a007..4669dca 100644
--- a/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java
+++ b/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java
@@ -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
@@ -555,4 +555,15 @@
                                     classfileBuffer);
         }
     }
+
+
+    /**
+     * Invoked by the java launcher to load a java agent that is packaged with
+     * the main application in an executable JAR file.
+     */
+    public static void loadAgent(String path) {
+        loadAgent0(path);
+    }
+
+    private static native void loadAgent0(String path);
 }
diff --git a/jdk/src/java.instrument/share/native/libinstrument/InstrumentationImplNativeMethods.c b/jdk/src/java.instrument/share/native/libinstrument/InstrumentationImplNativeMethods.c
index 6d117be..7b2ca5d 100644
--- a/jdk/src/java.instrument/share/native/libinstrument/InstrumentationImplNativeMethods.c
+++ b/jdk/src/java.instrument/share/native/libinstrument/InstrumentationImplNativeMethods.c
@@ -159,3 +159,20 @@
   (JNIEnv * jnienv, jobject implThis, jlong agent, jobjectArray prefixArray, jboolean isRetransformable) {
     setNativeMethodPrefixes(jnienv, (JPLISAgent*)(intptr_t)agent, prefixArray, isRetransformable);
 }
+
+
+/*
+ * Class:     sun_instrument_InstrumentationImpl
+ * Method:    loadAgent0
+ */
+JNIEXPORT void JNICALL Java_sun_instrument_InstrumentationImpl_loadAgent0
+   (JNIEnv* env, jclass clazz, jstring jarfile)
+{
+    extern jint loadAgent(JNIEnv* env, jstring path);
+    if (loadAgent(env, jarfile) != JNI_OK) {
+        if (!(*env)->ExceptionCheck(env)) {
+            createAndThrowInternalError(env);
+        }
+    }
+}
+
diff --git a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
index 625ea1a..dad0263 100644
--- a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
+++ b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
@@ -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
@@ -106,7 +106,7 @@
  * convert them to JVM TI capabilities.
  */
 void
-convertCapabilityAtrributes(const jarAttribute* attributes, JPLISAgent* agent) {
+convertCapabilityAttributes(const jarAttribute* attributes, JPLISAgent* agent) {
     /* set redefineClasses capability */
     if (getBooleanAttribute(attributes, "Can-Redefine-Classes")) {
         addRedefineClassesCapability(agent);
@@ -229,7 +229,7 @@
         /*
          * Convert JAR attributes into agent capabilities
          */
-        convertCapabilityAtrributes(attributes, agent);
+        convertCapabilityAttributes(attributes, agent);
 
         /*
          * Track (record) the agent class name and options data
@@ -386,7 +386,7 @@
         /*
          * Convert JAR attributes into agent capabilities
          */
-        convertCapabilityAtrributes(attributes, agent);
+        convertCapabilityAttributes(attributes, agent);
 
         /*
          * Create the java.lang.instrument.Instrumentation instance
@@ -435,6 +435,109 @@
 DEF_Agent_OnUnload(JavaVM *vm) {
 }
 
+/**
+ * Invoked by the java launcher to load an agent in the main executable JAR.
+ * The Launcher-Agent-Class attribute in the main manifest of the JAR file
+ * is the agent class.
+ *
+ * Returns JNI_OK if the agent is loaded and initialized; JNI_ERR if this
+ * function fails, possibly with a pending exception.
+ */
+jint loadAgent(JNIEnv* env, jstring path) {
+    JavaVM* vm;
+    JPLISAgent* agent;
+    const char* jarfile = NULL;
+    jarAttribute* attributes = NULL;
+    char* agentClass = NULL;
+    char* bootClassPath;
+    int oldLen, newLen;
+    jint result = JNI_ERR;
+
+    if ((*env)->GetJavaVM(env, &vm) < 0) {
+        return JNI_ERR;
+    }
+
+    // create JPLISAgent with JVMTI environment
+    if (createNewJPLISAgent(vm, &agent) != JPLIS_INIT_ERROR_NONE) {
+        return JNI_ERR;
+    }
+
+    // get path to JAR file as UTF-8 string
+    jarfile = (*env)->GetStringUTFChars(env, path, NULL);
+    if (jarfile == NULL) {
+        return JNI_ERR;
+    }
+
+    // read the attributes in the main section of JAR manifest
+    attributes = readAttributes(jarfile);
+    if (attributes == NULL) {
+        goto releaseAndReturn;
+    }
+
+    // Launcher-Agent-Class is required
+    agentClass = getAttribute(attributes, "Launcher-Agent-Class");
+    if (agentClass == NULL) {
+        goto releaseAndReturn;
+    }
+
+    // The value of Launcher-Agent-Class is in UTF-8, convert it to modified UTF-8
+    oldLen = (int) strlen(agentClass);
+    newLen = modifiedUtf8LengthOfUtf8(agentClass, oldLen);
+    if (newLen == oldLen) {
+        agentClass = strdup(agentClass);
+    } else {
+        char* str = (char*) malloc(newLen + 1);
+        if (str != NULL) {
+            convertUtf8ToModifiedUtf8(agentClass, oldLen, str, newLen);
+        }
+        agentClass = str;
+    }
+    if (agentClass == NULL) {
+         jthrowable oome = createThrowable(env, "java/lang/OutOfMemoryError", NULL);
+         if (oome != NULL) (*env)->Throw(env, oome);
+         goto releaseAndReturn;
+    }
+
+    // Boot-Class-Path
+    bootClassPath = getAttribute(attributes, "Boot-Class-Path");
+    if (bootClassPath != NULL) {
+        appendBootClassPath(agent, jarfile, bootClassPath);
+    }
+
+    // Can-XXXX capabilities
+    convertCapabilityAttributes(attributes, agent);
+
+    // Create the java.lang.instrument.Instrumentation object
+    if (!createInstrumentationImpl(env, agent)) {
+        goto releaseAndReturn;
+    }
+
+    // Enable the ClassFileLoadHook
+    if (!setLivePhaseEventHandlers(agent)) {
+        goto releaseAndReturn;
+    }
+
+    // invoke the agentmain method
+    if (!startJavaAgent(agent, env, agentClass, "", agent->mAgentmainCaller)) {
+        goto releaseAndReturn;
+    }
+
+    // initialization complete
+    result = JNI_OK;
+
+    releaseAndReturn:
+        if (agentClass != NULL) {
+            free(agentClass);
+        }
+        if (attributes != NULL) {
+            freeAttributes(attributes);
+        }
+        if (jarfile != NULL) {
+            (*env)->ReleaseStringUTFChars(env, path, jarfile);
+        }
+
+    return result;
+}
 
 /*
  *  JVMTI callback support
diff --git a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
index 5cc5861..e0c1782 100644
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java
@@ -843,6 +843,9 @@
      * @return a {@code ThreadInfo} object represented
      *         by {@code cd} if {@code cd} is not {@code null};
      *         {@code null} otherwise.
+     *
+     * @revised 9
+     * @spec JPMS
      */
     public static ThreadInfo from(CompositeData cd) {
         if (cd == null) {
diff --git a/jdk/src/java.rmi/share/classes/java/rmi/Remote.java b/jdk/src/java.rmi/share/classes/java/rmi/Remote.java
index 86a53a3..57814d2 100644
--- a/jdk/src/java.rmi/share/classes/java/rmi/Remote.java
+++ b/jdk/src/java.rmi/share/classes/java/rmi/Remote.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +40,8 @@
  * <code>java.rmi.activation.Activatable</code>.
  *
  * <p>For complete details on RMI, see the <a
- href=../../../platform/rmi/spec/rmiTOC.html>RMI Specification</a> which describes the RMI API and system.
+ * href="{@docRoot}/../specs/rmi/index.html">RMI Specification</a> which
+ * describes the RMI API and system.
  *
  * @since   1.1
  * @author  Ann Wollrath
diff --git a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java
index 74d3c24..a12e319 100644
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,9 +171,9 @@
  * By default, server sockets created by {@link RMISocketFactory}
  * listen on all network interfaces. See the
  * {@link RMISocketFactory} class and the section
- * <a href="{@docRoot}/../platform/rmi/spec/rmi-server29.html">RMI Socket Factories</a>
+ * <a href="{@docRoot}/../specs/rmi/server.html#rmi-socket-factories">RMI Socket Factories</a>
  * in the
- * <a href="{@docRoot}/../platform/rmi/spec/rmiTOC.html">Java RMI Specification</a>.
+ * <a href="{@docRoot}/../specs/rmi/index.html">Java RMI Specification</a>.
  *
  * @author  Ann Wollrath
  * @author  Peter Jones
diff --git a/jdk/src/java.sql/share/classes/java/sql/package.html b/jdk/src/java.sql/share/classes/java/sql/package.html
index 163522d..a8b2e7c 100644
--- a/jdk/src/java.sql/share/classes/java/sql/package.html
+++ b/jdk/src/java.sql/share/classes/java/sql/package.html
@@ -59,6 +59,7 @@
 <h2>Versions</h2>
 The JDBC 4.3 API incorporates all of the previous JDBC API versions:
 <UL>
+    <LI> The JDBC 4.2 API</li>
     <LI> The JDBC 4.1 API</li>
     <LI> The JDBC 4.0 API</li>
     <LI> The JDBC 3.0 API</li>
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
index d495de6..91c2f9e 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
@@ -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
@@ -41,7 +41,7 @@
  * (for example, you should not use the same <code>XMLSignContext</code>
  * instance to sign two different {@link XMLSignature} objects).
  * <p>
- * <b><a name="SupportedProperties"></a>Supported Properties</b>
+ * <b><a id="SupportedProperties"></a>Supported Properties</b>
  * <p>The following properties can be set using the
  * {@link #setProperty setProperty} method.
  * <ul>
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java
index 4c3da66..d8fbfd0 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java
@@ -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
@@ -40,7 +40,7 @@
  * (for example, you should not use the same <code>XMLValidateContext</code>
  * instance to validate two different {@link XMLSignature} objects).
  * <p>
- * <b><a name="SupportedProperties"></a>Supported Properties</b>
+ * <b><a id="SupportedProperties"></a>Supported Properties</b>
  * <p>The following properties can be set by an application using the
  * {@link #setProperty setProperty} method.
  * <ul>
diff --git a/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
index 8054ca8..16ddd87 100644
--- a/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
+++ b/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
@@ -214,13 +214,14 @@
             // Special-case the "load" command so that the right exception is
             // thrown.
             if (cmd.equals("load")) {
-                throw new AgentLoadException("Failed to load agent library");
+                String msg = "Failed to load agent library";
+                if (!message.isEmpty())
+                    msg += ": " + message;
+                throw new AgentLoadException(msg);
             } else {
-                if (message == null) {
-                    throw new AttachOperationFailedException("Command failed in target VM");
-                } else {
-                    throw new AttachOperationFailedException(message);
-                }
+                if (message.isEmpty())
+                    message = "Command failed in target VM";
+                throw new AttachOperationFailedException(message);
             }
         }
 
diff --git a/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
index edb0c0b..4a5fbdd 100644
--- a/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
+++ b/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
@@ -211,13 +211,14 @@
             // Special-case the "load" command so that the right exception is
             // thrown.
             if (cmd.equals("load")) {
-                throw new AgentLoadException("Failed to load agent library");
+                String msg = "Failed to load agent library";
+                if (!message.isEmpty())
+                    msg += ": " + message;
+                throw new AgentLoadException(msg);
             } else {
-                if (message == null) {
-                    throw new AttachOperationFailedException("Command failed in target VM");
-                } else {
-                    throw new AttachOperationFailedException(message);
-                }
+                if (message.isEmpty())
+                    message = "Command failed in target VM";
+                throw new AttachOperationFailedException(message);
             }
         }
 
diff --git a/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java
index 9ed1633..dfed550 100644
--- a/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java
+++ b/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java
@@ -213,13 +213,14 @@
             // Special-case the "load" command so that the right exception is
             // thrown.
             if (cmd.equals("load")) {
-                throw new AgentLoadException("Failed to load agent library");
+                String msg = "Failed to load agent library";
+                if (!message.isEmpty())
+                    msg += ": " + message;
+                throw new AgentLoadException(msg);
             } else {
-                if (message == null) {
-                    throw new AttachOperationFailedException("Command failed in target VM");
-                } else {
-                    throw new AttachOperationFailedException(message);
-                }
+                if (message.isEmpty())
+                    message = "Command failed in target VM";
+                throw new AttachOperationFailedException(message);
             }
         }
 
diff --git a/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
index 98d0ddc..9ab9357 100644
--- a/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
+++ b/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
@@ -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
@@ -25,15 +25,19 @@
 
 package sun.tools.attach;
 
+import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AgentInitializationException;
 import com.sun.tools.attach.spi.AttachProvider;
+import jdk.internal.misc.VM;
 
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Properties;
 import java.util.stream.Collectors;
 
@@ -43,8 +47,33 @@
 
 public abstract class HotSpotVirtualMachine extends VirtualMachine {
 
-    HotSpotVirtualMachine(AttachProvider provider, String id) {
+    private static final long CURRENT_PID;
+    private static final boolean ALLOW_ATTACH_SELF;
+    static {
+        PrivilegedAction<ProcessHandle> pa = ProcessHandle::current;
+        CURRENT_PID = AccessController.doPrivileged(pa).pid();
+
+        String s = VM.getSavedProperty("jdk.attach.allowAttachSelf");
+        ALLOW_ATTACH_SELF = "".equals(s) || Boolean.parseBoolean(s);
+    }
+
+    HotSpotVirtualMachine(AttachProvider provider, String id)
+        throws AttachNotSupportedException, IOException
+    {
         super(provider, id);
+
+        int pid;
+        try {
+            pid = Integer.parseInt(id);
+        } catch (NumberFormatException e) {
+            throw new AttachNotSupportedException("Invalid process identifier");
+        }
+
+        // The tool should be a different VM to the target. This check will
+        // eventually be enforced by the target VM.
+        if (!ALLOW_ATTACH_SELF && (pid == 0 || pid == CURRENT_PID)) {
+            throw new IOException("Can not attach to current VM");
+        }
     }
 
     /*
@@ -103,8 +132,6 @@
         }
         try {
             loadAgentLibrary("instrument", args);
-        } catch (AgentLoadException x) {
-            throw new InternalError("instrument library is missing in target VM", x);
         } catch (AgentInitializationException x) {
             /*
              * Translate interesting errors into the right exception and
@@ -116,13 +143,17 @@
                 case JNI_ENOMEM:
                     throw new AgentLoadException("Insuffient memory");
                 case ATTACH_ERROR_BADJAR:
-                    throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
+                    throw new AgentLoadException(
+                        "Agent JAR not found or no Agent-Class attribute");
                 case ATTACH_ERROR_NOTONCP:
-                    throw new AgentLoadException("Unable to add JAR file to system class path");
+                    throw new AgentLoadException(
+                        "Unable to add JAR file to system class path");
                 case ATTACH_ERROR_STARTFAIL:
-                    throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize");
+                    throw new AgentInitializationException(
+                        "Agent JAR loaded but agent failed to initialize");
                 default :
-                    throw new AgentLoadException("Failed to load agent - unknown reason: " + rc);
+                    throw new AgentLoadException("" +
+                        "Failed to load agent - unknown reason: " + rc);
             }
         }
     }
@@ -163,20 +194,20 @@
         return props;
     }
 
-    private static final String MANAGMENT_PREFIX = "com.sun.management.";
+    private static final String MANAGEMENT_PREFIX = "com.sun.management.";
 
     private static boolean checkedKeyName(Object key) {
         if (!(key instanceof String)) {
             throw new IllegalArgumentException("Invalid option (not a String): "+key);
         }
-        if (!((String)key).startsWith(MANAGMENT_PREFIX)) {
+        if (!((String)key).startsWith(MANAGEMENT_PREFIX)) {
             throw new IllegalArgumentException("Invalid option: "+key);
         }
         return true;
     }
 
     private static String stripKeyName(Object key) {
-        return ((String)key).substring(MANAGMENT_PREFIX.length());
+        return ((String)key).substring(MANAGEMENT_PREFIX.length());
     }
 
     @Override
@@ -204,9 +235,11 @@
     @Override
     public String startLocalManagementAgent() throws IOException {
         executeJCmd("ManagementAgent.start_local").close();
-        return getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
+        String prop = MANAGEMENT_PREFIX + "jmxremote.localConnectorAddress";
+        return getAgentProperties().getProperty(prop);
     }
 
+
     // --- HotSpot specific methods ---
 
     // same as SIGQUIT
@@ -245,8 +278,8 @@
         return executeCommand("jcmd", command);
     }
 
-    // -- Supporting methods
 
+    // -- Supporting methods
 
     /*
      * Execute the given command in the target VM - specific platform
@@ -306,10 +339,10 @@
     /*
      * Utility method to read data into a String.
      */
-    String readErrorMessage(InputStream sis) throws IOException {
+    String readErrorMessage(InputStream in) throws IOException {
         String s;
         StringBuilder message = new StringBuilder();
-        BufferedReader br = new BufferedReader(new InputStreamReader(sis));
+        BufferedReader br = new BufferedReader(new InputStreamReader(in));
         while ((s = br.readLine()) != null) {
             message.append(s);
         }
diff --git a/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java
index 4d0a3bc..504e9b5 100644
--- a/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java
+++ b/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java
@@ -160,13 +160,14 @@
             String message = readErrorMessage(sis);
             sis.close();
             if (cmd.equals("load")) {
-                throw new AgentLoadException("Failed to load agent library");
+                String msg = "Failed to load agent library";
+                if (!message.isEmpty())
+                    msg += ": " + message;
+                throw new AgentLoadException(msg);
             } else {
-                if (message == null) {
-                    throw new AttachOperationFailedException("Command failed in target VM");
-                } else {
-                    throw new AttachOperationFailedException(message);
-                }
+                if (message.isEmpty())
+                    message = "Command failed in target VM";
+                throw new AttachOperationFailedException(message);
             }
         }
 
diff --git a/jdk/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java
index 84d2a36..bf2a3dc 100644
--- a/jdk/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java
+++ b/jdk/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java
@@ -100,28 +100,29 @@
             connectPipe(hPipe);
 
             // create an input stream for the pipe
-            PipedInputStream is = new PipedInputStream(hPipe);
+            PipedInputStream in = new PipedInputStream(hPipe);
 
             // read completion status
-            int status = readInt(is);
+            int status = readInt(in);
             if (status != 0) {
                 // read from the stream and use that as the error message
-                String message = readErrorMessage(is);
-                is.close();
+                String message = readErrorMessage(in);
+                in.close();
                 // special case the load command so that the right exception is thrown
                 if (cmd.equals("load")) {
-                    throw new AgentLoadException("Failed to load agent library");
+                    String msg = "Failed to load agent library";
+                    if (!message.isEmpty())
+                        msg += ": " + message;
+                    throw new AgentLoadException(msg);
                 } else {
-                    if (message == null) {
-                        throw new AttachOperationFailedException("Command failed in target VM");
-                    } else {
-                        throw new AttachOperationFailedException(message);
-                    }
+                    if (message.isEmpty())
+                        message = "Command failed in target VM";
+                    throw new AttachOperationFailedException(message);
                 }
             }
 
             // return the input stream
-            return is;
+            return in;
 
         } catch (IOException ioe) {
             closePipe(hPipe);
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java
index 1e279c3..ecc83de 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java
@@ -20,6 +20,7 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 package jdk.incubator.http;
 
diff --git a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
index dc9d3d9..0a19ff5 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
@@ -71,6 +71,7 @@
 import static java.util.jar.JarFile.MANIFEST_NAME;
 import static java.util.stream.Collectors.joining;
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static sun.tools.jar.Validator.ENTRYNAME_COMPARATOR;
 
 /**
  * This class implements a simple utility for creating files in the JAR
@@ -132,6 +133,10 @@
     // if --release option found followed by at least file
     boolean isMultiRelease;
 
+    // The last parsed --release value, if any. Used in conjunction with
+    // "-d,--describe-module" to select the operative module descriptor.
+    int releaseValue = -1;
+
     /*
      * cflag: create
      * uflag: update
@@ -413,7 +418,7 @@
                     }
                 } else {
                     try (FileInputStream fin = new FileInputStream(FileDescriptor.in)) {
-                        found = describeModule(fin);
+                        found = describeModuleFromStream(fin);
                     }
                 }
                 if (!found)
@@ -604,11 +609,6 @@
         /* parse file arguments */
         int n = args.length - count;
         if (n > 0) {
-            if (dflag) {
-                // "--describe-module/-d" does not require file argument(s)
-                usageError(formatMsg("error.bad.dflag", args[count]));
-                return false;
-            }
             int version = BASE_VERSION;
             int k = 0;
             String[] nameBuf = new String[n];
@@ -616,6 +616,12 @@
             try {
                 for (int i = count; i < args.length; i++) {
                     if (args[i].equals("-C")) {
+                        if (dflag) {
+                            // "--describe-module/-d" does not require file argument(s),
+                            // but does accept --release
+                            usageError(getMsg("error.bad.dflag"));
+                            return false;
+                        }
                         /* change the directory */
                         String dir = args[++i];
                         dir = (dir.endsWith(File.separator) ?
@@ -649,8 +655,15 @@
                         k = 0;
                         nameBuf = new String[n];
                         version = v;
+                        releaseValue = version;
                         pathsMap.put(version, new HashSet<>());
                     } else {
+                        if (dflag) {
+                            // "--describe-module/-d" does not require file argument(s),
+                            // but does accept --release
+                            usageError(getMsg("error.bad.dflag"));
+                            return false;
+                        }
                         nameBuf[k++] = args[i];
                     }
                 }
@@ -756,7 +769,7 @@
      * can be found by recursively descending directories.
      *
      * @param dir    parent directory
-     * @param file s list of files to expand
+     * @param files  list of files to expand
      * @param cpaths set of directories specified by -C option for the files
      * @throws IOException if an I/O error occurs
      */
@@ -1721,23 +1734,62 @@
 
     // Modular jar support
 
-    static <T> String toString(Collection<T> c,
-                               CharSequence prefix,
-                               CharSequence suffix ) {
-        if (c.isEmpty())
-            return "";
-        return c.stream().map(e -> e.toString())
-                           .collect(joining(", ", prefix, suffix));
+    /**
+     * Associates a module descriptor's zip entry name along with its
+     * bytes and an optional URI. Used when describing modules.
+     */
+    interface ModuleInfoEntry {
+       String name();
+       Optional<String> uriString();
+       InputStream bytes() throws IOException;
     }
 
-    private boolean describeModule(ZipFile zipFile) throws IOException {
-        ZipEntry[] zes = zipFile.stream()
-            .filter(e -> isModuleInfoEntry(e.getName()))
-            .sorted(Validator.ENTRY_COMPARATOR)
-            .toArray(ZipEntry[]::new);
+    static class ZipFileModuleInfoEntry implements ModuleInfoEntry {
+        private final ZipFile zipFile;
+        private final ZipEntry entry;
+        ZipFileModuleInfoEntry(ZipFile zipFile, ZipEntry entry) {
+            this.zipFile = zipFile;
+            this.entry = entry;
+        }
+        @Override public String name() { return entry.getName(); }
+        @Override public InputStream bytes() throws IOException {
+            return zipFile.getInputStream(entry);
+        }
+        /** Returns an optional containing the effective URI. */
+        @Override public Optional<String> uriString() {
+            String uri = (Paths.get(zipFile.getName())).toUri().toString();
+            uri = "jar:" + uri + "/!" + entry.getName();
+            return Optional.of(uri);
+        }
+    }
 
-        if (zes.length == 0) {
-            // No module descriptor found, derive the automatic module name
+    static class StreamedModuleInfoEntry implements ModuleInfoEntry {
+        private final String name;
+        private final byte[] bytes;
+        StreamedModuleInfoEntry(String name, byte[] bytes) {
+            this.name = name;
+            this.bytes = bytes;
+        }
+        @Override public String name() { return name; }
+        @Override public InputStream bytes() throws IOException {
+            return new ByteArrayInputStream(bytes);
+        }
+        /** Returns an empty optional. */
+        @Override public Optional<String> uriString() {
+            return Optional.empty();  // no URI can be derived
+        }
+    }
+
+    /** Describes a module from a given zip file. */
+    private boolean describeModule(ZipFile zipFile) throws IOException {
+        ZipFileModuleInfoEntry[] infos = zipFile.stream()
+                .filter(e -> isModuleInfoEntry(e.getName()))
+                .sorted(Validator.ENTRY_COMPARATOR)
+                .map(e -> new ZipFileModuleInfoEntry(zipFile, e))
+                .toArray(ZipFileModuleInfoEntry[]::new);
+
+        if (infos.length == 0) {
+            // No module descriptor found, derive and describe the automatic module
             String fn = zipFile.getName();
             ModuleFinder mf = ModuleFinder.of(Paths.get(fn));
             try {
@@ -1747,8 +1799,8 @@
                     return true;
                 }
                 ModuleDescriptor md = mref.iterator().next().descriptor();
-                output(getMsg("out.automodule"));
-                describeModule(md, null, null, "automatic");
+                output(getMsg("out.automodule") + "\n");
+                describeModule(md, null, null, "");
             } catch (FindException e) {
                 String msg = formatMsg("error.unable.derive.automodule", fn);
                 Throwable t = e.getCause();
@@ -1757,46 +1809,117 @@
                 output(msg);
             }
         } else {
-            for (ZipEntry ze : zes) {
-                try (InputStream is = zipFile.getInputStream(ze)) {
-                    describeModule(is, ze.getName());
-                }
-            }
+            return describeModuleFromEntries(infos);
         }
         return true;
     }
 
-    private boolean describeModule(FileInputStream fis)
+    private boolean describeModuleFromStream(FileInputStream fis)
         throws IOException
     {
+        List<ModuleInfoEntry> infos = new LinkedList<>();
+
         try (BufferedInputStream bis = new BufferedInputStream(fis);
              ZipInputStream zis = new ZipInputStream(bis)) {
             ZipEntry e;
             while ((e = zis.getNextEntry()) != null) {
                 String ename = e.getName();
-                if (isModuleInfoEntry(ename)){
-                    moduleInfos.put(ename, zis.readAllBytes());
+                if (isModuleInfoEntry(ename)) {
+                    infos.add(new StreamedModuleInfoEntry(ename, zis.readAllBytes()));
                 }
             }
         }
-        if (moduleInfos.size() == 0)
+
+        if (infos.size() == 0)
             return false;
-        String[] names = moduleInfos.keySet().stream()
-            .sorted(Validator.ENTRYNAME_COMPARATOR)
-            .toArray(String[]::new);
-        for (String name : names) {
-            describeModule(new ByteArrayInputStream(moduleInfos.get(name)), name);
+
+        ModuleInfoEntry[] sorted = infos.stream()
+                .sorted(Comparator.comparing(ModuleInfoEntry::name, ENTRYNAME_COMPARATOR))
+                .toArray(ModuleInfoEntry[]::new);
+
+        return describeModuleFromEntries(sorted);
+    }
+
+    private boolean lessThanEqualReleaseValue(ModuleInfoEntry entry) {
+        return intVersionFromEntry(entry) <= releaseValue ? true : false;
+    }
+
+    private static String versionFromEntryName(String name) {
+        String s = name.substring(VERSIONS_DIR_LENGTH);
+        return s.substring(0, s.indexOf("/"));
+    }
+
+    private static int intVersionFromEntry(ModuleInfoEntry entry) {
+        String name = entry.name();
+        if (!name.startsWith(VERSIONS_DIR))
+            return BASE_VERSION;
+
+        String s = name.substring(VERSIONS_DIR_LENGTH);
+        s = s.substring(0, s.indexOf('/'));
+        return Integer.valueOf(s);
+    }
+
+    /**
+     * Describes a single module descriptor, determined by the specified
+     * --release, if any, from the given ordered entries.
+     * The given infos must be ordered as per ENTRY_COMPARATOR.
+     */
+    private boolean describeModuleFromEntries(ModuleInfoEntry[] infos)
+        throws IOException
+    {
+        assert infos.length > 0;
+
+        // Informative: output all non-root descriptors, if any
+        String releases = Arrays.stream(infos)
+                .filter(e -> !e.name().equals(MODULE_INFO))
+                .map(ModuleInfoEntry::name)
+                .map(Main::versionFromEntryName)
+                .collect(joining(" "));
+        if (!releases.equals(""))
+            output("releases: " + releases + "\n");
+
+        // Describe the operative descriptor for the specified --release, if any
+        if (releaseValue != -1) {
+            ModuleInfoEntry entry = null;
+            int i = 0;
+            while (i < infos.length && lessThanEqualReleaseValue(infos[i])) {
+                entry = infos[i];
+                i++;
+            }
+
+            if (entry == null) {
+                output(formatMsg("error.no.operative.descriptor",
+                                 String.valueOf(releaseValue)));
+                return false;
+            }
+
+            String uriString = entry.uriString().orElse("");
+            try (InputStream is = entry.bytes()) {
+                describeModule(is, uriString);
+            }
+        } else {
+            // no specific --release specified, output the root, if any
+            if (infos[0].name().equals(MODULE_INFO)) {
+                String uriString = infos[0].uriString().orElse("");
+                try (InputStream is = infos[0].bytes()) {
+                    describeModule(is, uriString);
+                }
+            } else {
+                // no root, output message to specify --release
+                output(getMsg("error.no.root.descriptor"));
+            }
         }
         return true;
     }
 
     static <T> String toString(Collection<T> set) {
         if (set.isEmpty()) { return ""; }
-        return set.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
-                  .collect(joining(" "));
+        return " " + set.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
+                  .sorted().collect(joining(" "));
     }
 
-    private void describeModule(InputStream entryInputStream, String ename)
+
+    private void describeModule(InputStream entryInputStream, String uriString)
         throws IOException
     {
         ModuleInfo.Attributes attrs = ModuleInfo.read(entryInputStream, null);
@@ -1804,71 +1927,94 @@
         ModuleTarget target = attrs.target();
         ModuleHashes hashes = attrs.recordedHashes();
 
-        describeModule(md, target, hashes, ename);
+        describeModule(md, target, hashes, uriString);
     }
 
     private void describeModule(ModuleDescriptor md,
                                 ModuleTarget target,
                                 ModuleHashes hashes,
-                                String ename)
+                                String uriString)
         throws IOException
     {
         StringBuilder sb = new StringBuilder();
-        sb.append("\nmodule ")
-          .append(md.toNameAndVersion())
-          .append(" (").append(ename).append(")");
 
+        sb.append(md.toNameAndVersion());
+
+        if (!uriString.equals(""))
+            sb.append(" ").append(uriString);
         if (md.isOpen())
-            sb.append("\n  open ");
+            sb.append(" open");
+        if (md.isAutomatic())
+            sb.append(" automatic");
+        sb.append("\n");
 
-        md.requires().stream()
-            .sorted(Comparator.comparing(Requires::name))
-            .forEach(r -> {
-                sb.append("\n  requires ");
-                if (!r.modifiers().isEmpty())
-                    sb.append(toString(r.modifiers())).append(" ");
-                sb.append(r.name());
-            });
-
-        md.uses().stream().sorted()
-            .forEach(p -> sb.append("\n  uses ").append(p));
-
+        // unqualified exports (sorted by package)
         md.exports().stream()
-            .sorted(Comparator.comparing(Exports::source))
-            .forEach(p -> sb.append("\n  exports ").append(p));
+                .sorted(Comparator.comparing(Exports::source))
+                .filter(e -> !e.isQualified())
+                .forEach(e -> sb.append("exports ").append(e.source())
+                                .append(toString(e.modifiers())).append("\n"));
 
-        md.opens().stream()
-            .sorted(Comparator.comparing(Opens::source))
-            .forEach(p -> sb.append("\n  opens ").append(p));
+        // dependences
+        md.requires().stream().sorted()
+                .forEach(r -> sb.append("requires ").append(r.name())
+                                .append(toString(r.modifiers())).append("\n"));
 
-        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.stream().sorted()
-            .forEach(p -> sb.append("\n  contains ").append(p));
+        // service use and provides
+        md.uses().stream().sorted()
+                .forEach(s -> sb.append("uses ").append(s).append("\n"));
 
         md.provides().stream()
-            .sorted(Comparator.comparing(Provides::service))
-            .forEach(p -> sb.append("\n  provides ").append(p.service())
-                            .append(" with ")
-                            .append(toString(p.providers())));
+                .sorted(Comparator.comparing(Provides::service))
+                .forEach(p -> sb.append("provides ").append(p.service())
+                                .append(" with")
+                                .append(toString(p.providers()))
+                                .append("\n"));
 
-        md.mainClass().ifPresent(v -> sb.append("\n  main-class " + v));
+        // qualified exports
+        md.exports().stream()
+                .sorted(Comparator.comparing(Exports::source))
+                .filter(Exports::isQualified)
+                .forEach(e -> sb.append("qualified exports ").append(e.source())
+                                .append(" to").append(toString(e.targets()))
+                                .append("\n"));
+
+        // open packages
+        md.opens().stream()
+                .sorted(Comparator.comparing(Opens::source))
+                .filter(o -> !o.isQualified())
+                .forEach(o -> sb.append("opens ").append(o.source())
+                                 .append(toString(o.modifiers()))
+                                 .append("\n"));
+
+        md.opens().stream()
+                .sorted(Comparator.comparing(Opens::source))
+                .filter(Opens::isQualified)
+                .forEach(o -> sb.append("qualified opens ").append(o.source())
+                                 .append(toString(o.modifiers()))
+                                 .append(" to").append(toString(o.targets()))
+                                 .append("\n"));
+
+        // non-exported/non-open packages
+        Set<String> concealed = new TreeSet<>(md.packages());
+        md.exports().stream().map(Exports::source).forEach(concealed::remove);
+        md.opens().stream().map(Opens::source).forEach(concealed::remove);
+        concealed.forEach(p -> sb.append("contains ").append(p).append("\n"));
+
+        md.mainClass().ifPresent(v -> sb.append("main-class ").append(v).append("\n"));
 
         if (target != null) {
-            String osName = target.osName();
-            if (osName != null)
-                sb.append("\n  operating-system-name " + osName);
-            String osArch = target.osArch();
-            if (osArch != null)
-                sb.append("\n  operating-system-architecture " + osArch);
+            String targetPlatform = target.targetPlatform();
+            if (!targetPlatform.isEmpty())
+                sb.append("platform ").append(targetPlatform).append("\n");
        }
 
        if (hashes != null) {
            hashes.names().stream().sorted().forEach(
-                   mod -> sb.append("\n  hashes ").append(mod).append(" ")
+                   mod -> sb.append("hashes ").append(mod).append(" ")
                             .append(hashes.algorithm()).append(" ")
-                            .append(toHex(hashes.hashFor(mod))));
+                            .append(toHex(hashes.hashFor(mod)))
+                            .append("\n"));
         }
 
         output(sb.toString());
diff --git a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java
index 491d093..857e4ab 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java
@@ -116,7 +116,7 @@
             // version number strings need to be sorted numerically
             n = VERSIONS_DIR.length();   // skip the common prefix
             int i1 = s1.indexOf('/', n);
-            int i2 = s1.indexOf('/', n);
+            int i2 = s2.indexOf('/', n);
             if (i1 == -1) throw new InvalidJarException(s1);
             if (i2 == -1) throw new InvalidJarException(s2);
             // shorter version numbers go first
diff --git a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
index fe77135..a109083 100644
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
@@ -45,7 +45,7 @@
 	'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
 	 together!
 error.bad.dflag=\
-        '-d, --describe-module' option requires no input file(s) to be specified: {0}
+        '-d, --describe-module' option requires no input file(s) to be specified
 error.bad.reason=\
         bad reason: {0}, must be one of deprecated, deprecated-for-removal, or incubating
 error.nosuch.fileordir=\
@@ -62,6 +62,10 @@
         Hashing module {0} dependences, unable to find module {1} on module path
 error.module.options.without.info=\
         One of --module-version or --hash-modules without module-info.class
+error.no.operative.descriptor=\
+        No operative descriptor for release: {0}
+error.no.root.descriptor=\
+        No root module descriptor, specify --release
 error.unable.derive.automodule=\
         Unable to derive module descriptor for: {0}
 error.unexpected.module-info=\
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java
index 3286c73..65ef602 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -217,9 +217,6 @@
      * a member of this class or a superclass, if the size of the argument list
      * does not match the number of declared arguments for the method, or
      * if the method is an initializer, constructor or static intializer.
-     * @throws {@link InvalidTypeException} if any argument in the
-     * argument list is not assignable to the corresponding method argument
-     * type.
      * @throws ClassNotLoadedException if any argument type has not yet been loaded
      * through the appropriate class loader.
      * @throws IncompatibleThreadStateException if the specified thread has not
@@ -322,9 +319,6 @@
      * a member of this class, if the size of the argument list
      * does not match the number of declared arguments for the constructor,
      * or if the method is not a constructor.
-     * @throws {@link InvalidTypeException} if any argument in the
-     * argument list is not assignable to the corresponding method argument
-     * type.
      * @throws ClassNotLoadedException if any argument type has not yet been loaded
      * through the appropriate class loader.
      * @throws IncompatibleThreadStateException if the specified thread has not
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java
index 64a9fa4..8ff159f 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -168,9 +168,6 @@
      * a member of this interface, if the size of the argument list
      * does not match the number of declared arguments for the method, or
      * if the method is not static or is a static initializer.
-     * @throws {@link InvalidTypeException} if any argument in the
-     * argument list is not assignable to the corresponding method argument
-     * type.
      * @throws ClassNotLoadedException if any argument type has not yet been loaded
      * through the appropriate class loader.
      * @throws IncompatibleThreadStateException if the specified thread has not
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java
index 109500a..175c12a 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java
@@ -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
@@ -40,8 +40,9 @@
  * permission allows, and discusses the risks of granting code the
  * permission.
  *
- * <table border=1 cellpadding=5 summary="Table shows permission
- * target name, what the permission allows, and associated risks">
+ * <table border="1" cellpadding=5>
+ * <caption style="display:none">Table shows permission target name, what the
+ * permission allows, and associated risks</caption>
  * <tr>
  * <th>Permission Target Name</th>
  * <th>What the Permission Allows</th>
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java
index b17f241..42ea4ca 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +41,7 @@
  * Several mirror interfaces have locations. Each such mirror
  * extends a {@link Locatable} interface.
  * <p>
- * <a name="strata"><b>Strata</b></a>
+ * <a id="strata"><b>Strata</b></a>
  * <p>
  * The source information for a Location is dependent on the
  * <i>stratum</i> which is used. A stratum is a source code
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java
index fa93b01..fdef1ea 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -249,9 +249,6 @@
      * if the method is a constructor or static initializer, or
      * if {@link #INVOKE_NONVIRTUAL} is specified and the method is
      * abstract.
-     * @throws {@link InvalidTypeException} if any argument in the
-     * argument list is not assignable to the corresponding method argument
-     * type.
      * @throws ClassNotLoadedException if any argument type has not yet been loaded
      * through the appropriate class loader.
      * @throws IncompatibleThreadStateException if the specified thread has not
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
index 41b61fc..50ad027 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +45,14 @@
  * <P>
  * The following table illustrates which subinterfaces of Type
  * are used to mirror types in the target VM --
- * <TABLE BORDER=1 SUMMARY="Maps each type declared in target to a mirrored
- *  instance of a subinterface of PrimitiveType or ReferenceType">
- * <TR BGCOLOR="#EEEEFF">
+ * <TABLE BORDER="1">
+ * <CAPTION style="display:none">Maps each type declared in target to a mirrored
+ *  instance of a subinterface of PrimitiveType or ReferenceType"</CAPTION>
+ * <TR style="background-color:#EEEEFF">
  *   <TH id="primtype" colspan=3>Subinterfaces of {@link PrimitiveType}</TH>
- * <TR BGCOLOR="#EEEEFF">
- *   <TH id="declared" align="left" colspan=2>Type declared in target as</TH>
- *   <TH id="mirrored" align="left">Is mirrored as an instance of</TH>
+ * <TR style="background-color:#EEEEFF">
+ *   <TH id="declared" style="text-align:left" colspan=2>Type declared in target as</TH>
+ *   <TH id="mirrored" style="text-align:left">Is mirrored as an instance of</TH>
  * <TR>
  *   <TD headers="primtype declared" colspan=2><CODE>boolean</CODE></TD>
  *   <TD headers="primtype mirrored"> {@link BooleanType}</TD>
@@ -79,12 +80,12 @@
  * <TR>
  *   <TD headers="primtype declared" colspan=2><CODE>void</CODE></TD>
  *   <TD headers="primtype mirrored">{@link VoidType}</TD>
- * <TR BGCOLOR="#EEEEFF">
+ * <TR style="background-color:#EEEEFF">
  *   <TH id="reftype"  colspan=3>Subinterfaces of {@link ReferenceType}</TH>
- * <TR BGCOLOR="#EEEEFF">
- *   <TH id="declared2" align="left">Type declared in target as</TH>
- *   <TH id="example2"  align="left">For example</TH>
- *   <TH id="mirrored2" align="left">Is mirrored as an instance of</TH>
+ * <TR style="background-color:#EEEEFF">
+ *   <TH id="declared2"style="text-align:left">Type declared in target as</TH>
+ *   <TH id="example2"  style="text-align:left">For example</TH>
+ *   <TH id="mirrored2" style="text-align:left">Is mirrored as an instance of</TH>
  * <TR>
  *   <TD headers="reftype declared2"><I>a class</I></TD>
  *   <TD headers="reftype example2"><CODE>Date</CODE></TD>
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java
index 75e5e41..b54c7b7 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * value hierarchy encompassing primitive values and object values.
  * <P>
  * Some examples of where values may be accessed:
- * <BLOCKQUOTE><TABLE SUMMARY="layout">
+ * <BLOCKQUOTE><TABLE><CAPTION style="display:none">layout</CAPTION>
  * <TR>
  *   <TD>{@link ObjectReference#getValue(com.sun.jdi.Field)
  *                 ObjectReference.getValue(Field)}
@@ -52,15 +52,16 @@
  * <P>
  * The following table illustrates which subinterfaces of Value
  * are used to mirror values in the target VM --
- * <TABLE BORDER=1 SUMMARY="Maps each kind of value to a mirrored
- *  instance of a subinterface of Value">
- * <TR BGCOLOR="#EEEEFF">
+ * <TABLE BORDER="1">
+ * <CAPTION style="display:none">Maps each kind of value to a mirrored
+ *  instance of a subinterface of Value</CAPTION>
+ * <TR style="background-color:#EEEEFF">
  *   <TH id="primval" colspan=4>Subinterfaces of {@link PrimitiveValue}</TH>
- * <TR BGCOLOR="#EEEEFF">
- *   <TH id="kind"     align="left">Kind of value</TH>
- *   <TH id="example"  align="left">For example -<br>expression in target</TH>
- *   <TH id="mirrored" align="left">Is mirrored as an<br>instance of</TH>
- *   <TH id="type"     align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
+ * <TR style="background-color:#EEEEFF">
+ *   <TH id="kind"     style="text-align:left">Kind of value</TH>
+ *   <TH id="example"  style="text-align:left">For example -<br>expression in target</TH>
+ *   <TH id="mirrored" style="text-align:left">Is mirrored as an<br>instance of</TH>
+ *   <TH id="type"     style="text-align:left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
  * <TR>
  *   <TD headers="primval kind">     a boolean</TD>
  *   <TD headers="primval example">  {@code true}</TD>
@@ -106,13 +107,13 @@
  *   <TD headers="primval example">  </TD>
  *   <TD headers="primval mirrored"> {@link VoidValue}</TD>
  *   <TD headers="primval type">     {@link VoidType}</TD>
- * <TR BGCOLOR="#EEEEFF">
+ * <TR style="background-color:#EEEEFF">
  *   <TH id="objref" colspan=4>Subinterfaces of {@link ObjectReference}</TH>
- * <TR BGCOLOR="#EEEEFF">
- *   <TH id="kind2"     align="left">Kind of value</TH>
- *   <TH id="example2"  align="left">For example -<br>expression in target</TH>
- *   <TH id="mirrored2" align="left">Is mirrored as an<br>instance of</TH>
- *   <TH id="type2"     align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
+ * <TR style="background-color:#EEEEFF">
+ *   <TH id="kind2"     style="text-align:left">Kind of value</TH>
+ *   <TH id="example2"  style="text-align:left">For example -<br>expression in target</TH>
+ *   <TH id="mirrored2" style="text-align:left">Is mirrored as an<br>instance of</TH>
+ *   <TH id="type2"     style="text-align:left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
  * <TR>
  *   <TD headers="objref kind2">     a class instance</TD>
  *   <TD headers="objref example2">  {@code this}</TD>
@@ -148,13 +149,13 @@
  *   <TD headers="objref example2">  {@code this.getClass()}<br>&nbsp;&nbsp;{@code .getClassLoader()}</TD>
  *   <TD headers="objref mirrored2"> {@link ClassLoaderReference}</TD>
  *   <TD headers="objref type2">     {@link ClassType}</TD>
- * <TR BGCOLOR="#EEEEFF">
+ * <TR style="background-color:#EEEEFF">
  *   <TH id="other" colspan=4>Other</TH>
- * <TR BGCOLOR="#EEEEFF">
- *   <TD id="kind3"     align="left">Kind of value</TD>
- *   <TD id="example3"  align="left">For example -<br>expression in target</TD>
- *   <TD id="mirrored3" align="left">Is mirrored as</TD>
- *   <TD id="type3"     align="left">{@link Type} of value</TD>
+ * <TR style="background-color:#EEEEFF">
+ *   <TD id="kind3"     style="text-align:left">Kind of value</TD>
+ *   <TD id="example3"  style="text-align:left">For example -<br>expression in target</TD>
+ *   <TD id="mirrored3" style="text-align:left">Is mirrored as</TD>
+ *   <TD id="type3"     style="text-align:left">{@link Type} of value</TD>
  * <TR>
  *   <TD headers="other kind3">     null</TD>
  *   <TD headers="other example3">  {@code null}</TD>
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
index 58c435a..d8f6e0b 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,8 +51,8 @@
  * Some {@link com.sun.jdi.connect.Connector} implementations may require slightly
  * different handling than presented below.
  *
- * <TABLE BORDER WIDTH="75%" SUMMARY="Four scenarios for connecting a debugger
- *  to a virtual machine">
+ * <TABLE BORDER="1" style="width:75%">
+ * <CAPTION style="display:none">Four scenarios for connecting a debugger to a virtual machine"</CAPTION>
  * <TR>
  * <TH scope=col>Scenario</TH>
  * <TH scope=col>Description</TH>
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html
index b6b8d5c..3f3ac69 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html
@@ -4,7 +4,7 @@
 JDI Type Signatures
 </TITLE>
 </HEAD>
-<BODY BGCOLOR="white">
+<BODY style="background-color:white">
 <dl><dd>
 <Table Border="0">
 <caption><font size=5><b>JDI Type Signatures</b></font></caption>
diff --git a/jdk/src/jdk.jdi/share/classes/module-info.java b/jdk/src/jdk.jdi/share/classes/module-info.java
index 6be5591..e778655 100644
--- a/jdk/src/jdk.jdi/share/classes/module-info.java
+++ b/jdk/src/jdk.jdi/share/classes/module-info.java
@@ -45,8 +45,8 @@
  * Platform Debugger Architecture documentation</a> for this release and the <a
  * href="http://java.sun.com/products/jpda">Java Platform Debugger Architecture
  * website</a>.
- * <p>
- * <font size="+1"><b>Global Exceptions:</b></font>
+ * <p style="font-size:larger">
+ * <b>Global Exceptions:</b>
  * <p>
  * This section documents exceptions which apply to the entire API and are thus
  * not documented on individual methods.
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
index d0bfe78..b1f0ca1 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
@@ -152,14 +152,14 @@
     @Override
     public void storeFiles(ResourcePool files) {
         try {
-            String targetOsName = files.moduleView()
-                                       .findModule("java.base")
-                                       .map(ResourcePoolModule::osName)
-                                       .orElse(null);
-            if (targetOsName == null) {
+            String value = files.moduleView()
+                                .findModule("java.base")
+                                .map(ResourcePoolModule::targetPlatform)
+                                .orElse(null);
+            if (value == null) {
                 throw new PluginException("ModuleTarget attribute is missing for java.base module");
             }
-            this.targetPlatform = Platform.toPlatform(targetOsName);
+            this.targetPlatform = Platform.toPlatform(value);
 
             checkResourcePool(files);
 
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
index ad78055..6a24564 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
@@ -324,15 +324,9 @@
             }
 
             @Override
-            public String osName() {
+            public String targetPlatform() {
                 initModuleAttributes();
-                return target != null? target.osName() : null;
-            }
-
-            @Override
-            public String osArch() {
-                initModuleAttributes();
-                return target != null? target.osArch() : null;
+                return target != null? target.targetPlatform() : null;
             }
 
             private void initModuleAttributes() {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java
index 412a65a..6abdfb0 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java
@@ -40,12 +40,17 @@
     UNKNOWN;
 
     /**
-     * Returns the {@code Platform} of the given OS name specified
+     * Returns the {@code Platform} derived from the target platform
      * in the {@code ModuleTarget} attribute.
-     *
-     * @param osName OS name in ModuleTarget attribute
      */
-    public static Platform toPlatform(String osName) {
+    public static Platform toPlatform(String targetPlatform) {
+        String osName;
+        int index = targetPlatform.indexOf("-");
+        if (index < 0) {
+            osName = targetPlatform;
+        } else {
+            osName = targetPlatform.substring(0, index);
+        }
         try {
             return Platform.valueOf(osName.toUpperCase(Locale.ENGLISH));
         } catch (IllegalArgumentException e) {
@@ -57,9 +62,9 @@
      * Returns the {@code Platform} to which the given module is target to.
      */
     public static Platform getTargetPlatform(ResourcePoolModule module) {
-        String osName = module.osName();
-        if (osName != null) {
-            return toPlatform(osName);
+        String targetPlatform = module.targetPlatform();
+        if (targetPlatform != null) {
+            return toPlatform(targetPlatform);
         } else {
             return Platform.UNKNOWN;
         }
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
index e6b0843..5a5768d 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java
@@ -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
@@ -110,15 +110,9 @@
         }
 
         @Override
-        public String osName() {
+        public String targetPlatform() {
             initModuleAttributes();
-            return target != null? target.osName() : null;
-        }
-
-        @Override
-        public String osArch() {
-            initModuleAttributes();
-            return target != null? target.osArch() : null;
+            return target != null? target.targetPlatform() : null;
         }
 
         private void initModuleAttributes() {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
index bcdb1e9..3a1dcf9 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
@@ -33,13 +33,13 @@
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import jdk.tools.jlink.internal.ModuleSorter;
 import jdk.tools.jlink.internal.Utils;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
@@ -132,18 +132,16 @@
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy(Function.identity(), out);
 
-        Optional<ResourcePoolModule> javaBase = in.moduleView().findModule("java.base");
-        javaBase.ifPresent(mod -> {
-            // fill release information available from transformed "java.base" module!
-            ModuleDescriptor desc = mod.descriptor();
-            desc.version().ifPresent(s -> release.put("JAVA_VERSION",
-                    quote(parseVersion(s.toString()))));
-            desc.version().ifPresent(s -> release.put("JAVA_FULL_VERSION",
-                    quote(s.toString())));
+        ResourcePoolModule javaBase = in.moduleView().findModule("java.base")
+                                                     .orElse(null);
+        if (javaBase == null || javaBase.targetPlatform() == null) {
+            throw new PluginException("ModuleTarget attribute is missing for java.base module");
+        }
 
-            release.put("OS_NAME", quote(mod.osName()));
-            release.put("OS_ARCH", quote(mod.osArch()));
-        });
+        // fill release information available from transformed "java.base" module!
+        ModuleDescriptor desc = javaBase.descriptor();
+        desc.version().ifPresent(v -> release.put("JAVA_VERSION",
+                                                  quote(parseVersion(v))));
 
         // put topological sorted module names separated by space
         release.put("MODULES",  new ModuleSorter(in.moduleView())
@@ -152,14 +150,15 @@
 
         // create a TOP level ResourcePoolEntry for "release" file.
         out.add(ResourcePoolEntry.create("/java.base/release",
-            ResourcePoolEntry.Type.TOP, releaseFileContent()));
+                                         ResourcePoolEntry.Type.TOP,
+                                         releaseFileContent()));
         return out.build();
     }
 
     // Parse version string and return a string that includes only version part
     // leaving "pre", "build" information. See also: java.lang.Runtime.Version.
-    private static String parseVersion(String str) {
-        return Runtime.Version.parse(str)
+    private static String parseVersion(ModuleDescriptor.Version v) {
+        return Runtime.Version.parse(v.toString())
                       .version()
                       .stream()
                       .map(Object::toString)
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
index e5c66a8..bdd8b42 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
@@ -211,8 +211,7 @@
             // drop target attribute only if any OS property is present
             ModuleTarget target = attrs.target();
             if (dropModuleTarget && target != null) {
-                this.dropModuleTarget = (target.osName() != null)
-                                        || (target.osArch() != null);
+                this.dropModuleTarget = (target.targetPlatform() != null);
             } else {
                 this.dropModuleTarget = false;
             }
@@ -377,7 +376,7 @@
             }
 
             void dropModuleTarget() {
-                extender.targetPlatform("", "");
+                extender.targetPlatform("");
             }
 
             byte[] getBytes() throws IOException {
@@ -527,8 +526,7 @@
                 ModuleDescriptor md = moduleInfo.descriptor;
                 // drop ModuleTarget attribute if java.base has all OS properties
                 ModuleTarget target = moduleInfo.target();
-                if (dropModuleTarget
-                    && (target.osName() != null) && (target.osArch() != null)) {
+                if (dropModuleTarget && target.targetPlatform() != null) {
                     dropModuleTarget = true;
                 } else {
                     dropModuleTarget = false;
@@ -543,7 +541,7 @@
             moduleInfo.validatePackages();
 
             // module-info.class may be overridden for optimization
-            // 1. update ModuleTarget attribute to drop osName, osArch, osVersion
+            // 1. update ModuleTarget attribute to drop targetPlartform
             // 2. add/update ModulePackages attribute
             if (moduleInfo.shouldRewrite()) {
                 entry = entry.copyWithContent(moduleInfo.getBytes());
@@ -655,10 +653,9 @@
                     // new ModuleTarget(String, String)
                     mv.visitTypeInsn(NEW, MODULE_TARGET_CLASSNAME);
                     mv.visitInsn(DUP);
-                    mv.visitLdcInsn(minfo.target().osName());
-                    mv.visitLdcInsn(minfo.target().osArch());
+                    mv.visitLdcInsn(minfo.target().targetPlatform());
                     mv.visitMethodInsn(INVOKESPECIAL, MODULE_TARGET_CLASSNAME,
-                        "<init>", "(Ljava/lang/String;Ljava/lang/String;)V", false);
+                        "<init>", "(Ljava/lang/String;)V", false);
 
                     mv.visitInsn(AASTORE);
                 }
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java
index b4a736d..a129210 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java
@@ -58,18 +58,11 @@
     public ModuleDescriptor descriptor();
 
     /**
-     * The module target OS name for this module.
+     * The target platform
      *
-     * @return The module target OS name
+     * @return The target platform
      */
-    public String osName();
-
-    /**
-     * The module target OS arch for this module.
-     *
-     * @return The module target OS arch
-     */
-    public String osArch();
+    public String targetPlatform();
 
     /**
      * Retrieves all the packages located in this module.
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
index 69be83d..4b4f425 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
@@ -177,8 +177,7 @@
         ModuleFinder moduleFinder;
         Version moduleVersion;
         String mainClass;
-        String osName;
-        String osArch;
+        String targetPlatform;
         Pattern modulesToHash;
         ModuleResolution moduleResolution;
         boolean dryrun;
@@ -311,9 +310,9 @@
         try (JmodFile jf = new JmodFile(options.jmodFile)) {
             try (InputStream in = jf.getInputStream(Section.CLASSES, MODULE_INFO)) {
                 ModuleInfo.Attributes attrs = ModuleInfo.read(in, null);
-                printModuleDescriptor(attrs.descriptor(),
-                                      attrs.target(),
-                                      attrs.recordedHashes());
+                describeModule(attrs.descriptor(),
+                               attrs.target(),
+                               attrs.recordedHashes());
                 return true;
             } catch (IOException e) {
                 throw new CommandException("err.module.descriptor.not.found");
@@ -323,66 +322,92 @@
 
     static <T> String toString(Collection<T> c) {
         if (c.isEmpty()) { return ""; }
-        return c.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
-                  .collect(joining(" "));
+        return " " + c.stream().map(e -> e.toString().toLowerCase(Locale.ROOT))
+                .sorted().collect(joining(" "));
     }
 
-    private void printModuleDescriptor(ModuleDescriptor md,
-                                       ModuleTarget target,
-                                       ModuleHashes hashes)
+    private void describeModule(ModuleDescriptor md,
+                                ModuleTarget target,
+                                ModuleHashes hashes)
         throws IOException
     {
         StringBuilder sb = new StringBuilder();
-        sb.append("\n").append(md.toNameAndVersion());
 
-        md.requires().stream()
-            .sorted(Comparator.comparing(Requires::name))
-            .forEach(r -> {
-                sb.append("\n  requires ");
-                if (!r.modifiers().isEmpty())
-                    sb.append(toString(r.modifiers())).append(" ");
-                sb.append(r.name());
-            });
+        sb.append(md.toNameAndVersion());
 
-        md.uses().stream().sorted()
-            .forEach(s -> sb.append("\n  uses ").append(s));
+        if (md.isOpen())
+            sb.append(" open");
+        if (md.isAutomatic())
+            sb.append(" automatic");
+        sb.append("\n");
 
+        // unqualified exports (sorted by package)
         md.exports().stream()
-            .sorted(Comparator.comparing(Exports::source))
-            .forEach(p -> sb.append("\n  exports ").append(p));
+                .sorted(Comparator.comparing(Exports::source))
+                .filter(e -> !e.isQualified())
+                .forEach(e -> sb.append("exports ").append(e.source())
+                                .append(toString(e.modifiers())).append("\n"));
 
-        md.opens().stream()
-            .sorted(Comparator.comparing(Opens::source))
-            .forEach(p -> sb.append("\n  opens ").append(p));
+        // dependences
+        md.requires().stream().sorted()
+                .forEach(r -> sb.append("requires ").append(r.name())
+                                .append(toString(r.modifiers())).append("\n"));
 
-        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.stream().sorted()
-                 .forEach(p -> sb.append("\n  contains ").append(p));
+        // service use and provides
+        md.uses().stream().sorted()
+                .forEach(s -> sb.append("uses ").append(s).append("\n"));
 
         md.provides().stream()
-            .sorted(Comparator.comparing(Provides::service))
-            .forEach(p -> sb.append("\n  provides ").append(p.service())
-                            .append(" with ")
-                            .append(toString(p.providers())));
+                .sorted(Comparator.comparing(Provides::service))
+                .forEach(p -> sb.append("provides ").append(p.service())
+                                .append(" with")
+                                .append(toString(p.providers()))
+                                .append("\n"));
 
-        md.mainClass().ifPresent(v -> sb.append("\n  main-class " + v));
+        // qualified exports
+        md.exports().stream()
+                .sorted(Comparator.comparing(Exports::source))
+                .filter(Exports::isQualified)
+                .forEach(e -> sb.append("qualified exports ").append(e.source())
+                                .append(" to").append(toString(e.targets()))
+                                .append("\n"));
+
+        // open packages
+        md.opens().stream()
+                .sorted(Comparator.comparing(Opens::source))
+                .filter(o -> !o.isQualified())
+                .forEach(o -> sb.append("opens ").append(o.source())
+                                 .append(toString(o.modifiers()))
+                                 .append("\n"));
+
+        md.opens().stream()
+                .sorted(Comparator.comparing(Opens::source))
+                .filter(Opens::isQualified)
+                .forEach(o -> sb.append("qualified opens ").append(o.source())
+                                 .append(toString(o.modifiers()))
+                                 .append(" to").append(toString(o.targets()))
+                                 .append("\n"));
+
+        // non-exported/non-open packages
+        Set<String> concealed = new TreeSet<>(md.packages());
+        md.exports().stream().map(Exports::source).forEach(concealed::remove);
+        md.opens().stream().map(Opens::source).forEach(concealed::remove);
+        concealed.forEach(p -> sb.append("contains ").append(p).append("\n"));
+
+        md.mainClass().ifPresent(v -> sb.append("main-class ").append(v).append("\n"));
 
         if (target != null) {
-            String osName = target.osName();
-            if (osName != null)
-                sb.append("\n  operating-system-name " + osName);
-            String osArch = target.osArch();
-            if (osArch != null)
-                sb.append("\n  operating-system-architecture " + osArch);
-        }
+            String targetPlatform = target.targetPlatform();
+            if (!targetPlatform.isEmpty())
+                sb.append("platform ").append(targetPlatform).append("\n");
+       }
 
-        if (hashes != null) {
-            hashes.names().stream().sorted().forEach(
-                    mod -> sb.append("\n  hashes ").append(mod).append(" ")
-                             .append(hashes.algorithm()).append(" ")
-                             .append(toHex(hashes.hashFor(mod))));
+       if (hashes != null) {
+           hashes.names().stream().sorted().forEach(
+                   mod -> sb.append("hashes ").append(mod).append(" ")
+                            .append(hashes.algorithm()).append(" ")
+                            .append(toHex(hashes.hashFor(mod)))
+                            .append("\n"));
         }
 
         out.println(sb.toString());
@@ -437,8 +462,7 @@
 
         final Version moduleVersion = options.moduleVersion;
         final String mainClass = options.mainClass;
-        final String osName = options.osName;
-        final String osArch = options.osArch;
+        final String targetPlatform = options.targetPlatform;
         final List<PathMatcher> excludes = options.excludes;
         final ModuleResolution moduleResolution = options.moduleResolution;
 
@@ -534,9 +558,10 @@
                 if (mainClass != null)
                     extender.mainClass(mainClass);
 
-                // --os-name, --os-arch
-                if (osName != null || osArch != null)
-                    extender.targetPlatform(osName, osArch);
+                // --target-platform
+                if (targetPlatform != null) {
+                    extender.targetPlatform(targetPlatform);
+                }
 
                 // --module-version
                 if (moduleVersion != null)
@@ -1327,15 +1352,10 @@
                         .withRequiredArg()
                         .withValuesConvertedBy(new ModuleVersionConverter());
 
-        OptionSpec<String> osName
-                = parser.accepts("os-name", getMessage("main.opt.os-name"))
+        OptionSpec<String> targetPlatform
+                = parser.accepts("target-platform", getMessage("main.opt.target-platform"))
                         .withRequiredArg()
-                        .describedAs(getMessage("main.opt.os-name.arg"));
-
-        OptionSpec<String> osArch
-                = parser.accepts("os-arch", getMessage("main.opt.os-arch"))
-                        .withRequiredArg()
-                        .describedAs(getMessage("main.opt.os-arch.arg"));
+                        .describedAs(getMessage("main.opt.target-platform.arg"));
 
         OptionSpec<Void> doNotResolveByDefault
                 = parser.accepts("do-not-resolve-by-default",
@@ -1400,10 +1420,8 @@
                 options.moduleVersion = getLastElement(opts.valuesOf(moduleVersion));
             if (opts.has(mainClass))
                 options.mainClass = getLastElement(opts.valuesOf(mainClass));
-            if (opts.has(osName))
-                options.osName = getLastElement(opts.valuesOf(osName));
-            if (opts.has(osArch))
-                options.osArch = getLastElement(opts.valuesOf(osArch));
+            if (opts.has(targetPlatform))
+                options.targetPlatform = getLastElement(opts.valuesOf(targetPlatform));
             if (opts.has(warnIfResolved))
                 options.moduleResolution = getLastElement(opts.valuesOf(warnIfResolved));
             if (opts.has(doNotResolveByDefault)) {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
index acc7710..c6ca25a 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties
@@ -64,10 +64,8 @@
 main.opt.main-class=Main class
 main.opt.main-class.arg=class-name
 main.opt.man-pages=Location of man pages
-main.opt.os-name=Operating system name
-main.opt.os-name.arg=os-name
-main.opt.os-arch=Operating system architecture
-main.opt.os-arch.arg=os-arch
+main.opt.target-platform=Target platform
+main.opt.target-platform.arg=target-platform
 main.opt.module-path=Module path
 main.opt.hash-modules=Compute and record hashes to tie a packaged module\
 \ with modules matching the given <regex-pattern> and depending upon it directly\
diff --git a/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java
index 124c737..29c7e87 100644
--- a/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java
@@ -393,7 +393,7 @@
         } catch (JdpException e) {
             error(e);
         } catch (AgentConfigurationError err) {
-            error(err.getError(), err.getParams());
+            error(err);
         }
     }
 
@@ -454,7 +454,7 @@
             }
 
         } catch (AgentConfigurationError e) {
-            error(e.getError(), e.getParams());
+            error(e);
         } catch (Exception e) {
             error(e);
         }
@@ -665,18 +665,6 @@
         throw new RuntimeException(keyText);
     }
 
-    public static void error(String key, String[] params) {
-        if (params == null || params.length == 0) {
-            error(key);
-        } else {
-            StringBuilder message = new StringBuilder(params[0]);
-            for (int i = 1; i < params.length; i++) {
-                message.append(' ').append(params[i]);
-            }
-            error(key, message.toString());
-        }
-    }
-
     public static void error(String key, String message) {
         String keyText = getText(key);
         System.err.print(getText("agent.err.error") + ": " + keyText);
@@ -690,6 +678,23 @@
         throw new RuntimeException(e);
     }
 
+    public static void error(AgentConfigurationError e) {
+        String keyText = getText(e.getError());
+        String[] params = e.getParams();
+
+        System.err.print(getText("agent.err.error") + ": " + keyText);
+
+        if (params != null && params.length != 0) {
+           StringBuffer message = new StringBuffer(params[0]);
+           for (int i = 1; i < params.length; i++) {
+               message.append(" " + params[i]);
+           }
+           System.err.println(": " + message);
+        }
+        e.printStackTrace();
+        throw new RuntimeException(e);
+    }
+
     public static void warning(String key, String message) {
         System.err.print(getText("agent.err.warning") + ": " + getText(key));
         System.err.println(": " + message);
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 997cec6..16987c2 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -301,7 +301,4 @@
 
 org/omg/CORBA/OrbPropertiesTest.java			        8175177 generic-all
 
-sample/mergesort/MergeSortTest.java				8178912 generic-all
-sample/chatserver/ChatTest.java					8178912 generic-all
-
 ############################################################################
diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups
index 2b62b78..07f876c 100644
--- a/jdk/test/TEST.groups
+++ b/jdk/test/TEST.groups
@@ -272,8 +272,7 @@
     com/sun/jndi \
     com/sun/corba \
     org/omg/CORBA \
-    lib/testlibrary \
-    sample
+    lib/testlibrary
 
 #
 # SCTP is its own group as it is highly sensitive to kernel/network config
@@ -465,7 +464,6 @@
 needs_jdk = \
   :jdk_jdi \
   com/sun/tools \
-  demo \
   jdk/security/jarsigner \
   sun/security/tools/jarsigner \
   sun/security/tools/policytool \
@@ -775,7 +773,6 @@
   javax \
   jdk \
   lib \
-  sample \
   sun \
   vm \
  -:needs_full_vm_compact1 \
diff --git a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java
index 8aabcae..26071d4 100644
--- a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java
+++ b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,4 +102,4 @@
         Objects.requireNonNull(menuItem, "The menu item should still be available at this point");
         sMenu.remove(menuItem);
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java
index edc43d6..8073276 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
index 8d8df5c..2b98636 100644
--- a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
+++ b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -98,7 +98,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
index 81baff8..b6e2210 100644
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/jdi/CatchAllTest.sh b/jdk/test/com/sun/jdi/CatchAllTest.sh
index 52d1864..fb0ab6a 100644
--- a/jdk/test/com/sun/jdi/CatchAllTest.sh
+++ b/jdk/test/com/sun/jdi/CatchAllTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -76,7 +76,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/CatchCaughtTest.sh b/jdk/test/com/sun/jdi/CatchCaughtTest.sh
index 47a0d35..0322b5e 100644
--- a/jdk/test/com/sun/jdi/CatchCaughtTest.sh
+++ b/jdk/test/com/sun/jdi/CatchCaughtTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/CatchPatternTest.sh b/jdk/test/com/sun/jdi/CatchPatternTest.sh
index 0a45b38..b4a45d6 100644
--- a/jdk/test/com/sun/jdi/CatchPatternTest.sh
+++ b/jdk/test/com/sun/jdi/CatchPatternTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -108,7 +108,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
index c5beb90..a3da825 100644
--- a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
+++ b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -70,7 +70,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/DeferredStepTest.sh b/jdk/test/com/sun/jdi/DeferredStepTest.sh
index 528404f..82e97ff 100644
--- a/jdk/test/com/sun/jdi/DeferredStepTest.sh
+++ b/jdk/test/com/sun/jdi/DeferredStepTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -53,7 +53,7 @@
   static class  jj1 implements Runnable {
     public void  run() {
         int count = 0;
-        
+
         for ( int ii = 0; ii < 10; ii++) {  // line 6
             int intInPotato04 = 666;        // line 7
             ++count;                        // line 8; @1 breakpoint
@@ -65,7 +65,7 @@
   static class jj2 implements Runnable {
     public void run() {
         int count2 = 0;
-        
+
         for (int ii = 0; ii < 10; ii++) {      // line 18
             String StringInPotato05 = "I am";  // line 19
             ++count2;                          // line 20; @1 breakpoint
@@ -139,7 +139,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
@@ -157,7 +157,7 @@
 If this works right, you should see StepEvents/Breakpoint events for lines
    8, 9, 6, 7, 8, 9, 6, ....   for thread jj11
 and
-  20, 21, 18, 19, 20, 21, 18, ... for thread jj2 
+  20, 21, 18, 19, 20, 21, 18, ... for thread jj2
 
 Since both threads are running at the same time, these
 events can be intermixed.
@@ -179,5 +179,5 @@
 
 EOF
 runit
-#jdbFailIfPresent "Nothing suspended" 
+#jdbFailIfPresent "Nothing suspended"
 #pass
diff --git a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
index e8fc44c..06eadb4 100644
--- a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
+++ b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -96,7 +96,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/EvalArgs.sh b/jdk/test/com/sun/jdi/EvalArgs.sh
index aa3e75f..b1c2f65 100644
--- a/jdk/test/com/sun/jdi/EvalArgs.sh
+++ b/jdk/test/com/sun/jdi/EvalArgs.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -25,7 +25,7 @@
 
 #  @test
 #  @bug 4663146
-#  @summary Arguments match no method error 
+#  @summary Arguments match no method error
 #  @author Jim Holmlund/Suvasis
 #
 #  @run shell/timeout=300 EvalArgs.sh
@@ -72,13 +72,13 @@
         System.out.println( ffjj1(myjj1));
         System.out.println( ffjj1(myjj2));
 
-        System.out.println("$classname.ffoverload($classname.jjboolean) = " + 
+        System.out.println("$classname.ffoverload($classname.jjboolean) = " +
                             $classname.ffoverload($classname.jjboolean));
-        System.out.println("$classname.ffoverload($classname.jjbyte) = " + 
+        System.out.println("$classname.ffoverload($classname.jjbyte) = " +
                             $classname.ffoverload($classname.jjbyte));
-        System.out.println("$classname.ffoverload($classname.jjchar) = " + 
+        System.out.println("$classname.ffoverload($classname.jjchar) = " +
                             $classname.ffoverload($classname.jjchar));
-        System.out.println("$classname.ffoverload($classname.jjdouble) = " + 
+        System.out.println("$classname.ffoverload($classname.jjdouble) = " +
                             $classname.ffoverload($classname.jjdouble));
 
 
@@ -94,11 +94,11 @@
     public static String ffjj1(jj1 arg) {
         return arg.me;
     }
-    
+
     public static String ffjj2(jj2 arg) {
         return arg.me;
     }
-    
+
     static String ffboolean(boolean p1) {
         return "ffbool: p1 = " + p1;
     }
@@ -106,31 +106,31 @@
     static String ffbyte(byte p1) {
         return "ffbyte: p1 = " + p1;
     }
-        
+
     static String ffchar(char p1) {
         return "ffchar: p1 = " + p1;
     }
-        
+
     static String ffdouble(double p1) {
         return "ffdouble: p1 = " + p1;
     }
-        
+
     static String fffloat(float p1) {
         return "fffloat: p1 = " + p1;
     }
-        
+
     static String ffint(int p1) {
         return "ffint: p1 = " + p1;
     }
-        
+
     static String fflong(long p1) {
         return "fflong: p1 = " + p1;
     }
-        
+
     static String ffshort(short p1) {
         return "ffshort: p1 = " + p1;
     }
-        
+
     static String ffintArray(int[] p1) {
         return "ffintArray: p1 = " + p1;
     }
@@ -139,15 +139,15 @@
     public static String ffoverload(jj1 arg) {
         return arg.me;
     }
-    
+
     static String ffoverload(boolean p1) {
         return "ffoverload: boolean p1 = " + p1;
     }
-/***        
+/***
     static String ffoverload(byte p1) {
         return "ffoverload: byte p1 = " + p1;
     }
-***/        
+***/
     static String ffoverload(char p1) {
         return "ffoverload: char p1 = " + p1;
     }
@@ -159,11 +159,11 @@
     static String ffoverload(float p1) {
         return "ffoverload: float p1 = " + p1;
     }
-/***        
+/***
     static String ffoverload(int p1) {
         return "ffoverload: int p1 = " + p1;
     }
-***/        
+***/
     static String ffoverload(long p1) {
         return "ffoverload: long p1 = " + p1;
     }
@@ -171,7 +171,7 @@
     static String ffoverload(short p1) {
         return "ffoverload: short p1 = " + p1;
     }
-      
+
     static String ffoverload(int[] p1) {
         return "ffoverload: int array p1 = " + p1;
     }
@@ -184,7 +184,7 @@
     public String toString() {
         return me;
     }
-    
+
   }
 
   static class jj2 extends jj1 {
@@ -227,7 +227,7 @@
     # Provide a visual break in the output
     cmd print 1
 
-    # Verify mixing primitive types works ok 
+    # Verify mixing primitive types works ok
     # These should work even though the arg types are
     # not the same because there is only one
     # method with each name.
@@ -302,7 +302,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh b/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh
index 2910897..15ee917 100644
--- a/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh
+++ b/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh b/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh
index bba2d90..b4cff66 100644
--- a/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh
+++ b/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -69,7 +69,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/JdbExprTest.sh b/jdk/test/com/sun/jdi/JdbExprTest.sh
index a3c4ce1..a8c11e0 100644
--- a/jdk/test/com/sun/jdi/JdbExprTest.sh
+++ b/jdk/test/com/sun/jdi/JdbExprTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
     public static void bkpt() {
        int i = 0;     //@1 breakpoint
     }
-    
+
     public static void main(String[] args) {
         bkpt();
     }
@@ -73,7 +73,7 @@
 
     cmd print java.lang.Long.MIN_VALUE
     jdbFailIfNotPresent " \= \-9223372036854775808" 3
-    
+
     cmd print 9223372036854775807L
     jdbFailIfNotPresent "9223372036854775807L = 9223372036854775807" 3
     cmd print 9223372036854775807
@@ -83,7 +83,7 @@
     jdbFailIfNotPresent "\-9223372036854775807L = \-9223372036854775807" 3
     cmd print -9223372036854775807
     jdbFailIfNotPresent "\-9223372036854775807 = \-9223372036854775807" 3
-    
+
     cmd print -1
     jdbFailIfNotPresent "\-1 = \-1" 3
     cmd print 1L
@@ -92,7 +92,7 @@
     jdbFailIfNotPresent "\-1L = \-1" 3
     cmd print 0x1
     jdbFailIfNotPresent "0x1 = 1" 3
-    
+
     cmd set $classname.aLong = 9223372036854775807L
     cmd print $classname.aLong
     jdbFailIfNotPresent "$classname.aLong = 9223372036854775807" 3
@@ -142,7 +142,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/JdbLockTest.sh b/jdk/test/com/sun/jdi/JdbLockTest.sh
index 6558b98..ac5b33e 100644
--- a/jdk/test/com/sun/jdi/JdbLockTest.sh
+++ b/jdk/test/com/sun/jdi/JdbLockTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2003, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/MixedSuspendTest.sh b/jdk/test/com/sun/jdi/MixedSuspendTest.sh
index 00f5f5d..a676d8e 100644
--- a/jdk/test/com/sun/jdi/MixedSuspendTest.sh
+++ b/jdk/test/com/sun/jdi/MixedSuspendTest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/jdi/NullLocalVariable.sh b/jdk/test/com/sun/jdi/NullLocalVariable.sh
index ce38929..14447d1 100644
--- a/jdk/test/com/sun/jdi/NullLocalVariable.sh
+++ b/jdk/test/com/sun/jdi/NullLocalVariable.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -40,10 +40,10 @@
     public static final void main(String args[]) {
         try {
             System.out.println("hi!");               // @1 breakpoint
-        } catch (Exception e) {         
+        } catch (Exception e) {
             e.printStackTrace();
         } finally {
-            System.out.println("done"); 
+            System.out.println("done");
         }
     }
 }
@@ -71,7 +71,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java
index 66f576f..dbc18ec 100644
--- a/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java
+++ b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh b/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh
index b14a422..0113c33 100644
--- a/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh
+++ b/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -135,7 +135,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/RedefineException.sh b/jdk/test/com/sun/jdi/RedefineException.sh
index c2f0555..19ea8cc 100644
--- a/jdk/test/com/sun/jdi/RedefineException.sh
+++ b/jdk/test/com/sun/jdi/RedefineException.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -75,7 +75,7 @@
       }
       System.out.println("a2: done");
     }
-  
+
     public void a3() throws Exception {
       int a3local = 3;
       String a3string = "a3";
@@ -105,7 +105,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/RedefineImplementor.sh b/jdk/test/com/sun/jdi/RedefineImplementor.sh
index dd7f83e..071ceec 100644
--- a/jdk/test/com/sun/jdi/RedefineImplementor.sh
+++ b/jdk/test/com/sun/jdi/RedefineImplementor.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -81,7 +81,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
index bd3bb51..049d6b6 100644
--- a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
+++ b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -50,13 +50,13 @@
     }
 
     public long m2(int j) {
-        System.out.println(System.getProperty("line.separator") + 
+        System.out.println(System.getProperty("line.separator") +
                            "**** public long m2(int j) with value: " + j);
         return j;
     }
 
     public long m2(long j) {
-        System.out.println(System.getProperty("line.separator") + 
+        System.out.println(System.getProperty("line.separator") +
                            "**** public long m2(long j) with value: " + j);
         return j;
     }
@@ -102,7 +102,7 @@
 
     for ii in . $TESTSRC $TESTSRC/.. ; do
         if [ -r "$ii/ShellScaffold.sh" ] ; then
-            . $ii/ShellScaffold.sh 
+            . $ii/ShellScaffold.sh
             break
         fi
     done
diff --git a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
index bdb3a0c..db33387 100644
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java
index 1f98e2b..4a0f1d8 100644
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java
@@ -66,6 +66,7 @@
                     "-XX:+UseCodeAging",
                     "-XX:+UseCerealGC",         // Should be ignored.
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
+                    "-Djdk.attach.allowAttachSelf",
                     "-cp", System.getProperty("test.class.path"),
                     "CheckOrigin",
                     "-runtests");
diff --git a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java
index c33ded9..e9d420a 100644
--- a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java
+++ b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
index c10d767..4eef659 100644
--- a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
+++ b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/test/com/sun/net/httpserver/bugs/B6433018.java b/jdk/test/com/sun/net/httpserver/bugs/B6433018.java
index 3193530..f9ff846 100644
--- a/jdk/test/com/sun/net/httpserver/bugs/B6433018.java
+++ b/jdk/test/com/sun/net/httpserver/bugs/B6433018.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -103,4 +103,3 @@
         }
     }
 }
-
diff --git a/jdk/test/com/sun/tools/attach/AttachSelf.java b/jdk/test/com/sun/tools/attach/AttachSelf.java
new file mode 100644
index 0000000..4e21492
--- /dev/null
+++ b/jdk/test/com/sun/tools/attach/AttachSelf.java
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.attach.VirtualMachine;
+
+import java.io.IOException;
+
+/**
+ * @test
+ * @modules jdk.attach
+ * @run main AttachSelf
+ * @run main/othervm -Djdk.attach.allowAttachSelf AttachSelf
+ * @run main/othervm -Djdk.attach.allowAttachSelf=true AttachSelf
+ * @run main/othervm -Djdk.attach.allowAttachSelf=false AttachSelf
+ */
+
+public class AttachSelf {
+
+    public static void main(String[] args) throws Exception {
+
+        String value = System.getProperty("jdk.attach.allowAttachSelf");
+        boolean canAttachSelf = (value != null) && !value.equals("false");
+
+        String vmid = "" + ProcessHandle.current().pid();
+
+        VirtualMachine vm = null;
+        try {
+            vm = VirtualMachine.attach(vmid);
+            if (!canAttachSelf)
+                throw new RuntimeException("Attached to self not expected");
+        } catch (IOException ioe) {
+            if (canAttachSelf)
+                throw ioe;
+        } finally {
+            if (vm != null) vm.detach();
+        }
+
+    }
+
+}
+
diff --git a/jdk/test/com/sun/tools/attach/PermissionTest.java b/jdk/test/com/sun/tools/attach/PermissionTest.java
index 1d74abb..9b034a2 100644
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/tools/attach/ProviderTest.java b/jdk/test/com/sun/tools/attach/ProviderTest.java
index 6c0125b..ed76290 100644
--- a/jdk/test/com/sun/tools/attach/ProviderTest.java
+++ b/jdk/test/com/sun/tools/attach/ProviderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/tools/attach/RunnerUtil.java b/jdk/test/com/sun/tools/attach/RunnerUtil.java
index 71c2508..1d7f0cc 100644
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java
@@ -48,7 +48,10 @@
      */
     public static ProcessThread startApplication(String... additionalOpts) throws Throwable {
         String classpath = System.getProperty("test.class.path", ".");
-        String[] myArgs = concat(additionalOpts, new String [] { "-XX:+UsePerfData", "-Dattach.test=true", "-classpath", classpath, "Application" });
+        String[] myArgs = concat(additionalOpts, new String [] {
+            "-XX:+UsePerfData", "-XX:+EnableDynamicAgentLoading",
+            "-Dattach.test=true", "-classpath", classpath, "Application"
+        });
         String[] args = Utils.addTestJavaOpts(myArgs);
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
         ProcessThread pt = new ProcessThread("runApplication", (line) -> line.equals(Application.READY_MSG), pb);
diff --git a/jdk/test/com/sun/tools/attach/StartManagementAgent.java b/jdk/test/com/sun/tools/attach/StartManagementAgent.java
index 5abeba2..1a5234b 100644
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/tools/attach/TempDirTest.java b/jdk/test/com/sun/tools/attach/TempDirTest.java
index 0ae0a46..5be1bc3 100644
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/com/sun/tools/attach/java.policy.allow b/jdk/test/com/sun/tools/attach/java.policy.allow
index 6c93a65..3e63a20 100644
--- a/jdk/test/com/sun/tools/attach/java.policy.allow
+++ b/jdk/test/com/sun/tools/attach/java.policy.allow
@@ -8,7 +8,8 @@
     permission com.sun.tools.attach.AttachPermission "createAttachProvider";
 
     /* implementation specific */
-    permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+    permission java.lang.RuntimePermission "manageProcess";
+    permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
     permission java.lang.RuntimePermission "accessClassInPackage.sun.tools.attach";
     permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmstat.monitor";
     permission java.lang.RuntimePermission "loadLibrary.attach";
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/com/sun/tools/attach/modules/Agent.java
similarity index 81%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/com/sun/tools/attach/modules/Agent.java
index f4974e3..7d91502 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/com/sun/tools/attach/modules/Agent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,10 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+import java.lang.instrument.Instrumentation;
 
-public interface Atomic {
+public class Agent {
 
+    public static void agentmain(String agentArgs, Instrumentation inst) {
+    }
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/com/sun/tools/attach/modules/Driver.java
similarity index 62%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/com/sun/tools/attach/modules/Driver.java
index f4974e3..7323709 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/com/sun/tools/attach/modules/Driver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,15 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+/**
+ * @test
+ * @modules jdk.attach
+ * @build m/* Agent
+ * @run main/othervm -Djdk.attach.allowAttachSelf m/p.Main jmx javaagent
+ * @run main/othervm -Djdk.attach.allowAttachSelf m/p.Main javaagent jmx
+ * @run main/othervm --limit-modules=jdk.attach -Djdk.attach.allowAttachSelf m/p.Main jmx javaagent
+ * @run main/othervm --limit-modules=jdk.attach -Djdk.attach.allowAttachSelf m/p.Main javaagent jmx
+ * @summary Basic test to ensure that a JMX agent or a tool agent can be loaded/started in
+  *         a modular application.
+ */
 
-public interface Atomic {
-
-}
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/com/sun/tools/attach/modules/m/module-info.java
similarity index 87%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/com/sun/tools/attach/modules/m/module-info.java
index f4974e3..ae7e4d1 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/com/sun/tools/attach/modules/m/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,7 @@
  * questions.
  */
 
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module m {
+    exports p;
+    requires jdk.attach;
 }
diff --git a/jdk/test/com/sun/tools/attach/modules/m/p/Main.java b/jdk/test/com/sun/tools/attach/modules/m/p/Main.java
new file mode 100644
index 0000000..b58822b
--- /dev/null
+++ b/jdk/test/com/sun/tools/attach/modules/m/p/Main.java
@@ -0,0 +1,164 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import com.sun.tools.attach.VirtualMachine;
+
+public class Main {
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("#modules loaded: " + moduleInfoCont());
+
+        String vmid = "" + ProcessHandle.current().pid();
+        VirtualMachine vm = VirtualMachine.attach(vmid);
+
+        for (String test : args) {
+            switch (test) {
+                case "jmx" :
+                    startJMXAgent(vm);
+                    break;
+                case "javaagent" :
+                    startJavaAgent(vm, createAgentJar());
+                    break;
+            }
+
+            System.out.println("#modules loaded: " + moduleInfoCont());
+        }
+    }
+
+    /**
+     * Locates module-info.class resources to get a count of the module of system
+     * modules.
+     */
+    static long moduleInfoCont() {
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        return scl.resources("module-info.class").count();
+    }
+
+    /**
+     * Starts a JMX agent and checks that java.management is loaded.
+     */
+    static void startJMXAgent(VirtualMachine vm) throws Exception {
+        System.out.println("Start JMX agent");
+        vm.startLocalManagementAgent();
+
+        // types in java.management should be visible
+        Class.forName("javax.management.MXBean");
+    }
+
+    /**
+     * Loads a java agent into the VM and checks that java.instrument is loaded.
+     */
+    static void startJavaAgent(VirtualMachine vm, Path agent) throws Exception {
+        System.out.println("Load java agent ...");
+        vm.loadAgent(agent.toString());
+
+        // the Agent class should be visible
+        Class.forName("Agent");
+
+        // types in java.instrument should be visible
+        Class.forName("java.lang.instrument.Instrumentation");
+    }
+
+    /**
+     * Creates a java agent, return the file path to the agent JAR file.
+     */
+    static Path createAgentJar() throws IOException {
+        Manifest man = new Manifest();
+        Attributes attrs = man.getMainAttributes();
+        attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0.0");
+        attrs.put(new Attributes.Name("Agent-Class"), "Agent");
+        Path agent = Paths.get("agent.jar");
+        Path dir = Paths.get(System.getProperty("test.classes"));
+        createJarFile(agent, man, dir, "Agent.class");
+        return agent;
+    }
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
+     *
+     * The input files are resolved against the given directory. Any input
+     * files that are directories are processed recursively.
+     */
+    static void createJarFile(Path jarfile, Manifest man, Path dir, String... files)
+        throws IOException
+    {
+        // create the target directory
+        Path parent = jarfile.getParent();
+        if (parent != null)
+            Files.createDirectories(parent);
+
+        List<Path> entries = new ArrayList<>();
+        for (String file : files) {
+            Files.find(dir.resolve(file), Integer.MAX_VALUE,
+                    (p, attrs) -> attrs.isRegularFile())
+                    .map(e -> dir.relativize(e))
+                    .forEach(entries::add);
+        }
+
+        try (OutputStream out = Files.newOutputStream(jarfile);
+             JarOutputStream jos = new JarOutputStream(out))
+        {
+            if (man != null) {
+                JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
+                jos.putNextEntry(je);
+                man.write(jos);
+                jos.closeEntry();
+            }
+
+            for (Path entry : entries) {
+                String name = toJarEntryName(entry);
+                jos.putNextEntry(new JarEntry(name));
+                Files.copy(dir.resolve(entry), jos);
+                jos.closeEntry();
+            }
+        }
+    }
+
+    /**
+     * Map a file path to the equivalent name in a JAR file
+     */
+    static String toJarEntryName(Path file) {
+        Path normalized = file.normalize();
+        return normalized.subpath(0, normalized.getNameCount())
+                .toString()
+                .replace(File.separatorChar, '/');
+    }
+}
diff --git a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
index 17587f9..35819bd 100644
--- a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
+++ b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html
index 2367cfc..356ad0f 100644
--- a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html
+++ b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java
index 980816e..76a432e 100644
--- a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java
+++ b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java b/jdk/test/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
index b84d00b..80c0dbb 100644
--- a/jdk/test/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
+++ b/jdk/test/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java b/jdk/test/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java
index 05d3ddf..853ff02 100644
--- a/jdk/test/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java
+++ b/jdk/test/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java b/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java
index 50cf7b0..7846ba7 100644
--- a/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java
+++ b/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011,2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html b/jdk/test/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
index 5913557..9b1adab 100644
--- a/jdk/test/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
+++ b/jdk/test/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2007 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  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 @@
 -->
 
 <html>
-<!--  
+<!--
   @test
   @bug 4934185
   @summary JCK1.5-runtime-interactive: XToolkit FileDialog does not work as expected
diff --git a/jdk/test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java b/jdk/test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
index e83306d..e988289 100644
--- a/jdk/test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
+++ b/jdk/test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/test/java/awt/Frame/FrameResize/ShowChildWhileResizingTest.java b/jdk/test/java/awt/Frame/FrameResize/ShowChildWhileResizingTest.java
index 69c7b84..62bbbda 100644
--- a/jdk/test/java/awt/Frame/FrameResize/ShowChildWhileResizingTest.java
+++ b/jdk/test/java/awt/Frame/FrameResize/ShowChildWhileResizingTest.java
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java b/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java
index 809e7ff..f9ad36f 100644
--- a/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java
+++ b/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
diff --git a/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java b/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
index 7f1ddeb..d2ea7bd 100644
--- a/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
+++ b/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
index 9bdd874..827e210 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017 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
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
index 223ffa4..ce9793f 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017 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
@@ -165,4 +165,3 @@
     }
 
 }
-
diff --git a/jdk/test/java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java b/jdk/test/java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java
index 3393def..baa893e 100644
--- a/jdk/test/java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java
+++ b/jdk/test/java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
index 53b3e10..772fb92 100644
--- a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
+++ b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017 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
diff --git a/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
index b88becb..5ebb6c6 100644
--- a/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
@@ -1,7 +1,7 @@
 #!/bin/ksh -p
 
 #
-# Copyright (c) 20015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -48,7 +48,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -76,8 +76,8 @@
 esac
 
 
-# Want this test to run standalone as well as in the harness, so do the 
-#  following to copy the test's directory into the harness's scratch directory 
+# Want this test to run standalone as well as in the harness, so do the
+#  following to copy the test's directory into the harness's scratch directory
 #  and set all appropriate variables:
 
 if [ -z "${TESTJAVA}" ] ; then
@@ -100,25 +100,25 @@
 echo "JDK under test is: $TESTJAVA"
 
 #Deal with .class files:
-if [ -n "${STANDALONE}" ] ; 
-   then 
+if [ -n "${STANDALONE}" ] ;
+   then
    #if standalone, remind user to cd to dir. containing test before running it
    echo "Just a reminder: cd to the dir containing this test when running it"
    # then compile all .java files (if there are any) into .class files
-   if [ -a *.java ] ; 
+   if [ -a *.java ] ;
       then echo "Reminder, this test should be in its own directory with all"
       echo "supporting files it needs in the directory with it."
-      ${TESTJAVA}/bin/javac ./*.java ; 
+      ${TESTJAVA}/bin/javac ./*.java ;
    fi
    # else in harness so copy all the class files from where jtreg put them
-   # over to the scratch directory this test is running in. 
+   # over to the scratch directory this test is running in.
    else cp ${TESTCLASSES}/*.class . ;
 fi
 
-#if in test harness, then copy the entire directory that the test is in over 
+#if in test harness, then copy the entire directory that the test is in over
 # to the scratch directory.  This catches any support files needed by the test.
-if [ -z "${STANDALONE}" ] ; 
-   then cp ${TESTSRC}/* . 
+if [ -z "${STANDALONE}" ] ;
+   then cp ${TESTSRC}/* .
 fi
 
 #Just before executing anything, make sure it has executable permission!
@@ -156,4 +156,3 @@
 
 #For additional examples of how to write platform independent KSH scripts,
 # see the jtreg file itself.  It is a KSH script for both Solaris and Win32
-
diff --git a/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java
index a46b798..0ac17b3 100644
--- a/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java
+++ b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.java b/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.java
index 8c09faa..0d4f0cc 100644
--- a/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.java
+++ b/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,4 +107,4 @@
             stop();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
index 93a1bad..233be91 100644
--- a/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
+++ b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java b/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java
index 997cac3..a9ea6ec 100644
--- a/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java
+++ b/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java
@@ -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
@@ -76,7 +76,7 @@
 
         mouseDragAndDrop(robot, point, getCenterPoint(targetFrame));
 
-        long time = System.currentTimeMillis() + 200;
+        long time = System.currentTimeMillis() + 1000;
 
         while (!passed) {
             if (time < System.currentTimeMillis()) {
@@ -222,10 +222,12 @@
                 }
                 Thread.sleep(10);
             }
-
-            Point point = getCenterPoint(dialog);
             Robot robot = new Robot();
             robot.setAutoDelay(50);
+            robot.waitForIdle();
+            robot.delay(200);
+
+            Point point = getCenterPoint(dialog);
 
             robot.mouseMove(point.x, point.y);
             robot.mousePress(InputEvent.BUTTON1_MASK);
diff --git a/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java b/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
index d16cd41..d3e866c 100644
--- a/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 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
diff --git a/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java b/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java
index e74edf8..b060707 100644
--- a/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java
+++ b/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java
@@ -18,6 +18,7 @@
  *
  * Please 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
diff --git a/jdk/test/java/awt/font/TextLayout/MissingCodePointLayoutTest.java b/jdk/test/java/awt/font/TextLayout/MissingCodePointLayoutTest.java
index 3d1ff85..67960cd 100644
--- a/jdk/test/java/awt/font/TextLayout/MissingCodePointLayoutTest.java
+++ b/jdk/test/java/awt/font/TextLayout/MissingCodePointLayoutTest.java
@@ -18,6 +18,7 @@
  *
  * Please 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
diff --git a/jdk/test/java/io/RandomAccessFile/FileLengthTest.java b/jdk/test/java/io/RandomAccessFile/FileLengthTest.java
index 3f5bff1..b7d1a42 100644
--- a/jdk/test/java/io/RandomAccessFile/FileLengthTest.java
+++ b/jdk/test/java/io/RandomAccessFile/FileLengthTest.java
@@ -9,7 +9,7 @@
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE randomAccessFile that
+ * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
  * You should have received a copy of the GNU General Public License version
diff --git a/jdk/test/java/lang/ClassLoader/CustomSystemLoader/CustomLoader.java b/jdk/test/java/lang/ClassLoader/CustomSystemLoader/CustomLoader.java
new file mode 100644
index 0000000..f367a50
--- /dev/null
+++ b/jdk/test/java/lang/ClassLoader/CustomSystemLoader/CustomLoader.java
@@ -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.
+ */
+
+import java.io.PrintStream;
+
+/*
+ * Custom system class loader.
+ */
+public class CustomLoader extends ClassLoader {
+    private static PrintStream out = System.out;
+    public  static ClassLoader INSTANCE;
+
+    public CustomLoader(ClassLoader classLoader) {
+        super("CustomSystemLoader", classLoader);
+        assert INSTANCE == null;
+        INSTANCE = this;
+
+        // test cases to validate that ClassLoader::getSystemClassLoader
+        // is not triggered during custom system class loader initialization
+        testEnumValueOf();
+    }
+
+    static void testEnumValueOf() {
+        TestEnum e = java.lang.Enum.valueOf(TestEnum.class, "C1");
+        if (e != TestEnum.C1) {
+            throw new RuntimeException("Expected: " + TestEnum.C1 + " got: " + e);
+        }
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+        out.println("CustomLoader: loading class: " + name);
+        return super.loadClass(name);
+    }
+
+    static enum TestEnum {
+        C1, C2, C3
+    }
+}
diff --git a/jdk/test/java/lang/ClassLoader/CustomSystemLoader/InitSystemLoaderTest.java b/jdk/test/java/lang/ClassLoader/CustomSystemLoader/InitSystemLoaderTest.java
new file mode 100644
index 0000000..d559129
--- /dev/null
+++ b/jdk/test/java/lang/ClassLoader/CustomSystemLoader/InitSystemLoaderTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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 8179950
+ * @build CustomLoader InitSystemLoaderTest
+ * @run main/othervm -Djava.system.class.loader=CustomLoader InitSystemLoaderTest
+ * @summary Test custom system loader initialization and verify their ancestors
+ */
+
+public class InitSystemLoaderTest {
+    public static void main(String... args) {
+        // check that system class loader is the custom loader
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        if (loader != CustomLoader.INSTANCE) {
+            throw new RuntimeException("Expected custom loader: "
+                + CustomLoader.INSTANCE + " got: " + loader);
+        }
+
+        // parent of the custom loader should be builtin system class loader
+        ClassLoader builtinSystemLoader = loader.getParent();
+        ClassLoader grandparent = builtinSystemLoader.getParent();
+        if (grandparent != ClassLoader.getPlatformClassLoader()) {
+            throw new RuntimeException("Expected class loader ancestor: "
+                + ClassLoader.getPlatformClassLoader() + " got: " + grandparent);
+        }
+    }
+}
diff --git a/jdk/test/java/lang/instrument/RedefineBigClass.sh b/jdk/test/java/lang/instrument/RedefineBigClass.sh
index 4f625a7..1c2bfb6 100644
--- a/jdk/test/java/lang/instrument/RedefineBigClass.sh
+++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
     -Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \
     -javaagent:RedefineBigClassAgent.jar=BigClass.class \
     -classpath "${TESTCLASSES}" RedefineBigClassApp \
-    > output.log 2>&1 
+    > output.log 2>&1
 result=$?
 
 cat output.log
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/instrument/executableJAR/Agent.java
similarity index 77%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/lang/instrument/executableJAR/Agent.java
index f4974e3..a537bd4 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/instrument/executableJAR/Agent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,13 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+import java.lang.instrument.Instrumentation;
 
-public interface Atomic {
+public class Agent {
 
+    public static Instrumentation inst;
+
+    public static void agentmain(String agentArgs, Instrumentation inst) {
+        Agent.inst = inst;
+    }
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/instrument/executableJAR/AgentHelper.java
similarity index 87%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/lang/instrument/executableJAR/AgentHelper.java
index f4974e3..47bd506 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/instrument/executableJAR/AgentHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,5 @@
  * questions.
  */
 
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+public class AgentHelper {
 }
diff --git a/jdk/test/java/lang/instrument/executableJAR/ExecJarWithAgent.java b/jdk/test/java/lang/instrument/executableJAR/ExecJarWithAgent.java
new file mode 100644
index 0000000..1fc82d7
--- /dev/null
+++ b/jdk/test/java/lang/instrument/executableJAR/ExecJarWithAgent.java
@@ -0,0 +1,138 @@
+/*
+ * 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
+ * @library /lib/testlibrary
+ * @build ExecJarWithAgent Main Agent AgentHelper JarUtils jdk.testlibrary.*
+ * @run testng ExecJarWithAgent
+ * @summary Test starting agents in executable JAR files
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.stream.Stream;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.OutputAnalyzer;
+
+@Test
+public class ExecJarWithAgent {
+
+    /**
+     * Basic test of java -jar with agent in the executable JAR
+     */
+    public void testBasic() throws Exception {
+        Manifest man = new Manifest();
+        Attributes attrs = man.getMainAttributes();
+        attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0.0");
+        attrs.put(Attributes.Name.MAIN_CLASS, "Main");
+        attrs.put(new Attributes.Name("Launcher-Agent-Class"), "Agent");
+
+        // require all capabilities
+        attrs.put(new Attributes.Name("Can-Redefine-Classes"), "true");
+        attrs.put(new Attributes.Name("Can-Retransform-Classes"), "true");
+        attrs.put(new Attributes.Name("Can-Set-Native-Method-Prefix"), "true");
+        attrs.put(new Attributes.Name("Boot-Class-Path"), "helper.jar");
+
+        Path app = Paths.get("app.jar");
+        Path dir = Paths.get(System.getProperty("test.classes"));
+
+        Path[] paths = Stream.of("Main.class", "Agent.class")
+                .map(Paths::get)
+                .toArray(Path[]::new);
+
+        JarUtils.createJarFile(app, man, dir, paths);
+
+        // helper API to test that the BCP has been extended
+        Path helper = Paths.get("helper.jar");
+        JarUtils.createJarFile(helper, dir, "AgentHelper.class");
+
+        // java -jar app.jar
+        assertEquals(exec(app).getExitValue(), 0);
+    }
+
+    /**
+     * Test that java -jar fails when the executable JAR has the
+     * Launcher-Agent-Class attribute but the class cannot be loaded.
+     */
+    public void testBadAgentClass() throws Exception {
+        Manifest man = new Manifest();
+        Attributes attrs = man.getMainAttributes();
+        attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0.0");
+        attrs.put(Attributes.Name.MAIN_CLASS, "Main");
+
+        // agent class does not exist
+        attrs.put(new Attributes.Name("Launcher-Agent-Class"), "BadAgent");
+
+        Path app = Paths.get("app.jar");
+        Path dir = Paths.get(System.getProperty("test.classes"));
+
+        JarUtils.createJarFile(app, man, dir, Paths.get("Main.class"));
+
+        // java -jar app.jar
+        int exitCode = exec(app).shouldContain("ClassNotFoundException").getExitValue();
+        assertNotEquals(exitCode, 0);
+    }
+
+    /**
+     * Test that java -jar fails when the executable JAR has the
+     * Launcher-Agent-Class attribute and the class does not define an
+     * agentmain method.
+     */
+    public void testNoAgentMain() throws Exception {
+        // manifest for the executable JAR
+        Manifest man = new Manifest();
+        Attributes attrs = man.getMainAttributes();
+        attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0.0");
+        attrs.put(Attributes.Name.MAIN_CLASS, "Main");
+
+        // the main class does not define the agentmain method
+        attrs.put(new Attributes.Name("Launcher-Agent-Class"), "Main");
+
+        Path app = Paths.get("app.jar");
+        Path dir = Paths.get(System.getProperty("test.classes"));
+
+        JarUtils.createJarFile(app, man, dir, Paths.get("Main.class"));
+
+        // java -jar app.jar
+        int exitCode = exec(app).shouldContain("NoSuchMethodException").getExitValue();
+        assertNotEquals(exitCode, 0);
+    }
+
+    /**
+     * java -jar app.jar, returning the OutputAnalyzer to analyze the output
+     */
+    private OutputAnalyzer exec(Path appJar) throws Exception {
+        return ProcessTools.executeTestJava("-jar", appJar.toString())
+                .outputTo(System.out)
+                .errorTo(System.out);
+    }
+
+
+}
diff --git a/jdk/test/java/lang/instrument/executableJAR/Main.java b/jdk/test/java/lang/instrument/executableJAR/Main.java
new file mode 100644
index 0000000..4cec5c36
--- /dev/null
+++ b/jdk/test/java/lang/instrument/executableJAR/Main.java
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.instrument.Instrumentation;
+
+public class Main {
+    public static void main(String[] args) throws Exception {
+        Instrumentation inst = Agent.inst;
+        if (inst == null)
+            throw new RuntimeException("Agent not loaded");
+
+        // check boot class path has been extended
+        Class<?> helper = Class.forName("AgentHelper");
+        if (helper.getClassLoader() != null)
+            throw new RuntimeException("AgentHelper not loaded by boot loader");
+
+        // check Instrumentation object can be used
+        Class<?>[] classes = inst.getAllLoadedClasses();
+        System.out.println(classes.length + " classes loaded");
+    }
+}
diff --git a/jdk/test/java/lang/invoke/DefineClassTest.java b/jdk/test/java/lang/invoke/DefineClassTest.java
index 456eaf6..baef2eb 100644
--- a/jdk/test/java/lang/invoke/DefineClassTest.java
+++ b/jdk/test/java/lang/invoke/DefineClassTest.java
@@ -75,7 +75,7 @@
     @Test
     public void testDefineClass() throws Exception {
         final String CLASS_NAME = THIS_PACKAGE + ".Foo";
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
+        Lookup lookup = lookup();
         Class<?> clazz = lookup.defineClass(generateClass(CLASS_NAME));
 
         // test name
@@ -101,7 +101,7 @@
     public void testAccess() throws Exception {
         final String THIS_CLASS = this.getClass().getName();
         final String CLASS_NAME = THIS_PACKAGE + ".Runner";
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
+        Lookup lookup = lookup();
 
         // public
         byte[] classBytes = generateRunner(CLASS_NAME + nextNumber(), THIS_CLASS, "method1");
@@ -144,9 +144,8 @@
         final String CLASS_NAME = THIS_PACKAGE + ".ClassWithClinit";
 
         byte[] classBytes = generateClassWithInitializer(CLASS_NAME, THIS_CLASS, "fail");
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
+        Class<?> clazz = lookup().defineClass(classBytes);
 
-        Class<?> clazz = lookup.defineClass(classBytes);
         // trigger initializer to run
         try {
             clazz.newInstance();
@@ -186,14 +185,14 @@
         assertNotEquals(target1.getProtectionDomain(), target2.getProtectionDomain());
 
         // protection domain 1
-        Lookup lookup1 = privateLookupIn(target1, lookup()).dropLookupMode(PRIVATE);
+        Lookup lookup1 = privateLookupIn(target1, lookup());
 
         Class<?> clazz = lookup1.defineClass(generateClass("p.Foo"));
         testSameAbode(clazz, lookup1.lookupClass());
         testDiscoverable(clazz, lookup1);
 
         // protection domain 2
-        Lookup lookup2 = privateLookupIn(target2, lookup()).dropLookupMode(PRIVATE);
+        Lookup lookup2 = privateLookupIn(target2, lookup());
 
         clazz = lookup2.defineClass(generateClass("p.Bar"));
         testSameAbode(clazz, lookup2.lookupClass());
@@ -205,7 +204,7 @@
      */
     @Test
     public void testBootLoader() throws Exception {
-        Lookup lookup = privateLookupIn(Thread.class, lookup()).dropLookupMode(PRIVATE);
+        Lookup lookup = privateLookupIn(Thread.class, lookup());
         assertTrue(lookup.getClass().getClassLoader() == null);
 
         Class<?> clazz = lookup.defineClass(generateClass("java.lang.Foo"));
@@ -216,8 +215,7 @@
 
     @Test(expectedExceptions = { IllegalArgumentException.class })
     public void testWrongPackage() throws Exception {
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
-        lookup.defineClass(generateClass("other.C"));
+        lookup().defineClass(generateClass("other.C"));
     }
 
     @Test(expectedExceptions = { IllegalAccessException.class })
@@ -226,23 +224,14 @@
         lookup.defineClass(generateClass(THIS_PACKAGE + ".C"));
     }
 
-    @Test(expectedExceptions = { UnsupportedOperationException.class })
-    public void testHasPrivateAccess() throws Exception {
-        Lookup lookup = lookup();
-        assertTrue(lookup.hasPrivateAccess());
-        lookup.defineClass(generateClass(THIS_PACKAGE + ".C"));
-    }
-
     @Test(expectedExceptions = { ClassFormatError.class })
     public void testTruncatedClassFile() throws Exception {
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
-        lookup.defineClass(new byte[0]);
+        lookup().defineClass(new byte[0]);
     }
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testNull() throws Exception {
-        Lookup lookup = lookup().dropLookupMode(PRIVATE);
-        lookup.defineClass(null);
+        lookup().defineClass(null);
     }
 
     /**
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
index 0116e5d..433fc45 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3288,4 +3288,3 @@
 #end[Bitwise]
     }
 }
-
diff --git a/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java b/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java
new file mode 100644
index 0000000..9d8eec4
--- /dev/null
+++ b/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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 8020801
+ * @summary Restriction on reflective call to MethodHandles.lookup method
+ * @run main java.base/java.lang.LookupTest
+ * @run main ReflectiveLookupTest
+ * @run main/othervm -Dsun.reflect.noInflation=true ReflectiveLookupTest
+ */
+
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.reflect.Method;
+
+import static java.lang.invoke.MethodType.*;
+
+/*
+ * Lookup object can be obtained statically or reflectively.
+ */
+public class ReflectiveLookupTest {
+    public static void main(String... args) throws Throwable {
+        // Get a full power lookup
+        Lookup lookup1 =  MethodHandles.lookup();
+        MethodHandle mh1 = lookup1.findStatic(lookup1.lookupClass(),
+                                              "foo",
+                                              methodType(String.class));
+        assertEquals((String) mh1.invokeExact(), foo());
+
+        Method lookupMethod =  MethodHandles.class.getMethod("lookup");
+        System.out.println("reflection method: " + lookupMethod);
+        if (!lookupMethod.getName().equals("lookup")) {
+            throw new RuntimeException("Unexpected name: " + lookupMethod.getName());
+        }
+
+        // Get a full power Lookup reflectively.
+        Lookup lookup2 = (Lookup) lookupMethod.invoke(null);
+        assertEquals(lookup1.lookupClass(), lookup2.lookupClass());
+        assertEquals(lookup1.lookupModes(), lookup2.lookupModes());
+        MethodHandle mh2 = lookup2.findStatic(lookup2.lookupClass(),
+                                             "foo",
+                                              methodType(String.class));
+        assertEquals((String) mh2.invokeExact(), foo());
+    }
+
+    static String foo() {
+        return "foo!";
+    }
+
+    static void assertEquals(Object o1, Object o2) {
+        if (!o1.equals(o2)) {
+            throw new RuntimeException(o1 + " != " + o2);
+        }
+    }
+}
+
diff --git a/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java b/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java
new file mode 100644
index 0000000..3e5341b
--- /dev/null
+++ b/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 java.lang;
+
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.reflect.InvocationTargetException;
+
+import static java.lang.invoke.MethodType.*;
+
+/*
+ * Verify that a Lookup object can be obtained statically from java.base
+ * but fails when it's obtained via reflection from java.base.
+ */
+public class LookupTest {
+    public static void main(String... args) throws Throwable {
+        // Get a full power lookup
+        Lookup lookup1 =  MethodHandles.lookup();
+        MethodHandle mh1 = lookup1.findStatic(lookup1.lookupClass(),
+                                              "foo",
+                                              methodType(String.class));
+        assertEquals((String) mh1.invokeExact(), foo());
+
+        // access protected member
+        MethodHandle mh2 = lookup1.findVirtual(java.lang.ClassLoader.class,
+                                               "getPackage",
+                                               methodType(Package.class, String.class));
+        ClassLoader loader = ClassLoader.getPlatformClassLoader();
+        Package pkg = (Package)mh2.invokeExact(loader, "java.lang");
+        assertEquals(pkg.getName(), "java.lang");
+
+        // MethodHandles.lookup will fail if it's called reflectively
+        try {
+            MethodHandles.class.getMethod("lookup").invoke(null);
+        } catch (InvocationTargetException e) {
+            if (!(e.getCause() instanceof IllegalArgumentException)) {
+                throw e.getCause();
+            }
+        }
+    }
+
+    static String foo() { return "foo!"; }
+
+    static void assertEquals(Object o1, Object o2) {
+        if (!o1.equals(o2)) {
+            throw new RuntimeException(o1 + " != " + o2);
+        }
+    }
+}
diff --git a/jdk/test/java/lang/module/AutomaticModulesTest.java b/jdk/test/java/lang/module/AutomaticModulesTest.java
index 4fce2be..d3b049e 100644
--- a/jdk/test/java/lang/module/AutomaticModulesTest.java
+++ b/jdk/test/java/lang/module/AutomaticModulesTest.java
@@ -402,9 +402,7 @@
     // Main-Class files that do not map to a legal qualified type name
     @DataProvider(name = "badmainclass")
     public Object[][] createBadMainClass() {
-        return new Object[][]{
-
-            { "Main",        null },
+        return new Object[][] {
             { "p..Main",     null },
             { "p-.Main",     null },
 
@@ -415,7 +413,7 @@
      * Test that a JAR file with a Main-Class attribute that is not a qualified
      * type name.
      */
-    @Test(dataProvider = "badmainclass", expectedExceptions = FindException.class)
+    @Test(dataProvider = "badmainclass")
     public void testBadMainClass(String mainClass, String ignore) throws IOException {
         Manifest man = new Manifest();
         Attributes attrs = man.getMainAttributes();
@@ -426,14 +424,16 @@
         String entry = mainClass.replace('.', '/') + ".class";
         createDummyJarFile(dir.resolve("m.jar"), man, entry);
 
-        // should throw FindException
-        ModuleFinder.of(dir).findAll();
+        // bad Main-Class value should be ignored
+        Optional<ModuleReference> omref = ModuleFinder.of(dir).find("m");
+        assertTrue(omref.isPresent());
+        ModuleDescriptor descriptor = omref.get().descriptor();
+        assertFalse(descriptor.mainClass().isPresent());
     }
 
     /**
      * Test that a JAR file with a Main-Class attribute that is not in the module
      */
-    @Test(expectedExceptions = FindException.class)
     public void testMissingMainClassPackage() throws IOException {
         Manifest man = new Manifest();
         Attributes attrs = man.getMainAttributes();
@@ -443,8 +443,11 @@
         Path dir = Files.createTempDirectory(USER_DIR, "mods");
         createDummyJarFile(dir.resolve("m.jar"), man);
 
-        // should throw FindException
-        ModuleFinder.of(dir).findAll();
+        // Main-Class should be ignored because package p is not in module
+        Optional<ModuleReference> omref = ModuleFinder.of(dir).find("m");
+        assertTrue(omref.isPresent());
+        ModuleDescriptor descriptor = omref.get().descriptor();
+        assertFalse(descriptor.mainClass().isPresent());
     }
 
 
diff --git a/jdk/test/java/lang/module/ConfigurationTest.java b/jdk/test/java/lang/module/ConfigurationTest.java
index d59612d..da00823 100644
--- a/jdk/test/java/lang/module/ConfigurationTest.java
+++ b/jdk/test/java/lang/module/ConfigurationTest.java
@@ -1843,17 +1843,9 @@
     public Object[][] createPlatformMatches() {
         return new Object[][]{
 
-            { "linux-arm",     "*-*" },
-            { "linux-*",       "*-*" },
-            { "*-arm",         "*-*" },
-
-            { "linux-*",       "linux-*" },
-            { "linux-arm",     "linux-*" },
-
-            { "*-arm",         "*-arm" },
-            { "linux-arm",     "*-arm" },
-
-            { "linux-arm",   "linux-arm" },
+            { "",              "" },
+            { "linux-arm",     "" },
+            { "linux-arm",     "linux-arm" },
 
         };
 
@@ -1863,9 +1855,8 @@
     public Object[][] createBad() {
         return new Object[][] {
 
-            { "linux-*",        "solaris-*"     },
-            { "*-arm",          "*-sparc"       },
-            { "linux-x86",      "solaris-sparc" },
+            { "linux-x64",        "linux-arm" },
+            { "linux-x64",        "windows-x64" },
 
         };
     }
@@ -1877,7 +1868,7 @@
     public void testPlatformMatch(String s1, String s2) throws IOException {
 
         ModuleDescriptor base =  ModuleDescriptor.newModule("java.base").build();
-        Path system = writeModule(base, "*-*");
+        Path system = writeModule(base, null);
 
         ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1")
                 .requires("m2")
@@ -1928,7 +1919,7 @@
         throws IOException
     {
         ModuleDescriptor base =  ModuleDescriptor.newModule("java.base").build();
-        Path system = writeModule(base, "*-*");
+        Path system = writeModule(base, null);
 
         ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1").build();
         Path dir1 = writeModule(descriptor1, s1);
@@ -2113,17 +2104,18 @@
 
 
     /**
-     * Decodes the platform string and calls the builder osName/osArch/osVersion
-     * methods to set the platform constraints.
+     * Writes a module-info.class. If {@code targetPlatform} is not null then
+     * it includes the ModuleTarget class file attribute with the target platform.
      */
-    static Path writeModule(ModuleDescriptor descriptor, String platformString)
+    static Path writeModule(ModuleDescriptor descriptor, String targetPlatform)
         throws IOException
     {
-        String[] s = platformString.split("-");
-        String osName = !s[0].equals("*") ? s[0] : null;
-        String osArch = !s[1].equals("*") ? s[1] : null;
-        ModuleTarget target = new ModuleTarget(osName, osArch);
-
+        ModuleTarget target;
+        if (targetPlatform != null) {
+            target = new ModuleTarget(targetPlatform);
+        } else {
+            target = null;
+        }
         String name = descriptor.name();
         Path dir = Files.createTempDirectory(name);
         Path mi = dir.resolve("module-info.class");
diff --git a/jdk/test/java/lang/module/ModuleDescriptorTest.java b/jdk/test/java/lang/module/ModuleDescriptorTest.java
index f4726a5..8351800 100644
--- a/jdk/test/java/lang/module/ModuleDescriptorTest.java
+++ b/jdk/test/java/lang/module/ModuleDescriptorTest.java
@@ -65,8 +65,8 @@
 @Test
 public class ModuleDescriptorTest {
 
-    @DataProvider(name = "invalidjavaidentifiers")
-    public Object[][] invalidJavaIdentifiers() {
+    @DataProvider(name = "invalidNames")
+    public Object[][] invalidNames() {
         return new Object[][]{
 
             { null,             null },
@@ -84,6 +84,32 @@
             { "foo.bar.1gus",   null },
             { "foo.bar.[gus]",  null },
 
+            { "class",          null },
+            { "interface",      null },
+            { "true",           null },
+            { "false",          null },
+            { "null",           null },
+
+            { "x.class",        null },
+            { "x.interface",    null },
+            { "x.true",         null },
+            { "x.false",        null },
+            { "x.null",         null },
+
+            { "class.x",        null },
+            { "interface.x",    null },
+            { "true.x",         null },
+            { "false.x",        null },
+            { "null.x",         null },
+
+            { "x.class.x",      null },
+            { "x.interface.x",  null },
+            { "x.true.x",       null },
+            { "x.false.x",      null },
+            { "x.null.x",       null },
+
+            { "_",              null },
+
         };
     }
 
@@ -199,7 +225,7 @@
         ModuleDescriptor.newModule("m").requires(EnumSet.allOf(Modifier.class), "m");
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testRequiresWithBadModuleName(String mn, String ignore) {
         requires(EnumSet.noneOf(Modifier.class), mn);
@@ -406,7 +432,7 @@
         ModuleDescriptor.newModule("foo").exports("p", Collections.emptySet());
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testExportsWithBadName(String pn, String ignore) {
         ModuleDescriptor.newModule("foo").exports(pn);
@@ -568,7 +594,7 @@
         ModuleDescriptor.newModule("foo").opens("p", Collections.emptySet());
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
             expectedExceptions = IllegalArgumentException.class )
     public void testOpensWithBadName(String pn, String ignore) {
         ModuleDescriptor.newModule("foo").opens(pn);
@@ -664,7 +690,7 @@
         ModuleDescriptor.newModule("foo").uses("S");
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testUsesWithBadName(String service, String ignore) {
         ModuleDescriptor.newModule("foo").uses(service);
@@ -737,13 +763,13 @@
         ModuleDescriptor.newModule("foo").provides("p.S", List.of("P"));
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testProvidesWithBadService(String service, String ignore) {
         ModuleDescriptor.newModule("foo").provides(service, List.of("p.Provider"));
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testProvidesWithBadProvider(String provider, String ignore) {
         List<String> names = new ArrayList<>(); // allows nulls
@@ -928,7 +954,7 @@
         assertTrue(Objects.equals(packages, Set.of("p1", "p2", "p3", "p4", "p5")));
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testPackagesWithBadName(String pn, String ignore) {
         Set<String> pkgs = new HashSet<>();  // allows nulls
@@ -943,7 +969,7 @@
         assertEquals(mn, "foo");
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testBadModuleName(String mn, String ignore) {
         ModuleDescriptor.newModule(mn);
@@ -1264,7 +1290,7 @@
         ModuleDescriptor.newModule("foo").mainClass("Main");
     }
 
-    @Test(dataProvider = "invalidjavaidentifiers",
+    @Test(dataProvider = "invalidNames",
           expectedExceptions = IllegalArgumentException.class )
     public void testMainClassWithBadName(String mainClass, String ignore) {
         Builder builder = ModuleDescriptor.newModule("foo");
diff --git a/jdk/test/java/lang/module/customfs/ModulesInCustomFileSystem.java b/jdk/test/java/lang/module/customfs/ModulesInCustomFileSystem.java
new file mode 100644
index 0000000..64586da
--- /dev/null
+++ b/jdk/test/java/lang/module/customfs/ModulesInCustomFileSystem.java
@@ -0,0 +1,142 @@
+/*
+ * 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
+ * @modules jdk.zipfs
+ * @library /lib/testlibrary
+ * @build ModulesInCustomFileSystem JarUtils m1/* m2/*
+ * @run testng/othervm ModulesInCustomFileSystem
+ * @summary Test ModuleFinder to find modules in a custom file system
+ */
+
+import java.io.File;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
+import java.lang.reflect.Method;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ModulesInCustomFileSystem {
+
+    /**
+     * Test exploded modules in a JAR file system.
+     */
+    public void testExplodedModulesInJarFileSystem() throws Exception {
+        Path m1 = findModuleDirectory("m1");
+        Path m2 = findModuleDirectory("m2");
+        Path mlib = m1.getParent();
+        assertEquals(mlib, m2.getParent());
+
+        // create JAR file containing m1/** and m2/**
+        Path jar = Files.createTempDirectory("mlib").resolve("modules.jar");
+        JarUtils.createJarFile(jar, mlib);
+        testJarFileSystem(jar);
+    }
+
+    /**
+     * Test modular JARs in a JAR file system
+     */
+    public void testModularJARsInJarFileSystem() throws Exception {
+        Path m1 = findModuleDirectory("m1");
+        Path m2 = findModuleDirectory("m2");
+        Path contents = Files.createTempDirectory("contents");
+        JarUtils.createJarFile(contents.resolve("m1.jar"), m1);
+        JarUtils.createJarFile(contents.resolve("m2.jar"), m2);
+
+        // create JAR file containing m1.jar and m2.jar
+        Path jar = Files.createTempDirectory("mlib").resolve("modules.jar");
+        JarUtils.createJarFile(jar, contents);
+        testJarFileSystem(jar);
+    }
+
+    /**
+     * Opens a JAR file as a file system
+     */
+    private void testJarFileSystem(Path jar) throws Exception {
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        try (FileSystem fs = FileSystems.newFileSystem(jar, scl)) {
+            // ModuleFinder to find modules in top-level directory
+            Path top = fs.getPath("/");
+            ModuleFinder finder = ModuleFinder.of(top);
+
+            // list the modules
+            listAllModules(finder);
+
+            // load modules into child layer, invoking m1/p.Main
+            loadAndRunModule(finder);
+        }
+    }
+
+    /**
+     * List all modules that the finder finds and the resources in the module.
+     */
+    private void listAllModules(ModuleFinder finder) throws Exception {
+        for (ModuleReference mref : finder.findAll()) {
+            System.out.println(mref.descriptor());
+            try (ModuleReader reader = mref.open()) {
+                reader.list().forEach(name -> System.out.format("  %s%n", name));
+            }
+        }
+    }
+
+    /**
+     * Creates a child layer with m1 and m2, invokes m1/p.Main to ensure that
+     * classes can be loaded.
+     */
+    private void loadAndRunModule(ModuleFinder finder) throws Exception {
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        Configuration cf = bootLayer.configuration()
+                .resolve(finder, ModuleFinder.of(), Set.of("m1"));
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+        Class<?> c = layer.findLoader("m1").loadClass("p.Main");
+        Method m = c.getMethod("main", String[].class);
+        m.invoke(null, (Object)new String[0]);
+    }
+
+    /**
+     * Find the directory for a module on the module path
+     */
+    private Path findModuleDirectory(String name) {
+        String mp = System.getProperty("jdk.module.path");
+        for (String element : mp.split(File.pathSeparator)) {
+            Path dir = Paths.get(element).resolve(name);
+            if (Files.exists(dir)) {
+                return dir;
+            }
+        }
+        assertFalse(true);
+        return null;
+    }
+}
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/module/customfs/m1/module-info.java
similarity index 87%
rename from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
rename to jdk/test/java/lang/module/customfs/m1/module-info.java
index f4974e3..bc420ad 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/module/customfs/m1/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,7 @@
  * questions.
  */
 
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module m1 {
+    exports p;
+    requires m2;
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/module/customfs/m1/p/Main.java
similarity index 84%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/lang/module/customfs/m1/p/Main.java
index f4974e3..65e45a8 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/module/customfs/m1/p/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,10 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+package p;
 
-public interface Atomic {
-
+public class Main {
+    public static void main(String[] args) {
+        q.Hello.hello();
+    }
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/module/customfs/m2/module-info.java
similarity index 87%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/lang/module/customfs/m2/module-info.java
index f4974e3..72b35d9 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/module/customfs/m2/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,6 @@
  * questions.
  */
 
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module m2 {
+    exports q;
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/lang/module/customfs/m2/q/Hello.java
similarity index 84%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/lang/module/customfs/m2/q/Hello.java
index f4974e3..5f912cd 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/lang/module/customfs/m2/q/Hello.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,10 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+package q;
 
-public interface Atomic {
-
+public class Hello {
+    public static void hello() {
+        System.out.println("hello");
+    }
 }
diff --git a/jdk/test/java/net/httpclient/ProxyAuthTest.java b/jdk/test/java/net/httpclient/ProxyAuthTest.java
index 54f480e..43ba690 100644
--- a/jdk/test/java/net/httpclient/ProxyAuthTest.java
+++ b/jdk/test/java/net/httpclient/ProxyAuthTest.java
@@ -20,6 +20,7 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 /*
diff --git a/jdk/test/java/nio/file/WatchService/DeleteInterference.java b/jdk/test/java/nio/file/WatchService/DeleteInterference.java
index 459b17e..fc889ad 100644
--- a/jdk/test/java/nio/file/WatchService/DeleteInterference.java
+++ b/jdk/test/java/nio/file/WatchService/DeleteInterference.java
@@ -15,6 +15,10 @@
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 /**
diff --git a/jdk/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java
index 7641580..f742b38 100644
--- a/jdk/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java
+++ b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/nio/file/spi/SetDefaultProvider.java b/jdk/test/java/nio/file/spi/SetDefaultProvider.java
index 10629f8..1d1910b 100644
--- a/jdk/test/java/nio/file/spi/SetDefaultProvider.java
+++ b/jdk/test/java/nio/file/spi/SetDefaultProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, 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
@@ -21,23 +21,141 @@
  * questions.
  */
 
-/* @test
- * @bug 4313887 7006126
- * @summary Unit test for java.nio.file.spi.FileSystemProvider
- * @build TestProvider SetDefaultProvider
- * @run main/othervm -Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider SetDefaultProvider
+/**
+ * @test
+ * @modules jdk.jartool
+ * @library /lib/testlibrary
+ * @build SetDefaultProvider TestProvider m/* jdk.testlibrary.ProcessTools
+ * @run testng/othervm SetDefaultProvider
+ * @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on
+ *          the command line to override the default file system provider
  */
 
-import java.nio.file.*;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.spi.ToolProvider;
 
+import jdk.testlibrary.ProcessTools;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
 public class SetDefaultProvider {
-    public static void main(String[] args) throws Exception {
-        Class<?> c = FileSystems.getDefault().provider().getClass();
 
-        Class<?> expected = Class.forName("TestProvider", false,
-            ClassLoader.getSystemClassLoader());
+    private static String SET_DEFAULT_FSP =
+        "-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider";
 
-        if (c != expected)
-            throw new RuntimeException();
+    private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
+        .orElseThrow(() ->
+            new RuntimeException("jar tool not found")
+        );
+
+    /**
+     * Test override of default FileSystemProvider with the main application
+     * on the class path.
+     */
+    public void testClassPath() throws Exception {
+        String moduleClasses = moduleClasses();
+        String testClasses = System.getProperty("test.classes");
+        String classpath = moduleClasses + File.pathSeparator + testClasses;
+        int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main");
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test override of default FileSystemProvider with the main application
+     * on the module path as an exploded module.
+     */
+    public void testExplodedModule() throws Exception {
+        String modulePath = System.getProperty("jdk.module.path");
+        int exitValue = exec(SET_DEFAULT_FSP, "-p", modulePath, "-m", "m/p.Main");
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test override of default FileSystemProvider with the main application
+     * on the module path as a modular JAR.
+     */
+    public void testModularJar() throws Exception {
+        String jarFile = createModularJar();
+        int exitValue = exec(SET_DEFAULT_FSP, "-p", jarFile, "-m", "m/p.Main");
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test override of default FileSystemProvider where the main application
+     * is a module that is patched by an exploded patch.
+     */
+    public void testExplodedModuleWithExplodedPatch() throws Exception {
+        Path patchdir = Files.createTempDirectory("patch");
+        String modulePath = System.getProperty("jdk.module.path");
+        int exitValue = exec(SET_DEFAULT_FSP,
+                             "--patch-module", "m=" + patchdir,
+                             "-p", modulePath,
+                             "-m", "m/p.Main");
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test override of default FileSystemProvider where the main application
+     * is a module that is patched by an exploded patch.
+     */
+    public void testExplodedModuleWithJarPatch() throws Exception {
+        Path patchdir = Files.createTempDirectory("patch");
+        Files.createDirectory(patchdir.resolve("m.properties"));
+        Path patch = createJarFile(patchdir);
+        String modulePath = System.getProperty("jdk.module.path");
+        int exitValue = exec(SET_DEFAULT_FSP,
+                             "--patch-module", "m=" + patch,
+                             "-p", modulePath,
+                             "-m", "m/p.Main");
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Returns the directory containing the classes for module "m".
+     */
+    private String moduleClasses() {
+        String mp = System.getProperty("jdk.module.path");
+        for (String dir : mp.split(File.pathSeparator)) {
+            Path m = Paths.get(dir, "m");
+            if (Files.exists(m)) return m.toString();
+        }
+        assertFalse(true);
+        return null;
+    }
+
+    /**
+     * Creates a modular JAR containing module "m".
+     */
+    private String createModularJar() throws Exception {
+        Path dir = Paths.get(moduleClasses());
+        Path jar = createJarFile(dir);
+        return jar.toString();
+    }
+
+    /**
+     * Creates a JAR file containing the entries in the given file tree.
+     */
+    private Path createJarFile(Path dir) throws Exception {
+        Path jar = Files.createTempDirectory("tmp").resolve("m.jar");
+        String[] args = { "--create", "--file=" + jar, "-C", dir.toString(), "." };
+        int ret = JAR_TOOL.run(System.out, System.out, args);
+        assertTrue(ret == 0);
+        return jar;
+    }
+
+    /**
+     * Invokes the java launcher with the given arguments, returning the exit code.
+     */
+    private int exec(String... args) throws Exception {
+       return ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue();
     }
 }
diff --git a/jdk/test/java/nio/file/spi/TestProvider.java b/jdk/test/java/nio/file/spi/TestProvider.java
index f0538e5..6832e86 100644
--- a/jdk/test/java/nio/file/spi/TestProvider.java
+++ b/jdk/test/java/nio/file/spi/TestProvider.java
@@ -77,7 +77,7 @@
                              LinkOption... options)
         throws IOException
     {
-        throw new ReadOnlyFileSystemException();
+        throw new RuntimeException("not implemented");
     }
 
     @Override
@@ -110,19 +110,20 @@
 
     @Override
     public void delete(Path file) throws IOException {
-        throw new ReadOnlyFileSystemException();
+        Path delegate = theFileSystem.unwrap(file);
+        defaultProvider.delete(delegate);
     }
 
     @Override
     public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
         throws IOException
     {
-        throw new ReadOnlyFileSystemException();
+        throw new RuntimeException("not implemented");
     }
 
     @Override
     public void createLink(Path link, Path existing) throws IOException {
-        throw new ReadOnlyFileSystemException();
+        throw new RuntimeException("not implemented");
     }
 
     @Override
@@ -136,14 +137,14 @@
     public void copy(Path source, Path target, CopyOption... options)
         throws IOException
     {
-        throw new ReadOnlyFileSystemException();
+        throw new RuntimeException("not implemented");
     }
 
     @Override
     public void move(Path source, Path target, CopyOption... options)
         throws IOException
     {
-        throw new ReadOnlyFileSystemException();
+        throw new RuntimeException("not implemented");
     }
 
     @Override
@@ -158,7 +159,8 @@
     public void createDirectory(Path dir, FileAttribute<?>... attrs)
         throws IOException
     {
-        throw new ReadOnlyFileSystemException();
+        Path delegate = theFileSystem.unwrap(dir);
+        defaultProvider.createDirectory(delegate, attrs);
     }
 
     @Override
@@ -167,13 +169,8 @@
                                               FileAttribute<?>... attrs)
         throws IOException
     {
-        if (options.contains(StandardOpenOption.READ) && options.size() == 1) {
-            Path delegate = theFileSystem.unwrap(file);
-            options = Collections.singleton(StandardOpenOption.READ);
-            return defaultProvider.newByteChannel(delegate, options, attrs);
-        }
-
-        throw new RuntimeException("not implemented");
+        Path delegate = theFileSystem.unwrap(file);
+        return defaultProvider.newByteChannel(delegate, options, attrs);
     }
 
     @Override
@@ -236,7 +233,7 @@
 
         @Override
         public boolean isReadOnly() {
-            return true;
+            return false;
         }
 
         @Override
@@ -419,7 +416,7 @@
 
         @Override
         public File toFile() {
-            return delegate.toFile();
+            return new File(toString());
         }
 
         @Override
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/nio/file/spi/m/module-info.java
similarity index 87%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/nio/file/spi/m/module-info.java
index f4974e3..8448047 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/nio/file/spi/m/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -20,9 +20,5 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module m {
 }
diff --git a/jdk/test/java/nio/file/spi/m/p/Main.java b/jdk/test/java/nio/file/spi/m/p/Main.java
new file mode 100644
index 0000000..4704c67
--- /dev/null
+++ b/jdk/test/java/nio/file/spi/m/p/Main.java
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * Launched by SetDefaultProvider to test startup with the default file system
+ * provider overridden.
+ */
+
+public class Main {
+    public static void main(String[] args) throws Exception {
+        FileSystem fs = FileSystems.getDefault();
+        if (fs.getClass().getModule() == Object.class.getModule())
+            throw new RuntimeException("FileSystemProvider not overridden");
+
+        // exercise the file system
+        Path dir = Files.createTempDirectory("tmp");
+        if (dir.getFileSystem() != fs)
+            throw new RuntimeException("'dir' not in default file system");
+        System.out.println("created: " + dir);
+
+        Path foo = Files.createFile(dir.resolve("foo"));
+        if (foo.getFileSystem() != fs)
+            throw new RuntimeException("'foo' not in default file system");
+        System.out.println("created: " + foo);
+
+        // exercise interop with java.io.File
+        File file = foo.toFile();
+        Path path = file.toPath();
+        if (path.getFileSystem() != fs)
+            throw new RuntimeException("'path' not in default file system");
+        if (!path.equals(foo))
+            throw new RuntimeException(path + " not equal to " + foo);
+    }
+}
diff --git a/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithNullPerms.java b/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithNullPerms.java
index 13b2db4..b42d88d 100644
--- a/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithNullPerms.java
+++ b/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithNullPerms.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013,2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithThread.java b/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithThread.java
index 955f39d..2995893 100644
--- a/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithThread.java
+++ b/jdk/test/java/security/AccessController/LimitedDoPrivilegedWithThread.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013,2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java b/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java
new file mode 100644
index 0000000..aad39cd
--- /dev/null
+++ b/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java
@@ -0,0 +1,146 @@
+/*
+ * 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.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @library /java/sql/modules
+ * @build luckydogdriver/* mystubdriver/*
+ * @run testng/othervm DriverManagerModuleTests
+ * @summary Tests that a JDBC Driver that is a module can be loaded
+ * via the service-provider loading mechanism.
+ */
+public class DriverManagerModuleTests {
+
+    private final String LUCKYDOGDRIVER_URL = "jdbc:tennis:myDB";
+    private static final String STUBDRIVERURL = "jdbc:stub:myDB";
+    private static final String CONNECTION_CLASS_NAME = "com.luckydogtennis.StubConnection";
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Validate JDBC drivers as modules will be accessible. One driver will be
+     * loaded and registered via the service-provider loading mechanism. The
+     * other driver will need to be explictly loaded
+     *
+     * @throws java.lang.Exception
+     */
+    @Test
+    public void test() throws Exception {
+        System.out.println("\n$$$ runing Test()\n");
+        dumpRegisteredDrivers();
+        Driver d = DriverManager.getDriver(STUBDRIVERURL);
+        assertNotNull(d, "StubDriver should not be null");
+        assertTrue(isDriverRegistered(d));
+        Driver d2 = null;
+
+        // This driver should not be found until it is explictly loaded
+        try {
+            d2 = DriverManager.getDriver(LUCKYDOGDRIVER_URL);
+        } catch (SQLException e) {
+            // ignore expected Exception
+        }
+        assertNull(d2, "LuckyDogDriver should  be null");
+        loadDriver();
+        d2 = DriverManager.getDriver(LUCKYDOGDRIVER_URL);
+        assertNotNull(d2, "LuckyDogDriver should not be null");
+        assertTrue(isDriverRegistered(d2), "Driver was NOT registered");
+
+        dumpRegisteredDrivers();
+        DriverManager.deregisterDriver(d2);
+        assertFalse(isDriverRegistered(d2), "Driver IS STILL registered");
+        dumpRegisteredDrivers();
+
+    }
+
+    /**
+     * Validate that a Connection can be obtained from a JDBC driver which is a
+     * module and loaded via the service-provider loading mechanism.
+     *
+     * @throws java.lang.Exception
+     */
+    @Test
+    public void test00() throws Exception {
+        System.out.println("\n$$$ runing Test00()\n");
+        Connection con = DriverManager.getConnection(STUBDRIVERURL);
+        assertNotNull(con, "Returned Connection should not be NULL");
+        System.out.println("con=" + con.getClass().getName());
+        assertTrue(con.getClass().getName().equals(CONNECTION_CLASS_NAME));
+
+    }
+
+    /**
+     * Utility method to see if a driver is registered
+     */
+    private static void dumpRegisteredDrivers() {
+        System.out.println("\n+++ Loaded Drivers +++");
+
+         DriverManager.drivers().forEach(d -> System.out.println("\t\t### Driver:" + d));
+
+        System.out.println("++++++++++++++++++++++++");
+    }
+
+    /**
+     * Utility method to load the LuckyDogDriver
+     */
+    private static void loadDriver() {
+        try {
+            Class.forName("luckydogtennis.LuckyDogDriver");
+        } catch (ClassNotFoundException ex) {
+            System.out.println("**** Error: luckydogtennis.LuckyDogDriver not found");
+        }
+        System.out.println("Driver Loaded");
+    }
+
+    /**
+     * Utility method to see if a driver is registered
+     */
+    private static boolean isDriverRegistered(Driver d) {
+        return DriverManager.drivers().filter(driver-> driver == d).findFirst().isPresent();
+
+    }
+}
diff --git a/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java
new file mode 100644
index 0000000..39f6913
--- /dev/null
+++ b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java
@@ -0,0 +1,91 @@
+/*
+ * 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 luckydogtennis;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class LuckyDogDriver implements Driver {
+
+    static {
+        registerDriver();
+        System.out.println("*****in static block LuckyDogDriver");
+    }
+
+    private static void registerDriver() {
+        try {
+            DriverManager.registerDriver(new LuckyDogDriver());
+        } catch (SQLException ex) {
+            Logger.getLogger(LuckyDogDriver.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+
+    public LuckyDogDriver() {
+        System.out.println("*****in LuckyDogDriver Constructor");
+    }
+
+    @Override
+    public Connection connect(String url, Properties info) throws SQLException {
+        if (acceptsURL(url)) {
+        return new StubConnection();
+        }
+        return null;
+    }
+
+    @Override
+    public boolean acceptsURL(String url) throws SQLException {
+        return url.matches("^jdbc:tennis:.*");
+    }
+
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getMajorVersion() {
+        return 1;
+    }
+
+    @Override
+    public int getMinorVersion() {
+        return 0;
+    }
+
+    @Override
+    public boolean jdbcCompliant() {
+        return true;
+    }
+
+    @Override
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff --git a/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java
new file mode 100644
index 0000000..3faece2
--- /dev/null
+++ b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java
@@ -0,0 +1,315 @@
+/*
+ * 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 luckydogtennis;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+public class StubConnection implements Connection{
+
+    @Override
+    public Statement createStatement() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String nativeSQL(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAutoCommit(boolean autoCommit) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getAutoCommit() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void commit() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void rollback() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void close() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public DatabaseMetaData getMetaData() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setReadOnly(boolean readOnly) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCatalog(String catalog) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getCatalog() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTransactionIsolation(int level) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getTransactionIsolation() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Map<String, Class<?>> getTypeMap() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setHoldability(int holdability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Savepoint setSavepoint() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Savepoint setSavepoint(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void rollback(Savepoint savepoint) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob createClob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob createBlob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob createNClob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML createSQLXML() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isValid(int timeout) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClientInfo(String name, String value) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClientInfo(Properties properties) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getClientInfo(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Properties getClientInfo() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setSchema(String schema) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getSchema() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void abort(Executor executor) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getNetworkTimeout() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/sql/modules/luckydogdriver/module-info.java
similarity index 83%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/sql/modules/luckydogdriver/module-info.java
index f4974e3..5f98bc3 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/sql/modules/luckydogdriver/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -20,9 +20,8 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module luckydogdriver {
+    requires transitive java.logging;
+    requires transitive java.sql;
+    exports luckydogtennis;
 }
diff --git a/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java
new file mode 100644
index 0000000..1697114
--- /dev/null
+++ b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java
@@ -0,0 +1,315 @@
+/*
+ * 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 com.luckydogtennis;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+public class StubConnection implements Connection{
+
+    @Override
+    public Statement createStatement() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String nativeSQL(String sql) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setAutoCommit(boolean autoCommit) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean getAutoCommit() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void commit() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void rollback() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void close() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public DatabaseMetaData getMetaData() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setReadOnly(boolean readOnly) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setCatalog(String catalog) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getCatalog() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTransactionIsolation(int level) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getTransactionIsolation() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Map<String, Class<?>> getTypeMap() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setHoldability(int holdability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Savepoint setSavepoint() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Savepoint setSavepoint(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void rollback(Savepoint savepoint) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Clob createClob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Blob createBlob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public NClob createNClob() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public SQLXML createSQLXML() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isValid(int timeout) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClientInfo(String name, String value) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setClientInfo(Properties properties) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getClientInfo(String name) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Properties getClientInfo() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setSchema(String schema) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public String getSchema() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void abort(Executor executor) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getNetworkTimeout() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff --git a/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java
new file mode 100644
index 0000000..d080dee
--- /dev/null
+++ b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java
@@ -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.
+ */
+package com.luckydogtennis;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class StubDriver implements Driver {
+
+    static {
+        System.out.println("*****in static block StubDriver");
+        registerDriver();
+    }
+
+    private static void registerDriver() {
+        try {
+            DriverManager.registerDriver(new StubDriver());
+        } catch (SQLException ex) {
+            Logger.getLogger(StubDriver.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+
+    public StubDriver() {
+        System.out.println("*****in StubDriver Constructor*************");
+        /*
+        for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
+            System.out.println(ste);
+        }
+        System.out.println("******************");
+        */
+    }
+
+    @Override
+    public Connection connect(String url, Properties info) throws SQLException {
+        if (acceptsURL(url)) {
+            return new StubConnection();
+        }
+        return null;
+    }
+
+    @Override
+    public boolean acceptsURL(String url) throws SQLException {
+        return url.matches("^jdbc:stub:.*");
+    }
+
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public int getMajorVersion() {
+        return 1;
+    }
+
+    @Override
+    public int getMinorVersion() {
+        return 0;
+    }
+
+    @Override
+    public boolean jdbcCompliant() {
+        return true;
+    }
+
+    @Override
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/sql/modules/mystubdriver/module-info.java
similarity index 78%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/sql/modules/mystubdriver/module-info.java
index f4974e3..ce15e83 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/sql/modules/mystubdriver/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -20,9 +20,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
-package javax.transaction.atomic;
-
-public interface Atomic {
-
+module mystubdriver {
+    requires transitive java.logging;
+    requires transitive java.sql;
+    exports com.luckydogtennis;
+    provides java.sql.Driver with
+        com.luckydogtennis.StubDriver;
 }
diff --git a/jdk/test/java/time/test/java/time/temporal/TestIsoWeekFields.java b/jdk/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
index 672295e..71916c1 100644
--- a/jdk/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
+++ b/jdk/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014,2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/util/Arrays/ParallelPrefix.java b/jdk/test/java/util/Arrays/ParallelPrefix.java
index 2b3fb70..7772c6e 100644
--- a/jdk/test/java/util/Arrays/ParallelPrefix.java
+++ b/jdk/test/java/util/Arrays/ParallelPrefix.java
@@ -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
@@ -179,119 +179,65 @@
     @Test
     public void testNPEs() {
         // null array
-        assertThrows( () -> Arrays.parallelPrefix((int[]) null, Integer::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((long []) null, Long::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((double []) null, Double::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((String []) null, String::concat),
-                NullPointerException.class, "should throw NPE");
+        assertThrowsNPE(() -> Arrays.parallelPrefix((int[]) null, Integer::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((long []) null, Long::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((double []) null, Double::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((String []) null, String::concat));
 
         // null array w/ range
-        assertThrows( () -> Arrays.parallelPrefix((int[]) null, 0, 0, Integer::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((long []) null, 0, 0, Long::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((double []) null, 0, 0, Double::max),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix((String []) null, 0, 0, String::concat),
-                NullPointerException.class, "should throw NPE");
+        assertThrowsNPE(() -> Arrays.parallelPrefix((int[]) null, 0, 0, Integer::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((long []) null, 0, 0, Long::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((double []) null, 0, 0, Double::max));
+        assertThrowsNPE(() -> Arrays.parallelPrefix((String []) null, 0, 0, String::concat));
 
         // null op
-        assertThrows( () -> Arrays.parallelPrefix(new int[] {}, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new long[] {}, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new double[] {}, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new String[] {}, null),
-                NullPointerException.class, "should throw NPE");
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new int[] {}, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new long[] {}, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new double[] {}, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new String[] {}, null));
 
         // null op w/ range
-        assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 0, 0, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 0, 0, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 0, 0, null),
-                NullPointerException.class, "should throw NPE");
-        assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 0, 0, null),
-                NullPointerException.class, "should throw NPE");
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new int[] {}, 0, 0, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new long[] {}, 0, 0, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new double[] {}, 0, 0, null));
+        assertThrowsNPE(() -> Arrays.parallelPrefix(new String[] {}, 0, 0, null));
     }
 
     @Test
     public void testIAEs() {
-        assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 1, 0, Integer::max),
-                IllegalArgumentException.class, "should throw IAE");
-        assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 1, 0, Long::max),
-                IllegalArgumentException.class, "should throw IAE");
-        assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 1, 0, Double::max),
-                IllegalArgumentException.class, "should throw IAE");
-        assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 1, 0, String::concat),
-                IllegalArgumentException.class, "should throw IAE");
+        assertThrowsIAE(() -> Arrays.parallelPrefix(new int[] {}, 1, 0, Integer::max));
+        assertThrowsIAE(() -> Arrays.parallelPrefix(new long[] {}, 1, 0, Long::max));
+        assertThrowsIAE(() -> Arrays.parallelPrefix(new double[] {}, 1, 0, Double::max));
+        assertThrowsIAE(() -> Arrays.parallelPrefix(new String[] {}, 1, 0, String::concat));
     }
 
     @Test
-    public void testAIOBEs() {
+    public void testAIOOBEs() {
         // bad "fromIndex"
-        assertThrows( () -> Arrays.parallelPrefix(new int[] {}, -1, 0, Integer::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new long[] {}, -1, 0, Long::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new double[] {}, -1, 0, Double::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new String[] {}, -1, 0, String::concat),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new int[] {}, -1, 0, Integer::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new long[] {}, -1, 0, Long::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new double[] {}, -1, 0, Double::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new String[] {}, -1, 0, String::concat));
 
         // bad "toIndex"
-        assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 0, 1, Integer::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 0, 1, Long::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 0, 1, Double::max),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
-        assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 0, 1, String::concat),
-                ArrayIndexOutOfBoundsException.class, "should throw AIOBE");
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new int[] {}, 0, 1, Integer::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new long[] {}, 0, 1, Long::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new double[] {}, 0, 1, Double::max));
+        assertThrowsAIOOB(() -> Arrays.parallelPrefix(new String[] {}, 0, 1, String::concat));
     }
 
     // "library" code
 
-    public interface Thrower<T extends Throwable> {
-
-        public void run() throws T;
+    private void assertThrowsNPE(ThrowingRunnable r) {
+        assertThrows(NullPointerException.class, r);
     }
 
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable) {
-        assertThrows(thrower, throwable, null);
+    private void assertThrowsIAE(ThrowingRunnable r) {
+        assertThrows(IllegalArgumentException.class, r);
     }
 
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable, String message) {
-        Throwable thrown;
-        try {
-            thrower.run();
-            thrown = null;
-        } catch (Throwable caught) {
-            thrown = caught;
-        }
-
-        assertInstance(thrown, throwable,
-            ((null != message) ? message : "") +
-            " Failed to throw " + throwable.getCanonicalName());
-    }
-
-    public static <T extends Throwable> void assertThrows(Class<T> throwable, String message, Thrower<T>... throwers) {
-        for(Thrower<T> thrower : throwers) {
-            assertThrows(thrower, throwable, message);
-        }
-    }
-
-    public static void assertInstance(Object actual, Class<?> expected) {
-        assertInstance(expected.isInstance(actual), null);
-    }
-
-    public static void assertInstance(Object actual, Class<?> expected, String message) {
-        assertTrue(expected.isInstance(actual), message);
+    private void assertThrowsAIOOB(ThrowingRunnable r) {
+        assertThrows(ArrayIndexOutOfBoundsException.class, r);
     }
 
     static void assertArraysEqual(int[] actual, int[] expected) {
diff --git a/jdk/test/java/util/Arrays/StreamAndSpliterator.java b/jdk/test/java/util/Arrays/StreamAndSpliterator.java
index b475e7e..47994f1 100644
--- a/jdk/test/java/util/Arrays/StreamAndSpliterator.java
+++ b/jdk/test/java/util/Arrays/StreamAndSpliterator.java
@@ -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
@@ -32,7 +32,9 @@
 import java.util.Arrays;
 import java.util.Spliterators;
 
-import static org.testng.Assert.assertNotNull;
+import org.testng.Assert.ThrowingRunnable;
+
+import static org.testng.Assert.assertThrows;
 
 public class StreamAndSpliterator {
     @Test
@@ -124,25 +126,11 @@
         assertThrowsAIOOB(() -> Spliterators.spliterator(new String[]{}, 0, 1, 0));
     }
 
-    void assertThrowsNPE(Runnable r) {
-        NullPointerException caught = null;
-        try {
-            r.run();
-        }
-        catch (NullPointerException e) {
-            caught = e;
-        }
-        assertNotNull(caught, "NullPointerException not thrown");
+    void assertThrowsNPE(ThrowingRunnable r) {
+        assertThrows(NullPointerException.class, r);
     }
 
-    void assertThrowsAIOOB(Runnable r) {
-        ArrayIndexOutOfBoundsException caught = null;
-        try {
-            r.run();
-        }
-        catch (ArrayIndexOutOfBoundsException e) {
-            caught = e;
-        }
-        assertNotNull(caught, "ArrayIndexOutOfBoundsException not thrown");
+    void assertThrowsAIOOB(ThrowingRunnable r) {
+        assertThrows(ArrayIndexOutOfBoundsException.class, r);
     }
 }
diff --git a/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java b/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
index 871b31f..e6bf027 100644
--- a/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
+++ b/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
@@ -42,6 +42,7 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertThrows;
 import static org.testng.Assert.assertTrue;
 
 /**
@@ -167,8 +168,8 @@
 
     @Test(dataProvider = "BitSet.stream.spliterator")
     public void testIntNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
+        assertThrows(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
+        assertThrows(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
     }
 
     @Test(dataProvider = "BitSet.stream.spliterator")
diff --git a/jdk/test/java/util/Collections/EmptyNavigableMap.java b/jdk/test/java/util/Collections/EmptyNavigableMap.java
index 359d30f..e874d32 100644
--- a/jdk/test/java/util/Collections/EmptyNavigableMap.java
+++ b/jdk/test/java/util/Collections/EmptyNavigableMap.java
@@ -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
@@ -36,10 +36,12 @@
 import java.util.NavigableMap;
 import java.util.SortedMap;
 import java.util.TreeMap;
+
+import org.testng.Assert;
+import org.testng.Assert.ThrowingRunnable;
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 
-import static org.testng.Assert.fail;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 
@@ -65,26 +67,27 @@
             ((null != message) ? message : "") + " Not empty. ");
     }
 
-    public interface Thrower<T extends Throwable> {
-
-        public void run() throws T;
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable) {
-        assertThrows(thrower, throwable, null);
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable, String message) {
-        Throwable result;
+    private <T extends Throwable> void assertThrows(Class<T> throwableClass,
+                                                    ThrowingRunnable runnable,
+                                                    String message) {
         try {
-            thrower.run();
-            fail(((null != message) ? message : "") + "Failed to throw " + throwable.getCanonicalName() + ". ");
-            return;
-        } catch (Throwable caught) {
-            result = caught;
+            Assert.assertThrows(throwableClass, runnable);
+        } catch (AssertionError e) {
+            throw new AssertionError(String.format("%s%n%s",
+                    ((null != message) ? message : ""), e.getMessage()), e);
         }
+    }
 
-        assertInstance(result, throwable, ((null != message) ? message : "") + "Failed to throw " + throwable.getCanonicalName() + ". ");
+    private void assertThrowsCCE(ThrowingRunnable r, String s) {
+        assertThrows(ClassCastException.class, r, s);
+    }
+
+    private void assertThrowsNPE(ThrowingRunnable r, String s) {
+        assertThrows(NullPointerException.class, r, s);
+    }
+
+    private void assertThrowsIAE(ThrowingRunnable r, String s) {
+        assertThrows(IllegalArgumentException.class, r, s);
     }
 
     public static final boolean isDescending(SortedMap<?,?> set) {
@@ -121,10 +124,9 @@
      */
     @Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
     public void testContainsRequiresComparable(String description, NavigableMap<?,?> navigableMap) {
-        assertThrows(() -> {
+        assertThrowsCCE(() -> {
             navigableMap.containsKey(new Object());
         },
-            ClassCastException.class,
             description + ": Compareable should be required");
     }
 
@@ -175,14 +177,12 @@
      */
     @Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
     public void testHeadMap(String description, NavigableMap navigableMap) {
-        assertThrows(
+        assertThrowsNPE(
             () -> { NavigableMap ss = navigableMap.headMap(null, false); },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> { NavigableMap ss = navigableMap.headMap(new Object(), true); },
-            ClassCastException.class,
             description + ": Must throw ClassCastException for non-Comparable element");
 
         NavigableMap ss = navigableMap.headMap("1", false);
@@ -203,50 +203,44 @@
      */
     @Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
     public void testSubMap(String description, NavigableMap navigableMap) {
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedMap ss = navigableMap.subMap(null, BigInteger.TEN);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedMap ss = navigableMap.subMap(BigInteger.ZERO, null);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedMap ss = navigableMap.subMap(null, null);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
         Object obj1 = new Object();
         Object obj2 = new Object();
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedMap ss = navigableMap.subMap(obj1, BigInteger.TEN);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedMap ss = navigableMap.subMap(BigInteger.ZERO, obj2);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedMap ss = navigableMap.subMap(obj1, obj2);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
         // minimal range
         navigableMap.subMap(BigInteger.ZERO, false, BigInteger.ZERO, false);
@@ -257,12 +251,11 @@
         Object first = isDescending(navigableMap) ? BigInteger.TEN : BigInteger.ZERO;
         Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
 
-            assertThrows(
+            assertThrowsIAE(
                 () -> {
                     navigableMap.subMap(last, true, first, false);
                 },
-                IllegalArgumentException.class, description
-                + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
+                description + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
 
         navigableMap.subMap(first, true, last, false);
     }
@@ -280,10 +273,9 @@
         // slightly smaller
         NavigableMap ns = subMap.subMap(first, false, last, false);
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.subMap(first, true, last, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -301,10 +293,9 @@
         NavigableMap ns = subMap.headMap(BigInteger.ONE, false);
 
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.headMap(BigInteger.ONE, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -322,10 +313,9 @@
         NavigableMap ns = subMap.tailMap(BigInteger.ONE, false);
 
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.tailMap(BigInteger.ONE, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -337,15 +327,15 @@
      */
     @Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
     public void testTailMap(String description, NavigableMap navigableMap) {
-        assertThrows(() -> {
+        assertThrowsNPE(() -> {
             navigableMap.tailMap(null);
         },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(() -> {
+        assertThrowsCCE(() -> {
             navigableMap.tailMap(new Object());
-        }, ClassCastException.class);
+        },
+            description);
 
         NavigableMap ss = navigableMap.tailMap("1", true);
 
diff --git a/jdk/test/java/util/Collections/EmptyNavigableSet.java b/jdk/test/java/util/Collections/EmptyNavigableSet.java
index afe216d..7ee13b8 100644
--- a/jdk/test/java/util/Collections/EmptyNavigableSet.java
+++ b/jdk/test/java/util/Collections/EmptyNavigableSet.java
@@ -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
@@ -37,10 +37,12 @@
 import java.util.NavigableSet;
 import java.util.SortedSet;
 import java.util.TreeSet;
+
+import org.testng.Assert;
+import org.testng.Assert.ThrowingRunnable;
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 
-import static org.testng.Assert.fail;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
@@ -67,26 +69,31 @@
             ((null != message) ? message : "") + " Not empty. ");
     }
 
-    public interface Thrower<T extends Throwable> {
-
-        public void run() throws T;
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable) {
-        assertThrows(thrower, throwable, null);
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable, String message) {
-        Throwable result;
+    private <T extends Throwable> void assertThrows(Class<T> throwableClass,
+                                                    ThrowingRunnable runnable,
+                                                    String message) {
         try {
-            thrower.run();
-            fail(((null != message) ? message : "") + "Failed to throw " + throwable.getCanonicalName() + ". ");
-            return;
-        } catch (Throwable caught) {
-            result = caught;
+            Assert.assertThrows(throwableClass, runnable);
+        } catch (AssertionError e) {
+            throw new AssertionError(String.format("%s%n%s",
+                    ((null != message) ? message : ""), e.getMessage()), e);
         }
+    }
 
-        assertInstance(result, throwable, ((null != message) ? message : "") + "Failed to throw " + throwable.getCanonicalName() + ". ");
+    private void assertThrowsCCE(ThrowingRunnable r, String s) {
+        assertThrows(ClassCastException.class, r, s);
+    }
+
+    private void assertThrowsNPE(ThrowingRunnable r, String s) {
+        assertThrows(NullPointerException.class, r, s);
+    }
+
+    private void assertThrowsIAE(ThrowingRunnable r, String s) {
+        assertThrows(IllegalArgumentException.class, r, s);
+    }
+
+    private void assertThrowsNSEE(ThrowingRunnable r, String s) {
+        assertThrows(NoSuchElementException.class, r, s);
     }
 
     public static final boolean isDescending(SortedSet<?> set) {
@@ -123,10 +130,9 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testContainsRequiresComparable(String description, NavigableSet<?> navigableSet) {
-        assertThrows(() -> {
+        assertThrowsCCE(() -> {
             navigableSet.contains(new Object());
         },
-            ClassCastException.class,
             description + ": Compareable should be required");
     }
 
@@ -176,9 +182,9 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testFirst(String description, NavigableSet<?> navigableSet) {
-        assertThrows(() -> {
+        assertThrowsNSEE(() -> {
             navigableSet.first();
-        }, NoSuchElementException.class, description);
+        }, description);
     }
 
     /**
@@ -186,14 +192,12 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testHeadSet(String description, NavigableSet navigableSet) {
-        assertThrows(
+        assertThrowsNPE(
             () -> { NavigableSet ns = navigableSet.headSet(null, false); },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> { NavigableSet ns = navigableSet.headSet(new Object(), true); },
-            ClassCastException.class,
             description + ": Must throw ClassCastException for non-Comparable element");
 
         NavigableSet ns = navigableSet.headSet("1", false);
@@ -206,9 +210,9 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testLast(String description, NavigableSet<?> navigableSet) {
-        assertThrows(() -> {
+        assertThrowsNSEE(() -> {
             navigableSet.last();
-        }, NoSuchElementException.class, description);
+        }, description);
     }
 
     /**
@@ -224,50 +228,44 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testSubSet(String description, NavigableSet navigableSet) {
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedSet ss = navigableSet.subSet(null, BigInteger.TEN);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedSet ss = navigableSet.subSet(BigInteger.ZERO, null);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(
+        assertThrowsNPE(
             () -> {
                 SortedSet ss = navigableSet.subSet(null, null);
             },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
         Object obj1 = new Object();
         Object obj2 = new Object();
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedSet ss = navigableSet.subSet(obj1, BigInteger.TEN);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedSet ss = navigableSet.subSet(BigInteger.ZERO, obj2);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
-        assertThrows(
+        assertThrowsCCE(
             () -> {
                 SortedSet ss = navigableSet.subSet(obj1, obj2);
             },
-            ClassCastException.class, description
-            + ": Must throw ClassCastException for parameter which is not Comparable.");
+            description + ": Must throw ClassCastException for parameter which is not Comparable.");
 
         // minimal range
         navigableSet.subSet(BigInteger.ZERO, false, BigInteger.ZERO, false);
@@ -278,11 +276,11 @@
         Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
         Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
 
-            assertThrows(
+            assertThrowsIAE(
                 () -> {
                     navigableSet.subSet(last, true, first, false);
                 },
-                IllegalArgumentException.class, description
+                description
                 + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
 
         navigableSet.subSet(first, true, last, false);
@@ -301,10 +299,9 @@
         // slightly smaller
         NavigableSet ns = subSet.subSet(first, false, last, false);
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.subSet(first, true, last, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -322,10 +319,9 @@
         NavigableSet ns = subSet.headSet(BigInteger.ONE, false);
 
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.headSet(BigInteger.ONE, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -343,10 +339,9 @@
         NavigableSet ns = subSet.tailSet(BigInteger.ONE, false);
 
         // slight expansion
-        assertThrows(() -> {
+        assertThrowsIAE(() -> {
             ns.tailSet(BigInteger.ONE, true);
         },
-            IllegalArgumentException.class,
             description + ": Expansion should not be allowed");
 
         // much smaller
@@ -358,15 +353,14 @@
      */
     @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
     public void testTailSet(String description, NavigableSet navigableSet) {
-        assertThrows(() -> {
+        assertThrowsNPE(() -> {
             navigableSet.tailSet(null);
         },
-            NullPointerException.class,
             description + ": Must throw NullPointerException for null element");
 
-        assertThrows(() -> {
+        assertThrowsCCE(() -> {
             navigableSet.tailSet(new Object());
-        }, ClassCastException.class);
+        }, description);
 
         NavigableSet ss = navigableSet.tailSet("1", true);
 
diff --git a/jdk/test/java/util/Iterator/PrimitiveIteratorDefaults.java b/jdk/test/java/util/Iterator/PrimitiveIteratorDefaults.java
index 2880578..a94323d 100644
--- a/jdk/test/java/util/Iterator/PrimitiveIteratorDefaults.java
+++ b/jdk/test/java/util/Iterator/PrimitiveIteratorDefaults.java
@@ -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
@@ -21,16 +21,16 @@
  * questions.
  */
 
-import org.testng.annotations.Test;
-
 import java.util.PrimitiveIterator;
 import java.util.function.Consumer;
 import java.util.function.DoubleConsumer;
 import java.util.function.IntConsumer;
 import java.util.function.LongConsumer;
 
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+import org.testng.Assert.ThrowingRunnable;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertThrows;
 
 /**
  * @test
@@ -53,8 +53,8 @@
             }
         };
 
-        executeAndCatch(() -> i.forEachRemaining((IntConsumer) null));
-        executeAndCatch(() -> i.forEachRemaining((Consumer<Integer>) null));
+        assertThrowsNPE(() -> i.forEachRemaining((IntConsumer) null));
+        assertThrowsNPE(() -> i.forEachRemaining((Consumer<Integer>) null));
     }
 
     public void testLongForEachRemainingWithNull() {
@@ -70,8 +70,8 @@
             }
         };
 
-        executeAndCatch(() -> i.forEachRemaining((LongConsumer) null));
-        executeAndCatch(() -> i.forEachRemaining((Consumer<Long>) null));
+        assertThrowsNPE(() -> i.forEachRemaining((LongConsumer) null));
+        assertThrowsNPE(() -> i.forEachRemaining((Consumer<Long>) null));
     }
 
     public void testDoubleForEachRemainingWithNull() {
@@ -87,29 +87,12 @@
             }
         };
 
-        executeAndCatch(() -> i.forEachRemaining((DoubleConsumer) null));
-        executeAndCatch(() -> i.forEachRemaining((Consumer<Double>) null));
+        assertThrowsNPE(() -> i.forEachRemaining((DoubleConsumer) null));
+        assertThrowsNPE(() -> i.forEachRemaining((Consumer<Double>) null));
     }
 
-    private void executeAndCatch(Runnable r) {
-        executeAndCatch(NullPointerException.class, r);
-    }
-
-    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        assertTrue(expected.isInstance(caught),
-                   String.format("Exception thrown %s not an instance of %s",
-                                 caught.getClass().getName(), expected.getName()));
+    private void assertThrowsNPE(ThrowingRunnable r) {
+        assertThrows(NullPointerException.class, r);
     }
 
 }
diff --git a/jdk/test/java/util/Map/Defaults.java b/jdk/test/java/util/Map/Defaults.java
index 7b2956f..02292ad 100644
--- a/jdk/test/java/util/Map/Defaults.java
+++ b/jdk/test/java/util/Map/Defaults.java
@@ -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
@@ -53,15 +53,19 @@
 import java.util.function.Function;
 import java.util.function.Supplier;
 
+import org.testng.Assert.ThrowingRunnable;
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
+
 import static java.util.Objects.requireNonNull;
+
 import static org.testng.Assert.fail;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertThrows;
 
 public class Defaults {
 
@@ -159,14 +163,8 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=nonNull values=nonNull")
     public static void testReplaceAllNoNullReplacement(String description, Map<IntegerEnum, String> map) {
-        assertThrows(
-            () -> { map.replaceAll(null); },
-            NullPointerException.class,
-            description);
-        assertThrows(
-            () -> { map.replaceAll((k,v) -> null); },
-            NullPointerException.class,
-            description + " should not allow replacement with null value");
+        assertThrowsNPE(() -> map.replaceAll(null));
+        assertThrowsNPE(() -> map.replaceAll((k,v) -> null)); //should not allow replacement with null value
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
@@ -209,7 +207,7 @@
     public void testReplaceKVNoNulls(String description, Map<IntegerEnum, String> map) {
         assertTrue(map.containsKey(FIRST_KEY), "expected key missing");
         assertSame(map.get(FIRST_KEY), FIRST_VALUE, "found wrong value");
-        assertThrows( () -> {map.replace(FIRST_KEY, null);}, NullPointerException.class, description + ": should throw NPE");
+        assertThrowsNPE(() -> map.replace(FIRST_KEY, null));
         assertSame(map.replace(FIRST_KEY, EXTRA_VALUE), FIRST_VALUE, description + ": replaced wrong value");
         assertSame(map.get(FIRST_KEY), EXTRA_VALUE, "found wrong value");
     }
@@ -248,8 +246,13 @@
     public void testReplaceKVVNoNulls(String description, Map<IntegerEnum, String> map) {
         assertTrue(map.containsKey(FIRST_KEY), "expected key missing");
         assertSame(map.get(FIRST_KEY), FIRST_VALUE, "found wrong value");
-        assertThrows( () -> {map.replace(FIRST_KEY, FIRST_VALUE, null);}, NullPointerException.class, description + ": should throw NPE");
-        assertThrows( () -> {if (!map.replace(FIRST_KEY, null, EXTRA_VALUE)) throw new NullPointerException("default returns false rather than throwing");}, NullPointerException.class,  description + ": should throw NPE");
+        assertThrowsNPE(() -> map.replace(FIRST_KEY, FIRST_VALUE, null));
+        assertThrowsNPE(
+                () -> {
+                    if (!map.replace(FIRST_KEY, null, EXTRA_VALUE)) {
+                        throw new NullPointerException("default returns false rather than throwing");
+                    }
+                });
         assertTrue(map.replace(FIRST_KEY, FIRST_VALUE, EXTRA_VALUE), description + ": replaced wrong value");
         assertSame(map.get(FIRST_KEY), EXTRA_VALUE, "found wrong value");
     }
@@ -319,9 +322,7 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testComputeIfAbsentNullFunction(String description, Map<IntegerEnum, String> map) {
-        assertThrows( () -> { map.computeIfAbsent(KEYS[1], null);},
-                NullPointerException.class,
-                "Should throw NPE");
+        assertThrowsNPE(() -> map.computeIfAbsent(KEYS[1], null));
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
@@ -366,9 +367,7 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testComputeIfPresentNullFunction(String description, Map<IntegerEnum, String> map) {
-        assertThrows( () -> { map.computeIfPresent(KEYS[1], null);},
-                NullPointerException.class,
-                "Should throw NPE");
+        assertThrowsNPE(() -> map.computeIfPresent(KEYS[1], null));
     }
 
      @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
@@ -459,9 +458,7 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testComputeNullFunction(String description, Map<IntegerEnum, String> map) {
-        assertThrows( () -> { map.compute(KEYS[1], null);},
-                NullPointerException.class,
-                "Should throw NPE");
+        assertThrowsNPE(() -> map.compute(KEYS[1], null));
     }
 
     @Test(dataProvider = "MergeCases")
@@ -531,9 +528,7 @@
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
     public void testMergeNullMerger(String description, Map<IntegerEnum, String> map) {
-        assertThrows( () -> { map.merge(KEYS[1], VALUES[1], null);},
-                NullPointerException.class,
-                "Should throw NPE");
+        assertThrowsNPE(() -> map.merge(KEYS[1], VALUES[1], null));
     }
 
     /** A function that flipflops between running two other functions. */
@@ -973,41 +968,8 @@
         return cases;
     }
 
-    public interface Thrower<T extends Throwable> {
-
-        public void run() throws T;
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable) {
-        assertThrows(thrower, throwable, null);
-    }
-
-    public static <T extends Throwable> void assertThrows(Thrower<T> thrower, Class<T> throwable, String message) {
-        Throwable thrown;
-        try {
-            thrower.run();
-            thrown = null;
-        } catch (Throwable caught) {
-            thrown = caught;
-        }
-
-        assertInstance(thrown, throwable,
-            ((null != message) ? message : "") +
-            " Failed to throw " + throwable.getCanonicalName());
-    }
-
-    public static <T extends Throwable> void assertThrows(Class<T> throwable, String message, Thrower<T>... throwers) {
-        for (Thrower<T> thrower : throwers) {
-            assertThrows(thrower, throwable, message);
-        }
-    }
-
-    public static void assertInstance(Object actual, Class<?> expected) {
-        assertInstance(expected.isInstance(actual), null);
-    }
-
-    public static void assertInstance(Object actual, Class<?> expected, String message) {
-        assertTrue(expected.isInstance(actual), message);
+    public static void assertThrowsNPE(ThrowingRunnable r) {
+        assertThrows(NullPointerException.class, r);
     }
 
     /**
diff --git a/jdk/test/java/util/Random/RandomTest.java b/jdk/test/java/util/Random/RandomTest.java
index 3055f5c..6b16e5b 100644
--- a/jdk/test/java/util/Random/RandomTest.java
+++ b/jdk/test/java/util/Random/RandomTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, 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
@@ -21,14 +21,13 @@
  * questions.
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.LongAdder;
 import java.util.function.BiConsumer;
 
+import org.testng.annotations.Test;
+
 import static org.testng.Assert.*;
 
 /**
@@ -172,12 +171,12 @@
      */
     public void testBadStreamSize() {
         Random r = new Random();
-        executeAndCatchIAE(() -> r.ints(-1L));
-        executeAndCatchIAE(() -> r.ints(-1L, 2, 3));
-        executeAndCatchIAE(() -> r.longs(-1L));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L, 1L));
-        executeAndCatchIAE(() -> r.doubles(-1L));
-        executeAndCatchIAE(() -> r.doubles(-1L, .5, .6));
+        assertThrowsIAE(() -> r.ints(-1L));
+        assertThrowsIAE(() -> r.ints(-1L, 2, 3));
+        assertThrowsIAE(() -> r.longs(-1L));
+        assertThrowsIAE(() -> r.longs(-1L, -1L, 1L));
+        assertThrowsIAE(() -> r.doubles(-1L));
+        assertThrowsIAE(() -> r.doubles(-1L, .5, .6));
     }
 
     /**
@@ -186,10 +185,10 @@
      */
     public void testBadStreamBounds() {
         Random r = new Random();
-        executeAndCatchIAE(() -> r.ints(2, 1));
-        executeAndCatchIAE(() -> r.ints(10, 42, 42));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L));
-        executeAndCatchIAE(() -> r.longs(10, 1L, -2L));
+        assertThrowsIAE(() -> r.ints(2, 1));
+        assertThrowsIAE(() -> r.ints(10, 42, 42));
+        assertThrowsIAE(() -> r.longs(-1L, -1L));
+        assertThrowsIAE(() -> r.longs(10, 1L, -2L));
 
         testDoubleBadOriginBound((o, b) -> r.doubles(10, o, b));
     }
@@ -198,45 +197,28 @@
     static final double FINITE = Math.PI;
 
     void testDoubleBadOriginBound(BiConsumer<Double, Double> bi) {
-        executeAndCatchIAE(() -> bi.accept(17.0, 2.0));
-        executeAndCatchIAE(() -> bi.accept(0.0, 0.0));
-        executeAndCatchIAE(() -> bi.accept(Double.NaN, FINITE));
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NaN));
-        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
+        assertThrowsIAE(() -> bi.accept(17.0, 2.0));
+        assertThrowsIAE(() -> bi.accept(0.0, 0.0));
+        assertThrowsIAE(() -> bi.accept(Double.NaN, FINITE));
+        assertThrowsIAE(() -> bi.accept(FINITE, Double.NaN));
+        assertThrowsIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
 
         // Returns NaN
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, FINITE));
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
+//        assertThrowsIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, FINITE));
+//        assertThrowsIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
 
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NEGATIVE_INFINITY));
+        assertThrowsIAE(() -> bi.accept(FINITE, Double.NEGATIVE_INFINITY));
 
         // Returns Double.MAX_VALUE
-//        executeAndCatchIAE(() -> bi.accept(FINITE, Double.POSITIVE_INFINITY));
+//        assertThrowsIAE(() -> bi.accept(FINITE, Double.POSITIVE_INFINITY));
 
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, FINITE));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
+        assertThrowsIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY));
+        assertThrowsIAE(() -> bi.accept(Double.POSITIVE_INFINITY, FINITE));
+        assertThrowsIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
     }
 
-    private void executeAndCatchIAE(Runnable r) {
-        executeAndCatch(IllegalArgumentException.class, r);
-    }
-
-    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        Assert.assertTrue(expected.isInstance(caught),
-                          String.format("Exception thrown %s not an instance of %s",
-                                        caught.getClass().getName(), expected.getName()));
+    private void assertThrowsIAE(ThrowingRunnable r) {
+        assertThrows(IllegalArgumentException.class, r);
     }
 
     /**
diff --git a/jdk/test/java/util/ResourceBundle/getBaseBundleName/resources/PropertyBundle.properties b/jdk/test/java/util/ResourceBundle/getBaseBundleName/resources/PropertyBundle.properties
index 343c648..92af2a6 100644
--- a/jdk/test/java/util/ResourceBundle/getBaseBundleName/resources/PropertyBundle.properties
+++ b/jdk/test/java/util/ResourceBundle/getBaseBundleName/resources/PropertyBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 20013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 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
@@ -21,4 +21,3 @@
 # questions.
 #
 dummy=foo
-
diff --git a/jdk/test/java/util/Spliterator/SpliteratorCollisions.java b/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
index 43c0fc6..da9de48f 100644
--- a/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
+++ b/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
@@ -212,16 +212,16 @@
     void testNullPointerException(String description,
                                   Collection<HashableInteger> exp,
                                   Supplier<Spliterator<HashableInteger>> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining(null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance(null));
+        assertThrowsNPE(() -> s.get().forEachRemaining(null));
+        assertThrowsNPE(() -> s.get().tryAdvance(null));
     }
 
     @Test(dataProvider = "HashableIntSpliteratorWithNull")
     void testNullPointerExceptionWithNull(String description,
                                           Collection<HashableInteger> exp,
                                           Supplier<Spliterator<HashableInteger>> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining(null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance(null));
+        assertThrowsNPE(() -> s.get().forEachRemaining(null));
+        assertThrowsNPE(() -> s.get().tryAdvance(null));
     }
 
 
diff --git a/jdk/test/java/util/Spliterator/SpliteratorFailFastTest.java b/jdk/test/java/util/Spliterator/SpliteratorFailFastTest.java
index a0e71d2..84d6ca9 100644
--- a/jdk/test/java/util/Spliterator/SpliteratorFailFastTest.java
+++ b/jdk/test/java/util/Spliterator/SpliteratorFailFastTest.java
@@ -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
@@ -21,9 +21,6 @@
  * questions.
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.ConcurrentModificationException;
@@ -42,8 +39,11 @@
 import java.util.WeakHashMap;
 import java.util.function.Supplier;
 
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+import org.testng.Assert.ThrowingRunnable;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertThrows;
 
 /**
  * @test
@@ -125,7 +125,7 @@
             });
             source.update();
 
-            executeAndCatch(() -> s.tryAdvance(e -> {
+            assertThrowsCME(() -> s.tryAdvance(e -> {
             }));
         }
 
@@ -137,7 +137,7 @@
             });
             source.update();
 
-            executeAndCatch(() -> s.forEachRemaining(e -> {
+            assertThrowsCME(() -> s.forEachRemaining(e -> {
             }));
         }
     }
@@ -147,7 +147,7 @@
         Source<T> source = ss.get();
         Spliterator<T> s = source.spliterator();
 
-        executeAndCatch(() -> s.forEachRemaining(e -> {
+        assertThrowsCME(() -> s.forEachRemaining(e -> {
             source.update();
         }));
     }
@@ -161,7 +161,7 @@
             s.estimateSize();
             source.update();
 
-            executeAndCatch(() -> s.tryAdvance(e -> {
+            assertThrowsCME(() -> s.tryAdvance(e -> {
             }));
         }
 
@@ -172,30 +172,13 @@
             s.estimateSize();
             source.update();
 
-            executeAndCatch(() -> s.forEachRemaining(e -> {
+            assertThrowsCME(() -> s.forEachRemaining(e -> {
             }));
         }
     }
 
-    private void executeAndCatch(Runnable r) {
-        executeAndCatch(ConcurrentModificationException.class, r);
-    }
-
-    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        assertTrue(expected.isInstance(caught),
-                   String.format("Exception thrown %s not an instance of %s",
-                                 caught.getClass().getName(), expected.getName()));
+    private void assertThrowsCME(ThrowingRunnable r) {
+        assertThrows(ConcurrentModificationException.class, r);
     }
 
 }
diff --git a/jdk/test/java/util/Spliterator/SpliteratorLateBindingFailFastHelper.java b/jdk/test/java/util/Spliterator/SpliteratorLateBindingFailFastHelper.java
index a3c53b7..cc89340 100644
--- a/jdk/test/java/util/Spliterator/SpliteratorLateBindingFailFastHelper.java
+++ b/jdk/test/java/util/Spliterator/SpliteratorLateBindingFailFastHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
index 3376a06..ca45ab7 100644
--- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
+++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
@@ -666,8 +666,8 @@
 
     @Test(dataProvider = "Spliterator<Integer>")
     public void testNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator<Integer>> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining(null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance(null));
+        assertThrowsNPE(() -> s.get().forEachRemaining(null));
+        assertThrowsNPE(() -> s.get().tryAdvance(null));
     }
 
     @Test(dataProvider = "Spliterator<Integer>")
@@ -866,8 +866,8 @@
 
     @Test(dataProvider = "Spliterator.OfInt")
     public void testIntNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
+        assertThrowsNPE(() -> s.get().forEachRemaining((IntConsumer) null));
+        assertThrowsNPE(() -> s.get().tryAdvance((IntConsumer) null));
     }
 
     @Test(dataProvider = "Spliterator.OfInt")
@@ -1009,8 +1009,8 @@
 
     @Test(dataProvider = "Spliterator.OfLong")
     public void testLongNullPointerException(String description, Collection<Long> exp, Supplier<Spliterator.OfLong> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((LongConsumer) null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((LongConsumer) null));
+        assertThrowsNPE(() -> s.get().forEachRemaining((LongConsumer) null));
+        assertThrowsNPE(() -> s.get().tryAdvance((LongConsumer) null));
     }
 
     @Test(dataProvider = "Spliterator.OfLong")
@@ -1152,8 +1152,8 @@
 
     @Test(dataProvider = "Spliterator.OfDouble")
     public void testDoubleNullPointerException(String description, Collection<Double> exp, Supplier<Spliterator.OfDouble> s) {
-        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((DoubleConsumer) null));
-        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((DoubleConsumer) null));
+        assertThrowsNPE(() -> s.get().forEachRemaining((DoubleConsumer) null));
+        assertThrowsNPE(() -> s.get().tryAdvance((DoubleConsumer) null));
     }
 
     @Test(dataProvider = "Spliterator.OfDouble")
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/java/util/jar/Pack200/SecurityTest.java
similarity index 69%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/java/util/jar/Pack200/SecurityTest.java
index f4974e3..93b2481 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/java/util/jar/Pack200/SecurityTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,19 @@
  * questions.
  */
 
-package javax.transaction.atomic;
+/**
+ * @test
+ * @bug 8179645
+ * @run main/othervm SecurityTest
+ * @summary Verify Pack200 initialization with security manager
+ */
 
-public interface Atomic {
+import java.util.jar.Pack200;
 
+public class SecurityTest {
+    public static void main(String... args) {
+        System.setSecurityManager(new SecurityManager());
+        Pack200.newPacker();
+        Pack200.newUnpacker();
+    }
 }
diff --git a/jdk/test/java/util/logging/Logger/logrb/resources/PropertyBundle.properties b/jdk/test/java/util/logging/Logger/logrb/resources/PropertyBundle.properties
index 343c648..92af2a6 100644
--- a/jdk/test/java/util/logging/Logger/logrb/resources/PropertyBundle.properties
+++ b/jdk/test/java/util/logging/Logger/logrb/resources/PropertyBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 20013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 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
@@ -21,4 +21,3 @@
 # questions.
 #
 dummy=foo
-
diff --git a/jdk/test/java/util/logging/Logger/setResourceBundle/resources/PropertyBundle.properties b/jdk/test/java/util/logging/Logger/setResourceBundle/resources/PropertyBundle.properties
index 343c648..92af2a6 100644
--- a/jdk/test/java/util/logging/Logger/setResourceBundle/resources/PropertyBundle.properties
+++ b/jdk/test/java/util/logging/Logger/setResourceBundle/resources/PropertyBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 20013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 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
@@ -21,4 +21,3 @@
 # questions.
 #
 dummy=foo
-
diff --git a/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java b/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java
index b18f522..394e23d 100644
--- a/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java
+++ b/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java
@@ -41,8 +41,8 @@
  * @modules jdk.attach/sun.tools.attach
  *          java.logging
  * @build jdk.testlibrary.ProcessTools
- * @run main/othervm TestLoggerWeakRefLeak Logger
- * @run main/othervm TestLoggerWeakRefLeak AnonymousLogger
+ * @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak Logger
+ * @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak AnonymousLogger
  */
 public class TestLoggerWeakRefLeak {
 
diff --git a/jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorTestHelper.java b/jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorTestHelper.java
index 0876584..8bbf20d 100644
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorTestHelper.java
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorTestHelper.java
@@ -26,8 +26,6 @@
 import java.util.stream.LambdaTestHelpers;
 
 import static org.testng.Assert.*;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
 
 /**
  * Assertion methods for spliterators, to be called from other tests
@@ -224,22 +222,22 @@
         // directly test the primitive methods
         if (sp instanceof Spliterator.OfInt) {
             Spliterator.OfInt psp = (Spliterator.OfInt) sp;
-            executeAndCatch(NullPointerException.class, () -> psp.forEachRemaining((IntConsumer) null));
-            executeAndCatch(NullPointerException.class, () -> psp.tryAdvance((IntConsumer) null));
+            assertThrowsNPE(() -> psp.forEachRemaining((IntConsumer) null));
+            assertThrowsNPE(() -> psp.tryAdvance((IntConsumer) null));
         }
         else if (sp instanceof Spliterator.OfLong) {
             Spliterator.OfLong psp = (Spliterator.OfLong) sp;
-            executeAndCatch(NullPointerException.class, () -> psp.forEachRemaining((LongConsumer) null));
-            executeAndCatch(NullPointerException.class, () -> psp.tryAdvance((LongConsumer) null));
+            assertThrowsNPE(() -> psp.forEachRemaining((LongConsumer) null));
+            assertThrowsNPE(() -> psp.tryAdvance((LongConsumer) null));
         }
         else if (sp instanceof Spliterator.OfDouble) {
             Spliterator.OfDouble psp = (Spliterator.OfDouble) sp;
-            executeAndCatch(NullPointerException.class, () -> psp.forEachRemaining((DoubleConsumer) null));
-            executeAndCatch(NullPointerException.class, () -> psp.tryAdvance((DoubleConsumer) null));
+            assertThrowsNPE(() -> psp.forEachRemaining((DoubleConsumer) null));
+            assertThrowsNPE(() -> psp.tryAdvance((DoubleConsumer) null));
         }
         else {
-            executeAndCatch(NullPointerException.class, () -> sp.forEachRemaining(null));
-            executeAndCatch(NullPointerException.class, () -> sp.tryAdvance(null));
+            assertThrowsNPE(() -> sp.forEachRemaining(null));
+            assertThrowsNPE(() -> sp.tryAdvance(null));
         }
     }
 
@@ -653,21 +651,8 @@
         }
     }
 
-    public static void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        assertTrue(expected.isInstance(caught),
-                   String.format("Exception thrown %s not an instance of %s",
-                                 caught.getClass().getName(), expected.getName()));
+    public static void assertThrowsNPE(ThrowingRunnable r) {
+        assertThrows(NullPointerException.class, r);
     }
 
     public static<U> void mixedTraverseAndSplit(Consumer<U> b, Spliterator<U> splTop) {
diff --git a/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java b/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java
index d2c07d2..436c4d0 100644
--- a/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java
+++ b/jdk/test/javax/management/loading/LibraryLoader/LibraryLoaderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/javax/management/monitor/ThreadPoolAccTest.java b/jdk/test/javax/management/monitor/ThreadPoolAccTest.java
index 5982fb1..2d2ef31 100644
--- a/jdk/test/javax/management/monitor/ThreadPoolAccTest.java
+++ b/jdk/test/javax/management/monitor/ThreadPoolAccTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java b/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java
index 4ad7465..38b0d87 100644
--- a/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java
+++ b/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/JSSEClient.java b/jdk/test/javax/net/ssl/TLS/JSSEClient.java
index c9467ba..0f51085 100644
--- a/jdk/test/javax/net/ssl/TLS/JSSEClient.java
+++ b/jdk/test/javax/net/ssl/TLS/JSSEClient.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/JSSEServer.java b/jdk/test/javax/net/ssl/TLS/JSSEServer.java
index d8f7792..9bd4fd0 100644
--- a/jdk/test/javax/net/ssl/TLS/JSSEServer.java
+++ b/jdk/test/javax/net/ssl/TLS/JSSEServer.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSE.java b/jdk/test/javax/net/ssl/TLS/TestJSSE.java
index 7e89e11..2c5a2c6 100644
--- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSEClientDefaultProtocol.java b/jdk/test/javax/net/ssl/TLS/TestJSSEClientDefaultProtocol.java
index 710bc68..91d735c 100644
--- a/jdk/test/javax/net/ssl/TLS/TestJSSEClientDefaultProtocol.java
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEClientDefaultProtocol.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java b/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java
index 2668d9f..9a37e54 100644
--- a/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSENoCommonProtocols.java b/jdk/test/javax/net/ssl/TLS/TestJSSENoCommonProtocols.java
index bfe5956..8473c8e 100644
--- a/jdk/test/javax/net/ssl/TLS/TestJSSENoCommonProtocols.java
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSENoCommonProtocols.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSEServerProtocol.java b/jdk/test/javax/net/ssl/TLS/TestJSSEServerProtocol.java
index a745a74..b306ca6 100644
--- a/jdk/test/javax/net/ssl/TLS/TestJSSEServerProtocol.java
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEServerProtocol.java
@@ -2,21 +2,22 @@
  * 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 free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/print/attribute/TestUnsupportedResolution.java b/jdk/test/javax/print/attribute/TestUnsupportedResolution.java
index 8b45b45..0ecf842 100644
--- a/jdk/test/javax/print/attribute/TestUnsupportedResolution.java
+++ b/jdk/test/javax/print/attribute/TestUnsupportedResolution.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -104,4 +104,3 @@
     return PAGE_EXISTS;
 }
 }
-
diff --git a/jdk/test/javax/security/auth/Subject/Generic.java b/jdk/test/javax/security/auth/Subject/Generic.java
index 1afba28..d81e1db 100644
--- a/jdk/test/javax/security/auth/Subject/Generic.java
+++ b/jdk/test/javax/security/auth/Subject/Generic.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
diff --git a/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASConfigSyntaxTest.java b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASConfigSyntaxTest.java
index 1a649ea..b98ed16 100644
--- a/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASConfigSyntaxTest.java
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASConfigSyntaxTest.java
@@ -1,23 +1,23 @@
-
-/**
+/*
  * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * This code is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License version 2 only, as published by
- * the Free Software Foundation.
+ * This code is free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
index 7df77b0..23f2436 100644
--- a/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
@@ -1,22 +1,23 @@
-/**
+/*
  * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * This code is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License version 2 only, as published by
- * the Free Software Foundation.
+ * This code is free software; you can redistribute 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).
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * You should have received a copy of the GNU General Public License version 2
- * along with this work; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
- * visit www.oracle.com if you need additional information or have any
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
diff --git a/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java b/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
index f6f7daa..86ccf75 100644
--- a/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
+++ b/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java b/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java
new file mode 100644
index 0000000..64c4e51
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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 8179027
+ * @requires (os.family == "windows")
+ * @summary JComboBox too small under Windows LAF
+ * @run main WindowsComboBoxSizeTest
+ */
+
+import javax.swing.*;
+import java.awt.FlowLayout;
+import java.awt.Robot;
+
+public class WindowsComboBoxSizeTest {
+    private static JTextField textField;
+    private static JComboBox<String> comboBox;
+    private static JComboBox<String> comboBoxEd;
+    private static JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new JFrame();
+            frame.getContentPane().setLayout( new FlowLayout() );
+
+            textField = new JTextField("item 1");
+            frame.getContentPane().add(textField);
+
+            comboBox = new JComboBox<>(new String[]
+                                                {"item 1", "item 2", "item 3"});
+            frame.getContentPane().add(comboBox);
+
+            comboBoxEd = new JComboBox<>(new String[]
+                                                {"item 1", "item 2", "item 3"});
+            comboBoxEd.setEditable( true );
+            frame.getContentPane().add(comboBoxEd);
+
+            frame.pack();
+            frame.setVisible( true );
+        });
+        Robot robot = new Robot();
+        robot.waitForIdle();
+
+        try {
+            test();
+        } finally {
+            SwingUtilities.invokeLater(frame::dispose);
+        }
+    }
+
+    private static void test() throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            int expected = textField.getSize().height;
+            if (comboBox.getSize().height != expected ) {
+                throw new RuntimeException(
+                        "Wrong non-editable JComboBox height " +
+                                              comboBox.getSize().height);
+            }
+            if (comboBoxEd.getSize().height != expected ) {
+                throw new RuntimeException(
+                        "Wrong editable JComboBox height " +
+                                            comboBoxEd.getSize().height);
+            }
+        });
+    }
+}
+
diff --git a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html
index a016cfb..8267185 100644
--- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html
+++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html
@@ -1,6 +1,6 @@
 <html>
 <!--
- Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -40,4 +40,4 @@
 3.Push OPEN button.
 4.Push DONE button.
 </body>
-</html> 
+</html>
diff --git a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
index 62d4923..1fd61fb 100644
--- a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
+++ b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java
@@ -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
@@ -37,7 +37,7 @@
 /**
  * @test
  * @key headful
- * @bug 8069348
+ * @bug 8069348 8159902
  * @summary SunGraphics2D.copyArea() does not properly work for scaled graphics
  * @author Alexandr Scherbatiy
  * @modules java.desktop/sun.awt
diff --git a/jdk/test/javax/swing/JInternalFrame/Test6325652.java b/jdk/test/javax/swing/JInternalFrame/Test6325652.java
index bcd2f4d..da07e19 100644
--- a/jdk/test/javax/swing/JInternalFrame/Test6325652.java
+++ b/jdk/test/javax/swing/JInternalFrame/Test6325652.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009,2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java b/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
index 10b817c..c87fd2a 100644
--- a/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
+++ b/jdk/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017 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
diff --git a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
index 94daa45..949878e 100644
--- a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
+++ b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
diff --git a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
index 73f4202..9eeaa0e 100644
--- a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
+++ b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java
@@ -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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @key headful
- * @bug 8041642 8079450
+ * @bug 8041642 8079450 8140237
  * @summary Incorrect paint of JProgressBar in Nimbus LF
  * @author Semyon Sadetsky
  */
@@ -39,16 +39,7 @@
     private static JProgressBar bar;
 
     public static void main(String[] args) throws Exception {
-        for (UIManager.LookAndFeelInfo info : UIManager
-                .getInstalledLookAndFeels()) {
-            if ("Nimbus".equals(info.getName())) {
-                try {
-                    UIManager.setLookAndFeel(info.getClassName());
-                } catch (Exception ex) {
-                }
-                break;
-            }
-        }
+        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
                 public void run() {
@@ -58,14 +49,14 @@
                     setup(frame);
                 }
             });
+            final Robot robot = new Robot();
+            robot.delay(300);
             SwingUtilities.invokeAndWait(new Runnable() {
                 @Override
                 public void run() {
                     point = bar.getLocationOnScreen();
                 }
             });
-            final Robot robot = new Robot();
-            robot.delay(100);
             Color color = robot.getPixelColor(point.x + 1, point.y + 7);
             System.out.println(color);
             if (color.getGreen() < 150 || color.getBlue() > 30 ||
@@ -77,7 +68,7 @@
             SwingUtilities.invokeAndWait(new Runnable() {
                 @Override
                 public void run() {
-                    //frame.dispose();
+                    frame.dispose();
                 }
             });
         }
diff --git a/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java b/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
index 5a04f28..c3b5069 100644
--- a/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
+++ b/jdk/test/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017 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
diff --git a/jdk/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java b/jdk/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java
index 9b713d3..3ac9883 100644
--- a/jdk/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java
+++ b/jdk/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java
@@ -8,7 +8,7 @@
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
diff --git a/jdk/test/lib/testlibrary/ModuleTargetHelper.java b/jdk/test/lib/testlibrary/ModuleTargetHelper.java
index b01e184..67ff0c7 100644
--- a/jdk/test/lib/testlibrary/ModuleTargetHelper.java
+++ b/jdk/test/lib/testlibrary/ModuleTargetHelper.java
@@ -41,19 +41,14 @@
     private ModuleTargetHelper() {}
 
     public static final class ModuleTarget {
-        private String osName, osArch;
+        private String targetPlatform;
 
-        public ModuleTarget(String osName, String osArch) {
-            this.osName = osName;
-            this.osArch = osArch;
+        public ModuleTarget(String targetPlatform) {
+            this.targetPlatform = targetPlatform;
         }
 
-        public String osName() {
-            return osName;
-        }
-
-        public String osArch() {
-            return osArch;
+        public String targetPlatform() {
+            return targetPlatform;
         }
     }
 
@@ -84,7 +79,7 @@
         ClassReader cr = new ClassReader(in);
         cr.accept(cv, attrs, 0);
         if (modTargets[0] != null) {
-            return new ModuleTarget(modTargets[0].osName(), modTargets[0].osArch());
+            return new ModuleTarget(modTargets[0].targetPlatform());
         }
 
         return null;
diff --git a/jdk/test/sample/TEST.properties b/jdk/test/sample/TEST.properties
deleted file mode 100644
index 8e5f78a..0000000
--- a/jdk/test/sample/TEST.properties
+++ /dev/null
@@ -1 +0,0 @@
-external.lib.roots = ../../
diff --git a/jdk/test/sample/chatserver/ChatTest.java b/jdk/test/sample/chatserver/ChatTest.java
deleted file mode 100644
index dcfe4d3..0000000
--- a/jdk/test/sample/chatserver/ChatTest.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 Test chat server chatserver test
- *
- * @library /src/sample/share/nio/chatserver
- * @build ChatTest ChatServer Client ClientReader DataReader MessageReader NameReader
- * @run testng ChatTest
- */
-
-import java.io.*;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CyclicBarrier;
-
-import org.testng.annotations.Test;
-
-public class ChatTest {
-    public static int listeningPort = 0;
-
-    @Test
-    public static void doTest() throws Throwable {
-        testStartStop();
-        testPortOpen();
-        testAsksForName();
-        testUseName();
-        testConnectDisconnectConnect();
-        testUsernameAndMessage();
-        testDontReceiveMessageInNameState();
-    }
-
-    private static ChatServer startServer() throws IOException {
-        ChatServer server = new ChatServer(0);
-        InetSocketAddress address = (InetSocketAddress) server.getSocketAddress();
-        listeningPort = address.getPort();
-        server.run();
-        return server;
-    }
-
-    public static void testStartStop() throws Exception {
-        ChatServer server = startServer();
-        server.shutdown();
-    }
-
-    public static void testPortOpen() throws Exception {
-        ChatServer server = startServer();
-        try {
-            Socket socket = new Socket("localhost", listeningPort);
-            if (!socket.isConnected()) {
-                throw new RuntimeException("Failed to connect to server: port not open");
-            }
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    public static void testAsksForName() throws Exception {
-        ChatServer server = startServer();
-        try {
-            Socket socket = new Socket("localhost", listeningPort);
-
-            Reader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
-            String string = readAvailableString(reader);
-            if (!string.equals("Name: ")) {
-                throw new RuntimeException("Server doesn't send Name: ");
-            }
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    public static void testUseName() throws Throwable {
-        ChatServer server = startServer();
-        try {
-            performTestUseName();
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    public static void testConnectDisconnectConnect() throws Exception {
-        ChatServer server = startServer();
-        try {
-            performTestConnectDisconnectConnect();
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    public static void testUsernameAndMessage() throws Exception {
-        ChatServer server = startServer();
-        try {
-            performTestUsernameAndMessage();
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    public static void testDontReceiveMessageInNameState() throws Exception {
-        ChatServer server = startServer();
-        try {
-            performDontReceiveMessageInNameState();
-        } finally {
-            server.shutdown();
-        }
-    }
-
-    private static void assertEqual(List<Exception> exception, Object value, Object expected) {
-        if (expected == value) {
-            return;
-        }
-        if (expected == null) {
-            exception.add(new RuntimeException("Expected null, but was: " + value));
-            return;
-        }
-        if (!expected.equals(value)) {
-            exception.add(new RuntimeException("Expected: " + expected + " but was: " + value));
-            return;
-        }
-    }
-
-    private static void performDontReceiveMessageInNameState() throws Exception {
-        final CyclicBarrier barrier1 = new CyclicBarrier(2);
-        final CyclicBarrier barrier2 = new CyclicBarrier(2);
-        final CyclicBarrier barrier3 = new CyclicBarrier(2);
-        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
-
-        ChatConnection chatConnection = new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "Name: ");
-                writer.write("testClient1\n");
-                waitForJoin(reader, "testClient1");
-                barrier1.await();
-                writer.write("Ignore this!\n");
-                barrier2.await();
-                barrier3.await();
-            }
-        };
-
-        Thread client2 = new Thread(new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                barrier1.await();
-                barrier2.await();
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "Name: ");
-                string = readAvailableString(reader, true);
-                assertEqual(exceptions, string, null);
-                writer.write("testClient2\n");
-                barrier3.await();
-            }
-        });
-
-        client2.start();
-        chatConnection.run();
-        if (!exceptions.isEmpty()) {
-            throw exceptions.get(0);
-        }
-
-    }
-
-    private static void waitForJoin(BufferedReader reader, String s) throws IOException {
-        String joined;
-        do {
-            joined = readAvailableString(reader);
-        } while (!(joined != null && joined.contains("Welcome " + s)));
-    }
-
-    private static void performTestUsernameAndMessage() throws Exception {
-        final CyclicBarrier barrier1 = new CyclicBarrier(2);
-        final CyclicBarrier barrier2 = new CyclicBarrier(2);
-        final CyclicBarrier barrier3 = new CyclicBarrier(2);
-        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
-
-        ChatConnection chatConnection = new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "Name: ");
-                writer.write("testClient1\n");
-                waitForJoin(reader, "testClient1");
-                barrier1.await();
-                barrier2.await();
-                string = readAvailableString(reader);
-                assertEqual(exceptions, string, "testClient2: Hello world!\n");
-                barrier3.await();
-            }
-        };
-
-        Thread client2 = new Thread(new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "Name: ");
-                barrier1.await();
-                writer.write("testClient2\nHello world!\n");
-                barrier2.await();
-                barrier3.await();
-            }
-        });
-
-        client2.start();
-        chatConnection.run();
-        if (!exceptions.isEmpty()) {
-            throw exceptions.get(0);
-        }
-    }
-
-    private static void performTestConnectDisconnectConnect() throws Exception {
-        final CyclicBarrier barrier1 = new CyclicBarrier(2);
-        final CyclicBarrier barrier2 = new CyclicBarrier(2);
-        final CyclicBarrier barrier3 = new CyclicBarrier(2);
-        final List<Exception> exceptions = new ArrayList<Exception>();
-
-        ChatConnection chatConnection = new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "Name: ");
-                writer.write("testClient1\n");
-            }
-        };
-
-        ChatConnection chatConnection2 = new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                readAvailableString(reader);
-                writer.write("testClient1\n");
-                waitForJoin(reader, "testClient1");
-                barrier1.await();
-                writer.write("Good morning!\n");
-                barrier2.await();
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "testClient2: Hello world!\n");
-                barrier3.await();
-            }
-        };
-
-        Thread client2 = new Thread(new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                readAvailableString(reader);
-                writer.write("testClient2\n");
-                waitForJoin(reader, "testClient2");
-                barrier1.await();
-                writer.write("Hello world!\n");
-                barrier2.await();
-                String string = readAvailableString(reader);
-                assertEqual(exceptions, string, "testClient1: Good morning!\n");
-                barrier3.await();
-            }
-        });
-
-        client2.start();
-        chatConnection.run();
-        chatConnection2.run();
-        if (!exceptions.isEmpty()) {
-            throw exceptions.get(0);
-        }
-    }
-
-    private static void performTestUseName() throws Exception {
-        final CyclicBarrier barrier1 = new CyclicBarrier(2);
-        final CyclicBarrier barrier2 = new CyclicBarrier(2);
-        final CyclicBarrier barrier3 = new CyclicBarrier(2);
-        final List<Exception> exceptions = new ArrayList<Exception>();
-
-        ChatConnection chatConnection = new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                if (!"Name: ".equals(string)) {
-                    exceptions.add(new RuntimeException("Expected Name: "));
-                }
-                writer.write("testClient1\n");
-                waitForJoin(reader, "testClient1");
-                barrier1.await();
-                barrier2.await();
-                string = readAvailableString(reader);
-                if (!"testClient2: Hello world!\n".equals(string)) {
-                    exceptions.add(new RuntimeException("testClient2: Hello world!\n"));
-                }
-                barrier3.await();
-            }
-        };
-
-        Thread client2 = new Thread(new ChatConnection() {
-            @Override
-            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
-                String string = readAvailableString(reader);
-                if (!"Name: ".equals(string)) {
-                    exceptions.add(new RuntimeException("Expected Name: "));
-                }
-                writer.write("testClient2\n");
-                waitForJoin(reader, "testClient2");
-                barrier1.await();
-                writer.write("Hello world!\n");
-                barrier2.await();
-                barrier3.await();
-            }
-        });
-
-        client2.start();
-        chatConnection.run();
-        if (!exceptions.isEmpty()) {
-            throw exceptions.get(0);
-        }
-    }
-
-    private static String readAvailableString(Reader reader) throws IOException {
-        return readAvailableString(reader, false);
-    }
-
-    private static String readAvailableString(Reader reader, boolean now) throws IOException {
-        StringBuilder builder = new StringBuilder();
-        int bytes;
-        if (now && !reader.ready()) {
-            return null;
-        }
-        do {
-            char[] buf = new char[256];
-            bytes = reader.read(buf);
-            builder.append(buf, 0, bytes);
-        } while (bytes == 256);
-        return builder.toString();
-    }
-
-    private abstract static class ChatConnection implements Runnable {
-        public Exception exception;
-
-        @Override
-        public void run() {
-            try (Socket socket = new Socket("localhost", listeningPort);
-            BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
-            Writer writer = new FlushingWriter(new OutputStreamWriter(socket.getOutputStream()))) {
-                socket.setTcpNoDelay(true);
-
-                run(socket, reader, writer);
-            } catch (Exception e) {
-                exception = e;
-            }
-        }
-
-        public abstract void run(Socket socket, BufferedReader reader, Writer writer) throws Exception;
-    }
-
-    private static class FlushingWriter extends Writer {
-        public final Writer delegate;
-
-        private FlushingWriter(Writer delegate) {
-            this.delegate = delegate;
-        }
-
-        @Override
-        public void write(char[] cbuf, int off, int len) throws IOException {
-            delegate.write(cbuf, off, len);
-        }
-
-        @Override
-        public void flush() throws IOException {
-            delegate.flush();
-        }
-
-        @Override
-        public void close() throws IOException {
-            delegate.close();
-        }
-
-        @Override
-        public void write(String str) throws IOException {
-            super.write(str);
-            flush();
-        }
-    }
-}
diff --git a/jdk/test/sample/mergesort/MergeSortTest.java b/jdk/test/sample/mergesort/MergeSortTest.java
deleted file mode 100644
index fb082c2..0000000
--- a/jdk/test/sample/mergesort/MergeSortTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 Test MergeSort
- *
- * @library /src/sample/share/forkjoin/mergesort
- * @build MergeSortTest MergeDemo MergeSort
- * @run testng MergeSortTest
- */
-
-import java.util.Arrays;
-import java.util.Random;
-
-import org.testng.annotations.Test;
-
-public class MergeSortTest {
-    private Random random;
-    private MergeSort target;
-
-    public MergeSortTest(Random random, MergeSort target) {
-        this.random = random;
-        this.target = target;
-    }
-
-    @Test
-    public static void doTest() {
-        MergeSortTest test = new MergeSortTest(new Random(), new MergeSort(Runtime.getRuntime().availableProcessors() * 4));
-        test.run();
-    }
-
-    private int[] generateArray(int elements) {
-        int[] array = new int[elements];
-        for (int i = 0; i < array.length; ++i) {
-            array[i] = random.nextInt(10);
-        }
-        return array;
-    }
-
-    private void run() {
-        testSort();
-        testSortSingle();
-        testSortEmpty();
-        testLong();
-    }
-
-    public void testLong() {
-        for (int i = 0; i < 1000; ++i) {
-            int elements = 1 + i * 100;
-
-            int[] array = generateArray(elements);
-            int[] copy = Arrays.copyOf(array, array.length);
-            Arrays.sort(copy);
-            target.sort(array);
-            assertEqual(copy, array);
-        }
-   }
-
-    private void testSortEmpty() {
-        int[] array = { };
-        target.sort(array);
-        assertEqual(new int[] { }, array);
-    }
-
-    private void testSortSingle() {
-        int[] array = { 1 };
-        target.sort(array);
-        assertEqual(new int[] { 1 }, array);
-    }
-
-    private void testSort() {
-        int[] array = { 7, 3, 9, 0, -6, 12, 54, 3, -6, 88, 1412};
-        target.sort(array);
-        assertEqual(new int[] { -6, -6, 0, 3, 3, 7, 9, 12, 54, 88, 1412 }, array);
-    }
-
-    private void assertEqual(int[] expected, int[] array) {
-        if (!Arrays.equals(expected, array)) {
-            throw new RuntimeException("Invalid sorted array!");
-        }
-    }
-
-
-}
diff --git a/jdk/test/sun/awt/dnd/8024061/bug8024061.java b/jdk/test/sun/awt/dnd/8024061/bug8024061.java
index 3591e37..0a9528a 100644
--- a/jdk/test/sun/awt/dnd/8024061/bug8024061.java
+++ b/jdk/test/sun/awt/dnd/8024061/bug8024061.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017 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
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java b/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
index 75f903f..5654858 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
@@ -37,7 +37,7 @@
  * @run main/othervm/timeout=600 -XX:+UsePerfData JvmstatCountersTest 1
  * @run main/othervm/timeout=600 -XX:+UsePerfData -Dcom.sun.management.jmxremote JvmstatCountersTest 2
  * @run main/othervm/timeout=600 -XX:+UsePerfData -Dcom.sun.management.jmxremote.port=0 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false JvmstatCountersTest 3
- * @run main/othervm/timeout=600 -XX:+UsePerfData JvmstatCountersTest 4
+ * @run main/othervm/timeout=600 -XX:+UsePerfData -Djdk.attach.allowAttachSelf JvmstatCountersTest 4
  */
 
 import java.io.*;
diff --git a/jdk/test/sun/net/idn/NFS4StringPrep.java b/jdk/test/sun/net/idn/NFS4StringPrep.java
index fc488f3..e1dbe92 100644
--- a/jdk/test/sun/net/idn/NFS4StringPrep.java
+++ b/jdk/test/sun/net/idn/NFS4StringPrep.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/krb5/auto/BogusKDC.java b/jdk/test/sun/security/krb5/auto/BogusKDC.java
index c5f9d9e..6184f5a 100644
--- a/jdk/test/sun/security/krb5/auto/BogusKDC.java
+++ b/jdk/test/sun/security/krb5/auto/BogusKDC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/krb5/auto/NoAddresses.java b/jdk/test/sun/security/krb5/auto/NoAddresses.java
index 298dc03..be49fda 100644
--- a/jdk/test/sun/security/krb5/auto/NoAddresses.java
+++ b/jdk/test/sun/security/krb5/auto/NoAddresses.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/krb5/auto/Renew.java b/jdk/test/sun/security/krb5/auto/Renew.java
index 0c44149..92f4108 100644
--- a/jdk/test/sun/security/krb5/auto/Renew.java
+++ b/jdk/test/sun/security/krb5/auto/Renew.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017 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
diff --git a/jdk/test/sun/security/krb5/auto/Renewal.java b/jdk/test/sun/security/krb5/auto/Renewal.java
index 3ddf84f..7ae2378 100644
--- a/jdk/test/sun/security/krb5/auto/Renewal.java
+++ b/jdk/test/sun/security/krb5/auto/Renewal.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/krb5/auto/SSLwithPerms.java b/jdk/test/sun/security/krb5/auto/SSLwithPerms.java
index 8569d35..0779c3d 100644
--- a/jdk/test/sun/security/krb5/auto/SSLwithPerms.java
+++ b/jdk/test/sun/security/krb5/auto/SSLwithPerms.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/krb5/canonicalize/Test.java b/jdk/test/sun/security/krb5/canonicalize/Test.java
index 62c44de..fe11462 100644
--- a/jdk/test/sun/security/krb5/canonicalize/Test.java
+++ b/jdk/test/sun/security/krb5/canonicalize/Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/mscapi/CastError.java b/jdk/test/sun/security/mscapi/CastError.java
index 5f9721a..c2c7ecd 100644
--- a/jdk/test/sun/security/mscapi/CastError.java
+++ b/jdk/test/sun/security/mscapi/CastError.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/mscapi/PrngSlow.java b/jdk/test/sun/security/mscapi/PrngSlow.java
index b8abd93..23d4ae9 100644
--- a/jdk/test/sun/security/mscapi/PrngSlow.java
+++ b/jdk/test/sun/security/mscapi/PrngSlow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/mscapi/PublicKeyInterop.sh b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh
index fc1550f..aab5ab8 100644
--- a/jdk/test/sun/security/mscapi/PublicKeyInterop.sh
+++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java b/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java
index 1c3337d..9677b65 100644
--- a/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java
+++ b/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java b/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java
index 9388972..581dc54 100644
--- a/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java
+++ b/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java
@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, 2016, Oracle and/or its affiliates. All rights
- * reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java
index 636809b..e2e1b47 100644
--- a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java
@@ -1,6 +1,24 @@
 /*
  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 import java.io.InputStream;
diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java
index 80d76e9..3383291 100644
--- a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java
@@ -1,6 +1,24 @@
 /*
  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 import java.io.InputStream;
diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java
index 35293d1..2a6ffb2 100644
--- a/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java
+++ b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java
@@ -4,9 +4,7 @@
  *
  * This code is free software; you can redistribute 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.
+ * 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
diff --git a/jdk/test/sun/security/tools/jarsigner/nameclash.sh b/jdk/test/sun/security/tools/jarsigner/nameclash.sh
index 69fe12c..80c9c8d 100644
--- a/jdk/test/sun/security/tools/jarsigner/nameclash.sh
+++ b/jdk/test/sun/security/tools/jarsigner/nameclash.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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
@@ -63,4 +63,3 @@
 $JARSIGNER -verify -debug -strict $JFILE || exit 3
 
 exit 0
-
diff --git a/jdk/test/sun/security/x509/URICertStore/SocksProxy.java b/jdk/test/sun/security/x509/URICertStore/SocksProxy.java
index 50c6e89..a44cf60 100644
--- a/jdk/test/sun/security/x509/URICertStore/SocksProxy.java
+++ b/jdk/test/sun/security/x509/URICertStore/SocksProxy.java
@@ -8,7 +8,7 @@
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
diff --git a/jdk/test/tools/jar/mmrjar/Basic.java b/jdk/test/tools/jar/mmrjar/Basic.java
index 5716d53..a5b1eca 100644
--- a/jdk/test/tools/jar/mmrjar/Basic.java
+++ b/jdk/test/tools/jar/mmrjar/Basic.java
@@ -221,7 +221,8 @@
         Assert.assertEquals(actual, expected);
     }
 
-    // jar tool does two updates, no exported packages, all concealed
+    // jar tool does two updates, no exported packages, all concealed.
+    // Along with various --describe-module variants
     @Test
     public void test5() throws IOException {
         // compile the mr10 directory
@@ -266,10 +267,13 @@
 
         jar("-d --file mr.jar");
 
+        String uri = (Paths.get("mr.jar")).toUri().toString();
+        uri = "jar:" + uri + "/!module-info.class";
+
         actual = lines(outbytes);
         expected = Set.of(
-                "module hi (module-info.class)",
-                "requires mandated java.base",
+                "hi " + uri,
+                "requires java.base mandated",
                 "contains p",
                 "contains p.internal"
         );
@@ -304,13 +308,19 @@
 
         actual = lines(outbytes);
         expected = Set.of(
-                "module hi (module-info.class)",
-                "requires mandated java.base",
+                "hi " + uri,
+                "requires java.base mandated",
                 "contains p",
                 "contains p.internal",
                 "contains p.internal.bar"
         );
         Assert.assertEquals(actual, expected);
+
+        for (String release : new String[] {"9" , "10", "100", "1000"}) {
+            jar("-d --file mr.jar --release " + release);
+            actual = lines(outbytes);
+            Assert.assertEquals(actual, expected);
+        }
     }
 
     // root and versioned module-info entries have different main-class, version
@@ -399,15 +409,42 @@
         Assert.assertEquals(rc, 0);
 
         jar("-d --file=mmr.jar");
-        System.out.println("-----------------------");
-        System.out.println( new String(outbytes.toByteArray()));
-        Assert.assertEquals(lines(outbytes),
-                            Set.of(
-                           "module m1 (META-INF/versions/9/module-info.class)",
-                           "module m1 (META-INF/versions/10/module-info.class)",
-                           "requires mandated java.base",
-                           "exports p",
-                           "main-class p.Main"));
+        Set<String> actual = lines(outbytes);
+        Set<String> expected = Set.of(
+                "releases: 9 10",
+                "No root module descriptor, specify --release"
+        );
+        Assert.assertEquals(actual, expected);
+
+        String uriPrefix = "jar:" + (Paths.get("mmr.jar")).toUri().toString();
+
+        jar("-d --file=mmr.jar --release 9");
+        actual = lines(outbytes);
+        expected = Set.of(
+                "releases: 9 10",
+                "m1 " + uriPrefix + "/!META-INF/versions/9/module-info.class",
+                "requires java.base mandated",
+                "exports p",
+                "main-class p.Main"
+        );
+        Assert.assertEquals(actual, expected);
+
+        jar("-d --file=mmr.jar --release 10");
+        actual = lines(outbytes);
+        expected = Set.of(
+                "releases: 9 10",
+                "m1 " + uriPrefix + "/!META-INF/versions/10/module-info.class",
+                "requires java.base mandated",
+                "exports p",
+                "main-class p.Main"
+        );
+        Assert.assertEquals(actual, expected);
+
+        for (String release : new String[] {"11", "12", "15", "100"}) {
+            jar("-d --file mmr.jar --release " + release);
+            actual = lines(outbytes);
+            Assert.assertEquals(actual, expected);
+        }
 
         Optional<String> exp = Optional.of("p.Main");
         try (ZipFile zf = new ZipFile("mmr.jar")) {
diff --git a/jdk/test/tools/jar/modularJar/Basic.java b/jdk/test/tools/jar/modularJar/Basic.java
index 92cc0a9..a656a86 100644
--- a/jdk/test/tools/jar/modularJar/Basic.java
+++ b/jdk/test/tools/jar/modularJar/Basic.java
@@ -478,13 +478,13 @@
             "--file=" + modularJar.toString())
             .assertSuccess()
             .resultChecker(r -> {
-                // Expect similar output: "bar, requires mandated foo, ...
+                // Expect "bar jar:file:/.../!module-info.class"
                 // conceals jdk.test.foo, conceals jdk.test.foo.internal"
-                Pattern p = Pattern.compile("module bar \\(module-info.class\\)\\s+requires\\s++foo");
-                assertTrue(p.matcher(r.output).find(),
-                           "Expecting to find \"bar, requires foo,...\"",
+                String uri = "jar:" + modularJar.toUri().toString() + "/!module-info.class";
+                assertTrue(r.output.contains("bar " + uri),
+                           "Expecting to find \"bar " + uri + "\"",
                            "in output, but did not: [" + r.output + "]");
-                p = Pattern.compile(
+                Pattern p = Pattern.compile(
                         "contains\\s+jdk.test.foo\\s+contains\\s+jdk.test.foo.internal");
                 assertTrue(p.matcher(r.output).find(),
                            "Expecting to find \"contains jdk.test.foo,...\"",
@@ -758,14 +758,15 @@
         for (String option : new String[]  {"--describe-module", "-d" }) {
 
             jar(option,
-                "--file=" + modularJar.toString())
+                "--file=" + modularJar.toString(),
+                "--release", "9")
                 .assertSuccess()
                 .resultChecker(r ->
                     assertTrue(r.output.contains("main-class jdk.test.baz.Baz"),
                               "Expected to find ", "main-class jdk.test.baz.Baz",
                                " in [", r.output, "]"));
 
-            jarWithStdin(modularJar.toFile(),  option)
+            jarWithStdin(modularJar.toFile(), option, "--release", "9")
                 .assertSuccess()
                 .resultChecker(r ->
                     assertTrue(r.output.contains("main-class jdk.test.baz.Baz"),
@@ -773,7 +774,7 @@
                                " in [", r.output, "]"));
 
         }
-        // run module maain class
+        // run module main class
         java(mp, "baz/jdk.test.baz.Baz")
             .assertSuccess()
             .resultChecker(r ->
@@ -900,7 +901,7 @@
                 .resultChecker(r -> {
                     assertTrue(r.output.contains("No module descriptor found"));
                     assertTrue(r.output.contains("Derived automatic module"));
-                    assertTrue(r.output.contains("module " + mid),
+                    assertTrue(r.output.contains(mid + " automatic"),
                                "Expected [", "module " + mid,"] in [", r.output, "]");
                     }
                 );
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java b/jdk/test/tools/jar/multiRelease/whitebox/Driver.java
similarity index 83%
copy from jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
copy to jdk/test/tools/jar/multiRelease/whitebox/Driver.java
index f4974e3..a7ac089 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java
+++ b/jdk/test/tools/jar/multiRelease/whitebox/Driver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -21,8 +21,8 @@
  * questions.
  */
 
-package javax.transaction.atomic;
-
-public interface Atomic {
-
-}
+/*
+ * @test
+ * @modules jdk.jartool/sun.tools.jar
+ * @run testng/othervm jdk.jartool/sun.tools.jar.ValidatorComparatorTest
+ */
diff --git a/jdk/test/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java b/jdk/test/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java
new file mode 100644
index 0000000..9740782
--- /dev/null
+++ b/jdk/test/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+/*
+ * @summary White-box test for Validator.ENTRYNAME_COMPARATOR ( currently just
+ *          checks module descriptors ).
+ */
+package sun.tools.jar;
+
+import java.util.List;
+import static java.util.stream.Collectors.toList;
+import static sun.tools.jar.Validator.ENTRYNAME_COMPARATOR;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class ValidatorComparatorTest {
+
+    @Test
+    public void testModuleInfo() throws Throwable {
+        List<String> list =
+                List.of("module-info.class",
+                        "META-INF/versions/9/module-info.class",
+                        "META-INF/versions/10/module-info.class");
+        List<String> sorted = list.stream()
+                .sorted(ENTRYNAME_COMPARATOR)
+                .collect(toList());
+        List<String> expected = list;
+        Assert.assertEquals(sorted, expected);
+
+
+        list =  List.of("META-INF/versions/10/module-info.class",
+                        "META-INF/versions/9/module-info.class",
+                        "module-info.class");
+        sorted = list.stream().sorted(ENTRYNAME_COMPARATOR).collect(toList());
+        expected =
+                List.of("module-info.class",
+                        "META-INF/versions/9/module-info.class",
+                        "META-INF/versions/10/module-info.class");
+        Assert.assertEquals(sorted, expected);
+
+
+        list =  List.of("META-INF/versions/1001/module-info.class",
+                        "META-INF/versions/1000/module-info.class",
+                        "META-INF/versions/999/module-info.class",
+                        "META-INF/versions/101/module-info.class",
+                        "META-INF/versions/100/module-info.class",
+                        "META-INF/versions/99/module-info.class",
+                        "META-INF/versions/31/module-info.class",
+                        "META-INF/versions/30/module-info.class",
+                        "META-INF/versions/29/module-info.class",
+                        "META-INF/versions/21/module-info.class",
+                        "META-INF/versions/20/module-info.class",
+                        "META-INF/versions/13/module-info.class",
+                        "META-INF/versions/12/module-info.class",
+                        "META-INF/versions/11/module-info.class",
+                        "META-INF/versions/10/module-info.class",
+                        "META-INF/versions/9/module-info.class",
+                        "module-info.class");
+        sorted = list.stream().sorted(ENTRYNAME_COMPARATOR).collect(toList());
+        expected =
+                List.of("module-info.class",
+                        "META-INF/versions/9/module-info.class",
+                        "META-INF/versions/10/module-info.class",
+                        "META-INF/versions/11/module-info.class",
+                        "META-INF/versions/12/module-info.class",
+                        "META-INF/versions/13/module-info.class",
+                        "META-INF/versions/20/module-info.class",
+                        "META-INF/versions/21/module-info.class",
+                        "META-INF/versions/29/module-info.class",
+                        "META-INF/versions/30/module-info.class",
+                        "META-INF/versions/31/module-info.class",
+                        "META-INF/versions/99/module-info.class",
+                        "META-INF/versions/100/module-info.class",
+                        "META-INF/versions/101/module-info.class",
+                        "META-INF/versions/999/module-info.class",
+                        "META-INF/versions/1000/module-info.class",
+                        "META-INF/versions/1001/module-info.class");
+        Assert.assertEquals(sorted, expected);
+    }
+}
diff --git a/jdk/test/tools/jlink/IntegrationTest.java b/jdk/test/tools/jlink/IntegrationTest.java
index de2c118..1218fad 100644
--- a/jdk/test/tools/jlink/IntegrationTest.java
+++ b/jdk/test/tools/jlink/IntegrationTest.java
@@ -207,11 +207,6 @@
         }
 
         checkReleaseProperty(props, "JAVA_VERSION");
-        checkReleaseProperty(props, "JAVA_FULL_VERSION");
-        checkReleaseProperty(props, "OS_NAME");
-        checkReleaseProperty(props, "OS_ARCH");
-        // OS_VERSION is added from makefile. We're testing API-way to create image here!
-        // checkReleaseProperty(props, "OS_VERSION");
 
         if (!Files.exists(output.resolve("toto.txt"))) {
             throw new AssertionError("Post processing not called");
diff --git a/jdk/test/tools/jlink/JLinkNegativeTest.java b/jdk/test/tools/jlink/JLinkNegativeTest.java
index d02ecbb..4b4e3d8 100644
--- a/jdk/test/tools/jlink/JLinkNegativeTest.java
+++ b/jdk/test/tools/jlink/JLinkNegativeTest.java
@@ -178,7 +178,7 @@
                     .output(imageFile)
                     .addMods("not_zip")
                     .modulePath(helper.defaultModulePath())
-                    .call().assertFailure("Error: java.util.zip.ZipException: zip file is empty");
+                    .call().assertFailure("Error: Error reading");
         } finally {
             deleteDirectory(jar);
         }
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java
index d2409f4..6629524 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java
@@ -113,12 +113,13 @@
         try {
             if (modRef.descriptor().name().equals("java.base")) {
                 ModuleTargetHelper.ModuleTarget mt = ModuleTargetHelper.read(modRef);
-                assertTrue(checkOSName(mt.osName()));
-                assertTrue(checkOSArch(mt.osArch()));
+                String[] values = mt.targetPlatform().split("-");
+                assertTrue(checkOSName(values[0]));
+                assertTrue(checkOSArch(values[1]));
             } else {
                 // target platform attribute is dropped by jlink plugin for other modules
                 ModuleTargetHelper.ModuleTarget mt = ModuleTargetHelper.read(modRef);
-                assertTrue(mt == null || (mt.osName() == null && mt.osArch() == null));
+                assertTrue(mt == null || mt.targetPlatform() == null);
             }
         } catch (IOException exp) {
             throw new UncheckedIOException(exp);
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
index ecdebe5..c8a2218 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
@@ -220,16 +220,16 @@
             throw new RuntimeException("ModuleTarget is missing for java.base");
         }
 
-        String osName = mt.osName();
-        String osArch = mt.osArch();
+        String[] values = mt.targetPlatform().split("-");
+        String osName = values[0];
+        String osArch = values[1];
 
         // create JMOD files
         Files.createDirectories(JMODS_DIR);
         Stream.of(modules).forEach(mn ->
             assertTrue(jmod("create",
                 "--class-path", MODS_DIR.resolve(mn).toString(),
-                "--os-name", osName,
-                "--os-arch", osArch,
+                "--target-platform", mt.targetPlatform(),
                 "--main-class", mn.replace('m', 'p') + ".Main",
                 JMODS_DIR.resolve(mn + ".jmod").toString()) == 0)
         );
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java
index aef19f5..59a059b 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java
@@ -62,8 +62,7 @@
         // parse module-info.class
         ClassReader cr = new ClassReader(in);
         cr.accept(cv, attrs, 0);
-        return modTargets[0] != null &&
-            (modTargets[0].osName() != null || modTargets[0].osArch() != null);
+        return modTargets[0] != null && modTargets[0].targetPlatform() != null;
     }
 
     public static void main(String... args) throws Exception {
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java
index a08fe01..bdb606f 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java
@@ -63,8 +63,7 @@
         // parse module-info.class
         ClassReader cr = new ClassReader(in);
         cr.accept(cv, attrs, 0);
-        return modTargets[0] != null &&
-            (modTargets[0].osName() != null || modTargets[0].osArch() != null);
+        return modTargets[0] != null && modTargets[0].targetPlatform() != null;
     }
 
     private static boolean hasModuleTarget(String modName) throws IOException {
diff --git a/jdk/test/tools/jmod/JmodTest.java b/jdk/test/tools/jmod/JmodTest.java
index 0439678..e578b2f 100644
--- a/jdk/test/tools/jmod/JmodTest.java
+++ b/jdk/test/tools/jmod/JmodTest.java
@@ -393,16 +393,17 @@
              MODS_DIR.resolve("describeFoo.jmod").toString())
              .assertSuccess()
              .resultChecker(r -> {
-                 // Expect similar output: "foo,  requires mandated java.base
-                 // exports jdk.test.foo,  contains jdk.test.foo.internal"
-                 Pattern p = Pattern.compile("\\s+foo\\s+requires\\s+mandated\\s+java.base");
+                 // Expect similar output: "foo... exports jdk.test.foo ...
+                 //   ... requires java.base mandated... contains jdk.test.foo.internal"
+                 Pattern p = Pattern.compile("foo\\s+exports\\s+jdk.test.foo");
                  assertTrue(p.matcher(r.output).find(),
-                           "Expecting to find \"foo, requires java.base\"" +
+                           "Expecting to find \"foo... exports jdk.test.foo\"" +
                                 "in output, but did not: [" + r.output + "]");
                  p = Pattern.compile(
-                        "exports\\s+jdk.test.foo\\s+contains\\s+jdk.test.foo.internal");
+                        "requires\\s+java.base\\s+mandated\\s+contains\\s+jdk.test.foo.internal");
                  assertTrue(p.matcher(r.output).find(),
-                           "Expecting to find \"exports ..., contains ...\"" +
+                           "Expecting to find \"requires java.base mandated..., " +
+                                "contains jdk.test.foo.internal ...\"" +
                                 "in output, but did not: [" + r.output + "]");
              });
     }
diff --git a/jdk/test/tools/launcher/modules/describe/DescribeModuleTest.java b/jdk/test/tools/launcher/modules/describe/DescribeModuleTest.java
new file mode 100644
index 0000000..330bb5e
--- /dev/null
+++ b/jdk/test/tools/launcher/modules/describe/DescribeModuleTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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
+ * @modules java.xml
+ * @library /lib/testlibrary
+ * @build DescribeModuleTest jdk.testlibrary.*
+ * @run testng DescribeModuleTest
+ * @summary Basic test for java --describe-module
+ */
+
+import jdk.testlibrary.ProcessTools;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class DescribeModuleTest {
+
+    /**
+     * Test that the output describes java.base
+     */
+    private void expectJavaBase(String... args) throws Exception {
+        int exitValue = ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .stdoutShouldContain("java.base")
+                .stdoutShouldContain("exports java.lang")
+                .stdoutShouldContain("uses java.nio.file.spi.FileSystemProvider")
+                .stdoutShouldContain("contains sun.launcher")
+                .stdoutShouldNotContain("requires ")
+                .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test that the output describes java.xml
+     */
+    private void expectJavaXml(String... args) throws Exception {
+        int exitValue = ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .stdoutShouldContain("java.xml")
+                .stdoutShouldContain("exports javax.xml")
+                .stdoutShouldContain("requires java.base")
+                .stdoutShouldContain("uses javax.xml.stream.XMLInputFactory")
+                .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test output/exitValue when describing an unknown module
+     */
+    private void expectUnknownModule(String... args) throws Exception {
+        int exitValue = ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .stdoutShouldNotContain("requires java.base")
+                .getExitValue();
+        assertTrue(exitValue != 0);
+    }
+
+
+    public void testDescribeJavaBase() throws Exception {
+        expectJavaBase("--describe-module", "java.base");
+        expectJavaBase("--describe-module=java.base");
+        expectJavaBase("-d", "java.base");
+    }
+
+    public void testDescribeJavaXml() throws Exception {
+        expectJavaXml("--describe-module", "java.xml");
+        expectJavaXml("--describe-module=java.xml");
+        expectJavaXml("-d", "java.xml");
+    }
+
+    public void testDescribeUnknownModule() throws Exception {
+        expectUnknownModule("--describe-module", "jdk.rhubarb");
+        expectUnknownModule("--describe-module=jdk.rhubarb");
+        expectUnknownModule("-d", "jdk.rhubarb");
+    }
+
+}
diff --git a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
index 8628539..4fd8984 100644
--- a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
+++ b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
@@ -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
@@ -33,7 +33,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import static jdk.testlibrary.ProcessTools.*;
+import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
 
 import org.testng.annotations.BeforeTest;
@@ -66,138 +66,80 @@
                 SRC_DIR.resolve("java.transaction"),
                 UPGRADEMODS_DIR.resolve("java.transaction"));
         assertTrue(compiled);
-
     }
 
-
     @Test
     public void testListAll() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--list-modules")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldContain("java.xml");
-        assertTrue(output.getExitValue() == 0);
+        exec("--list-modules")
+                .shouldContain("java.base")
+                .shouldContain("java.xml")
+                .shouldHaveExitValue(0);
     }
 
-
-    @Test
-    public void testListOneModule() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--list-modules=java.base")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldContain("exports java.lang");
-        assertTrue(output.getExitValue() == 0);
-    }
-
-
-    @Test
-    public void testListTwoModules() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--list-modules", "java.base,java.xml")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldContain("exports java.lang");
-        output.shouldContain("java.xml");
-        output.shouldContain("exports javax.xml");
-        assertTrue(output.getExitValue() == 0);
-    }
-
-
-    @Test
-    public void testListUnknownModule() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--list-modules", "java.rhubarb")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldNotContain("java.base");
-        output.shouldContain("java.rhubarb not found");
-        assertTrue(output.getExitValue() == 0);
-    }
-
-
     @Test
     public void testListWithModulePath() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--module-path", MODS_DIR.toString(), "--list-modules")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldContain("m1");
-        assertTrue(output.getExitValue() == 0);
+        exec("--list-modules", "--module-path", MODS_DIR.toString())
+                .shouldContain("java.base")
+                .shouldContain("m1")
+                .shouldHaveExitValue(0);
     }
 
-
     @Test
     public void testListWithUpgradeModulePath() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--upgrade-module-path", UPGRADEMODS_DIR.toString(),
-                              "--list-modules", "java.transaction")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("exports javax.transaction.atomic");
-        assertTrue(output.getExitValue() == 0);
+        String dir = UPGRADEMODS_DIR.toString();
+        exec("--list-modules", "--upgrade-module-path", dir)
+                .shouldContain(UPGRADEMODS_DIR.toString())
+                .shouldHaveExitValue(0);
     }
 
-
     @Test
     public void testListWithLimitMods1() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--limit-modules", "java.management.rmi", "--list-modules")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.rmi");
-        output.shouldContain("java.base");
-        output.shouldNotContain("java.scripting");
-        assertTrue(output.getExitValue() == 0);
+        exec("--limit-modules", "java.management.rmi", "--list-modules")
+                .shouldContain("java.rmi")
+                .shouldContain("java.base")
+                .shouldNotContain("java.scripting")
+                .shouldHaveExitValue(0);
     }
 
-
     @Test
     public void testListWithLimitMods2() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--module-path", MODS_DIR.toString(),
-                              "--limit-modules", "java.management",
-                              "--list-modules")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldNotContain("m1");
-        assertTrue(output.getExitValue() == 0);
+        exec("--list-modules",
+                    "--module-path", MODS_DIR.toString(),
+                    "--limit-modules", "java.management")
+                .shouldContain("java.base")
+                .shouldNotContain("m1")
+                .shouldHaveExitValue(0);
     }
 
-
     /**
      * java -version --list-modules => should print version and exit
      */
     @Test
     public void testListWithPrintVersion1() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("-version", "--list-modules")
-                .outputTo(System.out)
-                .errorTo(System.out);
-        output.shouldNotContain("java.base");
-        output.shouldContain("Runtime Environment");
-        assertTrue(output.getExitValue() == 0);
+        exec("-version", "--list-modules")
+                .shouldNotContain("java.base")
+                .shouldContain("Runtime Environment")
+                .shouldHaveExitValue(0);
     }
 
-
     /**
      * java --list-modules -version => should list modules and exit
      */
     @Test
     public void testListWithPrintVersion2() throws Exception {
-        OutputAnalyzer output
-            = executeTestJava("--list-modules", "-version")
+        exec("--list-modules", "-version")
+                .shouldContain("java.base")
+                .shouldNotContain("Runtime Environment")
+                .shouldHaveExitValue(0);
+    }
+
+    /**
+     * java args... returning the OutputAnalyzer to analyzer the output
+     */
+    private OutputAnalyzer exec(String... args) throws Exception {
+        return ProcessTools.executeTestJava(args)
                 .outputTo(System.out)
                 .errorTo(System.out);
-        output.shouldContain("java.base");
-        output.shouldNotContain("Runtime Environment");
-        assertTrue(output.getExitValue() == 0);
     }
 
 }
diff --git a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/module-info.java b/jdk/test/tools/launcher/modules/listmods/src/java.transaction/module-info.java
index d1a268c..95ddcb7 100644
--- a/jdk/test/tools/launcher/modules/listmods/src/java.transaction/module-info.java
+++ b/jdk/test/tools/launcher/modules/listmods/src/java.transaction/module-info.java
@@ -23,5 +23,4 @@
 
 module java.transaction {
     exports javax.transaction;
-    exports javax.transaction.atomic;
 }
diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
index 1f1ff31..c1c8deb 100644
--- a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
+++ b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
@@ -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
@@ -23,9 +23,8 @@
 
 /*
  * @test
- * @bug 8157068
- * @summary Patch java.base and user module with Hashes attribute tied with
- *          other module.
+ * @bug 8157068 8177844
+ * @summary Patch java.base and user module with ModuleHashes attribute
  * @library /lib/testlibrary
  * @modules jdk.compiler
  * @build CompilerUtils
@@ -59,6 +58,7 @@
     private static final Path JARS_DIR = Paths.get("jars");
     private static final Path PATCH_DIR = Paths.get("patches");
     private static final Path IMAGE = Paths.get("image");
+    private static final Path NEW_M1_JAR = JARS_DIR.resolve("new_m1.jar");
 
     private static final String JAVA_BASE = "java.base";
     private final String[] modules = new String[] { "m1", "m2" };
@@ -80,13 +80,23 @@
         assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve("m2"),
                                          PATCH_DIR.resolve("m2")));
 
+        createJars();
+
         // create an image with only m1 and m2
         if (Files.exists(JMODS)) {
             // create an image with m1,m2
             createImage();
         }
+
+        // create new copy of m1.jar
+        jar("--create",
+            "--file=" + NEW_M1_JAR.toString(),
+            "-C", MODS_DIR.resolve("m1").toString(), ".");
     }
 
+    /*
+     * Test patching system module and user module on module path
+     */
     @Test
     public void test() throws Throwable {
         Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE);
@@ -107,6 +117,9 @@
                 "-m", "m1/p1.Main", "2");
     }
 
+    /*
+     * Test --patch-module on a custom image
+     */
     @Test
     public void testImage() throws Throwable {
         if (Files.notExists(JMODS))
@@ -125,27 +138,49 @@
                 "-m", "m1/p1.Main", "2");
     }
 
+    /*
+     * Test a module linked in a system hashed in ModuleHashes attribute
+     * cannot be upgraded
+     */
     @Test
-    public void upgradeTiedModule() throws Throwable {
+    public void upgradeHashedModule() throws Throwable {
         if (Files.notExists(JMODS))
             return;
 
-        Path m1 = MODS_DIR.resolve("m1.jar");
-
-        // create another m1.jar
-        jar("--create",
-            "--file=" + m1.toString(),
-            "-C", MODS_DIR.resolve("m1").toString(), ".");
-
         // Fail to upgrade m1.jar with mismatched hash
         runTestWithExitCode(getJava(IMAGE),
-                "--upgrade-module-path", m1.toString(),
-                "-m", "m1/p1.Main");
+                "--upgrade-module-path", NEW_M1_JAR.toString(),
+                "-m", "m1/p1.Main", "ShouldNeverRun");
 
+        // test when SystemModules fast path is not enabled, i.e. exploded image
         runTestWithExitCode(getJava(IMAGE),
                 "--patch-module", "java.base=" + PATCH_DIR.resolve(JAVA_BASE),
-                "--upgrade-module-path", m1.toString(),
-                "-m", "m1/p1.Main", "1");
+                "--upgrade-module-path", NEW_M1_JAR.toString(),
+                "-m", "m1/p1.Main", "ShouldNeverRun");
+    }
+
+    /*
+     * Test a module linked in a system hashed in ModuleHashes attribute
+     * cannot be upgraded combining with --patch-module and --upgrade-module-path
+     */
+    @Test
+    public void patchHashedModule() throws Throwable {
+        if (Files.notExists(JMODS))
+            return;
+
+        // --patch-module does not disable hash check.
+        // Test that a hashed module cannot be upgraded.
+        runTestWithExitCode(getJava(IMAGE),
+                "--patch-module", "m1=.jar",
+                "--upgrade-module-path", NEW_M1_JAR.toString(),
+                "-m", "m1/p1.Main", "ShouldNeverRun");
+
+        // test when SystemModules fast path is not enabled, i.e. exploded image
+        runTestWithExitCode(getJava(IMAGE),
+                "--patch-module", "java.base=" + PATCH_DIR.resolve(JAVA_BASE),
+                "--patch-module", "m1=.jar",
+                "--upgrade-module-path", NEW_M1_JAR.toString(),
+                "-m", "m1/p1.Main", "ShouldNeverRun");
     }
 
     private void runTestWithExitCode(String... options) throws Throwable {
@@ -171,9 +206,8 @@
         assertTrue(exitValue == 0);
     }
 
-    static void createImage() throws Throwable {
+    static void createJars() throws Throwable {
         FileUtils.deleteFileTreeUnchecked(JARS_DIR);
-        FileUtils.deleteFileTreeUnchecked(IMAGE);
 
         Files.createDirectories(JARS_DIR);
         Path m1 = JARS_DIR.resolve("m1.jar");
@@ -189,7 +223,10 @@
             "--module-path", JARS_DIR.toString(),
             "--hash-modules", "m1",
             "-C", MODS_DIR.resolve("m2").toString(), ".");
+    }
 
+    static void createImage() throws Throwable {
+        FileUtils.deleteFileTreeUnchecked(IMAGE);
 
         String mpath = JARS_DIR.toString() + File.pathSeparator + JMODS.toString();
         execTool("jlink", "--module-path", mpath,
diff --git a/jdk/test/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java b/jdk/test/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java
new file mode 100644
index 0000000..0d2a1c4
--- /dev/null
+++ b/jdk/test/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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
+ * @modules jdk.jdeps jdk.zipfs
+ * @library /lib/testlibrary
+ * @build ShowModuleResolutionTest jdk.testlibrary.*
+ * @run testng ShowModuleResolutionTest
+ * @summary Basic test for java --show-module-resolution
+ */
+
+import jdk.testlibrary.ProcessTools;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ShowModuleResolutionTest {
+
+    /**
+     * Test that the resolution does not bind any services
+     */
+    private void expectJavaBase(String... args) throws Exception {
+        int exitValue = ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .stdoutShouldContain("root java.base")
+                .stdoutShouldNotContain("java.base binds")
+                .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+
+    /**
+     * Test that the resolution binds services that resolves additional
+     * modules
+     */
+    private void expectProviders(String... args) throws Exception {
+        int exitValue = ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .stdoutShouldContain("root java.base")
+                .stdoutShouldContain("root java.compiler")
+                .stdoutShouldContain("root jdk.compiler")
+                .stdoutShouldContain("root java.compiler")
+                .stdoutShouldContain("jdk.compiler requires java.compiler")
+                .stdoutShouldContain("java.base binds jdk.compiler")
+                .stdoutShouldContain("java.base binds jdk.jdeps")
+                .stdoutShouldContain("java.base binds jdk.zipfs")
+                .stdoutShouldContain("java.compiler binds jdk.compiler")
+                .stdoutShouldContain("jdk.jdeps requires jdk.compiler")
+                .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+
+    public void test() throws Exception {
+        expectJavaBase("--show-module-resolution",
+                       "--limit-modules", "java.base",
+                       "-version");
+        expectProviders("--show-module-resolution",
+                        "--limit-modules", "java.base,jdk.jdeps,jdk.zipfs",
+                        "-version");
+    }
+}
diff --git a/jdk/test/tools/launcher/modules/validate/ValidateModulesTest.java b/jdk/test/tools/launcher/modules/validate/ValidateModulesTest.java
new file mode 100644
index 0000000..668e4e4
--- /dev/null
+++ b/jdk/test/tools/launcher/modules/validate/ValidateModulesTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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
+ * @modules java.xml
+ * @library /lib/testlibrary
+ * @build ValidateModulesTest JarUtils jdk.testlibrary.*
+ * @run testng ValidateModulesTest
+ * @summary Basic test for java --validate-modules
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.OutputAnalyzer;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ValidateModulesTest {
+
+    /**
+     * Test that the system modules validate.
+     */
+    public void testSystemModules() throws Exception {
+        run("--validate-modules")
+                .stdoutShouldContain("java.base")
+                .stdoutShouldContain("java.xml")
+                .shouldHaveExitValue(0);
+    }
+
+    /**
+     * Test an automatic module on the module path with classes in the same
+     * package as a system module.
+     */
+    public void testPackageConflict() throws Exception {
+        Path tmpdir = Files.createTempDirectory("tmp");
+
+        Path classes = Files.createDirectory(tmpdir.resolve("classes"));
+        touch(classes, "javax/xml/XMLConstants.class");
+        touch(classes, "javax/xml/parsers/SAXParser.class");
+
+        Path lib = Files.createDirectory(tmpdir.resolve("lib"));
+        JarUtils.createJarFile(lib.resolve("xml.jar"), classes);
+
+        int exitValue = run("-p", lib.toString(), "--validate-modules")
+                .shouldContain("xml automatic")
+                .shouldContain("conflicts with module java.xml")
+                .getExitValue();
+        assertTrue(exitValue != 0);
+
+    }
+
+    /**
+     * Test two modules with the same name in a directory.
+     */
+    public void testDuplicateModule() throws Exception {
+        Path tmpdir = Files.createTempDirectory("tmp");
+
+        Path classes = Files.createDirectory(tmpdir.resolve("classes"));
+        touch(classes, "org/foo/Bar.class");
+
+        Path lib = Files.createDirectory(tmpdir.resolve("lib"));
+        JarUtils.createJarFile(lib.resolve("foo-1.0.jar"), classes);
+        JarUtils.createJarFile(lib.resolve("foo-2.0.jar"), classes);
+
+        int exitValue = run("-p", lib.toString(), "--validate-modules")
+                .shouldContain("contains same module")
+                .getExitValue();
+        assertTrue(exitValue != 0);
+    }
+
+    /**
+     * Test two modules with the same name in different directories.
+     */
+    public void testShadowed() throws Exception {
+        Path tmpdir = Files.createTempDirectory("tmp");
+
+        Path classes = Files.createDirectory(tmpdir.resolve("classes"));
+        touch(classes, "org/foo/Bar.class");
+
+        Path lib1 = Files.createDirectory(tmpdir.resolve("lib1"));
+        JarUtils.createJarFile(lib1.resolve("foo-1.0.jar"), classes);
+
+        Path lib2 = Files.createDirectory(tmpdir.resolve("lib2"));
+        JarUtils.createJarFile(lib2.resolve("foo-2.0.jar"), classes);
+
+        run("-p", lib1 + File.pathSeparator + lib2, "--validate-modules")
+                .shouldContain("shadowed by")
+                .shouldHaveExitValue(0);
+    }
+
+    /**
+     * Runs the java launcher with the given arguments.
+     */
+    private OutputAnalyzer run(String... args) throws Exception {
+        return ProcessTools.executeTestJava(args)
+                .outputTo(System.out)
+                .errorTo(System.out);
+    }
+
+    /**
+     * Creates a file relative the given directory.
+     */
+    private void touch(Path dir, String relPath) throws IOException {
+        Path file = dir.resolve(relPath.replace('/', File.separatorChar));
+        Files.createDirectories(file.getParent());
+        Files.createFile(file);
+    }
+}
diff --git a/jdk/test/tools/pack200/MultiRelease.java b/jdk/test/tools/pack200/MultiRelease.java
index d5e0438..491c09c 100644
--- a/jdk/test/tools/pack200/MultiRelease.java
+++ b/jdk/test/tools/pack200/MultiRelease.java
@@ -12,7 +12,7 @@
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
- r You should have received a copy of the GNU General Public License version
+ * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
diff --git a/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java b/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
index 17fcf67..719f91b 100644
--- a/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
+++ b/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
@@ -1542,8 +1542,7 @@
     @Override
     public Element visitModuleTarget(ModuleTarget_attribute attr, Element p) {
         Element e = new Element(x.getCpString(attr.attribute_name_index));
-        e.add(x.getCpString(attr.os_name_index));
-        e.add(x.getCpString(attr.os_arch_index));
+        e.add(x.getCpString(attr.target_platform_index));
         e.trimToSize();
         p.add(e);
         return null;
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 9c8f0e7..0d49ef4 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -410,3 +410,4 @@
 98108b7d4cb6078773e2d27ad8471dc25d4d6124 jdk-9+165
 2a8b403a623320479705aad04ed8d78396661eb7 jdk-9+166
 f260f1a2acf616509a4ee5a29bc7f2acca3853e3 jdk-9+167
+bc21e5ba6bf1538551093f57fa0f1a6571be05cc jdk-9+168
diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
index a093fb7..e0acd48 100644
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java
@@ -616,8 +616,7 @@
 
         @Override
         public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
-            out.writeShort(attr.os_name_index);
-            out.writeShort(attr.os_arch_index);
+            out.writeShort(attr.target_platform_index);
             return null;
         }
 
diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java
index ca317ad..f1ea696 100644
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleTarget_attribute.java
@@ -38,8 +38,7 @@
 public class ModuleTarget_attribute extends Attribute {
     ModuleTarget_attribute(ClassReader cr, int name_index, int length) throws IOException {
         super(name_index, length);
-        os_name_index = cr.readUnsignedShort();
-        os_arch_index = cr.readUnsignedShort();
+        target_platform_index = cr.readUnsignedShort();
     }
 
     @Override
@@ -47,6 +46,5 @@
         return visitor.visitModuleTarget(this, data);
     }
 
-    public final int os_name_index;
-    public final int os_arch_index;
+    public final int target_platform_index;
 }
diff --git a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
index c5950a1..31845bd 100644
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -668,33 +668,19 @@
     public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) {
         println("ModuleTarget:");
         indent(+1);
-        print("os_name: #" + attr.os_name_index);
-        if (attr.os_name_index != 0) {
+        print("target_platform: #" + attr.target_platform_index);
+        if (attr.target_platform_index != 0) {
             tab();
-            print("// " + getOSName(attr));
-        }
-        println();
-        print("os_arch: #" + attr.os_arch_index);
-        if (attr.os_arch_index != 0) {
-            tab();
-            print("// " + getOSArch(attr));
+            print("// " + getTargetPlatform(attr));
         }
         println();
         indent(-1);
         return null;
     }
 
-    private String getOSName(ModuleTarget_attribute attr) {
+    private String getTargetPlatform(ModuleTarget_attribute attr) {
         try {
-            return constant_pool.getUTF8Value(attr.os_name_index);
-        } catch (ConstantPoolException e) {
-            return report(e);
-        }
-    }
-
-    private String getOSArch(ModuleTarget_attribute attr) {
-        try {
-            return constant_pool.getUTF8Value(attr.os_arch_index);
+            return constant_pool.getUTF8Value(attr.target_platform_index);
         } catch (ConstantPoolException e) {
             return report(e);
         }
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
index 372c30e0..46a7c6a 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017 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
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java
index b171302..5a266b3 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java
@@ -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,17 +24,35 @@
  */
 package jdk.jshell.execution;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
 import java.security.CodeSource;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
+
 import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
 import jdk.jshell.spi.ExecutionControl.ClassInstallException;
 import jdk.jshell.spi.ExecutionControl.EngineTerminationException;
 import jdk.jshell.spi.ExecutionControl.InternalException;
-import jdk.jshell.spi.ExecutionControl.NotImplementedException;
 
 /**
  * The standard implementation of {@link LoaderDelegate} using
@@ -45,27 +63,141 @@
 class DefaultLoaderDelegate implements LoaderDelegate {
 
     private final RemoteClassLoader loader;
-    private final Map<String, Class<?>> klasses = new TreeMap<>();
+    private final Map<String, Class<?>> klasses = new HashMap<>();
 
-    class RemoteClassLoader extends URLClassLoader {
+    private static class RemoteClassLoader extends URLClassLoader {
 
-        private final Map<String, byte[]> classObjects = new TreeMap<>();
+        private final Map<String, ClassFile> classFiles = new HashMap<>();
 
         RemoteClassLoader() {
             super(new URL[0]);
         }
 
-        void delare(String name, byte[] bytes) {
-            classObjects.put(name, bytes);
+        private class ResourceURLStreamHandler extends URLStreamHandler {
+
+            private final String name;
+
+            ResourceURLStreamHandler(String name) {
+                this.name = name;
+            }
+
+            @Override
+            protected URLConnection openConnection(URL u) throws IOException {
+                return new URLConnection(u) {
+                    private InputStream in;
+                    private Map<String, List<String>> fields;
+                    private List<String> fieldNames;
+
+                    @Override
+                    public void connect() {
+                        if (connected) {
+                            return;
+                        }
+                        connected = true;
+                        ClassFile file = classFiles.get(name);
+                        in = new ByteArrayInputStream(file.data);
+                        fields = new LinkedHashMap<>();
+                        fields.put("content-length", List.of(Integer.toString(file.data.length)));
+                        Instant instant = new Date(file.timestamp).toInstant();
+                        ZonedDateTime time = ZonedDateTime.ofInstant(instant, ZoneId.of("GMT"));
+                        String timeStamp = DateTimeFormatter.RFC_1123_DATE_TIME.format(time);
+                        fields.put("date", List.of(timeStamp));
+                        fields.put("last-modified", List.of(timeStamp));
+                        fieldNames = new ArrayList<>(fields.keySet());
+                    }
+
+                    @Override
+                    public InputStream getInputStream() throws IOException {
+                        connect();
+                        return in;
+                    }
+
+                    @Override
+                    public String getHeaderField(String name) {
+                        connect();
+                        return fields.getOrDefault(name, List.of())
+                                     .stream()
+                                     .findFirst()
+                                     .orElse(null);
+                    }
+
+                    @Override
+                    public Map<String, List<String>> getHeaderFields() {
+                        connect();
+                        return fields;
+                    }
+
+                    @Override
+                    public String getHeaderFieldKey(int n) {
+                        return n < fieldNames.size() ? fieldNames.get(n) : null;
+                    }
+
+                    @Override
+                    public String getHeaderField(int n) {
+                        String name = getHeaderFieldKey(n);
+
+                        return name != null ? getHeaderField(name) : null;
+                    }
+
+                };
+            }
+        }
+
+        void declare(String name, byte[] bytes) {
+            classFiles.put(toResourceString(name), new ClassFile(bytes, System.currentTimeMillis()));
         }
 
         @Override
         protected Class<?> findClass(String name) throws ClassNotFoundException {
-            byte[] b = classObjects.get(name);
-            if (b == null) {
+            ClassFile file = classFiles.get(toResourceString(name));
+            if (file == null) {
                 return super.findClass(name);
             }
-            return super.defineClass(name, b, 0, b.length, (CodeSource) null);
+            return super.defineClass(name, file.data, 0, file.data.length, (CodeSource) null);
+        }
+
+        @Override
+        public URL findResource(String name) {
+            URL u = doFindResource(name);
+            return u != null ? u : super.findResource(name);
+        }
+
+        @Override
+        public Enumeration<URL> findResources(String name) throws IOException {
+            URL u = doFindResource(name);
+            Enumeration<URL> sup = super.findResources(name);
+
+            if (u == null) {
+                return sup;
+            }
+
+            List<URL> result = new ArrayList<>();
+
+            while (sup.hasMoreElements()) {
+                result.add(sup.nextElement());
+            }
+
+            result.add(u);
+
+            return Collections.enumeration(result);
+        }
+
+        private URL doFindResource(String name) {
+            if (classFiles.containsKey(name)) {
+                try {
+                    return new URL(null,
+                                   new URI("jshell", null, "/" + name, null).toString(),
+                                   new ResourceURLStreamHandler(name));
+                } catch (MalformedURLException | URISyntaxException ex) {
+                    throw new InternalError(ex);
+                }
+            }
+
+            return null;
+        }
+
+        private String toResourceString(String className) {
+            return className.replace('.', '/') + ".class";
         }
 
         @Override
@@ -73,6 +205,16 @@
             super.addURL(url);
         }
 
+        private static class ClassFile {
+            public final byte[] data;
+            public final long timestamp;
+
+            ClassFile(byte[] data, long timestamp) {
+                this.data = data;
+                this.timestamp = timestamp;
+            }
+
+        }
     }
 
     public DefaultLoaderDelegate() {
@@ -86,7 +228,7 @@
         boolean[] loaded = new boolean[cbcs.length];
         try {
             for (ClassBytecodes cbc : cbcs) {
-                loader.delare(cbc.name(), cbc.bytecodes());
+                loader.declare(cbc.name(), cbc.bytecodes());
             }
             for (int i = 0; i < cbcs.length; ++i) {
                 ClassBytecodes cbc = cbcs[i];
@@ -101,6 +243,12 @@
         }
     }
 
+    @Override
+    public void classesRedefined(ClassBytecodes[] cbcs) {
+        for (ClassBytecodes cbc : cbcs) {
+            loader.declare(cbc.name(), cbc.bytecodes());
+        }
+    }
 
     @Override
     public void addToClasspath(String cp)
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java
index c6a220f..a1e9d1f 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java
@@ -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
@@ -91,6 +91,17 @@
         throw new NotImplementedException("redefine not supported");
     }
 
+    /**Notify that classes have been redefined.
+     *
+     * @param cbcs the class name and bytecodes to redefine
+     * @throws NotImplementedException if not implemented
+     * @throws EngineTerminationException the execution engine has terminated
+     */
+    protected void classesRedefined(ClassBytecodes[] cbcs)
+            throws NotImplementedException, EngineTerminationException {
+        loaderDelegate.classesRedefined(cbcs);
+    }
+
     @Override
     public String invoke(String className, String methodName)
             throws RunException, InternalException, EngineTerminationException {
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java
index cf07818..3084c60 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControl.java
@@ -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
@@ -93,6 +93,12 @@
         } catch (Exception ex) {
             throw new ClassInstallException("redefine: " + ex.getMessage(), new boolean[cbcs.length]);
         }
+        // forward the redefine to remote-end to register the redefined bytecode
+        try {
+            super.redefine(cbcs);
+        } catch (NotImplementedException ex) {
+            // this remote doesn't care about registering bytecode, so we don't either
+        }
     }
 
     /**
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
index ab5a820..d06d587 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016,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
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java
index 7a1566c..8c1a711 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java
@@ -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
@@ -52,6 +52,13 @@
             throws ClassInstallException, NotImplementedException, EngineTerminationException;
 
     /**
+     * Notify that classes have been redefined.
+     *
+     * @param cbcs the class names and bytecodes that have been redefined
+     */
+    public void classesRedefined(ClassBytecodes[] cbcs);
+
+    /**
      * Adds the path to the execution class path.
      *
      * @param path the path to add
diff --git a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
index 3a1a4ea..810e80a 100644
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteExecutionControl.java
@@ -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
@@ -96,6 +96,15 @@
     public RemoteExecutionControl() {
     }
 
+    /**
+     * Redefine processing on the remote end is only to register the redefined classes
+     */
+    @Override
+    public void redefine(ClassBytecodes[] cbcs)
+            throws ClassInstallException, NotImplementedException, EngineTerminationException {
+        classesRedefined(cbcs);
+    }
+
     @Override
     public void stop() throws EngineTerminationException, InternalException {
         // handled by JDI
diff --git a/langtools/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java b/langtools/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java
index c707a61..62942b7 100644
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/pkg/A.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017 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
diff --git a/langtools/test/jdk/javadoc/tool/treeapi/overview.html b/langtools/test/jdk/javadoc/tool/treeapi/overview.html
index d825975..145796c 100644
--- a/langtools/test/jdk/javadoc/tool/treeapi/overview.html
+++ b/langtools/test/jdk/javadoc/tool/treeapi/overview.html
@@ -13,7 +13,7 @@
   accompanied this code).
 
   You should have received a copy of the GNU General Public License version
-  along with this work; if not, write to the Free Software Foundation,
+  2 along with this work; if not, write to the Free Software Foundation,
   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
   Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
diff --git a/langtools/test/jdk/jshell/GetResourceTest.java b/langtools/test/jdk/jshell/GetResourceTest.java
new file mode 100644
index 0000000..530c894
--- /dev/null
+++ b/langtools/test/jdk/jshell/GetResourceTest.java
@@ -0,0 +1,164 @@
+/*
+ * 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
+ * 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 8179531
+ * @summary Check that ClassLoader.getResource works as expected in the JShell agent.
+ * @modules jdk.jshell
+ * @build KullaTesting TestingInputStream
+ * @run testng GetResourceTest
+ */
+
+import jdk.jshell.Snippet;
+import static jdk.jshell.Snippet.Status.OVERWRITTEN;
+import static jdk.jshell.Snippet.Status.VALID;
+import org.testng.annotations.Test;
+
+
+@Test
+public class GetResourceTest extends KullaTesting {
+
+    public void checkGetResource() {
+        assertEval("import java.util.Arrays;");
+        assertEval("boolean match(byte[] data, byte[] snippet) {\n" +
+                   "    for (int i = 0; i < data.length - snippet.length; i++) {\n" +
+                   "        if (Arrays.equals(Arrays.copyOfRange(data, i, i + snippet.length), snippet)) {\n" +
+                   "            return true;\n" +
+                   "        }\n" +
+                   "    }\n" +
+                   "    return false;\n" +
+                   "}");
+        assertEval("boolean test() throws Exception {\n" +
+                   "    Class c = new Object() {}.getClass().getEnclosingClass();\n" +
+                   "    byte[] data = c.getClassLoader().getResource(c.getName().replace('.', '/') + \".class\").openStream().readAllBytes();\n" +
+                   "    return match(data, \"check text\".getBytes(\"UTF-8\"));\n" +
+                   "}");
+        assertEval("test()", "true");
+    }
+
+    public void checkRedefine() {
+        assertEval("import java.util.Arrays;");
+        assertEval("boolean match(byte[] data, byte[] snippet) {\n" +
+                   "    for (int i = 0; i < data.length - snippet.length; i++) {\n" +
+                   "        if (Arrays.equals(Arrays.copyOfRange(data, i, i + snippet.length), snippet)) {\n" +
+                   "            return true;\n" +
+                   "        }\n" +
+                   "    }\n" +
+                   "    return false;\n" +
+                   "}");
+        Snippet testMethod =
+                methodKey(assertEval("boolean test() throws Exception {\n" +
+                                     "    return false;\n" +
+                                     "}"));
+        assertEval("boolean test() throws Exception {\n" +
+                   "    Class c = new Object() {}.getClass().getEnclosingClass();\n" +
+                   "    byte[] data = c.getClassLoader().getResource(c.getName().replace('.', '/') + \".class\").openStream().readAllBytes();\n" +
+                   "    return match(data, \"updated variant\".getBytes(\"UTF-8\"));\n" +
+                   "}",
+                   IGNORE_VALUE,
+                   null,
+                   DiagCheck.DIAG_OK,
+                   DiagCheck.DIAG_OK,
+                   ste(MAIN_SNIPPET, VALID, VALID, false, null),
+                   ste(testMethod, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
+        assertEval("test()", "true");
+    }
+
+    public void checkResourceSize() {
+        assertEval("import java.net.*;");
+        assertEval("boolean test() throws Exception {\n" +
+                   "    Class c = new Object() {}.getClass().getEnclosingClass();" +
+                   "    URL url = c.getClassLoader().getResource(c.getName().replace('.', '/') + \".class\");\n" +
+                   "    URLConnection connection = url.openConnection();\n" +
+                   "    connection.connect();\n" +
+                   "    return connection.getContentLength() == connection.getInputStream().readAllBytes().length;\n" +
+                   "}");
+        assertEval("test()", "true");
+    }
+
+    public void checkTimestampCheck() {
+        assertEval("import java.net.*;");
+        assertEval("import java.time.*;");
+        assertEval("import java.time.format.*;");
+        assertEval("long[] times(Class c) throws Exception {\n" +
+                   "    URL url = c.getClassLoader().getResource(c.getName().replace('.', '/') + \".class\");\n" +
+                   "    URLConnection connection = url.openConnection();\n" +
+                   "    connection.connect();\n" +
+                   "    return new long[] {connection.getDate(),\n" +
+                   "                       connection.getLastModified()," +
+                   "                       Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(connection.getHeaderField(\"last-modified\"))).toEpochMilli()};\n" +
+                   "}");
+        Snippet testMethod =
+                methodKey(assertEval("long[] test() throws Exception {\n" +
+                                     "    int i = 0;\n" +
+                                     "    return times(new Object() {}.getClass().getEnclosingClass());\n" +
+                                     "}"));
+        assertEval("long[] orig = test();");
+        long s = System.currentTimeMillis();
+        while ((System.currentTimeMillis() - s) < 1000) { //ensure time change:
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ex) {}
+        }
+        assertEval("long[] test() throws Exception {\n" +
+                   "    int i = 1;\n" +
+                   "    return times(new Object() {}.getClass().getEnclosingClass());\n" +
+                   "}",
+                   IGNORE_VALUE,
+                   null,
+                   DiagCheck.DIAG_OK,
+                   DiagCheck.DIAG_OK,
+                   ste(MAIN_SNIPPET, VALID, VALID, false, null),
+                   ste(testMethod, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
+        assertEval("long[] nue = test();");
+        assertEval("orig[0] < nue[0]", "true");
+        assertEval("orig[1] < nue[1]", "true");
+        assertEval("orig[0] == orig[2]", "true");
+        assertEval("nue[0] == nue[2]", "true");
+    }
+
+    public void checkFieldAccess() {
+        assertEval("import java.net.*;");
+        assertEval("Class c = new Object() {}.getClass().getEnclosingClass();");
+        assertEval("URL url = c.getClassLoader().getResource(c.getName().replace('.', '/') + \".class\");");
+        assertEval("URLConnection connection = url.openConnection();");
+        assertEval("connection.connect();");
+        assertEval("connection.getHeaderFieldKey(0)", "\"content-length\"");
+        assertEval("connection.getHeaderFieldKey(1)", "\"date\"");
+        assertEval("connection.getHeaderFieldKey(2)", "\"last-modified\"");
+        assertEval("connection.getHeaderFieldKey(3)", "null");
+        assertEval("connection.getHeaderField(0) != null", "true");
+        assertEval("connection.getHeaderField(1) != null", "true");
+        assertEval("connection.getHeaderField(2) != null", "true");
+        assertEval("connection.getHeaderField(3) == null", "true");
+    }
+
+    public void checkGetResources() {
+        assertEval("import java.net.*;");
+        assertEval("Class c = new Object() {}.getClass().getEnclosingClass();");
+        assertEval("c.getClassLoader().getResources(c.getName().replace('.', '/') + \".class\").hasMoreElements()", "true");
+    }
+
+}
+
diff --git a/langtools/test/jdk/jshell/WrapperTest.java b/langtools/test/jdk/jshell/WrapperTest.java
index 60fc1d6..8debd46 100644
--- a/langtools/test/jdk/jshell/WrapperTest.java
+++ b/langtools/test/jdk/jshell/WrapperTest.java
@@ -14,9 +14,9 @@
  *
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., start1 Franklin St, Fifth Floor, Boston, MA 02110-1length01 USA.
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Please contact Oracle, start00 Oracle Parkway, Redwood Shores, CA 9406start USA
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
diff --git a/langtools/test/tools/javac/classreader/8171132/BadConstantValue.java b/langtools/test/tools/javac/classreader/8171132/BadConstantValue.java
index aa2cdac..b49e088 100644
--- a/langtools/test/tools/javac/classreader/8171132/BadConstantValue.java
+++ b/langtools/test/tools/javac/classreader/8171132/BadConstantValue.java
@@ -17,6 +17,10 @@
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 /*
diff --git a/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java
index cf9480c..0987d71 100644
--- a/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java
+++ b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -103,4 +103,3 @@
             throw new Exception("expected output not found: " + log);
     }
 }
-
diff --git a/langtools/test/tools/javadoc/sampleapi/res/fx.xml b/langtools/test/tools/javadoc/sampleapi/res/fx.xml
index abdbe70..840dcbb 100644
--- a/langtools/test/tools/javadoc/sampleapi/res/fx.xml
+++ b/langtools/test/tools/javadoc/sampleapi/res/fx.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -46,4 +46,3 @@
         </package>
     </module>
 </sampleapi>
-
diff --git a/langtools/test/tools/javadoc/sampleapi/res/simple.xml b/langtools/test/tools/javadoc/sampleapi/res/simple.xml
index 1717c1c..ab5a4c1 100644
--- a/langtools/test/tools/javadoc/sampleapi/res/simple.xml
+++ b/langtools/test/tools/javadoc/sampleapi/res/simple.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -531,4 +531,3 @@
         </package>
     </module>
 </sampleapi>
-
diff --git a/langtools/test/tools/javadoc/sampleapi/res/tiny.xml b/langtools/test/tools/javadoc/sampleapi/res/tiny.xml
index 66d6a77..7c3eddc 100644
--- a/langtools/test/tools/javadoc/sampleapi/res/tiny.xml
+++ b/langtools/test/tools/javadoc/sampleapi/res/tiny.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk
index 65b9bf5..7d4287e 100644
--- a/make/CreateJmods.gmk
+++ b/make/CreateJmods.gmk
@@ -135,8 +135,7 @@
 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
 	$(JMOD) create \
             --module-version $(VERSION_SHORT) \
-            --os-name '$(OPENJDK_MODULE_TARGET_OS_NAME)' \
-            --os-arch '$(OPENJDK_MODULE_TARGET_OS_ARCH)' \
+            --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
             --module-path $(JMODS_DIR) \
 	    --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
 	    $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index 6c47d06..4d088b8 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -27,6 +27,7 @@
 include $(SPEC)
 include MakeBase.gmk
 include Modules.gmk
+include ProcessMarkdown.gmk
 include ZipArchive.gmk
 include $(JDK_TOPDIR)/make/Tools.gmk
 include $(JDK_TOPDIR)/make/ModuleTools.gmk
@@ -51,9 +52,12 @@
 DOCROOTPARENT_FLAG ?= TRUE
 
 # URLs
-JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs
+JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
 BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
 COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
+LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
+REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
+
 
 # In order to get a specific ordering it's necessary to specify the total
 # ordering of tags as the tags are otherwise ordered in order of definition.
@@ -134,7 +138,10 @@
     the US and other countries.<br> \
     <a href="$(COPYRIGHT_URL)">Copyright</a> \
     &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \
-    $(COMPANY_ADDRESS). All rights reserved.$(DRAFT_MARKER_STR)</span>
+    $(COMPANY_ADDRESS). All rights reserved. \
+    Use is subject to <a href="$(LICENSE_URL)">license terms</a>. Also see the \
+    <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
+    $(DRAFT_MARKER_STR)</span>
 
 JAVADOC_TOP := \
     <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
@@ -356,7 +363,7 @@
 # unmodified
 
 ALL_MODULES := $(call FindAllModules)
-COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib
+COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
 
 $(foreach m, $(ALL_MODULES), \
   $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
@@ -370,36 +377,35 @@
   ) \
 )
 
+# Copy the global resources
+GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs
+$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
+    SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
+    FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
+    DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
+))
+JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
+
 ifeq ($(ENABLE_FULL_DOCS), true)
   # For all markdown files in $module/share/specs directories, convert them to
   # html.
-  MARKDOWN_SPEC_FILTER := %.md
 
-  # Macro for SetupCopyFiles that converts from markdown to html using pandoc.
-  define markdown-to-html
-	$(call MakeDir, $(@D))
-	$(RM) $@
-	$(PANDOC) -t html -s -o $@ $<
-  endef
-
-  rename-md-to-html = \
-      $(patsubst %.md,%.html,$1)
+  GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JAVADOC_OUTPUTDIR)/specs/resources/jdk-default.css
 
   $(foreach m, $(ALL_MODULES), \
     $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
-    $(if $(SPECS_$m), \
-      $(eval $(call SetupCopyFiles, CONVERT_MARKDOWN_$m, \
-          SRC := $(SPECS_$m), \
-          FILES := $(filter $(MARKDOWN_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \
-          DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
-          MACRO := markdown-to-html, \
-          NAME_MACRO := rename-md-to-html, \
-          LOG_ACTION := Converting from markdown, \
-      )) \
-      $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m)) \
+    $(foreach d, $(SPECS_$m), \
+      $(if $(filter %.md, $(call CacheFind, $d)), \
+        $(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d), \
+            SRC := $d, \
+            FILES := $(filter %.md, $(call CacheFind, $d)), \
+            DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
+            CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
+        )) \
+      ) \
+      $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d))) \
     ) \
   )
-
 endif
 
 # Special treatment for generated documentation
diff --git a/make/ReleaseFile.gmk b/make/ReleaseFile.gmk
index b57cb7b..0f4d080 100644
--- a/make/ReleaseFile.gmk
+++ b/make/ReleaseFile.gmk
@@ -48,6 +48,8 @@
     $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
   $(call info-file-item, "SOURCE", "$(strip $(SOURCE_REVISION))")
   $(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)")
+  $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+  $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
 endef
 
 # Param 1 - The file containing the MODULES list
diff --git a/make/UpdateBuildDocs.gmk b/make/UpdateBuildDocs.gmk
index 42f5ee0..e1008c4 100644
--- a/make/UpdateBuildDocs.gmk
+++ b/make/UpdateBuildDocs.gmk
@@ -27,6 +27,7 @@
 
 include $(SPEC)
 include MakeBase.gmk
+include ProcessMarkdown.gmk
 
 ################################################################################
 # This makefile updates the generated build html documentation.
@@ -38,62 +39,26 @@
   $(error Cannot continue)
 endif
 
-################################################################################
-# Setup make rules for converting a markdown file to html.
-#
-# Parameter 1 is the name of the rule. This name is used as variable prefix,
-# and the targets generated are listed in a variable by that name.
-#
-# Remaining parameters are named arguments. These include:
-#   SOURCE_FILE  The markdown source file
-#   TARGET_DIR   The directory where to store the generated html file
-#   OPTIONS      Additional options to pandoc
-#
-SetupMarkdownToHtml = $(NamedParamsMacroTemplate)
-define SetupMarkdownToHtmlBody
-  ifeq ($$($1_SOURCE_FILE), )
-    $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1)
-  endif
-
-  ifeq ($$($1_TARGET_DIR), )
-    $$(error TARGET_DIR is missing in SetupMarkdownToHtml $1)
-  endif
-
-  $1_BASENAME := $$(notdir $$(basename $$($1_SOURCE_FILE)))
-  $1_OUTPUT_FILE := $$($1_TARGET_DIR)/$$($1_BASENAME).html
-
-$$($1_OUTPUT_FILE): $$($1_SOURCE_FILE)
-	$$(call LogInfo, Converting $$(notdir $1) to html)
-	$$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown)
-	$$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \
-	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
-	    --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@')
-	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
-	if [ "x$$$$TOO_LONG_LINES" != x ]; then \
-	  $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
-	  $$(ECHO) "The following lines are longer than 80 characters:" ; \
-	  $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
-	fi
-
-  $1 := $$($1_OUTPUT_FILE)
-
-  TARGETS += $$($1)
-endef
+GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/specs/resources/jdk-default.css
 
 ################################################################################
 
 DOCS_DIR := $(TOPDIR)/common/doc
 
-$(eval $(call SetupMarkdownToHtml, building, \
-  SOURCE_FILE := $(DOCS_DIR)/building.md, \
-  TARGET_DIR := $(DOCS_DIR), \
+$(eval $(call SetupProcessMarkdown, building, \
+  FILES := $(DOCS_DIR)/building.md, \
+  DEST := $(DOCS_DIR), \
+  CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
 ))
+TARGETS += $(building)
 
-$(eval $(call SetupMarkdownToHtml, testing, \
-  SOURCE_FILE := $(DOCS_DIR)/testing.md, \
-  TARGET_DIR := $(DOCS_DIR), \
+$(eval $(call SetupProcessMarkdown, testing, \
+  FILES := $(DOCS_DIR)/testing.md, \
+  DEST := $(DOCS_DIR), \
+  CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
   OPTIONS := --toc, \
 ))
+TARGETS += $(testing)
 
 ################################################################################
 
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index ae0cc20..2891188 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -165,6 +165,7 @@
 WINDOWS_SHOWINCLUDE_SED_PATTERN := \
     -e '/^Note: including file:/!d' \
     -e 's|Note: including file: *||' \
+    -e 's|\r||g' \
     -e 's|\\|/|g' \
     -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \
     -e '\|$(TOPDIR)|I !d' \
diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk
new file mode 100644
index 0000000..eec4d0c
--- /dev/null
+++ b/make/common/ProcessMarkdown.gmk
@@ -0,0 +1,103 @@
+# 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.
+#
+
+ifeq (,$(_MAKEBASE_GMK))
+  $(error You must include MakeBase.gmk prior to including ProcessMarkdown.gmk)
+endif
+
+# Helper function for SetupProcessMarkdown
+# $1: The $1 from SetupProcessMarkdown
+# $2: The name of the current source file, relative to $1_SRC
+define ProcessMarkdown
+  $1_$2_OUTPUT_FILE := $$($1_DEST)/$$(basename $2).html
+  $1_$2_TARGET_DIR := $$(dir $$($1_$2_OUTPUT_FILE))
+  ifneq ($$($1_CSS), )
+    ifneq ($$(findstring http:/, $$($1_CSS)), )
+      $1_$2_CSS_OPTION := --css '$$($1_CSS)'
+    else
+      $1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR))
+      $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
+    endif
+  endif
+  $1_$2_OPTIONS = $$(shell $$(GREP) _pandoc-options_: $$($1_SRC)/$2 | $$(CUT) -d : -f 2-)
+  $1_$2_MARKER := $$(subst /,_,$1_$2)
+
+  $1_$2_VARDEPS := $$($1_OPTIONS) $$($1_CSS)
+  $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
+      $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps)
+
+$$($1_$2_OUTPUT_FILE): $$($1_SRC)/$2 $$($1_$2_VARDEPS_FILE)
+	$$(call LogInfo, Converting $2 to html)
+	$$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown)
+	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
+	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
+	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@')
+        ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
+	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
+	if [ "x$$$$TOO_LONG_LINES" != x ]; then \
+	  $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
+	  $$(ECHO) "The following lines are longer than 80 characters:" ; \
+	  $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
+	fi
+        endif
+
+  $1 += $$($1_$2_OUTPUT_FILE)
+endef
+
+################################################################################
+# Setup make rules for converting a markdown file to html.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SRC     : Source root dir (defaults to dir of first file)
+#   DEST    : Dest root dir
+#   FILES   : List of files to copy with absolute paths, or path relative to SRC.
+#             Must be in SRC.
+#   OPTIONS : Additional options to pandoc
+#
+SetupProcessMarkdown = $(NamedParamsMacroTemplate)
+define SetupProcessMarkdownBody
+  ifeq ($$($1_FILES), )
+    $$(error FILES is missing in SetupProcessMarkdown $1)
+  endif
+
+  ifeq ($$($1_DEST), )
+    $$(error DEST is missing in SetupProcessMarkdown $1)
+  endif
+
+  # Default SRC to the dir of the first file.
+  ifeq ($$($1_SRC), )
+    $1_SRC := $$(dir $$(firstword $$($1_FILES)))
+  endif
+
+  # Remove any trailing slash from SRC and DEST
+  $1_SRC := $$(patsubst %/,%,$$($1_SRC))
+  $1_DEST := $$(patsubst %/,%,$$($1_DEST))
+
+  $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
+    $$(eval $$(call ProcessMarkdown,$1,$$f)) \
+  )
+endef
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 4784994..238f160 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -401,3 +401,4 @@
 e36e62d3ea53c316f295b37bcc19867fbf510235 jdk-9+165
 5b2e7b2101c0048ba9f1df722e56611f523fdfe8 jdk-9+166
 e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167
+0f81cde5a1f75786f381dbfb59b9afbab70174c7 jdk-9+168
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
index c4e4aae..c23920b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java
index a26e6b9..f554a3c 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
index 26a5048..ec197ed 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/nashorn/test/script/basic/JDK-8150218.js b/nashorn/test/script/basic/JDK-8150218.js
index 72dffa2..6263a0f 100644
--- a/nashorn/test/script/basic/JDK-8150218.js
+++ b/nashorn/test/script/basic/JDK-8150218.js
@@ -1,21 +1,21 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * This code is free software; you can redistribute it and/or modify it
  * 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.
diff --git a/nashorn/test/script/basic/JDK-8170594.js b/nashorn/test/script/basic/JDK-8170594.js
index 6365500..7f74e98 100644
--- a/nashorn/test/script/basic/JDK-8170594.js
+++ b/nashorn/test/script/basic/JDK-8170594.js
@@ -1,21 +1,21 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * This code is free software; you can redistribute it and/or modify it
  * 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.
diff --git a/nashorn/test/script/basic/JDK-8171849.js b/nashorn/test/script/basic/JDK-8171849.js
index febc97c..cce6874 100644
--- a/nashorn/test/script/basic/JDK-8171849.js
+++ b/nashorn/test/script/basic/JDK-8171849.js
@@ -1,21 +1,21 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * This code is free software; you can redistribute it and/or modify it
  * 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.
diff --git a/nashorn/test/script/basic/es6/JDK-8168373.js b/nashorn/test/script/basic/es6/JDK-8168373.js
index af26e73..56d58b7 100644
--- a/nashorn/test/script/basic/es6/JDK-8168373.js
+++ b/nashorn/test/script/basic/es6/JDK-8168373.js
@@ -1,21 +1,21 @@
 /*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * This code is free software; you can redistribute it and/or modify it
  * 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.
@@ -36,8 +36,8 @@
   try { // Try creates control flow edges from assignments into catch blocks.
     // Lexically scoped, never read int variable (undefined at catch block) but still with a cf edge into catch block.
     // Since it's never read, it's not written either (Nashorn optimizes some dead writes).
-    let x = 0; 
-    if (p()) { throw {}; } // We need `p()` so this block doesn't get optimized away, for possibility of a `throw` 
+    let x = 0;
+    if (p()) { throw {}; } // We need `p()` so this block doesn't get optimized away, for possibility of a `throw`
     x = 0.0; // change the type of x to double
     r(x); // read x otherwise it's optimized away
   } catch (e) {} // under the bug, "throw" will try to widen unwritten int x to double for here and cause a verifier error